Skip to content

Commit

Permalink
1.1.6: #5
Browse files Browse the repository at this point in the history
  • Loading branch information
dmitrii-fediuk committed Nov 22, 2019
1 parent 22c1067 commit d671c40
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
9 changes: 8 additions & 1 deletion Controller/Response/Catalog.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ function execute() {return R::p(function() {
$pc->addAttributeToFilter('visibility', ['in' => [
V::VISIBILITY_BOTH, V::VISIBILITY_IN_CATALOG, V::VISIBILITY_IN_SEARCH
]]);
/**
* 2019-11-22
* @uses \Magento\Catalog\Model\ResourceModel\Product\Collection::addMediaGalleryData() loads the collection,
* so we should apply filters before it, not after.
* «Filters do not work for `catalog`»: https://github.com/justuno-com/m2/issues/5
*/
Filter::p($pc);
$pc->addMediaGalleryData(); // 2019-11-20 https://magento.stackexchange.com/a/228181
$brand = df_cfg('justuno_settings/options_interface/brand_attribute'); /** @var string $brand */
return array_values(array_map(function(P $p) use($brand) { /** @var array(string => mixed) $r */
Expand Down Expand Up @@ -127,6 +134,6 @@ function execute() {return R::p(function() {
* https://www.upwork.com/messages/rooms/room_e6b2d182b68bdb5e9bf343521534b1b6/story_4e29dacff68f2d918eff2f28bb3d256c
*/
return $r + ['BrandId' => $brand, 'BrandName' => !$brand ? null : ($p->getAttributeText($brand) ?: null)];
}, Filter::p($pc)->getItems()));
}, $pc->getItems()));
});}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "justuno.com/m2"
,"version": "1.1.5"
,"version": "1.1.6"
,"description": "Justuno module for Magento 2"
,"type": "magento2-module"
,"homepage": "https://github.com/justuno-com/m2"
Expand Down

0 comments on commit d671c40

Please sign in to comment.