$i = 1;
foreach ($product->getOptions() as $o) {
$values = $o->getValues();
foreach ($values as $v) {
print_r($v->getData());
}
$i++;
}
上面的代码输出以下结果:
Array
(
[option_type_id] => 9
[option_id] => 3
[sku] =>
[sort_order] => 0
[default_title] => Black
[store_title] =>
[title] => Black
[default_price] => 0.0000
[default_price_type] => fixed
[store_price] =>
[store_price_type] =>
[price] => 0.0000
[price_type] => fixed
)
Array
(
[option_type_id] => 7
[option_id] => 3
[sku] =>
[sort_order] => 0
[default_title] => Red
[store_title] =>
[title] => Red
[default_price] => 0.0000
[default_price_type] => fixed
[store_price] =>
[store_price_type] =>
[price] => 0.0000
[price_type] => fixed
)
Array
(
[option_type_id] => 8
[option_id] => 3
[sku] =>
[sort_order] => 0
[default_title] => White
[store_title] =>
[title] => White
[default_price] => 0.0000
[default_price_type] => fixed
[store_price] =>
[store_price_type] =>
[price] => 0.0000
[price_type] => fixed
)
我想输出[title]
值。我怎么做?谢谢你。我试过用$v->getData()['title']
,但没有用。