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

percent discount basd on quantity with hard coded add to button

Thread began 12/18/2013 4:35 pm by steve204795 | Last modified 12/20/2013 10:37 am by Jason Byrnes | 1329 views | 16 replies |

steve204795

percent discount basd on quantity with hard coded add to button

Hi .. I have added calculations and trigger as in support forum varying percentages based on quantity .. I'm not getting the discount showing on the confirm page. I've had to modify the checkout to get this to work with First Data's hosted checkout and it currently works but now my client wants to add 3 discount levels for quantity ranges 6-10 11-15 16-20 .. 3 files are attached ... thanks

Sign in to reply to this post

Jason ByrnesWebAssist

on the fire exinguishers page, in the add to cart button, the discountPercentage column is set to gt it;s value from the cart:

$ATC_itemdiscountPercentage = "".$eCart1->DisplayInfo("discountPercentage") ."";// column binding


this is circular logic, it cant get the value from the cart, the add to cart is trying to add the value to the cart.

this should be set to the desired percentage instead, for example, 20%:
$ATC_itemdiscountPercentage = "0.2";// column binding

Sign in to reply to this post

steve204795

percent discount basd on quantity with hard coded add to button

Originally Said By: Jason Byrnes
  on the fire exinguishers page, in the add to cart button, the discountPercentage column is set to gt it;s value from the cart:

$ATC_itemdiscountPercentage = "".$eCart1->DisplayInfo("discountPercentage") ."";// column binding


this is circular logic, it cant get the value from the cart, the add to cart is trying to add the value to the cart.

this should be set to the desired percentage instead, for example, 20%:
$ATC_itemdiscountPercentage = "0.2";// column binding  





Hi Jason .. thanks ... so just to clarify:

- I would need to create a column for each percentage range and then add a trigger

quantity more than 5 less than 11 > $ATC_itemdiscountPercentage1 = "0.1";// column binding

quantity more than 11 less than 16 > $ATC_itemdiscountPercentage2 = "0.2";// column binding

quantity more than 16 > $ATC_itemdiscountPercentage3 = "0.3";// column binding

I had changed the calculation in the original post to .... * [discountPercentage]:0.1... thinking that was where to input the percentage - I need to change that back to 0 correct?

Thanks again for your help

Sign in to reply to this post

Jason ByrnesWebAssist

so you would have the discountPercentage1, discountPercentage2, and discountPercentage3 columns

in the add to cart button behavior, on the bindings panel. you would add the percentages 0.1, 0.2, 0.3 to the corresponding columns.

then you would change the calculation to assign the appropriate discount based on quantity:
(abs([Quantity] >= 5 && [Quantity] < 11)?[Price] * [Quantity]) * [discountPercentage1]:0) + (abs([Quantity] >= 11 && [Quantity] <= 16)?[Price] * [Quantity]) * [discountPercentage2]:0) + (abs([Quantity] >= 16)?[Price] * [Quantity]) * [discountPercentage1]:0)

Sign in to reply to this post

steve204795

percent discount basd on quantity with hard coded add to button

line 12 is getting an error in the eCart1PHP.php .. see attached .. thanks

Sign in to reply to this post

steve204795

percent discount basd on quantity with hard coded add to button

here's the full error ...

Parse error: syntax error, unexpected ')' in /home/content/a/f/p/afpdns/html/WA_eCart/eCart1_PHP.php on line 12

Sign in to reply to this post

Jason ByrnesWebAssist

sorry, was missing some parentheses in the calculation code, the correct calculation code should be:

(abs([Quantity] >= 5 && [Quantity] < 11)?([Price] * [Quantity]) * ([discountPercentage1]:0)) + (abs([Quantity] >= 11 && [Quantity] <= 16)?([Price] * [Quantity]) * ([discountPercentage2]:0)) + (abs([Quantity] >= 16)?([Price] * [Quantity]) * ([discountPercentage1]:0))

Sign in to reply to this post

steve204795

percent discount basd on quantity with hard coded add to button

now it doesn't like one of the brackets '['

Parse error: syntax error, unexpected '[' in /home/content/a/f/p/afpdns/html/WA_eCart/eCart1_PHP.php on line 12

Sign in to reply to this post

Jason ByrnesWebAssist

send the WA_eCart/eCart1_PHP.php file

Sign in to reply to this post

steve204795

percent discount basd on quantity with hard coded add to button

ok .. thanks - here it is

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