delaen Posted May 1, 2003 Posted May 1, 2003 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
Druide Posted May 2, 2003 Posted May 2, 2003 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 ;)
delaen Posted May 2, 2003 Author Posted May 2, 2003 Instead of making you go through all that effort just to see what it looks like, I'll just post a picture :P
Mr. Ree Posted May 3, 2003 Posted May 3, 2003 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/
delaen Posted May 3, 2003 Author Posted May 3, 2003 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.
Guest Posted May 3, 2003 Posted May 3, 2003 Great tip thanks :) Also great site too, very amazon -esk ;)
Guest Posted May 3, 2003 Posted May 3, 2003 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:
Mr. Ree Posted May 3, 2003 Posted May 3, 2003 Too sweet! Thanks Bob! 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/
Guest Posted May 3, 2003 Posted May 3, 2003 added this feature but it's calculating wrong. You must buy $100 or more for free ship. It's calculating it at $50
delaen Posted May 4, 2003 Author Posted May 4, 2003 problem corrected, nice contrib. Thanks! Was it a problem with this code, or something else? Glad you got it working anyway.
Guest Posted May 4, 2003 Posted May 4, 2003 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
Stephan Gebbers Posted May 4, 2003 Posted May 4, 2003 What do i have to add that it does show up only when free shipping is enabled in admin? Regards, Stephan Gebbers
Stephan Gebbers Posted May 5, 2003 Posted May 5, 2003 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
delaen Posted May 5, 2003 Author Posted May 5, 2003 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.
Guest Posted May 6, 2003 Posted May 6, 2003 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.
gman Posted May 10, 2003 Posted May 10, 2003 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]
delaen Posted May 10, 2003 Author Posted May 10, 2003 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.
gman Posted May 15, 2003 Posted May 15, 2003 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]
alienated Posted June 6, 2003 Posted June 6, 2003 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?
Guest Posted June 6, 2003 Posted June 6, 2003 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
chet Posted June 6, 2003 Posted June 6, 2003 Has someone done the same with the quantity discount module ? http://www.oscommerce.com/community/contributions,1159 I cannot find the module used with this free shipping hack
Recommended Posts
Archived
This topic is now archived and is closed to further replies.