View Issue Details

IDProjectCategoryView StatusLast Update
0002435OXID eShop (all versions)4.05. Performancepublic2012-12-10 13:29
Reportertjungcl 
PriorityhighSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version4.4.7 revision 33396 
Target VersionFixed in Version4.5.2 revision 38481 
Summary0002435: Rangeprice calculation unneccessary costy, especially annoying in admin
Description(Also in all earlier versions of oxid).

The function
_applyRangePrice
is called for every article in any article-list.

Even if loadVariants is OFF, this function loads all variants, loads the prices for the variants, calculates the minimum and maximum price.

When all that is done, it checks, if loadVariants is OFF and if so, it throws away all the variant-loading-results and loads the min-price from oxvarminprice.

-->

The blLoadVariants check should absolutly be moved above the loading of all variants.

Plus you should consider to store the "isRangePrice" information in the oxarticle-table. It would be calculated and updated in the _onChangeUpdateMinVarPrice function - this would also spare a lot of variant-loading.

Also see https://bugs.oxid-esales.com/view.php?id=2388
Additional Informationminor issue:
calculating the min and max of arrayvalues can be done by using phps native functions min and max.

So, you can replace the loop

            $dMinPrice = $aPrices[0];
            $dMaxPrice = $aPrices[0];
            foreach ($aPrices as $dPrice) {
                if ($dMinPrice > $dPrice) {
                    $dMinPrice = $dPrice;
                }

                if ($dMaxPrice < $dPrice) {
                    $dMaxPrice = $dPrice;
                }
            }

with
            $dMinPrice = min($aPrices);
            $dMaxPrice = max($aPrices);
TagsPerformance
Theme
BrowserAll
PHP Versionany
Database Versionany

Relationships

related to 0002388 resolvedLinas Kukulskis bad performance and even crashes when loading long variant-list in admin 

Activities

tjungcl

2011-01-24 14:04

reporter   ~0004010

the function getVariants checks if loadVariants is true (else it doesnt load variants), but only when isAdmin is false - so if in admin, the rangeprice-calculation indeed loads all variants vor all articles in list.

Linas Kukulskis

2011-08-02 15:42

reporter   ~0004913

1. uzed min max functions
2. The blLoadVariants check moved above the loading of all variants.
3. added skip, from now calculates range price only for parent articles (for variants its skips)