close ad
WARNING PC USERS: Do Not Install the DREAMWEAVER CC 2017 Update »
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Discounting

Thread began 8/27/2009 10:06 am by Codesnap | Last modified 9/02/2009 2:21 am by Codesnap | 1666 views | 5 replies |

Codesnap

Discounting

I'm using eCart for a winery (who sell their wine online of course). I've been able to set up 10% discounting on 6 or more bottles and 20% discount on 12 or more bottles. Thankfully they've gone with a flat shipping rate, variable to various locations around Australia (so it's 'flat' in the sense that no matter what you order the shipping is a set fee for your location).

All well and good so far and working well, but they now want to sell other things too, such as a $10 voucher for their restaurant and cleanskin cases (of 12 bottles each). However both products are void of the 10/20% discount. I can kind of get around the cleanskin problem by charging it through at 120% so that it gets discounted by 20% when it goes through the checkout, but if they happen to order a $10 voucher to go with it it'll go through at $8 rather than $10.

So the underlying question here is how can I get products to go through the checkout system and circumvent discounting and shipping? Within the management system I've been able to set up controls to turn either

Sign in to reply to this post

Ray BorduinWebAssist

You would probably have to add a column to your cart like: "DiscountApplicable" and set it to 0 or 1 in the add to cart depending on whether that item would be discounted or not.

Then create a calculation:
AmtDiscounted = [TotalPrice] * [DiscountApplicable]

Then you can base the discount on the AmtDiscounted total instead of the subtotal and it won't discount items when the discount isn't applicable.

Sign in to reply to this post

Codesnap

Discounting

Yeah, was most of the way there. I had already applied the DiscountApplicable part (which I called DiscExempt) so I'm thinking I need to do the opposite of what you're talking about? And what you're talking about gets applied to that shoppingCart_PHP.php configuration file in the eCart folder? Do I edit it via CodeView or via the eCart window?

//eCart Rule
function WAEC_shoppingCart_10() {
$totalDiscount = 0;
if (true && (($this->TotalColumn("Quantity") >= 6) && ($this->TotalColumn("Quantity") < 12))) {
$totalDiscount += ($this->TotalColumn("TotalPrice") * 0.1);//Result
}
return WA_eCart_FormatNumber($totalDiscount, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule
//eCart Rule
function WAEC_shoppingCart_20() {
$totalDiscount = 0;
if (true && (($this->TotalColumn("Quantity") >= 12) || ($this->InCart("08CSSEMSAUV") == true) || ($this->InCart("08CSSEM") == true))) {
$totalDiscount += (($this->TotalColumn("TotalPrice") * 0.2) + 0);//Result
}
return WA_eCart_FormatNumber($totalDiscount, $this->ForceDecimalsC, $this->DecimalPlacesC);
}
//eCart Rule

Sign in to reply to this post

Ray BorduinWebAssist

Either place would do for updates. It is probably safer to use the cart interface if you want to be able to in the future. Small mistakes in code view may work, but could also prevent the cart interface from being used in the future.

In this case though the update is really simple... I think just update :

$totalDiscount += (($this->TotalColumn("TotalPrice") * 0.2) + 0);//Result


to refer to the calculated discouned total instead of "TotalPrice" when doing the discount.

Sign in to reply to this post

Codesnap

Calculating Discount

Hmmm, I can't see how that'd work without a reference to the Discount Exempt field that I had set up. On rereading my entries here I may be confusing the issue regarding when the discount is applicable. 10% is applicable when they buy 6 bottles or more, 20% when they buy 12 or more ... HOWEVER, it can be a mixed purchase. If a buyer wants 3 whites, 2 reds and a port they get a 10% discount because they bought 6 bottles all up (not necessarily 6 of a specific kind), so obviously the discount needs to be calculated on check out in this circumstance.

I need to be able to take items out of the discount equation where the specific column value of DiscExempt is met with the value of 1. I think I can set it up so that the total number of items where DiscountExempt is 0 totals 6 or more or 12 or more, but the discount will be applied to the total value, and not exclude items that are exempt from the discount.

Does that make sense? I just can't see how that kind of calculation can be done within the Merchandising Rule.

Sign in to reply to this post

Codesnap

I Worked It Out

Right, for the purpose of future reference, I'll tell you what I did to get it working.

Didn't spot this before, but you can apply discounting to specific items that meet a certain criteria. In this case I used the calculation of "Based on items with a specific value", using the total of TotalPrice, where DiscExempt has a value of 0, times 0.1 for 10%.

Prior to the above I added a condition where the total number of items with a DiscExempt value of 0 is greater than or equal to 6 and less than 12.

Repeated the process and adjusted the values for 20%.

Works fine.

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