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

How do I create a discount based on a session variable and specific items in the cart?

Thread began 6/14/2014 1:52 am by mora398588 | Last modified 6/17/2014 4:38 pm by mora398588 | 379 views | 4 replies |

mora398588

How do I create a discount based on a session variable and specific items in the cart?

There are four products we are looking to offer on our website. I have created a static "Add to Cart" button for each item and gave them a unique ID, such as 1, 2, 3, and 4.

I attempted to create a discount based on a session variable (userLevel) and specific items in the cart (i.e., the products outlined above). After including the Session variable condition (where userLevel = 1), I inserted the next condition with an AND separator (if presence of item 1 = = true). I them proceeded to include the next condition, but with an OR separator (if presence of item 2 = = true), and so on up to item 4 - each with OR separators. The calculation is based on items with a specific value, (Total of TotalPrice where Discountable has a value of 2 times .25).

I then proceeded to create two more discounts using the same conditions and separators for userLevel 2 and userLevel 3.

Now, here is the issue (if you have not discovered it already), when I tested the discount on my testing server (logged in under userLevel 1), the cart returned the correct discount for Item 1. When I cleared the cart and added Item 2, the cart returned all the discounts I created for userLevels 1, 2 and 3.

I am certifiably confused. Each discount is based on a Session Variable equal to the userLevel. The discounts based on Session variable userLevel 2 or 3 should not even show up - since I am logged in only under userLevel 1. I attempted to replace the OR separators for Items 2, 3 and 4 with an AND separator. Of course, that didn't work either.

I would welcome any assistance or clarification you can provide me. Thank you for your time in advance!

Sign in to reply to this post

Jason ByrnesWebAssist

Combining AND OR conditions in the discount wont work out properly.

Instead of using Presence of Specific Item in the cart, create a new cart column for Discountable. in the Add to cart buttons for items 1,2,3,4 set the Discountable column to 1 and for other items, set that column value to 0

then set the discount trigger as:

Session variable userLevel = 1

AND
number of items with a specific column value:
if the total number of items where "Discountable" has a value of "1" is ">" a value of "0"

Sign in to reply to this post

mora398588

Thank you, Jason. That worked great!!!

However, I am experiencing a similar issue involving a charge. I am looking to trigger a charge for a specific item (item 20) added to the cart. In my database, I have a MaterialFee column which includes the amount of the fee (i.e., 25.00). However, the MaterialFee only applies to Item 20. The Add to Cart button is bound to a recordset.

I inserted a "MaterialFee" column in my eCart Object and identified it as "currency." I have attempted the calculation based on items with a specific value where Material Fee is 25.00 plus 0. However, the charge is not triggering at all when I attempt to insert Item 20 to the cart. Ideally, I would like the charge to be added each time Item 20 is added to the cart. So, if the user adds three of Item 20 to the cart, the cart will calculate a 25.00 MaterialFee for each.

Sign in to reply to this post

Jason ByrnesWebAssist

For the trigger use Presence of Specific Item in the cart for this one, an set the ID to 20.

for the calculation, use:
Based on Quantity of an item:
Quantity of item '20' 'times' '25'

Sign in to reply to this post

mora398588

Jason, thank you. The changes worked great!

As always, your assistance is much appreciated.

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