close ad
 
Important WebAssist Announcement
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

Percentage discount for a specific item in cart

Thread began 2/28/2014 8:34 am by acornist | Last modified 2/28/2014 12:22 pm by acornist | 1541 views | 9 replies

acornistBeta Tester

Percentage discount for a specific item in cart

I'm sure it's something stupid, but for the life of me I can't spot what I'm doing wrong.

I have to put in a discount rule that allows the customer to apply a coupon for a given percentage off on one item with a specific ProductID.

I set up database-driven coupons for flat-rate and percentage off (they work great), but adapting them for specific products doesn't seem to work for me.

I have session variables in place for the coupon's PromoProduct, PromoAmount and PromoType, and the correct values are showing. I also have a column in the eCart object for ProductID.

This is the rule that appears in eCart1.php:

function WAEC_eCart1_PercentageOffProduct() {
$totalDiscount = 0;
if (true && ((sizeof($this->Items) > 0) && (isset($_SESSION['PromoCode'])) && (isset($_SESSION['PromoAmount'])) && (isset($_SESSION['PromoProduct'])) && ((isset($_SESSION['PromoPSpecific'])?$_SESSION['PromoPSpecific']:"") == "product") && ($this->ConditionalTotal("Quantity", "ProductID", "".$_SESSION['PromoProduct'] ."") > 0))) {
$totalDiscount += (floatval($this->GetInfo("".$_SESSION['PromoProduct'] ."", "Price")) * ($_SESSION['PromoAmount'] / 100));//Result
}
return WA_eCart_FormatNumber($totalDiscount, $this->ForceDecimalsC, $this->DecimalPlacesC);
}

I've confirmed that all the session variables, the eCart columns, and the discount calculation are returning the expected values.

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