/** * Check "Use default" checkbox display availability * * @param Mage_Eav_Model_Entity_Attribute $attribute * @return bool */ public function canDisplayUseDefault($attribute) { if (!$attribute->isScopeGlobal() && $this->getDataObject()->getStoreId()) { return true; } return false; }
/** * Delete product data * * @param Mage_Catalog_Model_Product $product * @param Mage_Eav_Model_Entity_Attribute $attribute * @return Enterprise_GiftCard_Model_Resource_Attribute_Backend_Giftcard_Amount */ public function deleteProductData($product, $attribute) { $condition = array(); if (!$attribute->isScopeGlobal()) { if ($storeId = $product->getStoreId()) { $condition['website_id IN (?)'] = array(0, Mage::app()->getStore($storeId)->getWebsiteId()); } } $condition['entity_id=?'] = $product->getId(); $condition['attribute_id=?'] = $attribute->getId(); $this->_getWriteAdapter()->delete($this->getMainTable(), $condition); return $this; }
/** * Retrieve label of attribute scope * * GLOBAL | WEBSITE | STORE * * @param Mage_Eav_Model_Entity_Attribute $attribute * @return string */ public function getScopeLabel($attribute) { $html = ''; if (Mage::app()->isSingleStoreMode()) { return $html; } if ($attribute->isScopeGlobal()) { $html .= '<br/>[GLOBAL]'; } elseif ($attribute->isScopeWebsite()) { $html .= '<br/>[WEBSITE]'; } elseif ($attribute->isScopeStore()) { $html .= '<br/>[STORE VIEW]'; } return $html; }
/** * Retrieve label of attribute scope * * GLOBAL | WEBSITE | STORE * * @param Mage_Eav_Model_Entity_Attribute $attribute * @return string */ public function getScopeLabel($attribute) { $html = ''; if (Mage::app()->isSingleStoreMode()) { return $html; } if ($attribute->isScopeGlobal()) { $html .= '<br/>' . Mage::helper('Mage_Adminhtml_Helper_Data')->__('[GLOBAL]'); } elseif ($attribute->isScopeWebsite()) { $html .= '<br/>' . Mage::helper('Mage_Adminhtml_Helper_Data')->__('[WEBSITE]'); } elseif ($attribute->isScopeStore()) { $html .= '<br/>' . Mage::helper('Mage_Adminhtml_Helper_Data')->__('[STORE VIEW]'); } return $html; }