Php Magento:使用附加属性创建自己的配送方式
我创建了一个模块,该模块实现了向magento发送新邮件的方法。目前,该模块运行良好 发货方式显示在onepage签出中Php Magento:使用附加属性创建自己的配送方式,php,magento,magento-1.4,Php,Magento,Magento 1.4,我创建了一个模块,该模块实现了向magento发送新邮件的方法。目前,该模块运行良好 发货方式显示在onepage签出中 class Tigerbytes_Barverkauf_Model_Carrier_Selbstabholung extends Mage_Shipping_Model_Carrier_Abstract 现在我想扩展这个功能。新的装运模块在前端不应再可见。因此,我在模块中添加了一个新属性。(显示前端) config.xml <default> &
class Tigerbytes_Barverkauf_Model_Carrier_Selbstabholung extends Mage_Shipping_Model_Carrier_Abstract
现在我想扩展这个功能。新的装运模块在前端不应再可见。因此,我在模块中添加了一个新属性。(显示前端)
config.xml
<default>
<carriers>
<selbstabholung>
<active>1</active>
<allowed_methods>selbstabholung</allowed_methods>
<methods>selbstabholung</methods>
<sallowspecific>0</sallowspecific>
<model>Tigerbytes_Barverkauf_Model_Carrier_Selbstabholung</model>
<name>Selbstabholung</name>
<title>Selbstabholung</title>
<specificerrmsg>Zur Zeit ist die Versandmethode nicht verfuegbar</specificerrmsg>
<handling>0</handling>
<handling_type>F</handling_type>
<show_frontend>0</show_frontend>
</selbstabholung>
</carriers>
system.xml
<show_frontend translate="label">
<label>zeige im Frontend?</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>
</show_frontend>
那么,我必须扩展什么,rate对象才知道show_frontend属性?您在模块中所做的一切都是正确的 就这么做吧: 在collectRates()方法中,您可以输入以下代码:
if(!Mage::getStoreConfig('carrier/selbstabholung/show_frontend'))
return false;
这段代码应该可以完成这项工作
您好。您完成了所有插入模块的操作,对吗 就这么做吧: 在collectRates()方法中,您可以输入以下代码:
if(!Mage::getStoreConfig('carrier/selbstabholung/show_frontend'))
return false;
这段代码应该可以完成这项工作
您好。附件:
我只想允许在前端显示装运方式。在后端订单的后端,我想显示它
因此,在collectRates()方法中,我实现了以下条件
if(Mage::getDesign()->getArea() === Mage_Core_Model_App_Area::AREA_FRONTEND &&
!Mage::getStoreConfig('carriers/'.$this->_code.'/show_frontend')){
return false;
}
现在它的工作完美 附件:
我只想允许在前端显示装运方式。在后端订单的后端,我想显示它
因此,在collectRates()方法中,我实现了以下条件
if(Mage::getDesign()->getArea() === Mage_Core_Model_App_Area::AREA_FRONTEND &&
!Mage::getStoreConfig('carriers/'.$this->_code.'/show_frontend')){
return false;
}
现在它的工作完美 该死,你说得对!谢谢。我正在考虑把它复杂化。:-)是的,有时候magento也很简单请把答案标记为正确~^该死,你说得对!谢谢。我正在考虑把它复杂化。:-)是的,有时候magento也很简单请把答案标记为正确~^