Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Adding a Flat shipping rate outside of my own country


monstermike

Recommended Posts

Hi guys

 

I would like to find out if it possible to add a Flat shipping rate to all the countries outside my own country. I have had a look at the zones section of oscommerce but i cant seem to get my head around what needs to be done. I am in South Africa and the shipping cost is included in the price of the product, if it is being ordered within South Africa, but if anything is ordered outside of South Africa, i need this flat rate to be added to the total when the user checks out.

 

Is this possible?, If so how do i go about implementing this?

 

Any help will greatly appreciated.

 

Thanks

 

Mike

Link to comment
Share on other sites

  • 2 weeks later...

Hi Chris

 

Sorry for the late reply, i have only managed to get back to this task today. Many thanks for your response. I have downloaded the module and had a look at the read me file that is included. The installation guidelines in the read me file may seem straight forward, but my php skills are pretty limited. Is there some kind of tutorial i can follow for the installation of this module.

 

Many thanks

 

Mike

Link to comment
Share on other sites

Hey Mike, I've created a flat rate module for my own webstore just last week. this is for version 2.3.1, but should work with any version really. I have limited php knowledge as well, but with some logic you can manage to create your own shipping modules based on the standard ones. Here's what I did:

 

in the folder includes/modules/shipping, find the 'flat.php' file.

copy this to a separate folder to your computer

 

when you open this up, you'll see the following code at the top:

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

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

     $this->code = 'flat';
     $this->title = MODULE_SHIPPING_FLAT_TEXT_TITLE;
     $this->description = MODULE_SHIPPING_FLAT_TEXT_DESCRIPTION;
     $this->sort_order = MODULE_SHIPPING_FLAT_SORT_ORDER;
     $this->icon = '';
     $this->tax_class = MODULE_SHIPPING_FLAT_TAX_CLASS;
     $this->enabled = ((MODULE_SHIPPING_FLAT_STATUS == 'True') ? true : false);

 

Now, this may look very difficult to understand, and it probably is. But let's look passed the code and look at what is on the screen. I see alot of lines with recurring words; I see the word 'flat' and then 'MODULE_SHIPPING_FLAT' come back quite alot. When I scroll down in the php file, I see these exact words coming back frequently.. These are indicators for the code to identify functions and the name of the module.

 

I started off by noting down how I would call my module. Instead of 'Flat Rate', I wanted to call it 'Flat Rate Inside of Europe', so in short, 'flateurope'.

 

I changed the word 'flat' in the code to 'flateurope' and the words 'MODULE_SHIPPING_FLAT' TO 'MODULE_SHIPPING_FLATEUROPE'.

In the code somewhere down the line there is the following;

'Do you want to offer flat rate shipping?'

I changed this to 'Do you want to offer flat rate shipping inside Europe?'

 

You should do this for the entire file. Using wordpad and the replace function, this will go fairly quickly. I end up with a file which has this code at the top:

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

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

     $this->code = 'flateurope';
     $this->title = MODULE_SHIPPING_FLATEUROPE_TEXT_TITLE;
     $this->description = MODULE_SHIPPING_FLATEUROPE_TEXT_DESCRIPTION;
     $this->sort_order = MODULE_SHIPPING_FLATEUROPE_SORT_ORDER;
     $this->icon = '';
     $this->tax_class = MODULE_SHIPPING_FLATEUROPE_TAX_CLASS;
     $this->enabled = ((MODULE_SHIPPING_FLATEUROPE_STATUS == 'True') ? true : false);

 

If you take a step back, I simply made a copy of the module, but I changed the references from flat to flateurope. I saved this as flateurope.php.

 

Now, step 2: the language file.

In the folder includes/languages/english/modules there is also a file called flat.php. The code in this one is shorter though;

define('MODULE_SHIPPING_FLAT_TEXT_TITLE', 'Shipment Fee');
define('MODULE_SHIPPING_FLAT_TEXT_DESCRIPTION', 'Shipment Fee');
define('MODULE_SHIPPING_FLAT_TEXT_WAY', 'Shipment Fee');

 

Wait a minute.. all those 'MODULE_SHIPPING_FLAT' references are in this file as well - this means that the file we edited earlier, refered to this file to fill in some gaps that are language dependent. Again, change the 'MODULE_SHIPPING_FLAT' words to 'MODULE_SHIPPING_FLATEUROPE'. Now, you save this also as flateurope.php and place it in the language subfolder.

 

We're all done! Now all you need to do is install this flateurope module in your shop and apply a zone to it.

 

Hope that helped.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...