Changing PayPal Shopping Cart button price using CMS builder
4 posts by 2 authors in: Forums > CMS Builder
Last Post: November 8, 2011 (RSS)
I am working on a website that sells paintings. The client wants a PayPal shopping cart, using PayPal's Website Payments Standard.
Currently I have the page set up with an image uploader and part of the description is the price. I have a "Buy Now" PayPal button below the picture so that when a picture is added a new button is generated. the problem is its the exact same button.
Is there any way I can set the page up so that when the client uploads/adds a new picture in the CMS editor that the new buttons price will automatically change? Any help would be greatly appreciated. Thanks
Currently I have the page set up with an image uploader and part of the description is the price. I have a "Buy Now" PayPal button below the picture so that when a picture is added a new button is generated. the problem is its the exact same button.
Is there any way I can set the page up so that when the client uploads/adds a new picture in the CMS editor that the new buttons price will automatically change? Any help would be greatly appreciated. Thanks
Re: [jeffrenner] Changing PayPal Shopping Cart button price using CMS builder
Hi jeffrenner,
The quick answer is, "Absolutely" and easily.
There are a number of scenarios that this wouldfit into, and since I don't know your specifics, here's a generic approach.
In the multi-record editor that lists your items for sale, create a text field called Price. In the input validation area, restrict the input to numbers and a period only.
Assuming that you're using a foreach loop to list all the items that are for sale, in the button code, where the price itself is normally displayed, insert
You can find many more specific code snippets in my CMSB Cookbook http://www.thecmsbcookbook.com
Hope that gets you started.
Jerry Kornbluth
The quick answer is, "Absolutely" and easily.
There are a number of scenarios that this wouldfit into, and since I don't know your specifics, here's a generic approach.
In the multi-record editor that lists your items for sale, create a text field called Price. In the input validation area, restrict the input to numbers and a period only.
Assuming that you're using a foreach loop to list all the items that are for sale, in the button code, where the price itself is normally displayed, insert
<?php echo $record['price'] ?>
. If it's a detail page then use <?php echo $your_tableRecord['price'] ?>
You can find many more specific code snippets in my CMSB Cookbook http://www.thecmsbcookbook.com
Hope that gets you started.
Jerry Kornbluth
The first CMS Builder reference book is now available on-line!
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
Re: [gkornbluth] Changing PayPal Shopping Cart button price using CMS builder
Thank you for your reply. I am not sure if that solution is workable since there are multiple items for sale on each detail page all with different prices. Here is the URL of the web page: http://windsorwhipworksartcenter.org/pages/ArtistBio.php
Below is the php and button code I am currently using on that page:
Thanks again. Jeff
<?php
$maxColumns = 2;
$columnCount = 0;
?>
<table>
<tr>
<?php foreach ($artistsRecord['pictures'] as $image): ?>
<td align="center" valign="top">
<a href="<?php echo $image['urlPath'] ?>" target="_blank"><img src = "<?php echo $image['thumbUrlPath'];?>" width = "<?php echo
$image['thumbWidth'];?>" height = "<?php echo $image['thumbHeight'];?>" alt =
"<?php echo $image['info1'];?>" style="color:#bba279;" border="1" /></a><br /><br/><form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="8Y9D8QMVVHH7S">
<input type="image" src="http://www.windsorwhipworksartcenter.org/images/artists/PayPalBuyButton.jpg" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form><?php echo $image['info1'] ?><br /><?php echo $image['info2'] ?><br /><?php echo $image['info3'] ?><br /><?php echo $image['info4'] ?><br /><?php echo $image['info5'] ?>
</td>
<?php if (++$columnCount % $maxColumns == 0): ?>
</tr>
<tr>
<?php endif ?>
<?php endforeach ?>
Below is the php and button code I am currently using on that page:
Thanks again. Jeff
<?php
$maxColumns = 2;
$columnCount = 0;
?>
<table>
<tr>
<?php foreach ($artistsRecord['pictures'] as $image): ?>
<td align="center" valign="top">
<a href="<?php echo $image['urlPath'] ?>" target="_blank"><img src = "<?php echo $image['thumbUrlPath'];?>" width = "<?php echo
$image['thumbWidth'];?>" height = "<?php echo $image['thumbHeight'];?>" alt =
"<?php echo $image['info1'];?>" style="color:#bba279;" border="1" /></a><br /><br/><form target="paypal" action="https://www.paypal.com/cgi-bin/webscr" method="post">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="8Y9D8QMVVHH7S">
<input type="image" src="http://www.windsorwhipworksartcenter.org/images/artists/PayPalBuyButton.jpg" border="0" name="submit" alt="PayPal - The safer, easier way to pay online!">
<img alt="" border="0" src="https://www.paypalobjects.com/en_US/i/scr/pixel.gif" width="1" height="1">
</form><?php echo $image['info1'] ?><br /><?php echo $image['info2'] ?><br /><?php echo $image['info3'] ?><br /><?php echo $image['info4'] ?><br /><?php echo $image['info5'] ?>
</td>
<?php if (++$columnCount % $maxColumns == 0): ?>
</tr>
<tr>
<?php endif ?>
<?php endforeach ?>
Re: [jeffrenner] Changing PayPal Shopping Cart button price using CMS builder
Hi jeffrenner ,
I'm assuming that all of the information about the item is stored in your PayPal account in the hosted_button_id value.
I store mine in the record itself and use the following in my foreach loop to show the purchase links:
That said, could you use one of the item image's info fields to store the hosted_button_id value? And then call it with:
Just a thought...
Jerry Kornbluth
I'm assuming that all of the information about the item is stored in your PayPal account in the hosted_button_id value.
I store mine in the record itself and use the following in my foreach loop to show the purchase links:
<a href="https://www.paypal.com/cgi-bin/webscr?amount=<?php echo $record['print_price'] ?>&business=<?php echo $record['paypal_e_mail_address'] ?>&cpp_header_image=http://www.my_site.com/images/pp.png&currency_code=USD&lc=US&add=1&cmd=_cart&no_shipping=0&no_note=1&bn%20value=PP-ShopCartBF&item_name=<?php echo $record['paypal_description'] ?>&shopping_url=http://www.my_site.com/gallery1.php&alt=Buy%20a%20Print&">Click To Purchase</a>
That said, could you use one of the item image's info fields to store the hosted_button_id value? And then call it with:
hosted_button_id" value="<?php echo $image['infoX'];?>"
Just a thought...
Jerry Kornbluth
The first CMS Builder reference book is now available on-line!
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php
Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php