Shopping cart add-in?

pands

Joined: 2002-10-10
Posts: 4
Posted: Thu, 2002-10-10 18:55

Is there an existing shopping cart that easily plugs into Gallery to allowing purchasing of images?

 
phylo

Joined: 2002-09-25
Posts: 19
Posted: Fri, 2002-10-11 00:14

If you have a paypal account you can use there shopping cart.. I have managed to get it to work fairly well.. to take a look go to

http://afm.photoliciousphotography.com/gallery and browse arround.

Let me know if you want the source for the mod.

Phil

 
pands

Joined: 2002-10-10
Posts: 4
Posted: Fri, 2002-10-11 21:35

Not bad :wink:. Which file(s) do you insert the paypal buttons into?

 
phylo

Joined: 2002-09-25
Posts: 19
Posted: Sat, 2002-10-12 07:57

The only way I could get it so that i got the correct image name was to insert them into the view_photo.php file. Took me a while to figure that one out.

Phil

 
maphu

Joined: 2002-09-28
Posts: 2
Posted: Thu, 2002-10-17 19:17

I'm interested in seeing the source code for this mod, could ya hook me up?

-Matt

 
teletubby

Joined: 2002-07-17
Posts: 8
Posted: Thu, 2002-10-17 20:48

phylo,

Can I get the source too please.

Thanks,

Teletubby

 
mgoldman

Joined: 2002-10-08
Posts: 2
Posted: Thu, 2002-10-17 21:27

if you don't mind can you place the mod in here or on sf.net - under a patch or something?

thanks

 
teletubby

Joined: 2002-07-17
Posts: 8
Posted: Tue, 2002-10-22 01:19

Here's how I figured out how to do it, Phylo probably has a better way:

Steps to do this:

Join PayPal
Upgrade to a Business account (so you can use a shopping cart)

put this code in /view_photo.php (If you put it in html_wrap/inline_photo.footer it just labels the photo link "item number" as inline_photo.footer). The reason you do this is so that you know which photo the customer wants to buy. You can also easily add a "View Cart" link by using the code Phylo has on his page (with your code you get from paypal) and put different options for print sizes in a table like he did.

<!-- BBCode Start --><TABLE BORDER=0 ALIGN=CENTER WIDTH=85%><TR><TD><font class="pn-sub">Code:</font><HR></TD></TR><TR><TD><FONT class="pn-sub"><PRE><form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="youremail@hotmail.com">
<input type="hidden" name="item_name" value="5X7 print">
<input type="hidden" name="item_number" value="<?= $photoURL ?>">
<input type="hidden" name="image_url" value="http://www.yourdomain.com/images/yourlogo.gif"><font face="Verdana" size="1">digital photo on CD .00</font><br>
<input type="hidden" name="amount" value=".00">
<input type="hidden" name="cancel_return" value="<?= $photoURL ?>">
<input type="image" src="http://www.yourdomain.com/images/yourcdlogo.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<input type="hidden" name="add" value="1">
</form> </TD></TR></TABLE><!-- BBCode End -->

 
phylo

Joined: 2002-09-25
Posts: 19
Posted: Tue, 2002-10-22 22:32

Sorry it has taken me so long to post again.. I have been super slammed trying to run my busines so I havnt checked the forums in a while.. I am actualy working with a couple of different people to make a much better data base driven gallery with a shopping cart system that will be much more robust than the one that I am using now.. Either that or I will make a better shpping cart hack for gallery.. It will probably still go through pay pal since they are way cheaper than any of the other online payment stuff I have been checking out.

Oh and that the above post is pretty much the same as what I did to my gallery. Here is the actual code.

<table width="55%" border="0">
<tr>
<td><form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_cart">
<input type="hidden" name="business" value="your paypal email address">
<input type="hidden" name="item_name" value="5X7 Print( or whatever you are seling)">
<input type="hidden" name="item_number" value=<?=$photoURL?>>
<input type="hidden" name="amount" value="$.00">
<input type="hidden" name="image_url" value="http://yoursite.com/logo.gif">
<input type="hidden" name="return" value="http://yoursite.com">
<input type="hidden" name="cancel_return" value="http://yoursite.com">
5x7 $5.00 <br>
<input type="image" src="https://www.paypal.com/images/x-click-but22.gif" border="0" name="submit" alt="Make payments with PayPal - it's fast, free and secure!">
<input type="hidden" name="add" value="1">
</form></td>

Phil

 
afeltmate

Joined: 2003-01-08
Posts: 13
Posted: Fri, 2003-01-10 14:25

Hi phylo,

I'm trying to hack gallery to have a dropdown list with the products instead of buttons, I find they take up too much space especially if you sell a number of items. The only problem is that I'm new to php and can't seem to figure out the best way to implement it. Right now I'm having a problem with getting the Image number into paypal.

You can check out what I've done so far here at:
http://24.102.175.40/~nuked/modules.php?set_albumName=Proofs&amp;op=modload&amp;name=gallery&amp;file=index&amp;include=view_album.php

and click on 4x6 (it's the only option that works currently, I wanted to get it working perfectly before adding all of the code necessary).

Let me know if you would like to help out with this.

 
afeltmate

Joined: 2003-01-08
Posts: 13
Posted: Fri, 2003-01-10 16:22

Nevermind, I figured out a better way to implement this. Just add the following code in you're inline_photothumb.frame or inline_photo.footer file depending on where you want the dropdown to show up.

I also added code in to change the pricing if the customer is a member of the website.

<table border="0" valign="top" align="center" cellspacing="0" cellpadding="0%">
<tr>
<td colspan=3 align=center><a href="<?php echo $href ?>"><?php echo $tag ?></a></td>
</tr>

</table>
<table border="0" cellspacing="0" cellpadding="0%" >

<?

if ($username == "") {
echo "<tr>n"
."<td valign="top" cellspacing="0" cellpadding="0%" Height="2">n"
."<form method="get" action="QuickIndex">n"
."<SELECT size=1 name="Product" onChange="if(options[selectedIndex].value) window.open(options[selectedIndex].value)">n"
."<OPTION value=>Choose a Product&amp;nbsp;</option>n"
."<OPTION value="https://www.paypal.com/cart/add=1&amp;business=yourname@youremail.com&amp;item_name=4x6&amp;item_number=$GLOBALS[id] - $GLOBALS[albumName]&amp;amount=10.00&amp;no_note=1&amp;currency_code=CAD">4x6</OPTION>n"
."<OPTION value="https://www.paypal.com/cart/add=1&amp;business=yourname@youremail.com&amp;item_name=5x7&amp;item_number=$GLOBALS[id] - $GLOBALS[albumName]&amp;amount=15.00&amp;no_note=1&amp;currency_code=CAD">5x7</OPTION>n"
."<OPTION value="https://www.paypal.com/cart/add=1&amp;business=yourname@youremail.com&amp;item_name=8x10&amp;item_number=$GLOBALS[id] - $GLOBALS[albumName]&amp;amount=18.00&amp;no_note=1&amp;currency_code=CAD">8x10</OPTION>n"
."<OPTION value="https://www.paypal.com/cart/add=1&amp;business=yourname@youremail.com&amp;item_name=11x17&amp;item_number=$GLOBALS[id] - $GLOBALS[albumName]&amp;amount=30.00&amp;no_note=1&amp;currency_code=CAD">11x17</OPTION>n"
."<OPTION value="https://www.paypal.com/cart/add=1&amp;business=yourname@youremail.com&amp;item_name=13x19&amp;item_number=$GLOBALS[id] - $GLOBALS[albumName]&amp;amount=40.00&amp;no_note=1&amp;currency_code=CAD">13x19</OPTION>n"
."<OPTION value="https://www.paypal.com/cart/add=1&amp;business=yourname@youremail.com&amp;item_name=Magazine Cover&amp;item_number=$GLOBALS[id] - $GLOBALS[albumName]&amp;amount=25.00&amp;no_note=1&amp;currency_code=CAD">Magazine Cover</OPTION>n"
."<OPTION value="https://www.paypal.com/cart/add=1&amp;business=yourname@youremail.com&amp;item_name=Photo Coffee Mug&amp;item_number=$GLOBALS[id] - $GLOBALS[albumName]&amp;amount=20.00&amp;no_note=1&amp;currency_code=CAD">Photo Coffee Mug</OPTION>n"
."<OPTION value="https://www.paypal.com/cart/add=1&amp;business=yourname@youremail.com&amp;item_name=Photo Candle&amp;item_number=$GLOBALS[id] - $GLOBALS[albumName]&amp;amount=20.00&amp;no_note=1&amp;currency_code=CAD">Photo Candle</OPTION>n"
."<OPTION value="https://www.paypal.com/cart/add=1&amp;business=yourname@youremail.com&amp;item_name=Sale Flyer&amp;item_number=$GLOBALS[id] - $GLOBALS[albumName]&amp;amount=30.00&amp;no_note=1&amp;currency_code=CAD">Sale Flyer</OPTION>n"
."<OPTION value="https://www.paypal.com/cart/add=1&amp;business=yourname@youremail.com&amp;item_name=Photo Calendar&amp;item_number=$GLOBALS[id] - $GLOBALS[albumName]&amp;amount=40.00&amp;no_note=1&amp;currency_code=CAD">Photo Calendar</OPTION>n"
."</SELECT>n"
."</form>n"
."</td></tr>";

} else {
echo "<tr>n"
."<td valign="top" cellspacing="0" cellpadding="0%" Height="2">n"
."<form method="get" action="QuickIndex">n"
."<SELECT size=1 name="Product" onChange="if(options[selectedIndex].value) window.open(options[selectedIndex].value)">n"
."<OPTION value=>Choose a Product&amp;nbsp;</option>n"
."<OPTION value="https://www.paypal.com/cart/add=1&amp;business=yourname@youremail.com&amp;item_name=4x6&amp;item_number=$GLOBALS[id] - $GLOBALS[albumName]&amp;amount=8.00&amp;no_note=1&amp;currency_code=CAD">4x6</OPTION>n"
."<OPTION value="https://www.paypal.com/cart/add=1&amp;business=yourname@youremail.com&amp;item_name=5x7&amp;item_number=$GLOBALS[id] - $GLOBALS[albumName]&amp;amount=10.00&amp;no_note=1&amp;currency_code=CAD">5x7</OPTION>n"
."<OPTION value="https://www.paypal.com/cart/add=1&amp;business=yourname@youremail.com&amp;item_name=8x10&amp;item_number=$GLOBALS[id] - $GLOBALS[albumName]&amp;amount=15.00&amp;no_note=1&amp;currency_code=CAD">8x10</OPTION>n"
."<OPTION value="https://www.paypal.com/cart/add=1&amp;business=yourname@youremail.com&amp;item_name=11x17&amp;item_number=$GLOBALS[id] - $GLOBALS[albumName]&amp;amount=25.00&amp;no_note=1&amp;currency_code=CAD">11x17</OPTION>n"
."<OPTION value="https://www.paypal.com/cart/add=1&amp;business=yourname@youremail.com&amp;item_name=13x19&amp;item_number=$GLOBALS[id] - $GLOBALS[albumName]&amp;amount=35.00&amp;no_note=1&amp;currency_code=CAD">13x19</OPTION>n"
."<OPTION value="https://www.paypal.com/cart/add=1&amp;business=yourname@youremail.com&amp;item_name=Magazine Cover&amp;item_number=$GLOBALS[id] - $GLOBALS[albumName]&amp;amount=20.00&amp;no_note=1&amp;currency_code=CAD">Magazine Cover</OPTION>n"
."<OPTION value="https://www.paypal.com/cart/add=1&amp;business=yourname@youremail.com&amp;item_name=Photo Coffee Mug&amp;item_number=$GLOBALS[id] - $GLOBALS[albumName]&amp;amount=15.00&amp;no_note=1&amp;currency_code=CAD">Photo Coffee Mug</OPTION>n"
."<OPTION value="https://www.paypal.com/cart/add=1&amp;business=yourname@youremail.com&amp;item_name=Photo Candle&amp;item_number=$GLOBALS[id] - $GLOBALS[albumName]&amp;amount=15.00&amp;no_note=1&amp;currency_code=CAD">Photo Candle</OPTION>n"
."<OPTION value="https://www.paypal.com/cart/add=1&amp;business=yourname@youremail.com&amp;item_name=Sale Flyer&amp;item_number=$GLOBALS[id] - $GLOBALS[albumName]&amp;amount=25.00&amp;no_note=1&amp;currency_code=CAD">Sale Flyer</OPTION>n"
."<OPTION value="https://www.paypal.com/cart/add=1&amp;business=yourname@youremail.com&amp;item_name=Photo Calendar&amp;item_number=$GLOBALS[id] - $GLOBALS[albumName]&amp;amount=35.00&amp;no_note=1&amp;currency_code=CAD">Photo Calendar</OPTION>n"
."</SELECT>n"
."</form>n"
."</td></tr>";

}

?>

 
winkypicker
winkypicker's picture

Joined: 2003-01-21
Posts: 117
Posted: Thu, 2003-01-23 02:04

Hi,

I have implemented the script above to be used to sell photos online.

Is there a way of adding an option (either by tick box, radio button or a second drop-down) preferably by radio button to allow the user to select glossy or matt finish? These variables then need to be passed into the PayPal cart.

Another thing I want to try and do is use the caption as a variable and pass this into the cart instead of the albumName. This is because I intend users to be able to customise their album with captions. This would give them a *meaningful* reference in the cart whilst still sending me the name of the file that I need in order to fulfil the order.

Any ideas anybody :sad: