Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls

Buy More, Save More Popup Message (4.6.0 and up)

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 09-17-2013, 08:45 PM
  acidon's Avatar 
acidon acidon is offline
 

Senior Member
  
Join Date: Feb 2008
Posts: 139
 

Default Buy More, Save More Popup Message (4.6.0 and up)

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!
Attached Thumbnails
Click image for larger version

Name:	example.jpg
Views:	326
Size:	36.4 KB
ID:	3557  
__________________
Version 4.7.6 X-cart Gold
Reply With Quote

The following 2 users thank acidon for this useful post:
hawk (02-23-2014), totaltec (09-23-2013)
  #2  
Old 09-17-2013, 09:18 PM
 
gozindagi gozindagi is offline
 

Advanced Member
  
Join Date: Jul 2013
Posts: 61
 

Default 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?
__________________
X-cart Platinum 4.6.0
Reply With Quote
  #3  
Old 09-18-2013, 06:14 AM
  acidon's Avatar 
acidon acidon is offline
 

Senior Member
  
Join Date: Feb 2008
Posts: 139
 

Default 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
__________________
Version 4.7.6 X-cart Gold
Reply With Quote
  #4  
Old 09-18-2013, 11:51 PM
 
gozindagi gozindagi is offline
 

Advanced Member
  
Join Date: Jul 2013
Posts: 61
 

Default 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.
__________________
X-cart Platinum 4.6.0
Reply With Quote

The following user thanks gozindagi for this useful post:
totaltec (09-23-2013)
  #5  
Old 09-23-2013, 08:13 PM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default 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.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote

The following 2 users thank totaltec for this useful post:
acidon (09-24-2013), gozindagi (09-23-2013)
  #6  
Old 09-23-2013, 10:23 PM
 
gozindagi gozindagi is offline
 

Advanced Member
  
Join Date: Jul 2013
Posts: 61
 

Default 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...
__________________
X-cart Platinum 4.6.0
Reply With Quote
  #7  
Old 09-23-2013, 11:50 PM
  ADDISON's Avatar 
ADDISON ADDISON is offline
 

X-Man
  
Join Date: Jan 2008
Posts: 2,613
 

Default 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.
__________________
X-Cart Next: Business 5.2 (learning and testing)
X-Cart Classic: Gold and Gold Plus 4.7
Lots of Modules and Customizations
OS in use: Red Hat Enterprise, Fedora, CentOS, Debian, Ubuntu, Linux Mint, Kali Linux
Ideas for Server configuration (basicaly): Nginx/Pound (reverse proxy), Apache/Nginx (webserver), Squid/Varnish (cache server), HHVM or (PHP-FPM + PHP 5.6 + opcache), MariaDB/Percona MySQL Server, Redis (storing sessions)

You can catch my ideas here: http://ideas.x-cart.com
Reply With Quote

The following user thanks ADDISON for this useful post:
totaltec (09-24-2013)
  #8  
Old 09-24-2013, 01:34 AM
 
gozindagi gozindagi is offline
 

Advanced Member
  
Join Date: Jul 2013
Posts: 61
 

Default 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.
__________________
X-cart Platinum 4.6.0
Reply With Quote

The following user thanks gozindagi for this useful post:
totaltec (09-24-2013)
  #9  
Old 09-24-2013, 06:23 AM
  acidon's Avatar 
acidon acidon is offline
 

Senior Member
  
Join Date: Feb 2008
Posts: 139
 

Default 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
__________________
Version 4.7.6 X-cart Gold
Reply With Quote

The following user thanks acidon for this useful post:
totaltec (09-24-2013)
  #10  
Old 09-24-2013, 06:27 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default 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.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote

The following user thanks totaltec for this useful post:
acidon (09-24-2013)
Reply
   X-Cart forums > X-Cart 4 > Dev Questions


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


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

   

 
X-Cart forums © 2001-2020