update
This commit is contained in:
@@ -2346,6 +2346,15 @@ abstract class WidgetProductBase extends WidgetBase
|
||||
|
||||
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(
|
||||
new \PrestaShop\PrestaShop\Adapter\Image\ImageRetriever($this->context->link),
|
||||
$this->context->link,
|
||||
@@ -2362,7 +2371,7 @@ abstract class WidgetProductBase extends WidgetBase
|
||||
$assembledProduct,
|
||||
$this->context->language
|
||||
) : false;
|
||||
} catch (\Exception $ex) {
|
||||
} catch (\Throwable $ex) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -2402,9 +2411,9 @@ abstract class WidgetProductBase extends WidgetBase
|
||||
if ('rand' === $order_by) {
|
||||
shuffle($products);
|
||||
}
|
||||
foreach ($products as &$product) {
|
||||
if ($product['id'] && $product = $this->getProduct($product['id'])) {
|
||||
$tpls[] = $product;
|
||||
foreach ($products as $product) {
|
||||
if (!empty($product['id']) && $presentedProduct = $this->getProduct($product['id'])) {
|
||||
$tpls[] = $presentedProduct;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user