Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

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!

Link to comment
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.

Link to comment
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>
Link to comment
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>';
		}
	}
?>  
Link to comment
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.

Link to comment
Share on other sites

  • 4 weeks later...

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

Link to comment
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)


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

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

 

Link to comment
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.

Link to comment
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!

Link to comment
Share on other sites

  • 3 weeks later...

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

Link to comment
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.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...