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

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues

rating

Is there an eCart Discount variable available?

Thread began 3/22/2010 8:34 pm by steve283594 | Last modified 3/25/2010 7:57 pm by Eric Mittman | 1252 views | 7 replies |

steve283594

Is there an eCart Discount variable available?

Hey guys,

Quick question:
Is there an existing variable in eCart that is available when a/any Discount Rule has been set?

On my pages throughout the site, I want to show a Discounted Price under the existing price. This is purely a visual price. The cart takes care of the actual discounts via the Discount rule.
I have a function (ASP VBScript) that works this out and writes the answer to the page.

I want to put an 'if statement' around that function that basically asks whether or not 'any' discount rule has been set in eCart. If true, then display the discount price else just show normal price.

Any help appreciated.

It is an older site so I am running eCart 4 (and VBScript :( )

Thanks in advance

Sign in to reply to this post

Eric Mittman

The discounts used in eCart are for the entire cart not for individual items. The discounts are accumulated and held in the cart, you can check on the total for discounts with some code like this:

<%
if (WA_eCart_GetDiscounts(eCart1) > 0) then
%>



This GetDiscounts function will get the total for the discounts, you can check it just like this if statement. If the total is greater than 0 then there is a discount for the current order.

Sign in to reply to this post

steve_hopper136052

Is there an eCart Discount variable available?

Thanks Eric, that's exactly what I need :)
I realize that the discount applies to the entire cart, which is why I'm having to add in a 'visual' price representation on the product pages to keep the client happy.

Thanks

Sign in to reply to this post

steve_hopper136052

Is there an eCart Discount variable available?

Hey Eric,

Was almost there - In case anyone else needs to use this, the code below returned the value I was looking for:

<% if ([mycartname]_eCart_GetDiscounts() > 0) then %>
show something here
<% end if %>

My next question is: is there some way of pulling in the active discount name into the cart? So instead of just having the word "Discounts" in the Cart, can I use the Discount name, eg April Sale - 10% Discount?

Thanks

Sign in to reply to this post

Art

You would basically check the recordset to see if the sale price is turned on and if so, then display sale message, if not, display nothing.

Sign in to reply to this post

Eric Mittman

You might be able to get at the info that you need for the discount by making use of the rule looper function. Here is an example of what this function looks like in action, I took this from my cart display:

<%
if (NOT WA_eCart_Rules_EOF(eCart1, "Discounts")) then
while (NOT WA_eCart_Rules_EOF(eCart1, "Discounts"))
if (WA_eCart_RuleLooperValue(eCart1, "Discounts") > 0) then
%>
<tr>
<td class="eC_IndividualCharge"><%=WA_eCart_RuleLooperName(eCart1, "Discounts")%></td>
<td>-<%=WA_eCart_DisplayMoney(eCart1, WA_eCart_RuleLooperValue(eCart1, "Discounts"))%></td>
</tr>
<%
end if
set eCart1 = WA_eCart_Rules_MoveNext(eCart1, "Discounts")
wend
set eCart1 = WA_eCart_Rules_MoveFirst(eCart1, "Discounts")
end if
%>



In this code once you looping over the rule you can get it's name and value like this:

name:

<%=WA_eCart_RuleLooperName(eCart1, "Discounts")%>



value:

WA_eCart_RuleLooperValue(eCart1, "Discounts")
Sign in to reply to this post

steve_hopper136052

Is there an eCart Discount variable available?

Thanks Eric, will give that a try :)

Update:
Perfect, thanks for your help

Sign in to reply to this post

Eric Mittman

That is good to hear, let us know if you have any further questions.

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