Jump to content
Tsimi

Only $xx left to get free shipping!

Recommended Posts

I was talking with @@dculley the other day and he had this cool idea to have some sort of message that would suggest that only $XX amount is left to get free shipping.

I found this idea interesting and thought this could be implemented inside the checkout_shipping.php. It would be also nice to have it connected to the already existing free shipping order total module so that it will only show when allow free shipping is set to true.

 

Here again this code is just beta and needs further testing.

 

checkout_shipping.php

 

FIND:

<?php
  if (tep_count_shipping_modules() > 0) {
?>

ADD RIGHT BEFORE/ABOVE:

<?php
    if ((MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') && ($free_shipping != true)){
        $free_suggest = round(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER - $cart->show_total(), 2) ;
        echo '<div class="alert alert-info"><i class="fa fa-exclamation-triangle fa-2x"> </i>' . TEXT_FREE_SHIPPING_SUGGEST1 . ' $' . $free_suggest . ' ' . TEXT_FREE_SHIPPING_SUGGEST2 . '</div>';  
    }     
?>   

includes/languages/english/checkout_shipping.php

// BOF FREE SHIPPING SUGGEST
define('TEXT_FREE_SHIPPING_SUGGEST1', 'Only');
define('TEXT_FREE_SHIPPING_SUGGEST2', 'left to get <strong>free shipping!</strong>');
// EOF FREE SHIPPING SUGGEST

That's it!

Edited by Tsimi

Share this post


Link to post
Share on other sites

This is indeed a good idea for those who offer free shipping. I would add it to the shopping cart page, so the customer doesn't have to start the checkout process before being notified. I find it annoying to have to go back and change something once I've started checkout.

 

Regards

Jim


See my profile for a list of my addons and ways to get support.

Share this post


Link to post
Share on other sites

Another piece of the puzzle, from 2009 so instructions will be out of date; http://www.clubosc.com/how-much-to-spend-for-free-shipping.html


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest Responsive osCommerce CE (community edition) here

Share this post


Link to post
Share on other sites

Why do I feel that I am always few steps behind? <_< :P

Thanks Gary. :thumbsup:

Share this post


Link to post
Share on other sites

This is burts better version for BS GOLD. Thanks @@burt !

 

english.php

define('SHIPPING_CHARGE', '<i class="glyphicon glyphicon-exclamation-sign" style="font-size:1.5em;"></i> Only another %s until you qualify for <strong>free shipping.</strong>');
define('SHIPPING_FREE', '<i class="glyphicon glyphicon-ok-sign" style="font-size:1.5em;"></i> You qualified for <strong>FREE shipping!</strong>');

shopping_cart.php (place where you want to show the message)

<div class="alert alert-info"> 
  <?php echo ($cart->show_total() <MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) ? sprintf(SHIPPING_CHARGE, tep_output_string_protected($currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER - $cart->show_total()))) : SHIPPING_FREE; ?>
</div>

Share this post


Link to post
Share on other sites

Here is my version refurbished with bits of burts code.

 

english.php

// BOF FREE SHIPPING SUGGEST
define('TEXT_FREE_SHIPPING_SUGGEST1', 'Only another');
define('TEXT_FREE_SHIPPING_SUGGEST2', 'until you qualify for <strong>free shipping.</strong>');
define('SHIPPING_FREE', 'You qualified for <strong>FREE shipping!</strong>');
// EOF FREE SHIPPING SUGGEST

shopping_cart.php

 

FIND:

<?php
  if ($cart->count_contents() > 0) {
?>

ADD AFTER:

<?php
    if (MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') {
		if ($cart->show_total() < MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) {
			$free_suggest = tep_output_string_protected($currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER - $cart->show_total()));
			echo '<div class="alert alert-info"><i class="fa fa-exclamation-triangle fa-2x"> </i>' . TEXT_FREE_SHIPPING_SUGGEST1 . ' ' . $free_suggest . ' ' . TEXT_FREE_SHIPPING_SUGGEST2 . '</div>';  
		} else {
			echo '<div class="alert alert-success"><i class="fa fa-check fa-2x"> </i>' . SHIPPING_FREE . '</div>';
		}
	}
?>  

Share this post


Link to post
Share on other sites

You've gone backwards..Why not use sprintf instead of 

 

 

define('TEXT_FREE_SHIPPING_SUGGEST1', 'Only another');
define('TEXT_FREE_SHIPPING_SUGGEST2', 'until you qualify for <strong>free shipping.</strong>');

 

and

 

 

echo '<div class="alert alert-info"><i class="fa fa-exclamation-triangle fa-2x"> </i>' . TEXT_FREE_SHIPPING_SUGGEST1 . ' ' . $free_suggest . ' ' . TEXT_FREE_SHIPPING_SUGGEST2 . '</div>'; 

 

Thus:

 

 

echo '<div class="alert alert-info">' . sprintf(TEXT_FREE_SHIPPING, $free_suggest)  . '</div>';

 

and

 

 

define('TEXT_FREE_SHIPPING', '<i class="fa fa-exclamation-triangle fa-2x"></i> Only another %s until you qualify for <strong>free shipping</strong>');

 

Even better, a Content Module for the Header that invokes the messageStack.  

Or a hook would also be interesting.


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest Responsive osCommerce CE (community edition) here

Share this post


Link to post
Share on other sites

Another piece of the puzzle, from 2009 so instructions will be out of date; http://www.clubosc.com/how-much-to-spend-for-free-shipping.html

 

Hi!

 

In my shop the shipping only within Germany from 99 EUR is free.

 

When I integrate the code in shopping_cart.php the Note will appear even if foreign customers, but this should then be hidden.

<?php echo ($cart->show_total() <MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) ? sprintf(SHIPPING_CHARGE, tep_output_string_protected($currencies->format(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER - $cart->show_total()))) : SHIPPING_FREE; ?>

How can I do that?

 

Regards, Frank

Share this post


Link to post
Share on other sites

It could be intetresting to suggest also diffrents products around the amount to help the customer to have the free  shipping ? 

or help the customer via advanced_search to select price close the amount of free shipping (difference)

Edited by Gyakutsuki


Regards
-----------------------------------------
Loïc

Contact me by skype for business
Contact me @gyakutsuki for an answer on the forum

Tuto for 2.4 :
- How to Display a new page with app
- How to make Header Tags under app APP
- How to make a
boostrap modal with external element
 

 

Share this post


Link to post
Share on other sites

In my shop the shipping only within Germany from 99 EUR is free.

You do not know the delivery location until the customer is logged in. Therefore the sipmlest option is to add "Shipping within Germay" to the outputted text.


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest Responsive osCommerce CE (community edition) here

Share this post


Link to post
Share on other sites

 

You do not know the delivery location until the customer is logged in. Therefore the sipmlest option is to add "Shipping within Germay" to the outputted text.

 

Okay, so I did it now!

Only another 10.00 EUR until you qualify for free shipping within Germany.
You qualified for FREE shipping within Germany!

Thank you!

Share this post


Link to post
Share on other sites

I was talking with @@dculley the other day and he had this cool idea to have some sort of message that would suggest that only $XX amount is left to get free shipping.

I found this idea interesting and thought this could be implemented inside the checkout_shipping.php. It would be also nice to have it connected to the already existing free shipping order total module so that it will only show when allow free shipping is set to true.

 

Here again this code is just beta and needs further testing.

 

checkout_shipping.php

 

FIND:

<?php
  if (tep_count_shipping_modules() > 0) {
?>

ADD RIGHT BEFORE/ABOVE:

<?php
    if ((MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING == 'true') && ($free_shipping != true)){
        $free_suggest = round(MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER - $cart->show_total(), 2) ;
        echo '<div class="alert alert-info"><i class="fa fa-exclamation-triangle fa-2x"> </i>' . TEXT_FREE_SHIPPING_SUGGEST1 . ' $' . $free_suggest . ' ' . TEXT_FREE_SHIPPING_SUGGEST2 . '</div>';  
    }     
?>   

includes/languages/english/checkout_shipping.php

// BOF FREE SHIPPING SUGGEST
define('TEXT_FREE_SHIPPING_SUGGEST1', 'Only');
define('TEXT_FREE_SHIPPING_SUGGEST2', 'left to get <strong>free shipping!</strong>');
// EOF FREE SHIPPING SUGGEST

That's it!

 

What if i have set up table rates and specified that shipping is 0 after a certain number?

I currently have 2 table rates, one for domestic, and one for International, and have just put if the total reaches a certain amount it will be 0 so free.

Will this code only work with the free shipping plugin turned on?

thanks

Share this post


Link to post
Share on other sites

As the code stands at the moment, yes it works only with the free shipping feature.

I don't know how you coded your table rate module to checkif a certain number has been reached but the theory should be the same. So you could use the same check routine and display a different text.

The only problem that i can think of, and that goes for the free shipping too, is if you have different rules for domestic and international. The system cannot know where the customer is browsing from unless he would be logged in.

Edited by Tsimi

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×