0

我使用Magento的1.4Magento的Overiding购物车价格问题

我在由 /httpdocs资料/应用/代码创建一个脚本乘坐购物车的价格/本地/法师/销售/型号/报价/项目.PHP

在Item.php,我有这样的代码:

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] 

当我试图取消对一个,一切都没问题。

我附上了一些图片。

你能告诉我这个解决方案吗?你的帮助将不胜感激。 谢谢! blank page that I got before proceeding in the shopping cart

firebug result

回答

0

这似乎很奇怪,你不是你的产品给一个变量赋值,但无论哪种方式,试图通过先设定储存ID装载特定的产品时,我有好运。这是一个例子。

$load_product = Mage::getModel('catalog/product') 
->setStoreId(Mage::app()>getStore()->getId()) 
->load($_product->getID); 

保存旅行到Magento的土地,它是强大的,但无情的!

+0

我仍然遇到同样的问题。我仍然在前往白色的空白页面。 '$ _product = $ this-> getProduct(); (Mage :: app() - > getStore() - > getId()) - > load($ _ product-> getID); $ productProducts = Mage :: getModel('catalog/product_type_configurable') - > getUsedProducts(null,$ _ product);' – PinoyStackOverflower