Exemple #1
0
 /**
  * Retrieve select object for loading entity attributes values
  * Join attribute store value
  *
  * @param Varien_Object $object
  * @param string $table
  * @return Varien_Db_Select
  */
 protected function _getLoadAttributesSelect($object, $table)
 {
     $select = parent::_getLoadAttributesSelect($object, $table);
     /**
      * This condition is applicable for all cases when we was work in not single
      * store mode, customize some value per specific store view and than back
      * to single store mode. We should load correct values
      */
     if (Mage::app()->isSingleStoreMode()) {
         $storeId = (int) Mage::app()->getStore(true)->getId();
     } else {
         $storeId = (int) $object->getStoreId();
     }
     $setId = $object->getAttributeSetId();
     $storeIds = array($this->getDefaultStoreId());
     if ($storeId != $this->getDefaultStoreId()) {
         $storeIds[] = $storeId;
     }
     $select->where('store_id IN (?)', $storeIds);
     if ($setId) {
         $select->join(array('set_table' => $this->getTable('eav/entity_attribute')), $this->_getReadAdapter()->quoteInto("{$table}.attribute_id = set_table.attribute_id" . ' AND set_table.attribute_set_id = ?', $setId), array());
     }
     return $select;
 }