我正在进行定制产品设计。设计产品后,根据产品的高度和宽度以及产品的自定义图像计算定制价格。它显示$ 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
答案 0 :(得分:0)
将echo $item->getProduct()->custom_image();
替换为echo $item->getProduct()->getData('custom_image');
答案 1 :(得分:0)
将zero?
更改为echo $ item-> getProduct() - > getCustomImage();