Developer forum

Forum » Templates » AJAX validate discount code

AJAX validate discount code

Peter Bille Larsen
Reply

Hi DWs

On client wants a discount code on a ecom website, where it's out of control with submit in pay process. I could be a field on the product card, on newsletter page, where ever.

I was thinking of validating the discount code with ajax. Any clue to how this could be done?

/PB


Replies

 
Viacheslav Musiychuk
Reply

Hi, you can validate voucher code with ajax

 

try ajax call to this

'/Admin/Module/eCom_Catalog/dw7/Vouchers/VouchersActions.ashx?cmd=CheckVoucher&code=' + voucher

 

where voucher - is your voucher code

 

it will returns true or false

 

Hope this will help.

 
Peter Bille Larsen
Reply

Hi Viacheslav,

cool. I am thinking that the code, which is awesome, must refer to the Voucher module in DW8, but the client solution is also a DW7, and the code is made in the Discount Module in Ecom.

Is there a similar way to validate with the Discount Module for Ecom ?

thanks
/Peter

 

 
Viacheslav Musiychuk
Reply

This voucher validation working just in DW8, and was not implemented in DW7

There are no other way to check this voucher code in DW7 via Ajax.

 
Peter Bille Larsen
Reply

ok thanks, I will see if theres something I can use in Solution Set.

//PB.

 

 
Peter Bille Larsen
Reply

One last comment. The module is not the voucher module, its the discount ecom module. (see screenshot).

I was thinking about submitting the basket in some way with ajax to see if any discounts appeared in the basket. Any other suggestions? :-)

 

Thanks
Peter

 

discount.png
 
Viacheslav Musiychuk
Reply

Here I have 2 suggestions:

1. Find partner in DW who will add such method (I think it is a couple line of code) and you will send ajax calls to check code

2. You can try use ajax calls to basket and see if any discounts presents there (cause discounts presents in product loops in basket template)

 

You must be logged in to post in the forum