2016-04-28 89 views
0

我正在定製產品design.After設計產品ia設置自定義價格基於產品的高度和寬度計算和產品的自定義圖像。它顯示價格和$ items數組中的自定義值。但在購物車頁面我是無法獲取這些值。如何在cart中獲得自定義價格和自定義圖像值。這是我設置價格和圖像值的代碼。Magento如何在購物車中獲得自定義價格和自定義圖像價值?

  $item->setCustomImage($products['imageutl1']); 
      $item->setCustomPrice($custom_price); 
      $item->setOriginalCustomPrice($custom_price); 
      // Enable super mode on the product. 
      $item->getProduct()->setIsSuperMode(true); 

      This is my code to get the price and image value on cart page.when i am trying to get the values on cart page using this code then it blanks the page.  
      $items = Mage::getSingleton('checkout/session')->getQuote()->getAllItems(); 

      foreach($items as $item) { 


       echo $productName = $item->getProduct()->getName(); 
       $productPrice = $item->getProduct()->getPrice(); 
       echo $item->getProduct()->custom_image(); 

      }  

[product_id] => 800 
      [product_type] => simple 
      [sku] => 111 
      [name] => Test product 
      [weight] => 4.0000 
      [tax_class_id] => 0 
      [base_cost] => 
      [is_recurring] => 0 
      [is_qty_decimal] => 0 
      [calculation_price] => 50.56 
      [base_calculation_price] => 
      [custom_price] => 50.56 
      [custom_image] => http://testimage.com/test/test.php/myimage.php 
      [is_nominal] => 
      [qty_to_add] => 1 
      [qty] => 1 
      [qty_options] => Array 
       (
       ) 

      [original_custom_price] => 50.56 
      [small_image] => 
      [thumbnail] => 
      [is_virtual] => 
      [created_at] => 2016-04-29 05:08:15 
      [updated_at] => 2016-04-29 05:08:15 
      [item_id] => 159 

回答

0

echo $item->getProduct()->getData('custom_image');

+0

這不是working.i在上面的代碼中添加了產品陣列。 –

+0

嘗試編輯的解決方案, – Shivanand

+0

這也不工作。只顯示產品名稱。 –

0

變化echo $item->getProduct()->custom_image();取代echo $item->getProduct()->custom_image();到回聲$用品 - > getProduct() - > getCustomImage();

相關問題