Magento 如何在购物车中获取自定义价格和自定义图像值



我正在从事定制产品设计。设计产品后,根据产品的高度和宽度以及产品的自定义图像设置自定义价格。它在数组$items显示价格和自定义值。但是在购物车页面上,我无法获得这些值。如何在购物车中获得自定义价格和自定义图像值。这是我设置价格和图像值的代码。

            $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

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

echo $item->getProduct()->custom_image();更改为回显 $item->getProduct()->getCustomImage();

相关内容

  • 没有找到相关文章

最新更新