ez projects / tc_mypurchases
| UNIX name | Owner | Status | Version | Compatible with |
|---|---|---|---|---|
| tc_mypurchases | Mark Marsiglio | beta | 0.9 | 4.0+ |
This operator enables the purchase history of a logged in user to be accessed in a product.tpl template to show different information to the user based on their order history.
This is primarily used to enabled downloadable purchases by using a template switch to show download links in place of the "add to cart" button for users who have already purchased the product.
Usage example:
Define the current users purchase list as an array in the full/product.tpl:
{def $my_buys = fetch(user, current_user)|my_purchases}
Put in download links if the current user has purchased the product:
{if and($my_buys|array_keys|contains($node.object.id), array('Pending', 'Delivered')|contains($my_buys[$node.object.id]) )} <div class='attribute-download-purchased'> <p class='purchasestatus'>You have purchased this product</p> <p>Please use the link(s) below to download your files.</p> <div class="attribute-file"> <p> {attribute_view_gui attribute=$node.object.data_map.file1} </p> </div> </div>