-
-
Notifications
You must be signed in to change notification settings - Fork 52
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #83 from lovata/develop
Release version 1.9.0
- Loading branch information
Showing
54 changed files
with
1,450 additions
and
1,462 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,54 +8,28 @@ | |
/** | ||
* Class BrandCollection | ||
* @package Lovata\Shopaholic\Classes\Collection | ||
* @author Andrey Kharanenka, [email protected], LOVATA Group | ||
* @author Andrey Kharanenka, [email protected], LOVATA Group | ||
* | ||
* @see \Lovata\Shopaholic\Tests\Unit\Collection\BrandCollectionTest | ||
* @link https://github.com/lovata/oc-shopaholic-plugin/wiki/BrandCollection | ||
* @see \Lovata\Shopaholic\Tests\Unit\Collection\BrandCollectionTest | ||
* @link https://github.com/lovata/oc-shopaholic-plugin/wiki/BrandCollection | ||
* | ||
* Search for Shopaholic, Sphinx for Shopaholic | ||
* @method $this search(string $sSearch) | ||
*/ | ||
class BrandCollection extends ElementCollection | ||
{ | ||
/** @var BrandListStore */ | ||
protected $obBrandListStore; | ||
|
||
/** | ||
* BrandCollection constructor. | ||
* @param BrandListStore $obBrandListStore | ||
*/ | ||
public function __construct(BrandListStore $obBrandListStore) | ||
{ | ||
$this->obBrandListStore = $obBrandListStore; | ||
parent::__construct(); | ||
} | ||
const ITEM_CLASS = BrandItem::class; | ||
|
||
/** | ||
* Sort list | ||
* @return $this | ||
*/ | ||
public function sort() | ||
{ | ||
if (!$this->isClear() && $this->isEmpty()) { | ||
return $this->returnThis(); | ||
} | ||
|
||
//Get sorting list | ||
$arResultIDList = $this->obBrandListStore->getBySorting(); | ||
if (empty($arResultIDList)) { | ||
return $this->clear(); | ||
} | ||
|
||
if ($this->isClear()) { | ||
$this->arElementIDList = $arResultIDList; | ||
$arResultIDList = BrandListStore::instance()->sorting->get(); | ||
|
||
return $this->returnThis(); | ||
} | ||
|
||
$this->arElementIDList = array_intersect($arResultIDList, $this->arElementIDList); | ||
|
||
return $this->returnThis(); | ||
return $this->applySorting($arResultIDList); | ||
} | ||
|
||
/** | ||
|
@@ -65,7 +39,7 @@ public function sort() | |
*/ | ||
public function active() | ||
{ | ||
$arResultIDList = $this->obBrandListStore->getActiveList(); | ||
$arResultIDList = BrandListStore::instance()->active->get(); | ||
|
||
return $this->intersect($arResultIDList); | ||
} | ||
|
@@ -78,21 +52,8 @@ public function active() | |
*/ | ||
public function category($iCategoryID) | ||
{ | ||
$arResultIDList = $this->obBrandListStore->getByCategory($iCategoryID); | ||
$arResultIDList = BrandListStore::instance()->category->get($iCategoryID); | ||
|
||
return $this->intersect($arResultIDList); | ||
} | ||
|
||
/** | ||
* Make element item | ||
* @see \Lovata\Shopaholic\Tests\Unit\Collection\BrandCollectionTest::testCollectionItem() | ||
* @param int $iElementID | ||
* @param \Lovata\Shopaholic\Models\Brand $obElement | ||
* | ||
* @return BrandItem | ||
*/ | ||
protected function makeItem($iElementID, $obElement = null) | ||
{ | ||
return BrandItem::make($iElementID, $obElement); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.