I would like to modify the destination based shipping module to use the states rather than the countries to produce the shipping costs. Anyone know how to do this? I am assuming that it would not be too bad with using the CGExtensions.
Thanks
njmeyer
US state based Destination Shipping
-
- Forum Members
- Posts: 86
- Joined: Sun Jul 05, 2009 2:37 am
Re: US state based Destination Shipping
This is a really late reply, but it IS possible if you are prepared to modify the Destination Based Shipping module.njmeyer wrote: I would like to modify the destination based shipping module to use the states rather than the countries to produce the shipping costs. Anyone know how to do this? I am assuming that it would not be too bad with using the CGExtensions.
Thanks
njmeyer
Based on DestinationBasedShipping version 1.1
STEP 1
Open DestinationBasedShipping.module.php file
Change line 40
from
Code: Select all
var $_destination_country;
Code: Select all
var $_destination_state;
Code: Select all
/*---------------------------------------------------------
SetAdditionalInfo()
---------------------------------------------------------*/
function SetAdditionalInfo($destination_address)
{
if( is_array($destination_address) )
{
if( isset($destination_address['state']) )
{
$this->_destination_state = $destination_address['state'];
}
else if( isset($destination_address['dest_state']) )
{
$this->_destination_state = $destination_address['dest_state'];
}
else if( isset($destination_address['shipping_state']) )
{
$this->_destination_state = $destination_address['shipping_state'];
}
}
$this->_destination_address = $destination_address;
}
from
Code: Select all
if( empty($this->_destination_country) )
Code: Select all
if( empty($this->_destination_state) )
from
Code: Select all
if( $this->_destination_country != $row['label'] )
Code: Select all
if( $this->_destination_state != $row['label'] )
STEP 2
Open function.admin_settings_tab.php
Change line 54-55
from:
Code: Select all
$smarty->assign('input_label',
$this->CreateInputCountryDropdown($id,'input_label','',true));
to:
Code: Select all
$smarty->assign('input_label',
$this->CreateInputStateDropdown($id,'input_label','',true));
from:
Code: Select all
$obj->input_label = $this->CreateInputCountryDropdown($id,'label[]',$row['label']);
Code: Select all
$obj->input_label = $this->CreateInputStateDropdown($id,'label[]',$row['label']);
Re: US state based Destination Shipping
Hi,
Did you ever achieve a working state based shipping solution? I also need a state based shipping solution although I need to use European states in and around the Alps, so unfortunately this list requires states from France, Italy & Switzerland. Does anyone know if this would be possible to achieve? I dont really want to hack the module but I guess that may be my only option.
Thanks
Chris
Did you ever achieve a working state based shipping solution? I also need a state based shipping solution although I need to use European states in and around the Alps, so unfortunately this list requires states from France, Italy & Switzerland. Does anyone know if this would be possible to achieve? I dont really want to hack the module but I guess that may be my only option.
Thanks
Chris
-
- Forum Members
- Posts: 86
- Joined: Sun Jul 05, 2009 2:37 am
Re: US state based Destination Shipping
Hi Chris,
I acheived this perfectly for Japanese prefectures using the above solution.
But, you might be able to do it without the hack by creating the country and states you need in the latest version of orders.
If you did this, put the state options in the country box and the country options in the state box.
Your state options should then appear in the DBS module.
Then swap the labels for country and state in the module templates.
It's a bit hacky in itself and maybe not so good if it's for a client, but I would say the only other option is to hack the module, unless somebody wants to take my hack of Calguys module and create a StateBasedShipping module from it?
Regards
Ben
I acheived this perfectly for Japanese prefectures using the above solution.
But, you might be able to do it without the hack by creating the country and states you need in the latest version of orders.
If you did this, put the state options in the country box and the country options in the state box.
Your state options should then appear in the DBS module.
Then swap the labels for country and state in the module templates.
It's a bit hacky in itself and maybe not so good if it's for a client, but I would say the only other option is to hack the module, unless somebody wants to take my hack of Calguys module and create a StateBasedShipping module from it?
Regards
Ben
Re: US state based Destination Shipping
I have a similar situation, complicated by the fact that I have to follow a courier charging scheme, not any info that is in a standard address:
My shipping options are:
Pick-up (free)
The city the vendor is in
The region the vendor is in
Rest of the country (urban)
rest of the country (rural)
I've created a field with these possible values in FEU but I'm guessing that CreateInputStateDropdown() is a library function tucked away somewhere in core?
I was hoping for a module where you simply define your shipping zones. This isn't it, but it's the nearest I've found.
My shipping options are:
Pick-up (free)
The city the vendor is in
The region the vendor is in
Rest of the country (urban)
rest of the country (rural)
I've created a field with these possible values in FEU but I'm guessing that CreateInputStateDropdown() is a library function tucked away somewhere in core?
I was hoping for a module where you simply define your shipping zones. This isn't it, but it's the nearest I've found.