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

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 <?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

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:
<a href="https://www.paypal.com/cgi-bin/webscr?amount=<?php echo $record['print_price'] ?>&amp;business=<?php echo $record['paypal_e_mail_address'] ?>&amp;cpp_header_image=http://www.my_site.com/images/pp.png&amp;currency_code=USD&amp;lc=US&amp;add=1&amp;cmd=_cart&amp;no_shipping=0&amp;no_note=1&amp;bn%20value=PP-ShopCartBF&amp;item_name=<?php echo $record['paypal_description'] ?>&amp;shopping_url=http://www.my_site.com/gallery1.php&amp;alt=Buy%20a%20Print&amp;">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