close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

PHP modifying Cart Items in Shopping Cart

Thread began 5/24/2012 5:23 am by fms77717 | Last modified 5/25/2012 2:31 pm by fms77717 | 895 views | 2 replies |

fms77717Beta Tester

PHP modifying Cart Items in Shopping Cart

I have a situation where I have to modify an eCart variable that I use for item discounts.

Each item may have a different discount value. I set the initial discount in the add to cart and it works as advertised. However, I now have a situation whereby I have to modify the discount when I get to the shopping cart based on all the contents in the shopping cart.

Not to make things worse (I even coupons for the shopping cart).

Based on the content items within the cart, how do I dynamically go through the rows of the cart (multiple nested loops) and reset the discount variable so that when the cart displays, all the new discount calculations are correct.

I know how to analyze the cart and nest the loops to make the calculations, but somehow the cart doesn't seem to be getting updated correctly.

Can I just directly access the items, like:
$eCart4->Items[$sib]->TotalItemDiscount = 12345;

or do I have to use a different methodoly (wa functions) to make this happen.

Thanks.

Sign in to reply to this post

Jason ByrnesWebAssist

yes, that should work, but after the loop, make sure to use:

$eCart4->ResetAll();
$eCart4->SaveCart();

to save the cart session.

Sign in to reply to this post

fms77717Beta Tester

Works perfectly.

Jason,

You are the man! Just what I needed.

$eCart4->ResetAll();
$eCart4->SaveCart();

The ResetAll did the trick.

Thanks.

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