Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

i need help with fixing two bugs i got with additional Shipping method i’ve created
 
M.S.
Member
 
Total Posts:  39
Joined:  2008-04-20
 

Hi, i have no experience with Programing and Scripting, but i followed all posts regarding adding Shipping Module and adding Shipping Table rate method.

i figure it out and succeeded to add one more “tablerate” shipping method to my backend and also to my fronted, accually it works but not properly:

my actions were :

1. I have searhed all the files and directories (also in file content) associated with Phrase tablerate in the Magento directory on my computer (same directory on the server).

I found those files locations:

* magento\app\code\core\Mage\Shipping\Model\Mysql4\Carrier\tablerate.php --->>> (file name and file content)

* magento\app\code\core\Mage\Shipping\Model\Carrier\tablerate.php --->>> (file name and file content)

* magento\app\code\core\Mage\Adminhtml\Model\System\Config\Source\Shipping\tablerate.php --->> >> (file name and file content)

* magento\app\code\core\Mage\Adminhtml\Model\System\Config\Backend\Shipping\tablerate.php --->>> (file name and file content)

* magento\app\code\core\Mage\Shipping\Model\Mysql4\Carrier\Tablerate --------------->>>(Directory name)

* magento\app\code\core\Mage\Shipping\Model\Mysql4\Carrier\Tablerate\collection.php ------>>>(phrase match only in file content)

* magento\app\code\core\Mage\Shipping\etc\system.xml ------>>>(phrase match only in file content)

* magento\app\code\core\Mage\Shipping\etc\config.xml ------>>>(phrase match only in file content)

2.I duplicated all the files tablerate.php to the same location and rename it to express.php
3.i changed the files (express.php) content, replaced in the file content all the phrase tablerate with express and Tablerate with Express.
4.i created directory called “Express” in magento\app\code\core\Mage\Shipping\Model\Mysql4\Carrier
5.copied magento\app\code\core\Mage\Shipping\Model\Mysql4\Carrier\Tablerate\collection.php to magento\app\code\core\Mage\Shipping\Model\Mysql4\Carrier\Express
6.Changed all the taberate phrase in collection.php content to exprss
7.edited the config.xml and system.xml like the following:

config.xml

 
Magento Community Magento Community
Magento Community
Magento Community
 
M.S.
Member
 
Total Posts:  39
Joined:  2008-04-20
 

<?xml version="1.0"?>
<!--
/**
 * Magento
 *
 * NOTICE OF LICENSE
 *
 * This source file is subject to the Open Software License (OSL 3.0)
 * that is bundled with this package in the file LICENSE.txt.
 * It is also available through the world-wide-web at this URL:
 * http://opensource.org/licenses/osl-3.0.php
 * If you did not receive a copy of the license and are unable to
 * obtain it through the world-wide-web, please send an email
 * to license@magentocommerce.com so we can send you a copy immediately.
 *
 * @category   Mage
 * @package    Mage_Shipping
 * @copyright  Copyright (c) 2004-2007 Irubin Consulting Inc. DBA Varien (http://www.varien.com)
 * @license    http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
-->
<
config>
    <
modules>
        <
Mage_Shipping>
            <
version>0.7.0</version>
        </
Mage_Shipping>
    </
modules>
    <global>
        <
models>
            <
shipping>
                <class>
Mage_Shipping_Model</class>
                <
resourceModel>shipping_mysql4</resourceModel>
            </
shipping>
            <
shipping_mysql4>
                <class>
Mage_Shipping_Model_Mysql4</class>
                <
entities>
                    <
tablerate>
                        <
table>shipping_tablerate</table>     
                </
tablerate>
                <!--
                
                
/** added this section
                */
                
-->
                    <
express>
                        <
table>shipping_express</table>
                    </
express>
                    </
entities>


            </
shipping_mysql4>
        </
models>
        <
resources>
            <
shipping_setup>
                <
setup>
                    <
module>Mage_Shipping</module>
                </
setup>
                <
connection>
                    <use>
core_setup</use>
                </
connection>
            </
shipping_setup>
            <
shipping_write>
                <
connection>
                    <use>
core_write</use>
                </
connection>
            </
shipping_write>
            <
shipping_read>
                <
connection>
                    <use>
core_read</use>
                </
connection>
            </
shipping_read>
        </
resources>
        <
sales>
            <
shipping>
                <
rule>
                    <
conditions>
                        <
dest_country>
                            <class>
Mage_Sales_Model_Shipping_Rule_Condition_Dest_Country</class>
                        </
dest_country>
                        <
dest_region>
                            <class>
Mage_Sales_Model_Shipping_Rule_Condition_Dest_Region</class>
                        </
dest_region>
                        <
dest_zip>
                            <class>
Mage_Sales_Model_Shipping_Rule_Condition_Dest_Zip</class>
                        </
dest_zip>
                        <
package_weight>
                            <class>
Mage_Sales_Model_Shipping_Rule_Condition_Package_Weight</class>
                        </
package_weight>
                        <
order_subtotal>
                            <class>
Mage_Sales_Model_Shipping_Rule_Condition_Order_Subtotal</class>
                        </
order_subtotal>
                        <
order_totalqty>
                            <class>
Mage_Sales_Model_Shipping_Rule_Condition_Order_Totalqty</class>
                        </
order_totalqty>
                    </
conditions>
                    <
actions>
                        <
carrier>
                            <class>
Mage_Sales_Model_Shipping_Rule_Action_Carrier</class>
                        </
carrier>
                        <
method>
                            <class>
Mage_Sales_Model_Shipping_Rule_Action_Method</class>
                        </
method>
                    </
actions>
                </
rule>
            </
shipping>
        </
sales>
    </global>
    <
adminhtml>
        <
acl>
            <
resources>
                <
admin>
                    <
children>
                        <
system>
                            <
children>
                                <
config>
                                    <
children>
                                        <
shipping>
                                            <
title>Shipping Section</title>
                                            <
sort_order>0</sort_order>
                                        </
shipping>
                                        <
carriers>
 
Magento Community Magento Community
Magento Community
Magento Community
 
M.S.
Member
 
Total Posts:  39
Joined:  2008-04-20
 

<title>Shipping Methods Section</title>
                                            <
sort_order>0</sort_order>
                                        </
carriers>
                                    </
children>
                                </
config>
                            </
children>
                        </
system>
                    </
children>
                </
admin>
            </
resources>
        </
acl>
        <
translate>
            <
modules>
                <
Mage_Shipping>
                    <
files>
                        <default>
Mage_Shipping.csv</default>
                    </
files>
                </
Mage_Shipping>
            </
modules>
        </
translate>
    </
adminhtml>
    <
frontend>
        <
translate>
            <
modules>
                <
Mage_Shipping>
                    <
files>
                        <default>
Mage_Shipping.csv</default>
                    </
files>
                </
Mage_Shipping>
            </
modules>
        </
translate>
        <
routers>
            <
shipping>
                <use>
standard</use>
                <
args>
                    <
module>Mage_Shipping</module>
                    <
frontName>shipping</frontName>
                </
args>
            </
shipping>
        </
routers>
        <
layout>
            <
updates>
                <
shipping>
                    <
file>shipping.xml</file>
                </
shipping>
            </
updates>
        </
layout>
    </
frontend>

    <default>
        <
shipping>
            <
option>
                <
checkout_multiple>1</checkout_multiple>
                <
checkout_multiple_maximum_qty>100</checkout_multiple_maximum_qty>
            </
option>

            <
origin>
                <
country_id>US</country_id>
                <
postcode>90034</postcode>
                <
region_id>12</region_id>
            </
origin>
        </
shipping>

        <
carriers>
            <
flatrate>
                <
active>1</active>
                <
sallowspecific>0</sallowspecific>
                <
model>shipping/carrier_flatrate</model>
                <
name>Fixed</name>
                <
price>5.00</price>
                <
title>Flat Rate</title>
                <
type>I</type>
                <
specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping methodplease contact us.</specificerrmsg>
                <
handling_type>F</handling_type>
            </
flatrate>

            <
freeshipping>
                <
active>0</active>
                <
sallowspecific>0</sallowspecific>
                <
cutoff_cost>50</cutoff_cost>
                <
model>shipping/carrier_freeshipping</model>
                <
name>Free</name>
                <
title>Free Shipping</title>
                <
specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping methodplease contact us.</specificerrmsg>
            </
freeshipping>

            <
tablerate>
                <
active>0</active>
                <
sallowspecific>0</sallowspecific>
                <
condition_name>package_weight</condition_name>
                <
model>shipping/carrier_tablerate</model>
                <
name>Table Rate</name>
                <
title>Best Way</title>
                <
specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping methodplease contact us.</specificerrmsg>
                <
handling_type>F</handling_type>
            </
tablerate>
                  <!--
                
                
/** added this section
                */
                
-->
             <
express>
                <
active>0</active>
                <
sallowspecific>0</sallowspecific>
                <
condition_name>package_weight</condition_name>
                <
model>shipping/carrier_express</model>
                <
name>Table Rate</name>
                <
title>Best Way</title>
                <
specificerrmsg>This shipping method is currently unavailable. If you would like to ship using this shipping methodplease contact us.</specificerrmsg>
                <
handling_type>F</handling_type>
            </
express>
        </
carriers>
    </default>
</
config>
 
Magento Community Magento Community
Magento Community
Magento Community
 
M.S.
Member
 
Total Posts:  39
Joined:  2008-04-20
 

added this to system.xml

<express translate="label">
                    <
label>Table rates</label>
                    <
frontend_type>text</frontend_type>
                    <
sort_order>2</sort_order>
                    <
show_in_default>1</show_in_default>
                    <
show_in_website>1</show_in_website>
                    <
show_in_store>1</show_in_store>
                    <
fields>
                         <
handling_type translate="label">
                            <
label>Calculate Handling Fee</label>
                            <
frontend_type>select</frontend_type>
                            <
source_model>shipping/source_handlingType</source_model>
                            <
sort_order>7</sort_order>
                            <
show_in_default>1</show_in_default>
                            <
show_in_website>1</show_in_website>
                            <
show_in_store>0</show_in_store>
                        </
handling_type>
                        <
handling_fee translate="label">
                            <
label>Handling Fee</label>
                            <
frontend_type>text</frontend_type>
                            <
sort_order>8</sort_order>
                            <
show_in_default>1</show_in_default>
                            <
show_in_website>1</show_in_website>
                            <
show_in_store>1</show_in_store>
                        </
handling_fee>
                        <
active translate="label">
                            <
label>Enabled</label>
                            <
frontend_type>select</frontend_type>
                            <
source_model>adminhtml/system_config_source_yesno</source_model>
                            <
sort_order>1</sort_order>
                            <
show_in_default>1</show_in_default>
                            <
show_in_website>1</show_in_website>
                            <
show_in_store>1</show_in_store>
                        </
active>
                        <
condition_name translate="label">
                            <
label>Condition</label>
                            <
frontend_type>select</frontend_type>
                            <
source_model>adminhtml/system_config_source_shipping_express</source_model>
                            <
sort_order>4</sort_order>
                            <
show_in_default>1</show_in_default>
                            <
show_in_website>1</show_in_website>
                            <
show_in_store>0</show_in_store>
                        </
condition_name>
                        <
export translate="label">
                            <
label>Export</label>
                            <
frontend_type>export</frontend_type>
                            <
sort_order>5</sort_order>
                            <
show_in_default>0</show_in_default>
                            <
show_in_website>1</show_in_website>
                            <
show_in_store>0</show_in_store>
                        </
export>
 
Magento Community Magento Community
Magento Community
Magento Community
 
M.S.
Member
 
Total Posts:  39
Joined:  2008-04-20
 

<import translate="label">
                            <
label>Import</label>
                            <
frontend_type>import</frontend_type>
                            <
backend_model>adminhtml/system_config_backend_shipping_express</backend_model>
                            <
sort_order>6</sort_order>
                            <
show_in_default>0</show_in_default>
                            <
show_in_website>1</show_in_website>
                            <
show_in_store>0</show_in_store>
                        </
import>
                        <
name translate="label">
                            <
label>Method name</label>
                            <
frontend_type>text</frontend_type>
                            <
sort_order>3</sort_order>
                            <
show_in_default>1</show_in_default>
                            <
show_in_website>1</show_in_website>
                            <
show_in_store>1</show_in_store>
                        </
name>
                        <
sort_order translate="label">
                            <
label>Sort order</label>
                            <
frontend_type>text</frontend_type>
                            <
sort_order>100</sort_order>
                            <
show_in_default>1</show_in_default>
                            <
show_in_website>1</show_in_website>
                            <
show_in_store>1</show_in_store>
                        </
sort_order>
                        <
title translate="label">
                            <
label>Title</label>
                            <
frontend_type>text</frontend_type>
                            <
sort_order>2</sort_order>
                            <
show_in_default>1</show_in_default>
                            <
show_in_website>1</show_in_website>
                            <
show_in_store>1</show_in_store>
                        </
title>
                        <
sallowspecific translate="label">
                            <
label>Ship to applicable countries</label>
                            <
frontend_type>select</frontend_type>
                            <
sort_order>90</sort_order>
                            <
frontend_class>shipping-applicable-country</frontend_class>
                            <
source_model>adminhtml/system_config_source_shipping_allspecificcountries</source_model>
                            <
show_in_default>1</show_in_default>
                            <
show_in_website>1</show_in_website>
                            <
show_in_store>1</show_in_store>
                        </
sallowspecific>
                        <
specificcountry translate="label">
                            <
label>Ship to Specific countries</label>
                            <
frontend_type>multiselect</frontend_type>
                            <
sort_order>91</sort_order>
                            <
source_model>adminhtml/system_config_source_country</source_model>
                            <
show_in_default>1</show_in_default>
                            <
show_in_website>1</show_in_website>
                            <
show_in_store>1</show_in_store>
                        </
specificcountry>
                        <
showmethod translate="label">
                            <
label>Show method if not applicable</label>
                            <
frontend_type>select</frontend_type>
                            <
sort_order>92</sort_order>
                            <
source_model>adminhtml/system_config_source_yesno</source_model>
                            <
show_in_default>1</show_in_default>
                            <
show_in_website>1</show_in_website>
                            <
show_in_store>1</show_in_store>
                        </
showmethod>
                        <
specificerrmsg translate="label">
                            <
label>Displayed Error Message</label>
                            <
frontend_type>textarea</frontend_type>
                            <
sort_order>80</sort_order>
                            <
show_in_default>1</show_in_default>
                            <
show_in_website>1</show_in_website>
                            <
show_in_store>1</show_in_store>
                        </
specificerrmsg>
                    </
fields>
                </
express>
 
Magento Community Magento Community
Magento Community
Magento Community
 
M.S.
Member
 
Total Posts:  39
Joined:  2008-04-20
 

after all the changes to the files, i’ve created a a table on the database the same like “shipping_tablerate” and called it “shipping_express”.

i went to admin -> configuration->(main website) -> shipping method --- and now i can see 1 more Shipping methos “tabe rate “ type

i exported the CSV file and edited it adding USA Shiiping Rates and load it back

the same to the original “ Table rate” and enable it........... now is the first problem, after i am saving configuration, the page go to “page not found (404) “ page , but after i go back with the back button on the browser, i get configuration succeful saved message, so then i goes to refresh cache, and save

now , on fronted i can see the two Shipping method when i get “quote”
but it showing the same price to every country despite the fact i set in the CSV file rate only to USA.

but is if set the Shipping method to specific country only, it will show the price only for this country.

*** so first problem is , after saving the imported CSV file the page is redirect to “page not found page)
*** Second problem that the table shipping dose not refer to the counry value in the CSV file and give the same price to all countries despite the fact i set only USA code in the CSV file

Please Help me with that !!!!!!!

 
Magento Community Magento Community
Magento Community
Magento Community
 
sherrie
Moderator
 
Avatar
Total Posts:  1655
Joined:  2007-12-14
Waterloo, ON
 

It sounds to me like your two problems are related and that it’s not actually importing the CSV file which is resulting in your second error.  The shipping module I created did not involve the database at all, so I’m not really sure how to help you as I’m pretty sure that’s where the error lies.  I know there are some other threads on here regarding adding additional table rates, though, so I would try searching for and re-reading them.

 
Magento Community Magento Community
Magento Community
Magento Community
 
M.S.
Member
 
Total Posts:  39
Joined:  2008-04-20
 

Hi,
Thank you for your reply, i’ve tried all the logic ways i could thought about, i have no progrmaing skills but it is very interesting me.
I am in China, running a trading company and my website will be a wholesale website for selling goods online. that’s why i must have a more than 1 table rate Shipping method.

Best Regards

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top