Php Magento过度隐藏购物车价格问题
我正在使用magento 1.4 通过在中创建脚本,我超越了购物车的价格 /httpdocs/app/code/local/Mage/Sales/Model/Quote/Item.php 在Item.php上,我有以下代码:Php Magento过度隐藏购物车价格问题,php,model-view-controller,zend-framework,magento,magento-1.4,Php,Model View Controller,Zend Framework,Magento,Magento 1.4,我正在使用magento 1.4 通过在中创建脚本,我超越了购物车的价格 /httpdocs/app/code/local/Mage/Sales/Model/Quote/Item.php 在Item.php上,我有以下代码: public function setPrice($price) //set the unit price { $qty = $this->getQty; $_helper = Mage::helper('catalog/ou
public function setPrice($price) //set the unit price
{
$qty = $this->getQty;
$_helper = Mage::helper('catalog/output');
Mage::getModel('catalog/product')->load($_product->getId);
$_product = $this->getProduct();
$childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null,$_product);
foreach($childProducts as $_attribute){
$tierPrices = $_helper->productAttribute($_attribute,$_attribute->getFormatedTierPrice());
foreach($tierPrices as $tierPrice){
if($qty == $tierPrice['price_qty']){
$price = $tierPrice['price'];
break;
}
}
}
$this->price = $price;
}
每次我向购物车添加产品时,它都应该进入购物车页面,但现在发生的是我只得到一个空白的白色页面。
当我同时检查FireBug的控制台时,我得到一个网络错误:500内部服务器错误
我认为发生这种情况的原因是我在这一行的代码:
![$childProducts = Mage::getModel('catalog/product_type_configurable')->getUsedProducts(null,$_product);][1]
当我尝试取消注释时,一切正常
我附上了一些图片
你能告诉我这个问题的解决办法吗。非常感谢你的帮助。
谢谢
您没有将产品分配给变量似乎有些奇怪,但不管怎样,我在尝试通过先设置商店ID加载特定产品时运气最好。这里有一个例子
$load_product = Mage::getModel('catalog/product')
->setStoreId(Mage::app()>getStore()->getId())
->load($_product->getID);
拯救进入Magento之地的旅程,它很强大,但不可饶恕 我还是有同样的问题。我仍在向白色空白页前进<代码>$\u product=$this->getProduct()$load_product=Mage::getModel('catalog/product')->setStoreId(Mage::app()->getStore()->getId())->load($_product->getId)$childProducts=Mage::getModel('catalog/product\u type\u configurable')->getUsedProducts(null,$\u product)代码>