Magento 如何在配送选项上添加徽标?
我克隆了tablerate运输方法,以提供另一种选择(快速快递)。 我到处查看如何在显示配送选项时添加徽标 我所做的: 在公共功能Magento 如何在配送选项上添加徽标?,magento,shipping,Magento,Shipping,我克隆了tablerate运输方法,以提供另一种选择(快速快递)。 我到处查看如何在显示配送选项时添加徽标 我所做的: 在公共功能collectRates中,我添加了我的配送模型 $method->setLogo( $this->getShipmentImageSrc('postaromana') ); $result->append($method); 现在我有了logo路径,问题是我不知道怎么称呼它。我想这通电话是用英语打的 /app/design/frontend/ba
collectRates
中,我添加了我的配送模型
$method->setLogo( $this->getShipmentImageSrc('postaromana') );
$result->append($method);
现在我有了logo路径,问题是我不知道怎么称呼它。我想这通电话是用英语打的
/app/design/frontend/base/default/template/checkout/onepage/shipping\u method/available.phtml
有什么办法解决这个问题吗?解决我的问题 我分享我的解决方案,以防有人需要 在
app/code/core/Mage/Shipping/etc/system.xml中
将其添加到您的新运营商上
<logo>
<label>Logo</label>
<frontend_type>image</frontend_type>
<backend_model>adminhtml/system_config_backend_image</backend_model>
<upload_dir config="system/filesystem/media" scope_info="0">freeshippingtimisoara/logo</upload_dir>
<base_url type="media" scoope_info="0">freeshippingtimisoara/logo</base_url>
<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>
</logo>
将/app/code/core/Mage/Checkout/Block/Onepage/Shipping/Method/Available.php
克隆到本地并添加此功能:
public function getCarrierLogo($carrierCode)
{
if ($logo = Mage::getStoreConfig('carriers/'.$carrierCode.'/logo'))
{
$carrierModel = Mage::getModel('shipping/carrier_' . $carrierCode);
$logo = $carrierModel->getShipmentImageSrc($carrierCode);
return $logo;
}
//$shippingModel = Mage::getModel('shipping/shipping');
//$carrier = $shippingModel->getShipmentImageSrc($carrierCode);
//Mage::helper('firephp')->debug( $carrier );
}
在app/design/frontend/default/sex/template/checkout/onepage/shipping\u method/available.phtml
我有这个文件在我的模板,最好是复制到您的模板,如果你想改变
<?php if($this->getCarrierLogo($code)): ?>
<span class="carrier-desc" style="margin:0 10px">
<img src="<?php echo $this->getCarrierLogo($code) ?>" alt="<?php echo $_code; ?>" />
</span>
<?php endif; ?>
getCarrierLogo($code)?>“alt=”“/>
你应该将你的解决方案作为答案而不是在你的问题中提供。然后接受它作为正确答案(即使它是你自己的)。在预定义的时间段后(我认为两天后),你将能够接受它下次,不要在答案中提问,添加一个答案并将其标记为正确答案,以便所有正在查找的人都能轻松找到。感谢您的提示。对此表示抱歉。我以后会记住。记住,要使此答案成为正确答案,请单击“向上/向下投票”图标下方的“确定”图标。
<?php if($this->getCarrierLogo($code)): ?>
<span class="carrier-desc" style="margin:0 10px">
<img src="<?php echo $this->getCarrierLogo($code) ?>" alt="<?php echo $_code; ?>" />
</span>
<?php endif; ?>