m2.SmartCategory icon indicating copy to clipboard operation
m2.SmartCategory copied to clipboard

Problem showing configurable items correctly

Open brosenberger opened this issue 6 years ago • 1 comments

Precondition

  • additionally module https://github.com/karliuka/m2.SmartCategoryConfigurable installed
  • create category with special price filter and option replace on configurable set to true
  • create a configurable (visibility catalog, search) with multiple configurated simple products (visibility individually not visible)

Action

  • add special price for one of the simple products of the configurable

Expected

  • the configurable product is shown in the given smart category in the frontend

Result

  • the configurable product is not shown in the given smart category

Current findings

  • within the catalog_product_category table only the simple product is added to the smart category and therefor the normal category_product_indexer does not add it to the index as the simple product is not visible individually
  • the arrays $postedProducts and $matchingProducts (\Faonni\SmartCategory\Model\Indexer\IndexBuilder::updateRuleProductData) differ but deleteIds and insertIds are both empty to due the array_diff method (both product arrays have the following structure: [productId1 => 1, productId2 => 1, ... ]. Therefore i think the correct solution would be to change the php method array_diff with array_diff_key to gain the differences in both arrays in https://github.com/karliuka/m2.SmartCategory/blob/7b97acb9bb183dc0bfd545df6b38eded3f0ed400/Model/Indexer/IndexBuilder.php#L299 but i am not quite sure if the current check was intentional

brosenberger avatar Sep 19 '18 09:09 brosenberger

I see that he made an extension for that: https://github.com/karliuka/m2.SmartCategoryConfigurable

pinguluk avatar Feb 28 '19 13:02 pinguluk