# Coupon discount rule

Thread began 5/04/2015 8:43 am by info4753 | Last modified 5/04/2015 2:27 pm by Ray Borduin | 305 views | 1 replies |

## 5/04/2015 8:43 am  |  #1 info4753

### Coupon discount rule

I've got a ecart with a coupon discount applied. What I try to achieve is giving all products with GutscheinCodeArtikel = 1 a 10%
discount. What I've tried is this:

//eCart Rule
function WAEC_eCart_DegustationWeine10() {
\$totalDiscount = 0;
if (true && ((\$this->ConditionalTotal("Quantity", "GutscheinCodeArtikel", "1") > 0) && ((isset(\$_SESSION['GutscheinCode'])?\$_SESSION['GutscheinCode']:"") == "123456"))) {
\$totalDiscount += (\$this->TotalColumn("TotalPrice", "GutscheinCodeArtikel", "1") * 0.1);//Result
}
return WA_eCart_FormatNumber(\$totalDiscount, \$this->ForceDecimalsC, \$this->DecimalPlacesC);
}
//eCart Rule

But this gives me a discount on the Total of all products in the cart not only the one that have the column GutscheinCodeArtikel = 1. How can I sum all products with column GutscheinCodeArtikel = 1?

Thanks for any help

Sign in to reply to this post

## 5/04/2015 12:13 pm  |  #2 info4753

Looks like this solves the problem:

//eCart Rule
function WAEC_eCart_DegustationWeine10() {
\$totalDiscount = 0;
if (true && ((\$this->ConditionalTotal("Quantity", "GutscheinCodeArtikel", "1") > 0) && ((isset(\$_SESSION['GutscheinCode'])?\$_SESSION['GutscheinCode']:"") == "123456"))) {
\$totalDiscount += (\$this->ConditionalTotal("TotalPrice", "GutscheinCodeArtikel", "1") * 0.1);//Result
}
return WA_eCart_FormatNumber(\$totalDiscount, \$this->ForceDecimalsC, \$this->DecimalPlacesC);
}
//eCart Rule

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.

## Everything else!

Close Window

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

Layout

Ease of use

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 Window

## We were unable to retrieve the attached file

Close Window

### Attach and remove files

• Text Formatting
• Insert Element
• Insert Link
• Block Formatting
• Cancel
Close Window

Close Window

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