magentomagento2

Magento 2 different prices on page product and search results


For some reason I have for some,different prices on page product and search results. The correct one is on the product page. For example product page is 1.60 and search result page 1.20.

What I have done: I have Magento 2.4.4 Change the product price in admin,I check the catalog_product_entity_decimal table to see the changes and it is update, then I see that I have to reindex the catalog_product_price index.

Once that is done the price is updated in the catalog_product_index_price table, but when I check the _replica one (catalog_product_index_price_replica) it is not updated.

This only happends to some products.Not sure what is happening

Because this is a search result page, I am using Amasty Elastic Search


Solution

  • I figured it out,it seems that in my case , when I updated a specific third party module, there was some sort of update on the table catalog_product_index_price_tmp.

    I deleted the table and created it manually, bad mistake, this table is used for updating the catalog product index (not sure if others), it stores the information on that table and then copies its values to the _replica one, this table is always emptied when reindexing the price.

    Solution was to delele the table

    DROP TABLE `catalog_product_index_price_tmp`;
    

    And then run the setup:upgrade , this table is created by magentos db_schema.xml in this file vendor/magento/module-catalog/etc/db_schema.xml

    Hope this helps others