You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
We came across a "bug", where sales were calculated wrongly, on a newly created site.
The product in use, has different active categories per site. Our sales are calculating the promotion based on these categories.
Site Shop EUR: Category EUR -45%
Site Shop CHF: Category CHF -45%
Site Blog: Category EUR -45%, Category CHF -45%
Now we have a different site, where products are queryied from one of the shop sites. The price, descriptions, categories are all correct. But when I query the sales, it always take that different site. That happens to have both categories. If I disable both categories for that site, there is no promotion at all.
Steps to reproduce
Create sites "A" and "B"
Create category "Site A -45%", which is only enabled on site A
Create category "Site B -45%", which is only enabled on site B
Create a product, with both categories enabled
Depending on which site you look at it, only one of the categories is active
Create 2 sales "A -45%" und "B -45%" depending on those categories
Create site "C"
Both categories should be visible in the product on that site
Now query the product on site C for site A in the Frontend and check the sales (craft.products().siteId(siteA.id).all())
Expected behavior
Only the sale, enabled for site A should be applied
Actual behavior
Sales from site C are applied
Additional information
I hotfixed vendor/craftcms/commerce/src/services/Sales.php, lines 459 and 460. It seems to work. But I am not 100% sure, if it is totally correct.
What happened?
Description
We came across a "bug", where sales were calculated wrongly, on a newly created site.
The product in use, has different active categories per site. Our sales are calculating the promotion based on these categories.
Site Shop EUR: Category EUR -45%
Site Shop CHF: Category CHF -45%
Site Blog: Category EUR -45%, Category CHF -45%
Now we have a different site, where products are queryied from one of the shop sites. The price, descriptions, categories are all correct. But when I query the sales, it always take that different site. That happens to have both categories. If I disable both categories for that site, there is no promotion at all.
Steps to reproduce
craft.products().siteId(siteA.id).all()
)Expected behavior
Only the sale, enabled for site A should be applied
Actual behavior
Sales from site C are applied
Additional information
I hotfixed
vendor/craftcms/commerce/src/services/Sales.php
, lines 459 and 460. It seems to work. But I am not 100% sure, if it is totally correct.from
to
Craft CMS version
4.5.9
Craft Commerce version
4.3.2 Pro
PHP version
8.2
Operating system and version
CentOS
Database type and version
MariaDB 10.5
Image driver and version
Installed plugins and versions
The text was updated successfully, but these errors were encountered: