X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Buy More, Save More Popup Message (4.6.0 and up) (https://forum.x-cart.com/showthread.php?t=67773)

acidon 09-17-2013 08:45 PM

Buy More, Save More Popup Message (4.6.0 and up)
 
1 Attachment(s)
If you are using a discount system that rewards customers in next fashion:

Spend over X get Y off

then here is the mod that will remind customers to spend more to qualify for the next tier of discounts. It will show a message in Add to Cart Popup when customer adds an item to cart (view attached image).

http://forum.x-cart.com/attachment.php?attachmentid=3557&stc=1&d=137947929 3

Simple example:

Spend 100$ or more and get 10$ OFF


In /common_files/modules/Add_to_cart_popup/product_added.tpl add:

Code:

{if $minicart_total_cost ge 100} {* Qualified amount *}

<tr><td colspan="3">You will receive 10$ discount at checkout!</td></tr>

{else}

<tr><td colspan="3">Current discount: 0$. Spend {math equation="x - y" x=100 y=$minicart_total_cost }$ more and get 10$ OFF!</td></tr>

{/if}


right after :

Code:

            <a href="cart.php" class="view-cart">{$lng.lbl_view_cart}</a>
          </div>
        </div>

      </td>
    </tr>


And more complex example:

Spend 75$ or more and get 5$ OFF
Spend 100$ or more and get 10$ OFF
Spend 150$ or more and get 15$ OFF
Spend 200$ or more and get 25$ OFF


In /common_files/modules/Add_to_cart_popup/product_added.tpl add:

Code:

{if $minicart_total_cost ge 200} {* Maximum qualified amount *}

<tr><td colspan="3">You will receive 25$ discount at checkout!</td></tr>

{elseif $minicart_total_cost ge 150}

<tr><td colspan="3">Current discount: 15$. Spend {math equation="x - y" x=200 y=$minicart_total_cost }$ more and get another 10$ OFF!</td></tr>

{elseif $minicart_total_cost ge 100}

<tr><td colspan="3">Current discount: 10$. Spend {math equation="x - y" x=150 y=$minicart_total_cost }$ more and get another 5$ OFF!</td></tr>

{elseif $minicart_total_cost ge 75}

<tr><td colspan="3">Current discount: 5$. Spend {math equation="x - y" x=100 y=$minicart_total_cost }$ more and get another 5$ OFF!</td></tr>

{else}

<tr><td colspan="3">Current discount: 0$. Spend {math equation="x - y" x=75 y=$minicart_total_cost }$ more and get 5$ OFF!</td></tr>

{/if}


right after :

Code:

            <a href="cart.php" class="view-cart">{$lng.lbl_view_cart}</a>
          </div>
        </div>

      </td>
    </tr>



This mod was tested in 4.6.0 and 4.6.1 . I am pretty sure it can be easily implemented in earlier versions as well.



Enjoy!

gozindagi 09-17-2013 09:18 PM

Re: Buy More, Save More Popup Message (4.6.0 and up)
 
Hello Acidon,

Thanks for a beautiful code.

If instead of hard coding in tpl file if I create offer through module and over range of price then how to define the offer?

acidon 09-18-2013 06:14 AM

Re: Buy More, Save More Popup Message (4.6.0 and up)
 
Can you be a little more specific, I am not sure if I understood your question correctly :oops:

gozindagi 09-18-2013 11:51 PM

Re: Buy More, Save More Popup Message (4.6.0 and up)
 
Hello acidon,

I want to say that instead of hard coding in tpl or php file if u please create it as a module where we can define a offer like range of price.

For example-

Spend Rs.100/- to 200/- to receive 100 off on total cart value

Spend Rs.200/- to 300/- to receive 150 off on total cart value

If we can create the offer through some modules then I think it will be better.

totaltec 09-23-2013 08:13 PM

Re: Buy More, Save More Popup Message (4.6.0 and up)
 
Quote:

Originally Posted by gozindagi
If we can create the offer through some modules then I think it will be better.

Yes, it would certainly be better. I might like to use this for a tutorial on module creation. If you plan to create this module let me know, if not, I might use it as an example and a free module for the community. Let me know.

gozindagi 09-23-2013 10:23 PM

Re: Buy More, Save More Popup Message (4.6.0 and up)
 
Quote:

Originally Posted by totaltec
Yes, it would certainly be better. I might like to use this for a tutorial on module creation. If you plan to create this module let me know, if not, I might use it as an example and a free module for the community. Let me know.


Great... That is a great idea..If anyone can create this module that I think will be better...

ADDISON 09-23-2013 11:50 PM

Re: Buy More, Save More Popup Message (4.6.0 and up)
 
I guess Qualiteam announced such of module in the roadmap. Buy More Save More.

gozindagi 09-24-2013 01:34 AM

Re: Buy More, Save More Popup Message (4.6.0 and up)
 
Quote:

Originally Posted by ADDISON
I guess Qualiteam announced such of module in the roadmap. Buy More Save More.


But that will release on February 201.But if Mike can help by contributing a free module I think that will be better.

acidon 09-24-2013 06:23 AM

Re: Buy More, Save More Popup Message (4.6.0 and up)
 
Quote:

Originally Posted by totaltec
Yes, it would certainly be better. I might like to use this for a tutorial on module creation. If you plan to create this module let me know, if not, I might use it as an example and a free module for the community. Let me know.


Sure go ahead, I knew this module is scheduled to be released by QT soon, that's why I didn't bother to create a module and only provided a quick hardcoded fix :)

totaltec 09-24-2013 06:27 AM

Re: Buy More, Save More Popup Message (4.6.0 and up)
 
I was not aware that QT had this planned, must have missed that. No need to reinvent the wheel, I think QT will do a much better job than I was planning.

I'll look for another idea to make my tutorial with, I would like to share with the community what I know about making modules.


All times are GMT -8. The time now is 08:07 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2021, Jelsoft Enterprises Ltd.