close ad
Databridge V2 with MySQLi support IS Now Available!
open ad
View Menu

Technical Support Forums

Free, outstanding support from WebAssist and your colleagues


Changing the discount description.

Thread began 5/30/2011 4:05 am by CraigR | Last modified 5/31/2011 1:25 pm by Jason Byrnes | 865 views | 5 replies |

CraigRBeta Tester

Changing the discount description.

In my store, discounts vary depending on the customer logged in

I have a number of discount rules, which use session values, allocated from a recordset, filtered by the current customer
This all seems to work pretty well, but I would like to alter the description of the discount rule, as it appears in the cart.
(I realise I will need to hand code this on the cart_PHP.php page and not be able to re-enter the ecart object interface)

As an example, I have a discounts rule which appears as

$this->Discounts[] = new WA_eCart_Rule(urldecode("10%25%20Summer%20Special"), true, "WAEC_cscart_10SummerSpecial");

If I replace the string 10%25%20Summer%20Special with a different string, the function WAEC_cscart_10SummerSpecial is still called, so that’s great.


$this->Discounts[] = new WA_eCart_Rule(urldecode("15%25%20Winter%20Special "), true, "WAEC_cscart_10SummerSpecial");

Gives me a different description

However if I try to replace the string or part of the string with say, a session value, nothing appears for the session value, which I know is set.
I have tried the following, and neither work for me

$this->Discounts[] = new WA_eCart_Rule(urldecode($_SESSION[‘'VoucherCode']."%25%20Winter%20Special "), true, "WAEC_cscart_10SummerSpecial");

$this->Discounts[] = new WA_eCart_Rule($_SESSION['VoucherCode'].urldecode("10%25%20Summer%20Special"), true, "WAEC_cscart_10SummerSpecial");

I assume I'm missing something

Sign in to reply to this post

Jason ByrnesWebAssist

instead of changing the name in the cart object file, you can change how it is displayed on the cart display page.

the code that will display the discount name will look like:

<?php echo $YourCart->RuleLooperName("Discounts"); ?>

this will be inside a loop that goes through each discount and displays the name, then the discount amount.

you can display the session in front of the discount name using:

<?php echo($_SESSION['VoucherCode']." ".$YourCart->RuleLooperName("Discounts")); ?>
Sign in to reply to this post

CraigRBeta Tester

Hi Jason.

Thanks for the reply.

I have used your proposed solution on a previous site


It certainly works, but i was hoping to build the description string within the ecart_PHP.php page.

If yours is the best solution, I'll stick with it.

Sign in to reply to this post

Jason ByrnesWebAssist

to be honest, I haven't tried setting the name dynamically in the cart object, but if it is working on the cart display page, my guess is that the variable is not set at the time the cart object is being loaded, but gets set farther down the page.

I would use the method of setting the name on the cart display rather than setting it in the cart object it, for 2 reasons:

1) you can get this to work

2) You can still edit the eCart object.

Sign in to reply to this post

CraigRBeta Tester

Seem like 2 good reasons to me !

Thanks for your help.

Sign in to reply to this post

Jason ByrnesWebAssist

no worries.

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





Ease of use


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