Mage_Adminhtml_Helper_Catalog_Product_Edit_Action_Attribute Class Reference

Inheritance diagram for Mage_Adminhtml_Helper_Catalog_Product_Edit_Action_Attribute:

Mage_Core_Helper_Data Mage_Core_Helper_Abstract

List of all members.

Public Member Functions

 getProducts ()
 getProductIds ()
 getSelectedStoreId ()
 getProductsSetIds ()
 getAttributes ()
 getProductsNotInStoreIds ()

Protected Attributes

 $_products
 $_productsNotInStore
 $_attributes
 $_excludedAttributes = array('url_key')


Detailed Description

Definition at line 35 of file Attribute.php.


Member Function Documentation

getAttributes (  ) 

Retrive same attributes for selected products without unique

Returns:
Mage_Eav_Model_Mysql4_Entity_Attribute_Collection

Definition at line 131 of file Attribute.php.

00132     {
00133         if (is_null($this->_attributes)) {
00134             $this->_attributes = $this->getProducts()->getEntity()->getEntityType()->getAttributeCollection()
00135                 ->addIsNotUniqueFilter()
00136                 ->setInAllAttributeSetsFilter($this->getProductsSetIds());
00137 
00138             foreach ($this->_excludedAttributes as $attributeCode) {
00139                 $this->_attributes->addFieldToFilter('attribute_code', array('neq'=>$attributeCode));
00140             }
00141 
00142             $this->_attributes->load();
00143             foreach($this->_attributes as $attribute) {
00144                 $attribute->setEntity($this->getProducts()->getEntity());
00145             }
00146         }
00147 
00148         return $this->_attributes;
00149     }

getProductIds (  ) 

Retrive selected products ids from post or session

Returns:
array|null

Definition at line 95 of file Attribute.php.

00096     {
00097         $session = Mage::getSingleton('adminhtml/session');
00098 
00099         if ($this->_getRequest()->isPost() && $this->_getRequest()->getActionName()=='edit') {
00100             $session->setProductIds($this->_getRequest()->getParam('product', null));
00101         }
00102 
00103         return $session->getProductIds();
00104     }

getProducts (  ) 

Retrive product collection

Returns:
Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection

Definition at line 71 of file Attribute.php.

00072     {
00073         if (is_null($this->_products)) {
00074             $productsIds = $this->getProductIds();
00075 
00076             if(!is_array($productsIds)) {
00077                 $productsIds = array(0);
00078             }
00079 
00080             $this->_products = Mage::getResourceModel('catalog/product_collection')
00081                 ->setStoreId($this->getSelectedStoreId())
00082                 ->addIdFilter($productsIds);
00083                 //->load();
00084                 //->addStoreNamesToResult();
00085         }
00086 
00087         return $this->_products;
00088     }

getProductsNotInStoreIds (  ) 

Retrive products ids that not available for selected store

Returns:
array

Definition at line 156 of file Attribute.php.

00157     {
00158         if (is_null($this->_productsNotInStore)) {
00159             $this->_productsNotInStoreIds = array();
00160             /*foreach ($this->getProducts() as $product) {
00161                 $stores = $product->getStores();
00162                 if (!isset($stores[$this->getSelectedStoreId()]) && $this->getSelectedStoreId() != 0) {
00163                     $this->_productsNotInStoreIds[] = $product->getId();
00164                 }
00165             }*/
00166         }
00167 
00168         return $this->_productsNotInStoreIds;
00169     }

getProductsSetIds (  ) 

Retrive selected products' attribute sets

Returns:
array

Definition at line 121 of file Attribute.php.

00122     {
00123         return $this->getProducts()->getSetIds();
00124     }

getSelectedStoreId (  ) 

Retrive selected store id

Returns:
integer

Definition at line 111 of file Attribute.php.

00112     {
00113         return (int) $this->_getRequest()->getParam('store', 0);
00114     }


Member Data Documentation

$_attributes [protected]

Definition at line 56 of file Attribute.php.

$_excludedAttributes = array('url_key') [protected]

Definition at line 64 of file Attribute.php.

$_products [protected]

Definition at line 42 of file Attribute.php.

$_productsNotInStore [protected]

Definition at line 49 of file Attribute.php.


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:23:12 2009 for Magento by  doxygen 1.5.8