close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Best way to implement discounts

Thread began 11/30/2009 1:17 pm by david.aprice316413 | Last modified 2/04/2010 1:02 pm by david.aprice316413 | 3677 views | 15 replies

Eric Mittman

This will be a two part approach. You will first need to get the calculation in place and working first. In the calculation you can specify hard coded values and colums. Rather than making reference to the cart values for this you would use the column names in square brackets. Also, you are setting the calculation for the column, not setting a discount amount. So what you have that looks like this:

$this->Bookdiscounttenpercent = abs($this->Quantity >= 10 && $this->Quantity < 30 && $this->ItemType == 2) *( $this->TotalPrice * .10);

Will need to look more like this:

abs([Quantity] >= 10 && [Quantity] < 30 && [ItemType] == 2) *( [TotalPrice] * .10);

So if you called this calculation column discountAmount it would hold the result of this calculation. The abs function is a php function that returns 0 if the expression inside is false, and 1 if it is true. So when this code is evaluated if the item has a quantity of more than 10 and less than 30 and the item type is 2 this part of the abs function will return 1. You are then multiplying 1 by the next part, which is the discount amount. So when an item meets this condition it will have 10% of the total price for the item held in this column.

You will then need to have a discount rule that just checks if there are items in the cart and if there is discount based on the subtotal of this new discountAmount calculated column.

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





Ease of use


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