Add Item to Cart only for specific pictures

cslewis

Joined: 2004-09-21
Posts: 16
Posted: Fri, 2006-08-04 07:38

I'm currently trying to get the checkout/paypal modules up and running on my gallery installation (the modules are up and running fine)

However, I do not want to to let every picture be available for sale. I only want to allow specific sub-albums and pictures to be purchased. As such, I have set the permissions to allow only the ones I want to be sold.

The theme I am working on is a modified Siriux theme (based off the Opticalpork Lightbox theme). In my album.tpl file, I have the following line to display the images (the section inside the "capt" part is what gets displayed when the image pops up with lightbox).

<a href="{g->url arg1="view=core.DownloadItem" arg2="itemId=`$child.id`"}" 
capt='<a href="{g->url arg1="view=core.ShowItem" arg2="itemId=`$child.id`"}">View Photo</a><BR /><BR />
<a href="{g->url arg1="controller=checkout.AddToCart" arg2="itemId=`$child.id`" arg3="return=`$theme.item.id`"}">Add Item to Cart</a>
<BR/>{g->text text=`$theme.permissions.checkout_purchase`}' rel="lightbox[photos]">

This works fine, and displays the link to add the correct item to the cart, and clicking it directs me to the cart. The problem is, this link is displayed on every item -- including those that don't have permission to be sold. Clicking the link on the ones without permission throw an error and don't allow it, but I would like to have some sort of check to prevent the "Add Item to Cart" portion from being displayed if the permission doesn't exist. I would think it would be something similar to "{if $theme.permissions.core_addDataItem}", but the closest thing I could find was $theme.permissions.checkout_purchase, and that appears to only work if the user logged in is the administrator.

I've searched the forums, but wasn't able to find anything to point me in the direction I needed to go. Any help would be most appreciated.

Thanks.
~Chris

 
Tropical Blue

Joined: 2006-08-12
Posts: 41
Posted: Mon, 2006-08-28 04:29

cslewis did you get any help on this? I can't help but I would like to do the opposite of what you're trying to do - I want to disallow one or two items on an album page from being sold. As I can't find an easy way to add headings part way through an album I'm actually using an image with a heading to sub-divide an album, probably not the best way to do it, but hey, it works for now except that I don't really need any smart A's (or computerly challenged people) ordering the headings. See http://www.supashotz.com/index.php?option=com_gallery2&Itemid=27&g2_itemId=4824 as an example of what I'm doing.