How to add cart link in Ajaxian album slideshow?

hidch

Joined: 2009-03-05
Posts: 1
Posted: Thu, 2009-03-05 10:08

hello!

im trying to put a cart link or icon in the album slideshow of Ajaxian theme, here is a screenshot showing where im trying to put it, as its in javascript i didnt find a way to put anything there,

[img]http://img.skitch.com/20090305-q9rm9iahrwcwqfpfnae86rq2ww.preview.jpg[/img]
Click for full size

[img]http://img.skitch.com/20090305-jjqtn9i3k5a97bpc4ym3ighpae.preview.jpg[/img]
Click for full size

anyone can help please? thanks

 
koppor

Joined: 2009-04-15
Posts: 17
Posted: Wed, 2009-04-15 23:47

Bump. - I'm using the carbon theme as workaround. However, the integration with the checkout module is not as good as with the cart module.

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Thu, 2009-04-16 00:42

<a href="{g->url arg1="view=cart.ViewCart" arg2="itemId=`$child.id`"}">{g->text text="Add to cart."}</a>

maybe?

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
koppor

Joined: 2009-04-15
Posts: 17
Posted: Thu, 2009-04-16 01:42

Isn't there an authcode needed? - The Carbon theme fetches the auth code out of the possible actions for an element. Unfortunately, this actions seem not to be transmitted in the case of Ajaxian.

I would rally love to have a cart button right to the picture as it is available at Carbon.

Back to the original isse:
The code to add the icon has to be placed after line 345 at thumbnail-functions.js. However, I still have no clue how to construct the URL...

 
suprsidr
suprsidr's picture

Joined: 2005-04-17
Posts: 8339
Posted: Thu, 2009-04-16 02:24

in album.tpl you could add your link:
{assign var=childCartLink value=}<a href="{g->url arg1="view=cart.ViewCart" arg2="itemId=`$child.id`"}">{g->text text="Add to cart."}</a>
and add an additional class to the thumb (2x):
class="%CLASS% giThumbnail size:=`$child.size`= summary:=`$childSummary`= description:=`$childDescription`= cartLink:=`$childCartLink`="}

and then in thumbnail-functions.js

    if (thumbnails[currentImageIndex].className.match(/cartLink:=(.+)=/)) {
	var cartLinkInfo = document.createElement('p');
	descriptionInfo.innerHTML = RegExp.$1;
	dataBlock.appendChild(cartLinkInfo);
    }

roughly

-s
FlashYourWeb and Your Gallery with The E2 XML Media Player for Gallery2

 
jessicasamuel

Joined: 2009-04-18
Posts: 1
Posted: Sat, 2009-04-18 08:45

Hi,

Useful, Thanks for sharing!

-
Jessica Danial

 
koppor

Joined: 2009-04-15
Posts: 17
Posted: Sat, 2009-04-18 16:54

The only issue remaining is that the cart symbol should be back-ended by AJAX.

Pressing on the basket should only add the amount if items in brackets behind. No reload of the page or whatever!