EmicoEcommerce / Magento2Tweakwise-archived

Magento 2 module for Tweakwise integration
Other
9 stars 25 forks source link

Only 1 recommendation rule triggered using groupcodes #100

Closed Alex-MaxServ closed 4 years ago

Alex-MaxServ commented 4 years ago

I'm trying to fire multiple recommendation rules on product pages by using groupcodes. I created 2 rules and tested them both separately. Both work fine, tried while assigning the rule and also assigning the groupcode. When assigning the same groupcode to both rules in Navigator, Navigator demoshop successfully shows items from both rules while Magento frontend only shows one of them.

Environment

Steps to reproduce

Actual result

Expected result

The power of groupcodes is to fire multiple rules and combine the results from multiple recommendation rules.

edwinljacobs commented 4 years ago

Could you specify exactly how the configuration looks in the magento backend and in the navigator? Which field do you use (i.e. crosssell or upsell or both)? I am not 100% sure on how to reproduce.

With kind regards

Alex-MaxServ commented 4 years ago

Hi Edwin,

I used both fields, I even tried them both at the same time.

In Magento: image

In Navigator I tried several situations. Here you will find the first rule. I can conform this rules works fine, while assigning the rule and/or the groupcode:

image

The second rule works fine either, using the rule name or (an unique) groupcode: image

When I assign the groupcode "alex" to both rules, I expect the result will be a combination of items from both rules. Unfortunately I only get the items from the first rule. I also tried changing the priority and maximum items.

While checking the groupcode in Navigator Demoshop, opening a product shows me both rules. Within both rules the expected items are shown.

Please let me know if you need more information! Thank you in advance for your help!

edwinljacobs commented 4 years ago

Hi,

Thanks for the info. This is indeed an issue and has to do with how the module parses the response from tweakwise. The fix will follow soon.

With kind regards

edwinljacobs commented 4 years ago

Hello we have created branch issue/100-group-code-recommendations which should fix this issue.

Could you verify if this is indeed fixes your issue? You can install this in your magento installation via composer require emico/tweakwise dev-issue/100-group-code-recommendations If this fails for some reason make sure that minimum-stability is set to dev in composer.json.

The problem is that the recommendations from the second rule override of the first set of recommendations. If all works I will merge this fix.

With kind regards.

Alex-MaxServ commented 4 years ago

Hi Edwin,

Thank you. I've tested the fix. Now I get products from both rules, so that seems to be working fine. Except the maximum/minimum products seem to be ignored.

In both rules within the groupcode, I set the max products on 5. So, when filled I would expect 5 or 10 products. In the demo shop in the first rule I see 2 products and in the seconde rule 5 products. The product detail page on the webshop shows only 4 products.

The groupcode triggers both rules, but it seems to go wrong with the amount of products returned.

edwinljacobs commented 4 years ago

Hi,

How many of those products in the demo shop are duplicates? We filter out duplicate products.

Alex-MaxServ commented 4 years ago

I can confirm there are no duplicated products showed in the demoshop.

edwinljacobs commented 4 years ago

I cannot reproduce this. Are your indices up to date? Are all the products in the demo store still available in magento under the correct id and are they visible? In my demo case I do have duplicates but after deduplication the count matches.

At the end of the line this is the query that fetches the recommendations in magento

SELECT e.*, price_index.price, price_index.tax_class_id, price_index.final_price, IF(price_index.tier_price IS NOT NULL, LEAST(price_index.min_price, price_index.tier_price), price_index.min_price) AS minimal_price, price_index.min_price, price_index.max_price, price_index.tier_price, cat_index.position AS cat_index_position, stock_status_index.stock_status AS is_salable FROM catalog_product_entity AS e INNER JOIN catalog_product_index_price AS price_index ON price_index.entity_id = e.entity_id AND price_index.website_id = '1' AND price_index.customer_group_id = 0 INNER JOIN catalog_category_product_index_store1 AS cat_index ON cat_index.product_id=e.entity_id AND cat_index.store_id=1 AND cat_index.visibility IN(2, 4) AND cat_index.category_id=2 INNER JOIN cataloginventory_stock_status AS stock_status_index ON e.entity_id = stock_status_index.product_id WHERE (e.entity_id IN(195, 1866, 872, 15, 1972, 2046, 51, 195, 195, 195, 1321, 1321, 1321, 1866, 1866, 1866, 563))

The entity_id IN (....) filter is based on the tweakwise response which can be seen in the demo shop. You should see something like 1000123 in this case the corresponding magento id is 23, the mapping from tweakwise id to magento id is explained in the documentation of tweakwise export module. https://github.com/EmicoEcommerce/Magento2TweakwiseExport (see notes on feed structure)

Alex-MaxServ commented 4 years ago

This fix, in combination with the different approach of assigning groupcodes seems to be working fine. Before, we assigned rules or groupcodes to categories in Magento. Now we only assign groupcodes to the module itself (stores-configuration-catalog-tweakwise-recommendations) as default crosssell and upsell template.

edwinljacobs commented 4 years ago

Thanks ill put it up for release.

edwinljacobs commented 4 years ago

Hello,

This has been fixed in https://github.com/EmicoEcommerce/Magento2Tweakwise/releases/tag/v2.1.7

With kind regards