update
This commit is contained in:
@@ -2346,6 +2346,15 @@ abstract class WidgetProductBase extends WidgetBase
|
|||||||
|
|
||||||
protected function getProduct($id)
|
protected function getProduct($id)
|
||||||
{
|
{
|
||||||
|
$id = (int) $id;
|
||||||
|
|
||||||
|
if (!$id || !\Db::getInstance()->getValue('
|
||||||
|
SELECT id_product FROM ' . _DB_PREFIX_ . 'product
|
||||||
|
WHERE id_product = ' . $id
|
||||||
|
)) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
$presenter = new \PrestaShop\PrestaShop\Core\Product\ProductPresenter(
|
$presenter = new \PrestaShop\PrestaShop\Core\Product\ProductPresenter(
|
||||||
new \PrestaShop\PrestaShop\Adapter\Image\ImageRetriever($this->context->link),
|
new \PrestaShop\PrestaShop\Adapter\Image\ImageRetriever($this->context->link),
|
||||||
$this->context->link,
|
$this->context->link,
|
||||||
@@ -2362,7 +2371,7 @@ abstract class WidgetProductBase extends WidgetBase
|
|||||||
$assembledProduct,
|
$assembledProduct,
|
||||||
$this->context->language
|
$this->context->language
|
||||||
) : false;
|
) : false;
|
||||||
} catch (\Exception $ex) {
|
} catch (\Throwable $ex) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2402,9 +2411,9 @@ abstract class WidgetProductBase extends WidgetBase
|
|||||||
if ('rand' === $order_by) {
|
if ('rand' === $order_by) {
|
||||||
shuffle($products);
|
shuffle($products);
|
||||||
}
|
}
|
||||||
foreach ($products as &$product) {
|
foreach ($products as $product) {
|
||||||
if ($product['id'] && $product = $this->getProduct($product['id'])) {
|
if (!empty($product['id']) && $presentedProduct = $this->getProduct($product['id'])) {
|
||||||
$tpls[] = $product;
|
$tpls[] = $presentedProduct;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user