开发者

Magento Weight Scope

开发者 https://www.devze.com 2023-03-08 18:45 出处:网络
Now that I have 3 stores running out of one database I\'ve run into an unforeseen problem. One of the stores ships calculates shipping from Europe using UPS XML, the other US also using UPS XML.

Now that I have 3 stores running out of one database I've run into an unforeseen problem.

One of the stores ships calculates shipping from Europe using UPS XML, the other US also using UPS XML.

The issue is that since the weight for each product has global scope I have a real issue in calculating shipping since it takes the same value and uses it as LBS in the US, and then KGS in Europe开发者_开发问答.

By design UPS can only use KGS in Europe and only LBS in the US.

I haven't been able to find any information on this topic. Has anyone found a way to deal with this problem?


I'm not sure enabling the setting on store basis will solve the issue - it depends on if the underlaying code actually checks for the setting correctly. But it is worth a shot.

To activate the "Carriers->UPS->Weight Unit" configuration option on store level instead of just website/global you can change the core XML (not recommended) placed here:

magento/app/code/core/Mage/Usa/etc/system.xml

And look up the option <show_in_store>0</show_in_store> under <ups> -> <fields> -> <unit_of_measure>. Change that to <show_in_store>1</show_in_store>, save and you should be all set.

For the nicer, flexible and upgrade friendly way to override this option you need to create a module.

Create the folder structure MyModules/XMLoverrides/etc inside the folder magento/app/code/local.

Inside that folder magento/app/code/local/MyModules/XMLoverrides/etc create two files, config.xml and system.xml.

For the config.xml file, paste this content and save:

<?xml version="1.0"?>
<config>
    <modules>
        <MyModules_XMLoverrides>
            <version>0.1.0</version>
        </MyModules_XMLoverrides>
    </modules>
</config>

And for system.xml, paste this text and save the file.

<?xml version="1.0"?>
<config>
    <sections>
        <carriers>
            <groups>
                <ups>
                    <fields>
                        <unit_of_measure>
                            <show_in_store>1</show_in_store>
                        </unit_of_measure>
                    </fields>
                </ups>
            </groups>
        </carriers>
    </sections>
</config>

You also need to create the file MyModules_XMLoverrides.xml inside the folder magento/app/etc/modules with the content:

<?xml version="1.0"?>
<config>
    <modules>
        <MyModules_XMLoverrides>
            <active>true</active>
            <codePool>local</codePool>
        </MyModules_XMLoverrides>
    </modules>
</config>

and save it. That should be it, and it will continue to override this option even when you upgrade Magento and the original system.xml file might be overwritten.

Now just cross your fingers that changing this setting really helps, and that my untested module example-code works. :)

0

精彩评论

暂无评论...
验证码 换一张
取 消