覆盖送货方式 - 我缺少什么
我以前写了很多模块但由于某种原因我的运输模块不会覆盖现有的Magneto运输方法。这是允许的吗?我在这里错过了什么?模块名称显示在配置区域的高级选项卡中,因此它已加载,但没有发生任何事情。任何提示?
码
等/模块/ Ssi_Shipping.xml
<?xml version="1.0"?>
<config>
<modules>
<Ssi_Shipping>
<active>true</active>
<codepool>local</codepool>
</Ssi_Shipping>
</modules>
</config>
本地/ SSI /运输/ etc.xml
<?xml version="1.0"?>
<config>
<modules>
<Ssi_Shipping>
<version>0.1.0</version>
</Ssi_Shipping>
</modules>
<global>
<models>
<shipping>
<rewrite>
<carrier_tablerate>Ssi_Shipping_Model_Carrier_Tablerate</carrier_tablerate>
</rewrite>
</shipping>
</models>
</global>
</config>
本地/ SSI /运输/型号/电信/ Tablerate.php
<?php
class Ssi_Shipping_Model_Carrier_Tablerate
extends Mage_Shipping_Model_Carrier_Tablerate {
public function isActive()
{
Mage::log("here! Ssi_Shipping_Model_Carrier_Tablerate");
// check to see if it's disabled
if (parent::isActive() == false)
return false;
// check in the shopping cart
foreach( Mage::getSingleton('checkout/session')->getQuote()->getItemsCollection() as $item ){
if ($item->getDeliveryFlag() == "test")
return true;
}
// if nothing is found then disable this option.
return false;
}
}
没有找到相关结果
已邀请:
5 个回复
刷骸码
是的,您可以将此代码暂时放在页面的任何位置,但是有一个单独的文件可用于从命令行运行(从Mage :: app()开始初始化Magento) 在我的例子中,代码是matrixrate_shipping / carrier_matrixrate所以我不得不改变我的config.xml:
代替
祝好运!
徘廷
渴翅吮斡撤
冕偷淮款
模型值是示例。您必须使用正确的路径替换它们。
挂帘妈乡
应该是
(注意大写P)。