Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

extra shipping options?


westmidsguy

Recommended Posts

I would like these shipping options

 

Standard Delivery 3 - 5 Working Days £3.99

 

Next Day Delivery £5.99

 

Saturday Delivery £6.99

 

Gift wrapping Options also available.

 

where can i find a module to show all this? i have searched everywhere can somebody show me how to do this?

 

thanks

Link to comment
Share on other sites

What you have asked for is three different flat fees, plus the gift wrap option. Fimble's method will do what you want - create and enable three different flat fee rates, each with a different name, and a different price, add the gift wrapping as a product option.

www.jyoshna.com. Currently using OsC with STS, Super Download Store, Categories Descriptons, Manufacturers Description, Individual Item Status, Infopages unlimited, Product Sort, Osplayer with flashmp3player, Product Tabs 2.1 with WebFx Tabpane and other bits and pieces including some I made myself. Many thanks to all whose contributions I have used!

Link to comment
Share on other sites

  • 2 weeks later...

Try to do following

 

1) Find the file includes/modules/shipping/flat.php and make 2 copies of it. Name them flat1.php and flat2.php. Upload them to the server

2) Do the same for includes/languages/english/modules/shipping/flat.php. In each file change the define to whatever you like, ie next day, saturday etc

3) Go to your admin and install the new modules you made. Add a price for each

4) You should see them at checkout

Link to comment
Share on other sites

Actually just out of curiosity I tried this, and found that it wasn't so simple as copying the flat rate module and language files twice over. osC didn't like the same class name being declared three times over, even if it was being declared in different-named shipping files, and didn't seem to like the same language defines being used over either, when it came to activating them in admin. A little internal editing of the files seemed necessary to add a '2' or a '3' after the declared classes or defines in the various shipping and corresponding languages files. Apart from that it should work, although I didn't go all the way through with it.

www.jyoshna.com. Currently using OsC with STS, Super Download Store, Categories Descriptons, Manufacturers Description, Individual Item Status, Infopages unlimited, Product Sort, Osplayer with flashmp3player, Product Tabs 2.1 with WebFx Tabpane and other bits and pieces including some I made myself. Many thanks to all whose contributions I have used!

Link to comment
Share on other sites

Thank you for checking and approving :)

 

Very concrete here is the file includes/modules/shipping/flat2.php

<?php
/*
 $Id: flat2.php 1739 2007-12-20 00:52:16Z hpdl $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 class flat2 {
   var $code, $title, $description, $icon, $enabled;

// class constructor
   function flat2() {
     global $order;

     $this->code = 'flat2';
     $this->title = MODULE_SHIPPING_FLAT2_TEXT_TITLE;
     $this->description = MODULE_SHIPPING_FLAT2_TEXT_DESCRIPTION;
     $this->sort_order = MODULE_SHIPPING_FLAT2_SORT_ORDER;
     $this->icon = '';
     $this->tax_class = MODULE_SHIPPING_FLAT2_TAX_CLASS;
     $this->enabled = ((MODULE_SHIPPING_FLAT2_STATUS == 'True') ? true : false);

     if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FLAT2_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_FLAT2_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;
       }
     }
   }

// class methods
   function quote($method = '') {
     global $order;

     $this->quotes = array('id' => $this->code,
                           'module' => MODULE_SHIPPING_FLAT2_TEXT_TITLE,
                           'methods' => array(array('id' => $this->code,
                                                    'title' => MODULE_SHIPPING_FLAT2_TEXT_WAY,
                                                    'cost' => MODULE_SHIPPING_FLAT2_COST)));

     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_FLAT2_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 Flat Shipping', 'MODULE_SHIPPING_FLAT2_STATUS', 'True', 'Do you want to offer flat rate shipping?', '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 ('Shipping Cost', 'MODULE_SHIPPING_FLAT2_COST', '5.00', 'The shipping cost for all orders using 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_FLAT2_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_FLAT2_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_FLAT2_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_FLAT2_STATUS', 'MODULE_SHIPPING_FLAT2_COST', 'MODULE_SHIPPING_FLAT2_TAX_CLASS', 'MODULE_SHIPPING_FLAT2_ZONE', 'MODULE_SHIPPING_FLAT2_SORT_ORDER');
   }
 }
?>

 

And here is the corresponding includes/languages/english/modules/shipping/flat2.php

<?php
/*
 $Id: flat2.php 1739 2007-12-20 00:52:16Z hpdl $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2002 osCommerce

 Released under the GNU General Public License
*/

define('MODULE_SHIPPING_FLAT2_TEXT_TITLE', 'flat rate 2 title');
define('MODULE_SHIPPING_FLAT2_TEXT_DESCRIPTION', 'flat rate 2 desc');
define('MODULE_SHIPPING_FLAT2_TEXT_WAY', 'flar rate 2 way');
?>

 

There are no other various files included and no other way to go than to upload and instal via admin

Link to comment
Share on other sites

Wow how complicated such a simple thing should be.

 

Try starting again with the files edited as suggested above.

 

The error is saying that the code in the first line is wrong, so how does you code look for flat2.php?

Getting better with mods but no programmer am I.

Link to comment
Share on other sites

All you had to do was copy and paste multimixer's flat2 code from the opening <?php to the closing ?> into a plain text editor such as notepad, save it as flat2.php and upload it to your web server in the /includes/modules/shipping directory and then do the same thing again for the language define, which goes in includes/languages/english/modules/shipping. As Johnnybebad suggested, do it again.

 

Normally the error you quoted means a missing ; from the end of a line or mismatched {} or " , but this cannot be the case from the first line which is or should be just <?php

The error message would also have reported the full directory path/name for the file giving the error so you can also tell whether the problem was with the first or the second flat2 (ie in includes/modules/shipping or includes/languages/english/modules/shipping).

www.jyoshna.com. Currently using OsC with STS, Super Download Store, Categories Descriptons, Manufacturers Description, Individual Item Status, Infopages unlimited, Product Sort, Osplayer with flashmp3player, Product Tabs 2.1 with WebFx Tabpane and other bits and pieces including some I made myself. Many thanks to all whose contributions I have used!

Link to comment
Share on other sites

Parse error: syntax error, unexpected T_STRING in line 1

 

I just checked again using the code I posted, and there are no errors. Try one more time, and if there are still errors then post the complete error as Ben said

Link to comment
Share on other sites

Well just to make life easy for yourself, download this contribution and upload the files in it:

 

Multiple Flat Rates V2

 

Done in 2003. Lol :rolleyes:

www.jyoshna.com. Currently using OsC with STS, Super Download Store, Categories Descriptons, Manufacturers Description, Individual Item Status, Infopages unlimited, Product Sort, Osplayer with flashmp3player, Product Tabs 2.1 with WebFx Tabpane and other bits and pieces including some I made myself. Many thanks to all whose contributions I have used!

Link to comment
Share on other sites

How to duplicate a module.

I saw it some where in the Tips and tricks.

search there.

 

Satish

Ask/Skype for Free osCommerce value addon/SEO suggestion tips for your site.

 

Check My About US For who am I and what My company does.

Link to comment
Share on other sites

  • 1 month later...

Hello I have a quastion related with this topic.I installed this contribution multiple flat rates v.2.1 and I wonder where to edit the code to not show on checkout_shipping.php the text defined in MODULE_SHIPPING_NAME_TEXT_TITLE.But I want to see it in admin area -> modules->shipping.If someone give me a hint I will be very gratefull.

Link to comment
Share on other sites

  • 10 months later...

Just did the same with the table rate. One thing need to be noted is, not all the TABLEs in the long php file need to be changed to TABLE2. TABLE_ZONES_TO_GEO_ZONES and TABLE_CONFIGURATIONs should remain unchanged. This may be obvious to experts but not to some one who is new to php like myself.

Link to comment
Share on other sites

  • 2 months later...

Hi there,

 

I am simply trying to make a shipping cost for Australia and one for New Zealand.

 

I have created a file called flat2.php using the code below and placed it in the right shipping module folder (as well as the English language folder version).

 

When I go to install the modules in ADMIN, I can see two modules to install (the button says "+ Install Module (2)") and when I click them, they both pop up. However, one seems to install by default, and the other requires you to click on Install Module button once you have selected it. But when you do that, it overwrites the one that was already installed.

 

Does this sound familiar to anyone? I can't seem to figure out what it going wrong.

 

Cheers Dave

 

 

 

Thank you for checking and approving :)

 

Very concrete here is the file includes/modules/shipping/flat2.php

<?php
/*
 $Id: flat2.php 1739 2007-12-20 00:52:16Z hpdl $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 class flat2 {
   var $code, $title, $description, $icon, $enabled;

// class constructor
   function flat2() {
     global $order;

     $this->code = 'flat2';
     $this->title = MODULE_SHIPPING_FLAT2_TEXT_TITLE;
     $this->description = MODULE_SHIPPING_FLAT2_TEXT_DESCRIPTION;
     $this->sort_order = MODULE_SHIPPING_FLAT2_SORT_ORDER;
     $this->icon = '';
     $this->tax_class = MODULE_SHIPPING_FLAT2_TAX_CLASS;
     $this->enabled = ((MODULE_SHIPPING_FLAT2_STATUS == 'True') ? true : false);

     if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FLAT2_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_FLAT2_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;
       }
     }
   }

// class methods
   function quote($method = '') {
     global $order;

     $this->quotes = array('id' => $this->code,
                           'module' => MODULE_SHIPPING_FLAT2_TEXT_TITLE,
                           'methods' => array(array('id' => $this->code,
                                                    'title' => MODULE_SHIPPING_FLAT2_TEXT_WAY,
                                                    'cost' => MODULE_SHIPPING_FLAT2_COST)));

     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_FLAT2_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 Flat Shipping', 'MODULE_SHIPPING_FLAT2_STATUS', 'True', 'Do you want to offer flat rate shipping?', '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 ('Shipping Cost', 'MODULE_SHIPPING_FLAT2_COST', '5.00', 'The shipping cost for all orders using 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_FLAT2_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_FLAT2_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_FLAT2_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_FLAT2_STATUS', 'MODULE_SHIPPING_FLAT2_COST', 'MODULE_SHIPPING_FLAT2_TAX_CLASS', 'MODULE_SHIPPING_FLAT2_ZONE', 'MODULE_SHIPPING_FLAT2_SORT_ORDER');
   }
 }
?>

 

And here is the corresponding includes/languages/english/modules/shipping/flat2.php

<?php
/*
 $Id: flat2.php 1739 2007-12-20 00:52:16Z hpdl $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2002 osCommerce

 Released under the GNU General Public License
*/

define('MODULE_SHIPPING_FLAT2_TEXT_TITLE', 'flat rate 2 title');
define('MODULE_SHIPPING_FLAT2_TEXT_DESCRIPTION', 'flat rate 2 desc');
define('MODULE_SHIPPING_FLAT2_TEXT_WAY', 'flar rate 2 way');
?>

 

There are no other various files included and no other way to go than to upload and instal via admin

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...