Php 从osCommerce shoppingCart对象检索购物车内容
如何从osCommerce中的shoppingCart对象提取或获取值?我想在主页上显示购物车内容,因此我打印了当前会话以获得以下内容:Php 从osCommerce shoppingCart对象检索购物车内容,php,arrays,object,oscommerce,Php,Arrays,Object,Oscommerce,如何从osCommerce中的shoppingCart对象提取或获取值?我想在主页上显示购物车内容,因此我打印了当前会话以获得以下内容: shoppingCart Object ( [contents] => Array ( [32] => Array ( [qty] => 1 ) [26] =>
shoppingCart Object
(
[contents] => Array
(
[32] => Array
(
[qty] => 1
)
[26] => Array
(
[qty] => 2
)
)
[total] => 2960
[weight] => 0
[cartID] => 29022
[content_type] =>
)
从这里,我想从
contents
数组中检索值。i、 例如:32个数量、26个数量和总数,但我不知道如何操作,因为它使用的是“shoppingCart对象”。在对象内部有数组
因此,您可以:
$contents = $shoppingCart['contents'];
获取itemid和数量
如果您想要总数,请执行以下操作:
$contents = $shoppingCart['total'];
可能重复的