aa
This commit is contained in:
@@ -998,24 +998,33 @@ class ArticleFormatter
|
|||||||
|
|
||||||
private static function getStockInfo($product)
|
private static function getStockInfo($product)
|
||||||
{
|
{
|
||||||
if (!$product) {
|
try {
|
||||||
return [
|
if (!$product) {
|
||||||
'stock_quantity' => 0,
|
return [
|
||||||
'quantity' => 0,
|
'stock_quantity' => 0,
|
||||||
'price' => '',
|
'quantity' => 0,
|
||||||
'color' => 'black',
|
'price' => '',
|
||||||
'permalink' => ''
|
'color' => 'black',
|
||||||
];
|
'permalink' => ''
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (isset($product['stock_quantity'])) {
|
||||||
|
$quantity = intval($product['stock_quantity']);
|
||||||
|
}
|
||||||
|
|
||||||
|
$price = '0';
|
||||||
|
if (isset($product['price'])) {
|
||||||
|
$price = $product['price'];
|
||||||
|
}
|
||||||
|
if (isset($product['sale_price'])) {
|
||||||
|
$price = $product['sale_price'];
|
||||||
|
}
|
||||||
|
|
||||||
|
} catch (e) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($product['stock_quantity'])) {
|
|
||||||
$quantity = intval($product['stock_quantity']);
|
|
||||||
}
|
|
||||||
$price = $product['price'];
|
|
||||||
if (isset($product['sale_price'])) {
|
|
||||||
$price = $product['sale_price'];
|
|
||||||
}
|
|
||||||
|
|
||||||
return [
|
return [
|
||||||
'quantity' => $quantity,
|
'quantity' => $quantity,
|
||||||
'price' => $price,
|
'price' => $price,
|
||||||
@@ -1159,7 +1168,7 @@ class ArticleFormatter
|
|||||||
return $item->value;
|
return $item->value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Restituisce null se non trovato
|
// Restituisce null se non trovato
|
||||||
return null;
|
return null;
|
||||||
} catch (Exception $e) {
|
} catch (Exception $e) {
|
||||||
|
|||||||
Reference in New Issue
Block a user