View Issue Details

IDProjectCategoryView StatusLast Update
0003213OXID eShop (all versions)4.05. Performancepublic2012-12-10 13:29
Reporterwanis 
PrioritynormalSeverityminorReproducibilityalways
Status resolvedResolutionfixed 
Product Version4.3.0 revision 26948 
Target VersionFixed in Version4.5.3 revision 39087 
Summary0003213: oxArticle::getManufacturerId is useless for CE and PE versions
Descriptionthis function using additional SQL check for getting is manufacturer belongs to the same shop.
if manufacturer is not active or dont exists, its checked in oxArticle::getManufacturer
$oManufacturer->load( $sManufacturerId )
and
$oManufacturer = $oManufacturer->oxmanufacturers__oxactive->value ? $oManufacturer : null;

we should leave it for extendability, but no checking logic here.

For EE versions, this function could be unchanged, as it can be used to check if article has manufacturer in lightweight way (only one DB check), but can also be deprecated, and force developers to use getManufacturer object to ensure availability to active shop.
Additional InformationI suggest to rewrite this function to
    public function getManufacturerId( $blForceReload = false )
    {
        $sManufacturerId = false;
        if ( $this->oxarticles__oxmanufacturerid->value ) {
           $sManufacturerId = $this->oxarticles__oxmanufacturerid->value;
        }
        return $sManufacturerId;
    }




and leave for EE :

    public function getManufacturerId( $blForceReload = false )
    {
        $sManufacturerId = false;
        if ( $this->oxarticles__oxmanufacturerid->value ) {
            if ( !$blForceReload && isset( self::$_aArticleManufacturers[$this->getId()])) {
                return self::$_aArticleManufacturers[$this->getId()];
            }
            $oDb = oxDb::getDb();
            $sQ = "select oxid from ".getViewName('oxmanufacturers')." where oxid=".$oDb->quote($this->oxarticles__oxmanufacturerid->value);
            self::$_aArticleManufacturers[$this->getId()] = $sManufacturerId = $oDb->getOne( $sQ );
        }
        return $sManufacturerId;
    }
TagsPerformance
ThemeBoth
BrowserAll
PHP Versionany
Database Versionany

Activities

birute_meilutyte

2011-09-01 09:12

reporter   ~0005161

@developers: please, investigate if offered solution is correct

arvydas_vapsva

2011-09-02 14:10

reporter   ~0005165

good idea, thnx!