mirror of
https://github.com/retailcrm/opencart-module.git
synced 2024-11-21 20:56:07 +03:00
Merge pull request #156 from Neur0toxine/master
[fix] Исправление некорректной загрузки акционных цен
This commit is contained in:
commit
93bacf9b7b
@ -1,3 +1,6 @@
|
||||
## v.3.3.4
|
||||
* Исправлен баг с некорректной выгрузкой акционных цен для товаров с характеристиками
|
||||
|
||||
## v.3.3.3
|
||||
* Добавлено удаление типа цены товара для неустановленных акционных цен
|
||||
|
||||
|
@ -67,19 +67,19 @@ class ModelExtensionRetailcrmPrices extends Model
|
||||
foreach ($products as $product) {
|
||||
$specials = $this->model_catalog_product->getProductSpecials($product['product_id']);
|
||||
|
||||
if (!$specials) {
|
||||
if ($specials) {
|
||||
$productPrice = array();
|
||||
|
||||
if (is_array($specials) && count($specials)) {
|
||||
$productPrice = $this->getSpecialPrice($specials);
|
||||
}
|
||||
|
||||
$prices = array_merge($this->getPriceRequest($product, $site, $productPrice), $prices);
|
||||
} else {
|
||||
$productPrice = $this->getEmptyPrice();
|
||||
$prices[] = $this->getPriceRequest($product, $site, $productPrice);
|
||||
$prices = array_merge($prices, $this->getPriceRequest($product, $site, $productPrice));
|
||||
continue;
|
||||
}
|
||||
|
||||
$productPrice = array();
|
||||
|
||||
if (is_array($specials) && count($specials)) {
|
||||
$productPrice = $this->getSpecialPrice($specials);
|
||||
}
|
||||
|
||||
$prices[] = $this->getPriceRequest($product, $site, $productPrice);
|
||||
}
|
||||
|
||||
return $prices;
|
||||
@ -97,7 +97,7 @@ class ModelExtensionRetailcrmPrices extends Model
|
||||
private function getPriceRequest($product, $site, $productPrice)
|
||||
{
|
||||
$offers = $this->retailcrm->getOffers($product);
|
||||
$pricesProduct = array();
|
||||
$pricesProducts = array();
|
||||
|
||||
foreach ($offers as $optionsString => $optionsValues) {
|
||||
$optionsString = explode('_', $optionsString);
|
||||
@ -139,14 +139,14 @@ class ModelExtensionRetailcrmPrices extends Model
|
||||
}
|
||||
}
|
||||
|
||||
$pricesProduct = array(
|
||||
$pricesProducts[] = array(
|
||||
'externalId' => $offerId ? $product['product_id'] . '#' . $offerId : $product['product_id'],
|
||||
'site' => $site,
|
||||
'prices' => $price
|
||||
);
|
||||
}
|
||||
|
||||
return $pricesProduct;
|
||||
return $pricesProducts;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -63,7 +63,7 @@ class ModelRetailcrmPricesAdminTest extends OpenCartTest
|
||||
$this->assertEquals('special2', $price['prices'][1]['code']);
|
||||
$this->assertEquals('special3', $price['prices'][2]['code']);
|
||||
$this->assertFalse($price['prices'][0]['remove']);
|
||||
$this->assertFalse($price['prices'][1]['remove']);
|
||||
$this->assertNotFalse($price['prices'][1]['remove']);
|
||||
$this->assertNotFalse($price['prices'][2]['remove']);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user