mirror of
https://github.com/retailcrm/prestashop-module.git
synced 2025-03-02 19:33:14 +03:00
Merge pull request #49 from Frosin/master
fixed offer's article, prices display in catalog
This commit is contained in:
commit
443ce09dd8
@ -148,9 +148,23 @@ class RetailcrmCatalog
|
|||||||
$quantity = (int) StockAvailable::getQuantityAvailableByProduct($product['id_product'], $offer['id_product_attribute']);
|
$quantity = (int) StockAvailable::getQuantityAvailableByProduct($product['id_product'], $offer['id_product_attribute']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$offerPrice = Combination::getPrice($offer['id_product_attribute']);
|
$offerCombination = new Combination($offer['id_product_attribute']);
|
||||||
|
|
||||||
|
$offerPrice = $offerCombination->price + $price;
|
||||||
$offerPrice = $offerPrice > 0 ? $offerPrice : $price;
|
$offerPrice = $offerPrice > 0 ? $offerPrice : $price;
|
||||||
|
|
||||||
|
if ($offerCombination->wholesale_price > 0) {
|
||||||
|
$offerPurchasePrice = round($offerCombination->wholesale_price, 2);
|
||||||
|
} else {
|
||||||
|
$offerPurchasePrice = $purchasePrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!empty($offerCombination->reference)) {
|
||||||
|
$offerArticle = htmlspecialchars($offerCombination->reference);
|
||||||
|
} else {
|
||||||
|
$offerArticle = $article;
|
||||||
|
}
|
||||||
|
|
||||||
$item = array(
|
$item = array(
|
||||||
'id' => $product['id_product'] . '#' . $offer['id_product_attribute'],
|
'id' => $product['id_product'] . '#' . $offer['id_product_attribute'],
|
||||||
'productId' => $product['id_product'],
|
'productId' => $product['id_product'],
|
||||||
@ -161,10 +175,10 @@ class RetailcrmCatalog
|
|||||||
'picture' => $pictures,
|
'picture' => $pictures,
|
||||||
'url' => $url,
|
'url' => $url,
|
||||||
'quantity' => $quantity > 0 ? $quantity : 0,
|
'quantity' => $quantity > 0 ? $quantity : 0,
|
||||||
'purchasePrice' => $purchasePrice,
|
'purchasePrice' => $offerPurchasePrice,
|
||||||
'price' => round($offerPrice, 2),
|
'price' => round($offerPrice, 2),
|
||||||
'vendor' => $vendor,
|
'vendor' => $vendor,
|
||||||
'article' => $article,
|
'article' => $offerArticle,
|
||||||
'weight' => $weight,
|
'weight' => $weight,
|
||||||
'dimensions' => $dimensions
|
'dimensions' => $dimensions
|
||||||
);
|
);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user