Zen Cart Logo
Forums / General Questions / add custom price to cart

add custom price to cart

Views: 709

Results 1 to 4 of 4
14 Jun 2013, 1:14 PM
#1
johndoes avatar

johndoes

New Zenner

Join Date:
May 2013
Location:
Ireland
Posts:
9
Plugin Contributions:
0

add custom price to cart

hopefully someone can offer some help on this as I am a little confused :blush:

I have added a simple calculation script in tpl.product_info_display.php that requires users to input the width and height of the product they require. A simple calculation is then done in the backend to produce the price. I now need to add that price to cart when the customer clicks add to cart or I could add it to the cost of the product. Whichever is simpler.

An example is:

Customer wants to purchase t-shirt @ £1.25 They then want to customise it and require the customisation to be 8 inches x 2.5 inches. My simple script then works out the price and this is added to the existing price of the t-shirt, or if simpler, added to cart with the t-shirt when customer clicks add to cart.

Does anyone know how this can be done or lead me in the right direction?

14 Jun 2013, 3:04 PM
#2
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: add custom price to cart

johndoes:

Does anyone know how this can be done or lead me in the right direction?

There'll be many ways to do this. One of the simplest (in my opinion) is, when the calculation has been made in the backend, save it as a $_SESSION variable, then read it back in and add it to the item cost as/when the product is added to the cart (whatever page that may be on).

Well, that's the basic theory/principle. Whether you'll find it to be of any useful help is another matter.

Cheers
Rod

14 Jun 2013, 5:28 PM
#3
johndoes avatar

johndoes

New Zenner

Join Date:
May 2013
Location:
Ireland
Posts:
9
Plugin Contributions:
0

Re: add custom price to cart

Thanks Rod. PHP isn't my strong point though. Would you know of any previous forum posts of other peoples attempts at something similar or even any particular keywords to get me started?

16 Jun 2013, 9:18 AM
#4
rodg avatar

rodg

Deceased

Join Date:
Jan 2007
Location:
Australia
Posts:
6,263
Plugin Contributions:
4

Re: add custom price to cart

johndoes:

Thanks Rod. PHP isn't my strong point though. Would you know of any previous forum posts of other peoples attempts at something similar or even any particular keywords to get me started?

Try this:
http://www.w3schools.com/php/php_sessions.asp

Cheers
Rod