aimeos / aimeos-core

Aimeos PHP e-commerce framework for ultra fast online shops, scalable marketplaces, complex B2B applications and #gigacommerce
https://aimeos.org
Other
3.26k stars 112 forks source link

Category coupon decorator: Count basket items only once #294

Closed nvindice closed 2 years ago

nvindice commented 2 years ago

When using the Category coupon decorator in only mode on basket items which belong to multiple allowed categories, their value was reduced multiple times.

aimeos commented 2 years ago

Thank you for your PR!

The most important statement seems to be this one: unset( $prodIds[$listItem->getRefId()] ); Why did you replace the foreach with a while loop?

nvindice commented 2 years ago

Exactly, the unset does the work. However, I needed to remove the slice from the original filter (because otherwise too less items are fetched). The default slice size of 100 results could be too small with a big basket or in shops where items belong to many categories simultaneously. I did not want to guess a number of item<->category relations that would be a good limit, so I used the while loop.

aimeos commented 2 years ago

OK, understood. There are two minor coding style issues and we can merge your PR if you fix them.

nvindice commented 2 years ago

Yeah well, I used the original code including at least one of the style issues ;-) Fixed it.

aimeos commented 2 years ago

Thanks a lot!

nvindice commented 2 years ago

Could you please tag a new version soon? This IMO is a serious bug which leads to basket miscalculation. Thank you!

aimeos commented 2 years ago

Tagged now (2021.10.21)

nvindice commented 2 years ago

Thanks a lot!