diff --git a/classes/item/PromoBlockItem.php b/classes/item/PromoBlockItem.php index c54dfd4c..a92164d6 100644 --- a/classes/item/PromoBlockItem.php +++ b/classes/item/PromoBlockItem.php @@ -34,17 +34,6 @@ class PromoBlockItem extends ElementItem /** @var PromoBlock */ protected $obElement = null; - /** - * Get product collection attribute - * @return ProductCollection - */ - protected function getProductAttribute() : ProductCollection - { - $obProductList = ProductCollection::make()->promo($this->id); - - return $obProductList; - } - /** * Returns URL of a promo block page. * @@ -81,4 +70,15 @@ public function getPageParamList($sPageCode) : array return $arPageParamList; } + + /** + * Get product collection attribute + * @return ProductCollection + */ + protected function getProductAttribute() : ProductCollection + { + $obProductList = ProductCollection::make()->promo($this->id); + + return $obProductList; + } } diff --git a/classes/store/offer/SortingListStore.php b/classes/store/offer/SortingListStore.php index fd90886a..e5de58d2 100644 --- a/classes/store/offer/SortingListStore.php +++ b/classes/store/offer/SortingListStore.php @@ -1,5 +1,6 @@ sValue == OfferListStore::SORT_PRICE_ASC) { - $arElementIDList = $this->getByPriceASC(); - } elseif ($this->sValue == OfferListStore::SORT_PRICE_DESC) { - $arElementIDList = $this->getByPriceDESC(); - } elseif ($this->sValue == OfferListStore::SORT_NEW) { - $arElementIDList = $this->getNewOfferList(); - } elseif ($this->sValue == OfferListStore::SORT_NO) { - $arElementIDList = $this->getOfferList(); - } elseif (preg_match('%^'.OfferListStore::SORT_PRICE_ASC.'\|.+%', $this->sValue)) { - $arElementIDList = $this->getByPriceTypeASC(); - } elseif (preg_match('%^'.OfferListStore::SORT_PRICE_DESC.'\|.+%', $this->sValue)) { - $arElementIDList = $this->getByPriceTypeDESC(); - } else { - $arElementIDList = $this->getCustomSortingList(); - } + if ($this->sValue == OfferListStore::SORT_PRICE_ASC) { + $arElementIDList = $this->getByPriceASC(); + } elseif ($this->sValue == OfferListStore::SORT_PRICE_DESC) { + $arElementIDList = $this->getByPriceDESC(); + } elseif ($this->sValue == OfferListStore::SORT_NEW) { + $arElementIDList = $this->getNewOfferList(); + } elseif ($this->sValue == OfferListStore::SORT_NO) { + $arElementIDList = $this->getOfferList(); + } elseif (preg_match('%^'.OfferListStore::SORT_PRICE_ASC.'\|.+%', $this->sValue)) { + $arElementIDList = $this->getByPriceTypeASC(); + } elseif (preg_match('%^'.OfferListStore::SORT_PRICE_DESC.'\|.+%', $this->sValue)) { + $arElementIDList = $this->getByPriceTypeDESC(); + } else { + $arElementIDList = $this->getCustomSortingList(); + } return $arElementIDList; } @@ -72,10 +73,15 @@ protected function getCustomSortingList() : array */ protected function getByPriceASC() : array { - $arElementIDList = (array) Price::getByItemType(Offer::class) - ->whereNull('price_type_id') - ->orderBy('price', 'asc') - ->lists('item_id'); + $arElementIDList = (array) DB::table('lovata_shopaholic_prices') + ->select('lovata_shopaholic_offers.id') + ->whereNull('lovata_shopaholic_prices.price_type_id') + ->where('lovata_shopaholic_offers.active', true) + ->whereNull('lovata_shopaholic_offers.deleted_at') + ->where('lovata_shopaholic_prices.item_type', Offer::class) + ->orderBy('lovata_shopaholic_prices.price', 'asc') + ->join('lovata_shopaholic_offers', 'lovata_shopaholic_offers.id', '=', 'lovata_shopaholic_prices.item_id') + ->lists('id'); return $arElementIDList; } @@ -86,10 +92,15 @@ protected function getByPriceASC() : array */ protected function getByPriceDESC() : array { - $arElementIDList = (array) Price::getByItemType(Offer::class) - ->whereNull('price_type_id') - ->orderBy('price', 'desc') - ->lists('item_id'); + $arElementIDList = (array) DB::table('lovata_shopaholic_prices') + ->select('lovata_shopaholic_offers.id') + ->whereNull('lovata_shopaholic_prices.price_type_id') + ->where('lovata_shopaholic_offers.active', true) + ->whereNull('lovata_shopaholic_offers.deleted_at') + ->where('lovata_shopaholic_prices.item_type', Offer::class) + ->orderBy('lovata_shopaholic_prices.price', 'desc') + ->join('lovata_shopaholic_offers', 'lovata_shopaholic_offers.id', '=', 'lovata_shopaholic_prices.item_id') + ->lists('id'); return $arElementIDList; } diff --git a/classes/store/product/SortingListStore.php b/classes/store/product/SortingListStore.php index 6b5f19d6..e42bae6d 100644 --- a/classes/store/product/SortingListStore.php +++ b/classes/store/product/SortingListStore.php @@ -79,6 +79,7 @@ protected function getByPriceASC() : array ->select('lovata_shopaholic_offers.product_id') ->whereNull('lovata_shopaholic_prices.price_type_id') ->where('lovata_shopaholic_offers.active', true) + ->whereNull('lovata_shopaholic_offers.deleted_at') ->where('lovata_shopaholic_prices.item_type', Offer::class) ->orderBy('lovata_shopaholic_prices.price', 'asc') ->join('lovata_shopaholic_offers', 'lovata_shopaholic_offers.id', '=', 'lovata_shopaholic_prices.item_id') @@ -100,6 +101,7 @@ protected function getByPriceDESC() : array ->select('lovata_shopaholic_offers.product_id') ->whereNull('lovata_shopaholic_prices.price_type_id') ->where('lovata_shopaholic_offers.active', true) + ->whereNull('lovata_shopaholic_offers.deleted_at') ->where('lovata_shopaholic_prices.item_type', Offer::class) ->orderBy('lovata_shopaholic_prices.price', 'desc') ->join('lovata_shopaholic_offers', 'lovata_shopaholic_offers.id', '=', 'lovata_shopaholic_prices.item_id') diff --git a/components/Breadcrumbs.php b/components/Breadcrumbs.php index b801de14..fc3c53d3 100644 --- a/components/Breadcrumbs.php +++ b/components/Breadcrumbs.php @@ -10,6 +10,7 @@ * Class Breadcrumbs * @package Lovata\Shopaholic\Components * @author Andrey Kharanenka, a.khoronenko@lovata.com, LOVATA Group + * @deprecated * * @link https://github.com/lovata/oc-shopaholic-plugin/wiki/Breadcrumbs */ diff --git a/updates/version.yaml b/updates/version.yaml index ebb8675c..dd3778fd 100644 --- a/updates/version.yaml +++ b/updates/version.yaml @@ -97,4 +97,6 @@ 1.22.2: - 'Added "deactivate" fields to config of XmlImportSettings model.' 1.22.3: - - 'Fixed attaching of children categories to parent category in script of import from XML.' \ No newline at end of file + - 'Fixed attaching of children categories to parent category in script of import from XML.' +1.22.4: + - 'Removed deleted offers from sorting by price.' \ No newline at end of file