我想仅在客户购买某些产品时才显示条款和条件(agreements.phtml).例如,我们的一些产品需要处方.客户购买其中一个,我们希望条款出现.
我在后端创建了一个属性:prescription_required
伪代码如下:
Loop through products in the basket
if prescription_required == yes
set flag to yes
end if
end loop
Run Code Online (Sandbox Code Playgroud)
如果flag设置为yes,请通过agreements.phtml中的代码
我认为我遇到的主要问题是在agreement.phmtl中获取产品信息并在整个篮子中循环.
我试过了
<?php
$_product = Mage::getModel('catalog/product')->load($this->getData('product_id'));
echo $_product->getName();
?>
Run Code Online (Sandbox Code Playgroud)
但没有任何回报.