View Issue Details

IDProjectCategoryView StatusLast Update
0006970OXID eShop (all versions)4. ------ eShop Core -------public2024-06-12 16:07
Reporterm4r73n Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionno change required 
Product Version6.1.2 
Summary0006970: Article->hasAmountPrice() returns the wrong result
DescriptionArticle->hasAmountPrice() returns if there is *any* article in the shop that has an amount price defined.
It should return if *this article* has an amount price defined.

The reason is that there's a WHERE missing in the SQL query: $sQ = "SELECT 1 FROM `oxprice2article` LIMIT 1";
It should be: $sQ = "SELECT 1 FROM `oxprice2article` WHERE `oxartid` = '" . $this->getId() . "'LIMIT 1";
TagsArticle, Solution Provided
ThemeNot defined
BrowserNot defined
PHP VersionNot defined
Database VersionNot defined

Activities

SvenBrunk

2024-06-12 16:07

administrator   ~0017031

@m4r73n: We can think of many cases where this would harm performance, but of no use case where this would help anything.
This query should be very fast to resolve (it does only read the first line on the table no matter how big it is and not even the fields, so it also doesn't matter if it was blown up to many columns) and the result is cached within the Request.
If we on the other hand add the current article to the query, it now instantly matters how big the table is. Since this is only a flag that tells the shop if it needs to read the actual data, this could only matter if you have few lines of this in the database. And at that point the query for the actual data should also be fast as the table is small anyway.

If we are missing anything, please feel free to re-open the ticket with more information about what you are trying to achieve.