Jump to content
Sign in to follow this  
Nils P.

[Contribution] Shopping Cart Box Enhancement 1.0 for 2.2 MS2

Recommended Posts

Hi all,

 

here's a new contribution I made...

 

http://www.oscommerce.com/community/contributions,1514

 

This contribution has several improvements for the shopping cart info box and will work with osC2.2 MS2. It can basically work with any language. This version comes with language definitions and instructions in English and German.

 

The best way to show what it does is with these two screenshots:

 

http://www.leer.privat.t-online.de/pics/sh...pingcartbox.gif

 

Features:

 

- A "Free Shipping For Orders Over..." message will be displayed in the shopping cart box (if free shipping is enabled).

 

- If a customer's cart isn't empty, the box will display how much more he has to spent to qualify for free shipping. If they reach the threshold, a different message will be displayed. The code has a built in switch to turn this feature on or off.

 

NOTE: This part of the conribution is based on Bruce Hakala's Free Shipping Calcul for MS1. URL: http://www.oscommerce.com/community/contributions,1361 . I updated it and beefed it up a little.

 

- If a customer's cart isn't empty, a checkout button will be displayed in the shopping cart box. The code has a built in switch to turn this feature on or off.

 

- Order total will use *bold* digits and letters (optional)

 

There are no files to add or overwrite with this version 1.0. Just follow the instructions listed in the included text file. I hope you'll enjoy it! This is the support thread, by the way - I'll try to answer any questions as soon and good as possible! :wink:

 

So long,

Nils

Share this post


Link to post
Share on other sites

Thanks for your reply. You can download the module and have a look for and hopefully shed some light on how it can be done :)

If you lazy like me, I've included the code for you below 8)

Yeah I paid for this contribution, mainly because I find it very good for my current store and it drives sales. I was disappointed when the module was never updated for MS1 and MS2 and when I asked on the board no-one seem to feel the same as i did about this mod. So I guessing paying was the only was to it.

 

 

 

<?php

/*

 $Id: freecount.php,v 1.39 2003/09/12 22:41:52 Strider Exp $



 osCommerce, Open Source E-Commerce Solutions

 http://www.oscommerce.com



 Copyright (c) 2003 osCommerce



 Released under the GNU General Public License

*/



 class freecount {

   var $code, $title, $description, $icon, $enabled;



// class constructor

   function freecount() {

     global $order, $total_count;



     $this->code = 'freecount';

     $this->title = MODULE_SHIPPING_FREECOUNT_TEXT_TITLE;

     $this->description = MODULE_SHIPPING_FREECOUNT_TEXT_DESCRIPTION;

     $this->sort_order = MODULE_SHIPPING_FREECOUNT_SORT_ORDER;

     $this->icon = '';

     $this->tax_class = MODULE_SHIPPING_FREECOUNT_TAX_CLASS;

     $this->enabled = ((MODULE_SHIPPING_FREECOUNT_STATUS == 'True') ? true : false);



     if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FREECOUNT_NUMBER <= $total_count) ) {

         if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FREECOUNT_ZONE > 0) ) {

           $check_flag = false;

           $check_query = tep_db_query("select zone_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_FREECOUNT_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");

           while ($check = tep_db_fetch_array($check_query)) {

             if ($check['zone_id'] < 1) {

               $check_flag = true;

               break;

             } elseif ($check['zone_id'] == $order->delivery['zone_id']) {

               $check_flag = true;

               break;

             }

           }



           if ($check_flag == false) {

             $this->enabled = false;

           }

         }

      }

      else{

          $this->enabled = false;

      }

   }



// class methods

   function quote($method = '') {

     global $order, $total_count;



     $this->quotes = array('id' => $this->code,

                           'module' => MODULE_SHIPPING_FREECOUNT_TEXT_TITLE,

                           'methods' => array(array('id' => $this->code,

                                                    'title' => MODULE_SHIPPING_FREECOUNT_TEXT_WAY,

                                                    'cost' => (0.0000001) + MODULE_SHIPPING_FREECOUNT_HANDLING)));



     if ($this->tax_class > 0) {

       $this->quotes['tax'] = tep_get_tax_rate($this->tax_class, $order->delivery['country']['id'], $order->delivery['zone_id']);

     }



     if (tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title);



     return $this->quotes;

   }



   function check() {

     if (!isset($this->_check)) {

       $check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_FREECOUNT_STATUS'");

       $this->_check = tep_db_num_rows($check_query);

     }

     return $this->_check;

   }



   function install() {

     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Freecount Shipping', 'MODULE_SHIPPING_FREECOUNT_STATUS', 'True', 'Do you want to offer free shipping on number of items?', '6', '0', 'tep_cfg_select_option(array('True', 'False'), ', now())");

     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Item Count for Free Shipping', 'MODULE_SHIPPING_FREECOUNT_NUMBER', '3', 'The number of items customer needs to buy in an order to get free shipping?', '6', '0', now())");

     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Handling Fee', 'MODULE_SHIPPING_FREECOUNT_HANDLING', '0', 'Handling fee for this shipping method.', '6', '0', now())");

     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Tax Class', 'MODULE_SHIPPING_FREECOUNT_TAX_CLASS', '0', 'Use the following tax class on the shipping fee.', '6', '0', 'tep_get_tax_class_title', 'tep_cfg_pull_down_tax_classes(', now())");

     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Shipping Zone', 'MODULE_SHIPPING_FREECOUNT_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");

     tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_FREECOUNT_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");

   }



   function remove() {

     tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");

   }



   function keys() {

     return array('MODULE_SHIPPING_FREECOUNT_STATUS', 'MODULE_SHIPPING_FREECOUNT_NUMBER', 'MODULE_SHIPPING_FREECOUNT_HANDLING', 'MODULE_SHIPPING_FREECOUNT_TAX_CLASS', 'MODULE_SHIPPING_FREECOUNT_ZONE', 'MODULE_SHIPPING_FREECOUNT_SORT_ORDER');

   }

 }

?>

Share this post


Link to post
Share on other sites

No probs. I will see what I can do and update a little later on. I think its a great mod I dont want to miss out on.

Share this post


Link to post
Share on other sites

Hi,

 

I'm using the "Free Shipping over amount" contrib on a MS1 shop.

http://www.oscommerce.com/community/contributions,146/page,2

I love the idea of your contrib but I can't get it to work. I mean, the checkout button is showing fine, but it's not showing any of the free shipping info.

 

is it not supposed to work with this contrib then?

Or better... can you make it work?

 

I'd be very thankfull!

 

keep it up. it's little details like this that make a shop look professional and yours is surely one of them!

 

loving it already :-)

 

ps: just got v1.1 going to update... will it work? who knows!

 

DicE


_____.:::.________###__________|/______

:(o o): . (o o) (o o)

ooO--(_)--Ooo-ooO--(_)--Ooo-ooO--(_)--Ooo-

Share this post


Link to post
Share on other sites

Hi all,

I uploaded a new version of Shopping Cart Box Enhancement, right here:

http://www.oscommerce.com/community/contributions,1514

 

This version has one important change:

It addresses the fact that many shopkeepers will only grant free shipping within their own country (thanks for your feedback), with the appropriate setting in the admin area ("Provide Free Shipping For Orders Made" to "national"), but do not know how to change the original version of this contribution accordingly. So:

 

- If free shipping is granted for orders over a defined sum only within the shopkeeper's own country, the message in the shopping cart box will reflect that. (Example: "All orders over $ 100 receive FREE shipping within Australia")

 

- The same holds true for free shipping only *outside* of the shop's home country, which is a possible setting in osC2.2 MS2.

 

- This new feature will work in a versatile way, as it will use the home country defined in the admin interface. This comes at a price though:

An extra database query is performed to find out the home country, which will slightly reduce the speed that your pages will display. Though most pages within osC have dozens of database queries and another one won't make a huge difference, it is possible to avoid this one by hard coding the shop's country (only for this contribution - it doesn't affect any other part of the shop). Instructions for doing that are enclosed.

 

Please read the instructions carefully, and no problems should occur. ;) I hope...

Good luck,

Nils

Share this post


Link to post
Share on other sites

Hi all,

 

I just uploaded version 1.2 of my contribution Shopping Cart Box Enhancement , I recommend using this one.

 

Changes: The checkout button (if enabled) in the Shopping Cart Box now will not be displayed anywhere in the checkout area.

 

... I uploaded a full version, for both updating and first time installations. I added detailed instructions in English and German.

 

Good luck! :)

 

Nils

Share this post


Link to post
Share on other sites

I have installed the contribution but when I check out it will not tell me about the % needed or at for getting free shipping. I have MS1 2.2 and in my admin section I am using the fedex1.php module for xml. No where is there a choice to add free shipping. Can you help me on this one?

 

JM


Always remember, we need patience, guidance and most of all understanding.

 

My Contributions

Share this post


Link to post
Share on other sites

Nils tahnks for your contribution im gonna test it on ms1 ian load 5 and give feedback


MS2

Share this post


Link to post
Share on other sites
I have installed the contribution but when I check out it will not tell me about the % needed or at for getting free shipping. I have MS1 2.2 and in my admin section I am using the fedex1.php module for xml. No where is there a choice to add free shipping. Can you help me on this one?

 

JM

Go to your shipping module screen in the admin and enable the "FREE SHIPPING" module.

Then go to Order Total modules screen and enter the config of the SHIPPING, and enable free shipping. it should work

Share this post


Link to post
Share on other sites

Weird, in my admin section in the shipping modules esection there is no allow free shipping. It is in the customers shipping section where I can administer free shipping. This is confusing as the post said the admin/shipping module enable free shipping. Oh well it is working now.

 

JM


Always remember, we need patience, guidance and most of all understanding.

 

My Contributions

Share this post


Link to post
Share on other sites

Hello, I was very happy to find this contribution and is working fine "BUT" :(

what if i want to charge a small handling fee? like 4.99 for orders 59 or more?

 

And what if? customer does not want hes free shipping.. Instead he wants to pay next day ups shipping? or secon day? This is because i just offer free shipping for ground services within USA. I also sell Frozen Products that are only shipped Second day and these product do not qualify for free shipping.

 

Thanks in advance for your Help.

 

Mauro.

Share this post


Link to post
Share on other sites

I have input the new configuration into the 2 relevant documents but the text does not seem to display in the shopping cart of free delivery info. In my admin shipping module section I have it set to the 'Flat rate' module and in the Order total module I have set it to 'Allow Free Shipping'. I am using vesion MS2, can anybody help me?

 

BTW the button appears in the cart window.

 

Thanks

Mark

Edited by MarkR

Share this post


Link to post
Share on other sites
BTW the button appears in the cart window.

Yes. That's what it's supposed to do. See readme file for details (including how to turn it off).

 

I didn't set it to both in the admin Order total section.

No need to do that with version 1.2. It works nicely with all posible settings here: national, international, and both. :)

Share this post


Link to post
Share on other sites

Hi Guys,

 

Great work with this Enhancement!

 

I installed it and went to check out but received the following error:

 

Warning: Failed opening 'includes/languages/english/modules/shipping/freecount.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/m/mrgad/www/catalog/includes/classes/shipping.php on line 36

 

Warning: Failed opening 'includes/modules/shipping/freecount.php' for inclusion (include_path='.:/usr/local/lib/php') in /home/m/mrgad/www/catalog/includes/classes/shipping.php on line 37

 

Fatal error: Cannot instantiate non-existent class: freecount in /home/m/mrgad/www/catalog/includes/classes/shipping.php on line 39

 

I would appreciate any help...

 

Best regards,

Arnold

Share this post


Link to post
Share on other sites

Hi everyone!

in the first place, thanks for this great contrib! I have just installed and it went everything smoothly. :thumbsup:

just wanna add a tiny bit. i translated to spanish, here it goes;

maybe it can be add to the installation file :P

 

languages/espanol.php

 

// Contribution Shopping Cart Box Enhancement

define('TEXT_ADD_TO_GET_FREE_SHIPPING', '[añade %s]');

define('TEXT_FREE_SHIPPING_RECEIVED', 'Su pedido es enviado GRATIS.');

define('TEXT_FREE_SHIPPING_LIMIT', '¡Todos los pedidos sobre %s son enviados GRATIS!');

define('TEXT_FREE_SHIPPING_LIMIT_INTERNATIONAL', 'Todos los pedidos sobre %s son enviados GRATIS fuera de %s.');

define('TEXT_FREE_SHIPPING_LIMIT_NATIONAL', 'Todos los pedidos sobre %s son enviados GRATIS dentro de %s.');

define('TEXT_FREE_SHIPPING_RECEIVED_INTERNATIONAL', 'Su pedido es enviado GRATIS fuera de %s.');

define('TEXT_FREE_SHIPPING_RECEIVED_NATIONAL', 'Su pedido es enviado GRATIS dentro de %s.');

hope it hepls to some1

regards

unai


"Dream as if you'll live forever...

live as if you'll die today."

Share this post


Link to post
Share on other sites

Hi,

 

I have installed this contribution, congratulations!

I checked the "shipping module screen in the admin and enable the "FREE SHIPPING" module. Then go to Order Total modules screen and enter the config of the SHIPPING, and enable free shipping. it should work "

But noting appear in the cart.

 

Thanks,

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
Sign in to follow this  

×