I am trying to allow users to "buy" acidfree albums of photos for download via Pando. I've cloned the e-commerce file.module to create pandopkg.module and modified it so that it doesn't demand or verify a filepath -- instead, I plan to give it a URL at checkout time.
What I've done so far is to implement the following function in acidfree.module (borrowed from ec.media)
function acidfree_ec_pandopkg_nodetypes() {
return array('album' => array('realm' => 'pandoPkg.module'));
}
I can then edit a previously created acidfree album to make it an ecommmerce pandopkg product. This seems to create a product out of the acidfree album, and in fact, I can manually construct a link to add this album to the shopping cart. However, I'm unable to get the "add to cart" link to show up when displaying the album. If I edit acidfree image to be a pandopkg product, then an "add to cart" link is properly displayed alongside the image. What's the hook that adds this link?
How do modify acidfree.module so that 1) I can display the "add to cart" link" and 2) change the way the album is viewed when I click on it from the shopping cart or products page?
Alternatively, the e-commerce file module has the following hooks:
/**
* Node-managed file functions
*
* The following hooks allow third-party modules which contain files to treat
* their files as products. This module allows downloads only when the
* products have been purchased.
*
* See also the ec_media module (ecommerce/contrib/ec_media).
*/
/**
* Determine which node types are eligible to be treated as products.
*
* Invokes hook_ec_file_nodetypes. Third-party modules must implement that
* hook to be treated as products.
*/
function _ec_file_get_managed_types() {
static $cache;
if (!$cache) {
$cache = module_invoke_all('ec_file_nodetypes');
}
return $cache;
}
/**
* Determine whether a node is an instance of a node-managed product.
*/
function _ec_file_is_managed($node) {
// sometimes node passed in is not really a valid node
if (!$node->type && $node->nid)
$node = node_load($node->nid);
return in_array($node->type, array_keys(_ec_file_get_managed_types()));
}
How do you utilize these features?
Comments
This works, but it can't be the right way to do it.
I put this line in theme_views_album_list_view() of the acidfree class_album.inc:
It seems to work, but isn't there a proper way to do the same thing?