Smile-SA / elasticsuite

Smile ElasticSuite - Magento 2 merchandising and search engine built on ElasticSearch
https://elasticsuite.io
Open Software License 3.0
762 stars 339 forks source link

Filter price including Taxes (VAT) #1489

Open kevinvuillemin opened 5 years ago

kevinvuillemin commented 5 years ago

Hello,

The catalog search show the product list with prices inluding taxes, but the price filter show the values without taxes.

Do you know if is possible to show the price slider with taxes please ?

PS : In the configuration, all prices options are displayed with "include taxes". We have VAT in france ;-)

romainruaud commented 5 years ago

To be honest, there is most probably something strange on your Magento instance, probably in the taxes configurations or in the display configuration for taxes.

We are in France too, and already done a lot of projects with ElasticSuite and we never faced this issue.

Can you give us more details :

Best regards

cmuench commented 5 years ago

Possible relation to #1003

kevinvuillemin commented 5 years ago

You can see my taxes configurations and search results in the catalog :

screencapture-as-de-trefle-nc-admin-as-admin-system-config-edit-section-tax-2019-07-31-07_28_33

Sélection_008

cmuench commented 5 years ago

That's exactly what we had in one of our shops. We fixed that with a module which overwrites the price value in the index by respecting the default tax class. See PR #1003.

kevinvuillemin commented 5 years ago

Yes but we have several taxes you kow ?

cmuench commented 5 years ago

@kevinvuillemin you mean, several taxes per product?

romainruaud commented 5 years ago

I don't understand why "Catalog Prices : Excluding taxes".

Afaik we always consider that product prices are "incluging TVA" when contributing a product in the BO.

But that explain your bug, clearly, basically, we index into Elasticsearch what is stored into the catalog_product_price_index table.

So if product prices are created excluding taxes, this would lead to this table to contain excluding taxes data => will be indexed as is in Elasticsearch after.

Regards

romainruaud commented 5 years ago

I'm not a huge fan of #1003 implementation since it involves "recalculating" each product price during indexing.

I'd instead do this in javascript directly in the price slider, as we did previously for the multiple currencies : https://github.com/Smile-SA/elasticsuite/blob/2.8.x/src/module-elasticsuite-catalog/view/frontend/web/js/range-slider-widget.js#L45

cmuench commented 5 years ago

@romainruaud In most of the B2B shops, the product prices are "excluding tax". I had a discussion with some Magento developers, years ago. IMHO the price index should contain the prices with and without tax. Magento does not understand that. They are developing in their demo store with demo data and US environment which needs tax only in the checkout. I am also not a big fan of the workaround of PR #1003. It solves in our case the problem. We have prices "excluding tax" and alway a 19% tax rate. It there are multiple rates, this will not work anymore. Then we need to re-calculate the price for every product during indexing process.

Xoce51 commented 5 years ago

Hi I'm facing the same issue too :/

@romainruaud

I don't understand why "Catalog Prices : Excluding taxes".

Afaik we always consider that product prices are "incluging TVA" when contributing a product in the BO.

But that explain your bug, clearly, basically, we index into Elasticsearch what is stored into the catalog_product_price_index table.

So if product prices are created excluding taxes, this would lead to this table to contain excluding taxes data => will be indexed as is in Elasticsearch after.

Regards

I thought about setting the price "including VAT" but I was wondering if we save the product including VAT, and for some reason we need to change the amount of the VAT, the price of the product won't change and will be wrong ? (I don't know if you will follow me ;) trying to give an exemple: My product price: 100€ (incl. VAT 20%) I change the VAT to 10%, the price of the product will stay at 100€ ? That why I wonder if during the indexation we could have the both price incl. VAT and excl. VAT. For the JS solution I don't follow you. Because some product could be at 10% and other at 20% and I'm talking about store which manage B2C and B2B on the same website. Hope I'm clear enough :)

kevinvuillemin commented 4 years ago

Up please.

The b2c catalog needs a filter price with the taxes beacause we show the products all taxes included and not without taxe

yutv commented 3 years ago

Hello @romainruaud,

There are at least two projects at Smile which use the Catalog Prices = Excluding Tax configuration. Currently the https://github.com/Smile-SA/elasticsuite/pull/1003 is applied on them.

This the PR has the following disadvantages:

So there is a real demand on a proper solution without issues described above.

Just an idea - is it possible to resolve the issue by doing a king of price adjustment between filter component and elasticsearch query? For example: