Adding SnapGalaxy print option to photo.tpl

calexguest

Joined: 2009-03-04
Posts: 4
Posted: Wed, 2009-03-04 14:55

Hello All!

I'm trying to add an option to the simplified theme so that from the photo view there will be an option/link/image clickable to encourage printing to the SnapGalaxy module. I thought I had gotten it with this:

---------------
[added to photo.tpl]
<a href="{g->url arg1="controller=snapgalaxy.SnapGalaxyPrintPhotos" arg2="itemId=`$theme.item.id`" arg3="return=true" useAuthToken=true}" id="printItem">Test</a>
---------------

The above statement represents hours of grepping through various gallery code looking for combinations that worked. I thought I'd never get the session token to work... Now, I can click the "test" link and it will send the image to SnapGalaxy. It appears as though the session data is working. I can use the back key and find additional images that get added to the cart on SnapGalaxy whenever I press the "test" link again.

The problem is that I can't get the returnUrl value set. I've tried passing various args to the url and nothing seems to make a difference. If I click on: cancel order, continue shopping, purchase additional photos, etc. it takes me to a blank SnapGalaxy Cart page. Only by hitting the back key several times do I make it back to the site. I tried adding an arg3="returnUrl='http://www.anywhere.com/main.php?g2_itemId={$theme.item.id}'", but no address or combo I try seems to change anything.

I've tried looking at how other themes handle this, but found no themes with the Print to SnapGalaxy option on the photo page. Seems like they are all done from some block somewhere so I have no themeable reference.

Any help would be GREATLY appreciated!

Alex

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Wed, 2009-03-04 22:21

If I remember correctly, the returnUrl parameter should be set to "1" for the url generator to add the correct return url automatically. You certainly don't need to specify the url yourself.

However, the returnUrl parameter is a Gallery-specifc thing; I can't see that SnapGalaxy would obey it.

 
calexguest

Joined: 2009-03-04
Posts: 4
Posted: Thu, 2009-03-05 13:40
alecmyers wrote:
If I remember correctly, the returnUrl parameter should be set to "1" for the url generator to add the correct return url automatically. You certainly don't need to specify the url yourself.

However, the returnUrl parameter is a Gallery-specifc thing; I can't see that SnapGalaxy would obey it.

-----

Thanks for the reply! I've tried <a href="{g->url arg1="controller=snapgalaxy.SnapGalaxyPrintPhotos" arg2="itemId=`$theme.item.id`" returnUrl=1 useAuthToken=true}" id="printItem">Test</a> . I even tried to force it with returnUrl="http://www.anywhere.com/main.php?g2_itemId={$theme.item.id}". I then saw where another module had the parameter of return=true . I've tried both with no luck?!?!? The authToken is working, but still can't return to the site. I hate being this close and finding myself stuck!

Any other ideas?

Thanks again!
Alex

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Thu, 2009-03-05 13:43

Does the snapGalaxy module even pass a return url (in the format that SnapGalaxy requires)?

 
calexguest

Joined: 2009-03-04
Posts: 4
Posted: Thu, 2009-03-05 17:13

I don't know where that info is stored. It's not on the address line. I figured it must be a cookie or something because only the session identifier shows on the address bar when you arrive at snapgalaxy. In looking at the request from the page source where Gallery2 naturally process the Print to SnapGalaxy request it sends the following:
<a href="main.php?g2_controller=snapgalaxy.SnapGalaxyPrintPhotos&amp;g2_itemId=105832&amp;g2_returnUrl=http%3A%2F%2Fanywhere.com%2Fg2%2Fmain.php%3Fg2_itemId%3D105832&amp;g2_authToken=bef824443752" class="gbAdminLink gbLink-snapgalaxy_SnapGalaxyPrintPhotos">Print on SnapGalaxy</a>

Is there a way to hardwire this same command in the photo.tpl? I tried, but could only get it to apply a session id when I sent useAuthToken=1 command to a module to process. If there's another way to put the session ID in the above field, I could hard code it in... The problem is that I don't know how to find out the session id until AFTER the HTML page has been written and the g2_authSession hidden field exists.

Alex

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Fri, 2009-03-06 18:46

Please don't re-post questions in new threads. It's not necessary.

 
calexguest

Joined: 2009-03-04
Posts: 4
Posted: Fri, 2009-03-06 19:21

I didn't realize. After posting in themes I thought that modules may be a more appropriate place to post. Was that a bad idea? Is there a better way to have the same thread span multiple topics?

Thanks,
Alex

 
alecmyers

Joined: 2006-08-01
Posts: 4342
Posted: Fri, 2009-03-06 20:05

I can move the thread if you want; my perception (and certainly my own usage of this site) doesn't distinguish between the different forums. I think most people use the "latest posts" feature rather than sticking to one or two categories only.

It's unhelpful to repost questions because you end up with too many loose ends and half-finished ideas and then later on someone searching might find one thread and not the other. I think your topic hasn't been answered not because there's an army of experts waiting to jump in and fix your problem if only they'd see the thread but because you're asking an extremely specialist question that needs probably a couple of hours of individual attention to your site and none of the five (or so) regular contributors of answers knows enough to give you an instant fix or is interested enough to donate those couple of hours. Asking the same question again isn't likely to change either of those facts!