好吧,我一直在为这个拔头发!我尝试了一个 SQL 调用来将功能添加到产品中,但是由于产品是一行并且功能不是它为每个产品创建一个新行。我想我可以将两者都添加到数组中并根据产品 ID 加入它们。这是数组
array
0 =>
array
'id_product' => string '9' (length=1)
'name' => string 'Brady ENV100 MAXX Enhanced Sorbents' (length=35)
'number_sold' => string '6' (length=1)
'link_rewrite' => string 'brady-env100-maxx-enhanced-sorbents' (length=35)
'id_image' => string '27' (length=2)
1 =>
array
'id_product' => string '10' (length=2)
'name' => string 'Brady GP100 MAXX Enhanced Heavy Pad' (length=35)
'number_sold' => string '3' (length=1)
'link_rewrite' => string 'brady-gp100-maxx-enhanced-heavy-pad' (length=35)
'id_image' => string '29' (length=2)
array
0 =>
array
'id_product' => string '9' (length=1)
'name' => string 'Height' (length=6)
'value' => string '5' (length=1)
1 =>
array
'id_product' => string '9' (length=1)
'name' => string 'Width' (length=5)
'value' => string '5' (length=1)
2 =>
array
'id_product' => string '9' (length=1)
'name' => string 'Depth' (length=5)
'value' => string '5' (length=1)
3 =>
array
'id_product' => string '9' (length=1)
'name' => string 'Weight' (length=6)
'value' => string '5' (length=1)
4 =>
array
'id_product' => string '10' (length=2)
'name' => string 'Height' (length=6)
'value' => string '10' (length=2)
我看过很多教程,但似乎没有任何工作。我希望它看起来像
array
0 =>
array
'id_product' => string '9' (length=1)
'name' => string 'Brady ENV100 MAXX Enhanced Sorbents' (length=35)
'number_sold' => string '6' (length=1)
'link_rewrite' => string 'brady-env100-maxx-enhanced-sorbents' (length=35)
'id_image' => string '27' (length=2)
name' => string 'Height' (length=6)
'value' => string '5' (length=1)
'name' => string 'Width' (length=5)
'value' => string '5' (length=1)
'name' => string 'Depth' (length=5)
'value' => string '5' (length=1)
等等。