Skip to content

Commit

Permalink
Merge pull request #193 from oc-shopaholic/develop
Browse files Browse the repository at this point in the history
Release version 1.22.4
  • Loading branch information
kharanenka authored Jun 21, 2019
2 parents d8b0f3c + bf68f80 commit 2d32371
Show file tree
Hide file tree
Showing 5 changed files with 51 additions and 35 deletions.
22 changes: 11 additions & 11 deletions classes/item/PromoBlockItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down Expand Up @@ -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;
}
}
57 changes: 34 additions & 23 deletions classes/store/offer/SortingListStore.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?php namespace Lovata\Shopaholic\Classes\Store\Offer;

use DB;
use Event;
use Lovata\Toolbox\Classes\Store\AbstractStoreWithParam;

Expand All @@ -23,21 +24,21 @@ class SortingListStore extends AbstractStoreWithParam
*/
protected function getIDListFromDB() : array
{
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();
}
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;
}
Expand Down Expand Up @@ -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;
}
Expand All @@ -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;
}
Expand Down
2 changes: 2 additions & 0 deletions classes/store/product/SortingListStore.php
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand All @@ -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')
Expand Down
1 change: 1 addition & 0 deletions components/Breadcrumbs.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
* Class Breadcrumbs
* @package Lovata\Shopaholic\Components
* @author Andrey Kharanenka, [email protected], LOVATA Group
* @deprecated
*
* @link https://github.com/lovata/oc-shopaholic-plugin/wiki/Breadcrumbs
*/
Expand Down
4 changes: 3 additions & 1 deletion updates/version.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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.'
- 'Fixed attaching of children categories to parent category in script of import from XML.'
1.22.4:
- 'Removed deleted offers from sorting by price.'

0 comments on commit 2d32371

Please sign in to comment.