我使用 OC 2.3 搜索并尝试了各种方法。 我正在尝试在产品页面上显示购物车中已有的单个产品项目 - 有什么想法吗? 谢谢
答案 0 :(得分:0)
需要显示当前商品页面的单个商品的商品数量。 我输入了下面的代码,但我认为需要在控制器中声明的值。
<?php echo "CURRENT PRODUCT ITEMS IN CART: " . $products_quantity; ?>
答案 1 :(得分:0)
我在catalog/controller/product/product.php中输入了波纹管声明, 它有效,但仅当购物车中有产品时才有效。
foreach ($this->cart->getProducts() as $product) {
if ($product['quantity']) {
$products_quantity = $product['quantity'];
}
$data['products'] = array(
'products_quantity' => $product['quantity']
);
$data['products_quantity'] = $products_quantity;
}