cancel
Showing results for 
Search instead for 
Did you mean: 

Product in Website issue

Product in Website issue

I have set up websites in a multi-site setup so that they share products, but a few websites don't carry certain colors.  For those websites, I've not added configurations for those colors.   So

 

Product configuration A is on websites 1,2,3

Product configuration B is on websites 1,3.

 

My issue is that website 2 is showing both A and B.  Is there a reason that option is showing up? I have made sure cron is running, redeployed static content, cleared cache, and also manually did a full reindex.  Still no luck getting those options to disappear.

 

I had asked earlier if it was possible to not show product colors using this method and they said it was possible, can you tell me what I'm doing wrong?

 

Oddly enough, if I got to a product on store #2, clear cache, and load that page first, it shows the correct color options, but all other products still have the original issue.  It's almost like its getting the data for the main store.

9 REPLIES 9

Re: Product in Website issue

Just to clarify futher

 

Configuration B only has sites 1, 3 checked in its 'Product in websites' section (and this is correctly reflected in the product grid.

 

I also checked the 'catalog_product_website' table and configuration B is correctly not listed in there for website 2.  Is there another database table I can check to see why it's showing up there?

Re: Product in Website issue

Hello @joseph_digiovanna

 

Please check once indexing table "index_state", that indexing is done properly or not. Also refresh cache once.

Manish Mittal
https://www.manishmittal.com/

Re: Product in Website issue

Hey Manish,

 

I don't have an index_state table in the database.  This is Magento EE 2.2.5 + MySQL if that's helpful.

 

mysql> select * from index_state;

ERROR 1146 (42S02): Table 'magento.index_state' doesn't exist

 

For indexer state though, I have:

 

php bin/magento indexer:status
+---------------------------------+--------+-----------+-----------------+------------------+
| Title                           | Status | Update On | Schedule Status | Schedule Updated |
+---------------------------------+--------+-----------+-----------------+------------------+
| Amasty Related Products         | Ready  | Save      |                 |                  |
| Amasty: Search Pro - Categories | Ready  | Save      |                 |                  |
| Catalog Product Rule            | Ready  | Save      |                 |                  |
| Catalog Rule Product            | Ready  | Save      |                 |                  |
| Catalog Search                  | Ready  | Save      |                 |                  |
| Category Products               | Ready  | Save      |                 |                  |
| Content Manager Search          | Ready  | Save      |                 |                  |
| Customer Grid                   | Ready  | Save      |                 |                  |
| Design Config Grid              | Ready  | Save      |                 |                  |
| Product Categories              | Ready  | Save      |                 |                  |
| Product EAV                     | Ready  | Save      |                 |                  |
| Product Price                   | Ready  | Save      |                 |                  |
| Product/Target Rule             | Ready  | Save      |                 |                  |
| Sales Rule                      | Ready  | Save      |                 |                  |
| Stock                           | Ready  | Save      |                 |                  |
| Target Rule/Product             | Ready  | Save      |                 |                  |
+---------------------------------+--------+-----------+-----------------+------------------+

I'm in development mode with all caching / bundling / minifying disabled, so I don't think those things are the issue.  What information can I provide to help figure out what's going wrong?

Re: Product in Website issue

I also ran the following :

 

php bin/magento setup:upgrade

php bin/magento setup:di:compile

php bin/magento setup:static-content:deploy -f

php bin/magento indexer:reindex

php bin/magento cache:clean

 

Just to be safe

Re: Product in Website issue

It appears that part of this is caching related.  On the product page specifically, if I disable all caching the product color swatches only list the 2 correctly available for that product on a store.  If I enable all caching, it shows all 6 possible colors available on the main store.

 

Please let me know if this helps anything, this is a significant issue for us.

Re: Product in Website issue

Interestingly enough, with caching enabled, the layered navigation still correctly shows the possible color options.  It's the list view of the product and the product page itself that have the wrong options when caching is enabled.

 

When caching is disabled entirely, the layered navigation and the product page itself are correct, but the list view is still incorrect.

Re: Product in Website issue

Okay, sorry for the rapid set of messages, may have made some progress.  Can this be related to color being a global attribute?  I'd like to keep color global so it can be used for configurations and for layered navigation.

 

We're using the 'Product in Websites' section to remove specific configurations from certain websites.  My understanding was that this would hide the swatch if all products with that color were not part of that website.  Can someone verify if this is supposed to be the case and if anything else needs to be done to get that effect?

 

Re: Product in Website issue

Again, more interesting information.  I don't think this has to do with color being a global attribute, but instead perhaps something to do with the list / grid view swatches.

 

Right now, if I load the product page first after clearing cache, the swatches are correct.  If I then load the grid view, the swatches for that particular item are correct (looks like it's cached).  At all points, the layered navigation swatch options appear to be correct.

 

If I load the grid view first after clearing cache, the swatches for that item are incorrect, and then the swatches in the product view if reloaded are incorrect (I'm guessing because it was cached from the list / grid view).

 

I'll keep trying to pinpoint it.

Re: Product in Website issue

Okay, I've managed to figure out the cause I believe.  It seems as though in some cases (primarily on the grid view) the getConfigurableOptionsIds function inside module-swatches Configurable.php file doesn't filter things out based upon a product configuration existing in a store.

 

Because it wasn't filtering, all available colors would show up in that case.  This wasn't an issue on the product page so if it cached it there first, it would look correct on the grid view as well for that specific item.

 

I added a test in the innermost loop before adding the attribute code to the list of ids, that (if the attribute is "color" specifically) it will filter it by the websites the product in the outermost loop is in.  This test appears to fix all my issues.  I'm going to examen any potential side effects of this, but hopefully having this information is useful to you.