[checkout] how to add a "add to cart" icon below every picture?

philmo1

Joined: 2009-02-06
Posts: 6
Posted: Fri, 2009-02-06 17:25

Hello!
Could anybody tell me how to add a "add to cart" link for the checkout module below every single picture in album view?
im new to G2 and this is my first post so please be nice ;-)
Thanks!

 
alecmyers

Joined: 2006-08-01
Posts: 4338
Posted: Fri, 2009-02-06 17:50

It is somewhat theme dependent. Firstly you can have "Add to cart" as part of the regular list of itemActions shown underneath every thumbnail, if you tick the "show Add to Cart everywhere" option in the checkout admin page.

Secondly you can add it manually to your album.tpl file. Add this at the relevant place:
<a href="{g->url arg1="controller=checkout.AddToCart" arg2="itemId=`$child.id`" arg3="return=1"}" rel="nofollow">{g->text text="Add to Cart"}</a>
Make sure to follow the instructions at the top of the file with regard to where and how to save modified template files.

 
philmo1

Joined: 2009-02-06
Posts: 6
Posted: Fri, 2009-02-06 19:05

thanks for that quick reply! it all worked out ;)
you helped a lot :)

 
kaba-2

Joined: 2009-02-16
Posts: 41
Posted: Sat, 2009-02-21 18:06

hi, where do you add the script in the file?

 
kaba-2

Joined: 2009-02-16
Posts: 41
Posted: Sat, 2009-02-21 21:53

i dont understand in which paragraph of the file album.tpl I have to add the following script...

<a href="{g->url arg1="controller=checkout.AddToCart" arg2="itemId=`$child.id`" arg3="return=1"}" rel="nofollow">{g->text text="Add to Cart"}</a>

 
alecmyers

Joined: 2006-08-01
Posts: 4338
Posted: Sat, 2009-02-21 23:42
Quote:
i dont understand in which paragraph of the file album.tpl I have to add the following script...

It depends on which theme you're using.

 
oceco

Joined: 2007-10-22
Posts: 666
Posted: Mon, 2009-02-23 23:29

Are there any plans to have an image icon below/above/beneath the element description? With the english phrase I have no problem, but with the German phrase "Zum Warenkorb hinzufügen" (ugly). BTW: Where can I copy the language files from for the checkout module etc.? I downloaded all modules today and the po/mo-files are missing for all languages. Download all language files in language settings didn't help either.

rgds/oceco

Gallery-Version = 2.3 Kern 1.3.0
API = Core 7.54, Modul 3.9, Motiv 2.6, Eingebettet 1.5
PHP-Version = 5.2.6 apache2handler
Webserver = Apache/2.0.52 (CentOS)
Datenbank = mysqli 4.1.20, lock.system=database
Werkzeuge = Exif, ArchiveUpload, ImageMagick, Gd, Getid3, Thumbnail, LinkItemToolkit, SquareThumb
Beschleunigung = none/900, none/900
Betriebssystem = Linux naiad.kreativmedia.ch 2.6.9-42.ELsmp #1 SMP Sat Aug 12 09:39:11 CDT 2006 i686
Standard-Motiv = carbon
gettext = Aktiviert
Sprache = de_DE
___________________________________________________
Top Secret: Tipps, Tricks und mehr
The Most Secret Gallery2 Treasure: Quick Start Guide

 
alecmyers

Joined: 2006-08-01
Posts: 4338
Posted: Tue, 2009-02-24 11:25
Quote:
Are there any plans to have an image icon below/above/beneath the element description?

I have no such plans as part of the 'official' module code.

You can have an icon next to the "add to cart" links by putting the appropriate style in your icon pack style sheet; other than that, it's down to you to modify your own installation/template files/css files etc to suit, as with all Gallery customizations.

 
kaba-2

Joined: 2009-02-16
Posts: 41
Posted: Tue, 2009-03-03 11:05

please what's the script to add the icon next to "add to cart" below every picture? and which file I have to add it in?

 
hazzy

Joined: 2005-05-07
Posts: 55
Posted: Thu, 2009-03-26 10:07

Hi All,

Alecmyers I l ove [checkout] - thanks.

kaba-2 - you might want to look at this code change I made in the /themes/carbon/templates/local/photo.tpl module to add the ADD TO CART under all photos. The new code is sandwiched between the comments.

				      width=$image.width height=$image.height}
			  <div id="photo">
			  {g->image id="%ID%" item=$theme.item image=$image
				    fallback=$smarty.capture.fallback class="%CLASS%"}
              </div>
 
              {*  Below lines added to set "Add to Basket"  under the full size pictures *}
			   <br />
			   <div class="block-core-ItemLinks">
               <a class="gbAdminLink gbAdminLink gbLink-checkout_AddToCart" href="{g->url arg1="controller=checkout.AddToCart" arg2="itemId=`$theme.item.id`" arg3="return=1"}" rel="nofollow">{g->text text="Add to Basket"}</a>
				</div>
              {* Above lines added to set "Add to Basket"  under the full size pictures *}
 
 			{/g->container}
		      {else}
			<div id="photo">
			{g->image item=$theme.item image=$image fallback=$smarty.capture.fallback}
			</div>
		      {/if}
		    {else}
		      {$smarty.capture.fallback}

Only problem is it doesn;'t take account of the set permissions - Alecmyers, any idea what needs to be changed to do that?

Ta. hazzy.

 
alecmyers

Joined: 2006-08-01
Posts: 4338
Posted: Thu, 2009-03-26 10:30
Quote:
you might want to look at this code change I made in the /themes/carbon/templates/local/photo.tpl module to add the ADD TO CART under all photos. The new code is sandwiched between the comments.

I'm slightly confused... for themes that have itemLinks below the thumbnails the Add To Cart link is already included (if permissions allow) so should appear under thumbnails. Kaba was asking about the icon, specifically, I think.

If your theme doesn't have the itemLinks (I know nothing about Carbon, one way or the other) you could presumably copy the code from a theme that does, no?

 
hazzy

Joined: 2005-05-07
Posts: 55
Posted: Thu, 2009-03-26 12:58

Hi Alecmyers,

Maybe I got the wrong end of the stick.

But for what it's worth for other people using the the Carbon theme, the ADD TO CART links appear under the thumbnail views but not under the single photo view. Permissions are set correctly.

Answering my own question above - The code below now takes account of any set [checkout_purchase] permissions.

{g->image id="%ID%" item=$theme.item image=$image
fallback=$smarty.capture.fallback class="%CLASS%"}
</div>

{* Below lines added to set "Add to Basket" under the full size pictures *}
{if ($theme.permissions.checkout_purchase)}
<br />
<div class="block-core-ItemLinks">

<a class="gbAdminLink gbAdminLink gbLink-checkout_AddToCart" href="{g->url arg1="controller=checkout.AddToCart" arg2="itemId=`$theme.item.id`" arg3="return=1"}" rel="nofollow">{g->text text="Add to Basket"}</a>
</div>
{/if}
{* Above lines added to set "Add to Basket" under the full size pictures *}

 
alecmyers

Joined: 2006-08-01
Posts: 4338
Posted: Thu, 2009-03-26 14:07
Quote:
{if ($theme.permissions.checkout_purchase)}

Cool. I didn't know you could do that.

Do you mean that Carbon doesn't have *any* itemLinks on the photo page, or that just the Purchase... is missing?

 
hazzy

Joined: 2005-05-07
Posts: 55
Posted: Fri, 2009-03-27 10:15

Hi Alec,

There are itemLinks in Carbon but they occur in a dropdown list on the right of the photo and the ADD TO CART is mixed in with all the others like VIEW SLIDESHOW etc.

To generate maximum revenue, I though it would be nice to have the ADD TO CART with a little icon immediately under the photo so it is always visible and not just one option in the dropdown list.

hazzy

 
alecmyers

Joined: 2006-08-01
Posts: 4338
Posted: Fri, 2009-03-27 10:18

ok - thanks.

BTW I've also done something similar in my installation, where I don't display the itemLinks to visitors at all.