View Issue Details

IDProjectCategoryView StatusLast Update
0000441OXID eShop (all versions)4.07. Source code, Testpublic2012-12-10 13:45
Reportermarco_steinhaeuser 
PriorityurgentSeveritymajorReproducibilityalways
Status resolvedResolutionfixed 
Product Version4.0.0.1 revision 14455 
Target VersionFixed in Version4.1.1 revision 18442 
Summary0000441: Variant prices are not inherited from father articles
DescriptionVariants not inherit parent article price if the variant price is = 0. In previous versions in such cases variants inherited prices from parent article.

oxarticle.php line 2842 to 2853

 

if ( $this->$name->value == 'nopic.jpg' || $this->$name->value == 'nopic_ico.jpg' || ((stristr($name, '_oxthumb') || stristr($name, '_oxicon') || stristr($name, '_oxpic') || stristr($name, '_oxzoom') ) && $this->$name->value == '')) {

            // pictures

            if ( $this->_blLoadParentData && $this->isAdmin() )

                $this->$name = clone $oParentArticle->$name;

            else {

                $aFile = explode( '/', $oParentArticle->$name->value);

                $this->$name->setValue(@$aFile[1]);

            }

        } elseif ( $this->$name->value == '' ||

                $this->$name->value == '0000-00-00 00:00:00' ||

                $this->$name->value == '0000-00-00' ||

                ( $this->$name->fldtype == 'double' && $this->$name->value == 0)

 

 

Elseif checks fldtype over the class oxfield. But it isn’t intended to check fldtype in the __get () method of oxfield.

Only value and rawvalue can be checked there. Therefore elseif doesn’t deal with oxprice.
TagsNo tags attached.
Theme
BrowserAll
PHP Version5.2.6
MySQL Version5.0.33

Activities

dainius.bigelis

2009-04-14 11:36

reporter   ~0000755

The bug revived in 4.1.0 version again.

tomas_liubinas

2009-04-15 11:13

reporter   ~0000761

Last edited: 2009-04-15 12:07

Reason for bug: normally parent values are derived to empty variant values and zero variant price was not correctly detected as "empty".

Normaly bugs should not reappear because we always make sure we have a test for the bug case. But in this case test supposed to detect the case was plain wrong. Additionally even after fixing the test it didn't work as supposed as it appeared that there is a difference in functionality between string "0" and int 0 price values, one was set in test another in shop.

After that was fixed and tests written it still didn't worked for lists. Because one thing is oxarticle object another is oxsimplevariant class used for variants in lists. It's a new class and oxsimplevariant was not caring about inherited parent values at all. It didn't need to, normally because everything what it uses for dispaly are variant own values like oxvarselect. But due to this bug it was noticed thad oxprice field value is different thing. It has to be loaded from parent even in simple variant case. So additionally protected oxsimplevariant::_getParentPrice() method was implemented.

There are still some things to note, now this method executes sql to get parent value, but as we already have parent values it would be better to set parent article for oxsimplevariant directly. That's ok, but directly we can not do that as oxsimplevariant is actually an oxlist element.

So either we loop through all elements after the list is loaded and set parent values (that's a bit performance consuming and sensless) or better we introduce oxsimplevariantlist class (extended from oxlist) with one additional method setParentArticle($sParentId) which sets parent article before list is loaded. And later the value would be passed to oxsimplevariant where we can easily get it without sql.