close ad
Install the LAtest Updates to Work with CC 2017 and CC 2018
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Varying Percentages Discount Based on Quantity

Thread began 10/18/2013 8:44 am by catnip | Last modified 10/21/2013 11:59 am by Jason Byrnes | 1656 views | 31 replies |

catnip

Varying Percentages Discount Based on Quantity

Hi

I am trying to add a percentage discount to our eCart5 when a user adds 3 of a certain product, BUT some of these products will offer 10% off if you buy 3 and some will offer 20% off and also 50% off....How can this be achieved? also what addition do I have to make in the database?, add another column with the percentage? ie: 20 so if this column has a value then that product has a discount applied to it?

Please can someone assist, need to have this complete over the weekend :o(

Many thanks in advance.

Sign in to reply to this post

Jason ByrnesWebAssist

add a column to the cart for the discount percentage. use the decimal value, so 0.1 for 10%, etc. name the column discountPercentage

on the calculations tab, create a calculation named discountAmount as:
abs([Quantity] >= 3)?([Price] * [Quantity]) * [discountPercentage]:0

on the discounts tab, create the discount as:
trigger:
"Subtotal for any column" if the subtotal of column "discountAmount" as ">" a value of "0"

Calculation:
"Based on column subtotal"
subtotal for column "discountAmount" "plus" "0"

Sign in to reply to this post

catnip

Hi Jason

Thanks for a great detailed explanation....but it is throwing up a syntax error in the Cart_PHP.php page on line 12
" $itmObj->discountAmount = abs($itmObj->Quantity >= 3)?($itmObj->Price * $itmObj->Quantity) * [discountPercentage]:0;//t"

Error: Parse error: syntax error, unexpected '['

Sign in to reply to this post

Jason ByrnesWebAssist

what did you name the cart column? it should be named discountPercentage

Sign in to reply to this post

catnip

Yes....that is what I named it

Sign in to reply to this post

Jason ByrnesWebAssist

send the Cart_PHP.php page file please.

Sign in to reply to this post

catnip

Sent

Sign in to reply to this post

Jason ByrnesWebAssist

there is no column named discountPercentage:

//columns
$this->ID = $itemID;//n?
$this->Name = $itemName;//t
$this->Description = $itemDescription;//t
$this->Thumbnail = $itemThumbnail;//t
$this->Weight = $itemWeight;//w
$this->Quantity = $itemQuantity;//n
$this->Price = $itemPrice;//c
//calculations



on the columns click the plus button and add a new column, name it discountPercentage

Sign in to reply to this post

catnip

Output type? Unique?

Sign in to reply to this post

Jason ByrnesWebAssist

Output type van be left as text or set to number.

don't select unique.

Sign in to reply to this post
loading

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