获取产品属性参考 - Prestashop 1.7
Get product attribute reference - Prestashop 1.7
我需要在模块 php 文件中获取产品组合 ean13。
使用这个我可以获得产品参考:
$product = new
Product(Tools::getValue('id_product'));
$varRef = $product->reference;
我不知道如何获得组合 ean13,因为它是一个产品数组。
{$product|@var_dump}}
'attributes' =>
array (size=2)
1 =>
array (size=8)
'id_attribute' => string '1' (length=1)
'id_attribute_group' => string '1' (length=1)
'name' => string 'S' (length=1)
'group' => string 'Taille' (length=6)
'reference' => string '' (length=0)
'ean13' => string '' (length=0)
'isbn' => string '' (length=0)
'upc' => string '' (length=0)
有什么快速解决办法吗?
谢谢!
这有效并将列出给定产品的每个 combination/variant 的 EAN 13:
$product = new Product((int)Tools::getValue('id_product'));
$id_lang = Context::getContext()->language->id;
$combinations = $product->getAttributeCombinations((int)$id_lang, true);
foreach ($combinations as $c)
p($c['ean13']);
我需要在模块 php 文件中获取产品组合 ean13。 使用这个我可以获得产品参考:
$product = new
Product(Tools::getValue('id_product'));
$varRef = $product->reference;
我不知道如何获得组合 ean13,因为它是一个产品数组。
{$product|@var_dump}}
'attributes' =>
array (size=2)
1 =>
array (size=8)
'id_attribute' => string '1' (length=1)
'id_attribute_group' => string '1' (length=1)
'name' => string 'S' (length=1)
'group' => string 'Taille' (length=6)
'reference' => string '' (length=0)
'ean13' => string '' (length=0)
'isbn' => string '' (length=0)
'upc' => string '' (length=0)
有什么快速解决办法吗? 谢谢!
这有效并将列出给定产品的每个 combination/variant 的 EAN 13:
$product = new Product((int)Tools::getValue('id_product'));
$id_lang = Context::getContext()->language->id;
$combinations = $product->getAttributeCombinations((int)$id_lang, true);
foreach ($combinations as $c)
p($c['ean13']);