Код: Выделить всё
$id_lang=Configuration::get('PS_LANG_DEFAULT');
$id_products = array(2,3,4,6,7);
$all_products = array();
foreach ($id_products as $id_product ) {
$product_id = $id_product;
$link = new Link();
$image = Image::getCover($product_id);
$url = $link->getProductLink($product_id);
$product = new Product($product_id);
$imagePath = Link::getImageLink($product->link_rewrite, $image['id_image'], 'home_default');
array_push($all_products, $product);
}
$this->context->smarty->assign(
array(
'all_products' => $all_products,
'lang_id' => $id_lang,
'url' => $url,
)
);
Код: Выделить всё
[list]
{foreach from=$all_products item=product name=product}
[url={$url}]name|escape:'html':'UTF-8'}" itemprop="url">
[/url]
{/foreach}
[/list]
Подробнее здесь: https://stackoverflow.com/questions/383 ... duct-id-in
Мобильная версия