Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Tell customer how much more to spend to get free shipping


delaen

Recommended Posts

Posted

In includesboxesshopping_cart.php

REPLACE:

  if ($cart->count_contents() > 0) {

   $info_box_contents[] = array('text' => tep_draw_separator());

   $info_box_contents[] = array('align' => 'right',

                                'text' => $currencies->format($cart->show_total()));

 }

 

 

WITH:

 

  if ($cart->count_contents() > 0) {

   $info_box_contents[] = array('text' => tep_draw_separator());

   $info_box_contents[] = array('align' => 'right',

                                'text' => $currencies->format($cart->show_total()));

        

if ($cart->show_total() < MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) {

 $add_to_get_free_shipping = MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER - $cart->show_total();

     $info_box_contents[] = array('align' => 'right',

                                      'text' => sprintf(BOX_SHOPPING_CART_FREE_SHIPPING, $currencies->format($add_to_get_free_shipping)));

 

}

 }

 

In includeslanguagesenglish.php

ADD:

define('BOX_SHOPPING_CART_FREE_SHIPPING', 'Add %s to your order and receive FREE shipping!');

 

This will stick a message into your shopping cart box telling the customer how much more they need to add to their cart to qualify for free shipping.

 

I haven't tested this on anything that didn't have the "buy over a certain amount, get free shipping" option on, so be sure to test this first with your version.

 

To see a working copy, go to my site and add something to your cart. I didn't really think this qualified as a contribution, so I stuck it in this forum. Hopefully this isn't something that someone has done a long time ago and I just missed :P

  • Replies 66
  • Created
  • Last Reply
Posted

very nice one, thanks for your effort

Robert

 

We all need to learn it once, how hard it may seem when you look at it, also you will master it someday ;)

Posted

Instead of making you go through all that effort just to see what it looks like, I'll just post a picture :P

 

freeship.jpg

Posted

I would love to add this feature but I am a bit baffled.

 

In my catalogincludesboxesshopping_cart.php you say to look for;

  if ($cart->count_contents() > 0) { 

   $info_box_contents[] = array('text' => tep_draw_separator()); 

   $info_box_contents[] = array('align' => 'right', 

                                'text' => $currencies->format($cart->show_total())); 

 }

 

Mine looks like this;

if ($cart->count_contents() > 0) {

   $cart_contents_string = '<table border="0" width="100%" cellspacing="0" cellpadding="0">';

   $products = $cart->get_products(); // $products[$i]['id'] .. $products[$i]['name'] .. $products[$i]['quantity']

   for ($i=0; $i<sizeof($products); $i++) {

     $cart_contents_string .= '<tr><td align="right" valign="top" class="infoBoxContents">';



     if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {

       $cart_contents_string .= '<span class="newItemInCart">'; // highlight product quantity

     } else {

       $cart_contents_string .= '<span class="infoBoxContents">';

     }

 

This is from Ian's MS1 Loaded 5 with shopping_cart.php,v 1.1.1.1 2002/11/28 which looks a great deal like the current CVS.

 

What version boxes/shopping_cart.php are you using?

 

TIA

Mr. Ree

How to find answers to OSC Common Questions

1. Look at http://wiki.oscommerce.com

2. Search http://www.oscommerce.com/forums/

3. Post a request in http://www.oscommerce.com/forums/

Posted

It should be further down the page. The current shopping_cart.php looks like this:

 

<?php

/*

 $Id: shopping_cart.php,v 1.18 2003/02/10 22:31:06 hpdl Exp $



 osCommerce, Open Source E-Commerce Solutions

 http://www.oscommerce.com



 Copyright (c) 2003 osCommerce



 Released under the GNU General Public License

*/

?>

<!-- shopping_cart //-->

         <tr>

           <td>

<?php

 $info_box_contents = array();

 $info_box_contents[] = array('text' => BOX_HEADING_SHOPPING_CART);



 new infoBoxHeading($info_box_contents, false, true, tep_href_link(FILENAME_SHOPPING_CART));



 $cart_contents_string = '';

 if ($cart->count_contents() > 0) {

   $cart_contents_string = '<table border="0" width="100%" cellspacing="0" cellpadding="0">';

   $products = $cart->get_products();

   for ($i=0, $n=sizeof($products); $i<$n; $i++) {

     $cart_contents_string .= '<tr><td align="right" valign="top" class="infoBoxContents">';



     if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {

       $cart_contents_string .= '<span class="newItemInCart">';

     } else {

       $cart_contents_string .= '<span class="infoBoxContents">';

     }



     $cart_contents_string .= $products[$i]['quantity'] . ' x </span></td><td valign="top" class="infoBoxContents"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">';



     if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {

       $cart_contents_string .= '<span class="newItemInCart">';

     } else {

       $cart_contents_string .= '<span class="infoBoxContents">';

     }



     $cart_contents_string .= $products[$i]['name'] . '</span></a></td></tr>';



     if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {

       tep_session_unregister('new_products_id_in_cart');

     }

   }

   $cart_contents_string .= '</table>';

 } else {

   $cart_contents_string .= BOX_SHOPPING_CART_EMPTY;

 }



 $info_box_contents = array();

 $info_box_contents[] = array('text' => $cart_contents_string);



 if ($cart->count_contents() > 0) {

   $info_box_contents[] = array('text' => tep_draw_separator());

   $info_box_contents[] = array('align' => 'right',

                                'text' => $currencies->format($cart->show_total()));

 }



 new infoBox($info_box_contents);

?>

           </td>

         </tr>

<!-- shopping_cart_eof //-->

 

The part that needs changed is:

 

  if ($cart->count_contents() > 0) {

   $info_box_contents[] = array('text' => tep_draw_separator());

   $info_box_contents[] = array('align' => 'right',

                                'text' => $currencies->format($cart->show_total()));

 }

 

It should be around line 57.

Posted

Great tip thanks :)

 

Also great site too, very amazon -esk ;)

Posted

he he he also just noticed this on your cart

 

Your shopping cart is empty. This is an indication that you are not buying enough.

 

LMAO :lol:

 

Sorry to go off topic :oops:

Posted

added this feature but it's calculating wrong. You must buy $100 or more for free ship. It's calculating it at $50

Posted

problem corrected, nice contrib. Thanks!

Posted

how did you get it to read Sub-total in the cart area?

Posted
problem corrected, nice contrib. Thanks!

 

Was it a problem with this code, or something else? Glad you got it working anyway.

Posted

problem was me :) I didn't do something right. I started over and it worked. Thanks a bunch!

Oh and I found out how to do the sub-total thing as well:)

Thanks

Love your site

Posted

hey, i did it this way now..

 

using MS1 loaded5

-setting the EUR or USD to 0.00 in Admin>Modules>Order-Total>Shipping will disable the display

 

if ($cart->show_total() > 0) {

if ($cart->show_total() < MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) {

     $add_to_get_free_shipping = MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER - $cart->show_total();

         $info_box_contents[] = array('align' => 'right',

                                        'text' => sprintf(BOX_SHOPPING_CART_FREE_SHIPPING, $currencies->format($add_to_get_free_shipping)));

  }

 }

 

L8er,

Stephan

 

 

Posted
hey, i did it this way now..

 

using MS1 loaded5  

-setting the EUR or USD to 0.00 in Admin>Modules>Order-Total>Shipping will disable the display

 

if ($cart->show_total() > 0) {

if ($cart->show_total() < MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) {

     $add_to_get_free_shipping = MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER - $cart->show_total();

         $info_box_contents[] = array('align' => 'right',

                                        'text' => sprintf(BOX_SHOPPING_CART_FREE_SHIPPING, $currencies->format($add_to_get_free_shipping)));

  }

 }

 

L8er,

Stephan

 

Yea, that should work for now. I'll see if I can find time to code it in a real way. I think it should only take about 2 seconds and 2 lines of code though.

Posted

How can anyone do the following;I am not guru on this,please be gentle.

1In order to receive free shipment customer required to buy certain number of pieces of an item. e.g Buy 100 of an item and get free shipment

2)In order to receive free shipment customer required to buy certain number of pieces of an multible items.e.g.Buy total of 100 items and get free shipment.

Thanks in advance.

Posted

Great tip!

 

How do I get the "You are $X.XX away from FREE ground shipping" within the product_info page? and to work with an additional language as well?

 

I am testing a site with English and Spanish catalog content, and would need for message to change if customer selects Spanish or goes by default via browser to Spanish language version.

 

Hope you can help. For a view of test site : http://www.directmark.net/mp/dmp/product_i...434796192b928e9

 

Thanks.

 

Guillermo

Guillermo Huapaya Jr

www.decorativemerchandise.com

[email protected]

Posted
Great tip!

 

How do I get the "You are $X.XX away from FREE ground shipping" within the product_info page? and to work with an additional language as well?

 

I don't use any other languages, but I assume you would just have to add

define('BOX_SHOPPING_CART_FREE_SHIPPING', 'Add %s to your order and receive FREE shipping!');

to that languages main page, and change the text to the right language.

 

About the other part: I haven't tested this in the least, but try adding

 

	if ($cart->show_total() < MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) {

 $add_to_get_free_shipping = MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER - $cart->show_total();

 echo '<p>' . sprintf(BOX_SHOPPING_CART_FREE_SHIPPING, $currencies->format($add_to_get_free_shipping));

}

 

in product_info.php wherever you want to display the message. If that doesn't work at all...let me know.

Posted
I don't use any other languages, but I assume you would just have to add  

define('BOX_SHOPPING_CART_FREE_SHIPPING', 'Add %s to your order and receive FREE shipping!');

to that languages main page, and change the text to the right language.

 

About the other part:  I haven't tested this in the least, but try adding  

 

	if ($cart->show_total() < MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER) {

 $add_to_get_free_shipping = MODULE_ORDER_TOTAL_SHIPPING_FREE_SHIPPING_OVER - $cart->show_total();

 echo '<p>' . sprintf(BOX_SHOPPING_CART_FREE_SHIPPING, $currencies->format($add_to_get_free_shipping));

}

 

in product_info.php wherever you want to display the message.  If that doesn't work at all...let me know.

 

Tried above code. Seems to work fine. Thanks for your help, Delaen.

 

Guillermo

Guillermo Huapaya Jr

www.decorativemerchandise.com

[email protected]

  • 3 weeks later...
Posted

i have attempted this and i get the same problem marie was getting where it calculates at $50 dollars instead of the $265.00 set in the shipping modules admin screen.

 

any suggestions?

Posted

look in admin>modules>order total>shipping and make sure you have that set at whatever you want. It defaulted back to $50 on me, that was where I was having my problem

Archived

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

×
×
  • Create New...