close ad
WARNING: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Update Cart Question

Thread began 4/05/2010 7:48 pm by steven348539 | Last modified 4/07/2010 8:24 pm by Eric Mittman | 1042 views | 4 replies |

steven348539

Update Cart Question

Yes, back again. I've been playing around trying to add some functionality I've wanted to my cart and things have been going well.

My question is, is it possible to update the price on the cart page after changing the size option? I have it updating the new size in the select list, but not the price.

I know for the details page, I had to have it use a recordset to get the price for that size and assign it to the cart, but I can't see where to do that in the cart page.

You can see the site at www.cis-portraits.com

Thanks

Sign in to reply to this post

steven348539

Would it be a matter of going into the cart.php file and in the UpdateCart function, add the recordset using the integer the relates to the size, which is stored in the cart, to grab the right data out of the database and assigning it to $ItemPrice? Or just bypassing assigning it to $ItemPrice and just assign it to $this->Items[$n]->Price?

Sign in to reply to this post

Eric Mittman

You could go directly into the code and set it up that way, but if you make any changes to the cart it will undo your additions.

The main problem is that the cart is not designed to work with options that change the price through a selection in the cart itself. The ideal way to do this would be to use calculations to determine the price based on the value of the option. This would work out if you had the value of the option stored along with the option name. If you had it setup this way it would allow you to make edits to the cart without undoing your changes.

Sign in to reply to this post

steven348539

Thanks for the response. I figured that would be the hazard of modifying the code directly, and which is why I was asking for some guidance :D

I do have the option price stored in the DB already in a separate column. So, if I am currently using this calculation for the price in the cart:

[Price] * [Quantity]

I would want to change it to:

([Price]+$rows_rsPrice['SizePrice']) * [Quantity]

But wouldn't I need to place a recordset somewhere that will use the SizeID that is stored in the cart to grab the price for that size/option? Or is there a way to store it in the cart so it is updated automatically?

Sign in to reply to this post

Eric Mittman

You are on the rite track here, but rather than have the recordset reference in the calculation you would want to have another column in your cart to store this value, then when you update the size you will also need to update this other column.

Getting the other column to update to the proper value when you update the selected option would require some js coding. You could have a hidden form element for the other column and a display of the value so that you can see it, then when you update the selected option you could update the value of the hidden form element for the other column. Then when you click on the update button for the cart the columns should all be updated to the new values and the calculations should show you the correct price based on the selected option.

Sign in to reply to this post

Build websites with a little help from your friends

Your friends over here at WebAssist! These Dreamweaver extensions will assist you in building unlimited, custom websites.

Build websites from already-built web applications

These out-of-the-box solutions provide you proven, tested applications that can be up and running now.  Build a store, a gallery, or a web-based email solution.

Want your website pre-built and hosted?

Close Windowclose

Rate your experience or provide feedback on this page

Account or customer service questions?
Please user our contact form.

Need technical support?
Please visit support to ask a question

Content

rating

Layout

rating

Ease of use

rating

security code refresh image

We do not respond to comments submitted from this page directly, but we do read and analyze any feedback and will use it to help make your experience better in the future.

Close Windowclose

We were unable to retrieve the attached file

Close Windowclose

Attach and remove files

add attachmentAdd attachment
Close Windowclose

Enter the URL you would like to link to in your post

Close Windowclose

This is how you use right click RTF editing

Enable right click RTF editing option allows you to add html markup into your tutorial such as images, bulleted lists, files and more...

-- click to close --

Uploading file...