Merge pull request #49 from Frosin/master

fixed offer's article, prices display in catalog
This commit is contained in:
Alex Lushpai 2019-08-23 11:05:38 +03:00 committed by GitHub
commit 443ce09dd8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -148,9 +148,23 @@ class RetailcrmCatalog
$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;
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(
'id' => $product['id_product'] . '#' . $offer['id_product_attribute'],
'productId' => $product['id_product'],
@ -161,10 +175,10 @@ class RetailcrmCatalog
'picture' => $pictures,
'url' => $url,
'quantity' => $quantity > 0 ? $quantity : 0,
'purchasePrice' => $purchasePrice,
'purchasePrice' => $offerPurchasePrice,
'price' => round($offerPrice, 2),
'vendor' => $vendor,
'article' => $article,
'article' => $offerArticle,
'weight' => $weight,
'dimensions' => $dimensions
);