Public Member Functions | |
currentStore ($store=null) | |
Protected Member Functions | |
_isAllowedAttribute ($attribute, $attributes=null) | |
_getStoreId ($store=null) | |
_getProduct ($productId, $store=null) | |
Protected Attributes | |
$_ignoredAttributeCodes = array('entity_id', 'attribute_set_id', 'entity_type_id') | |
$_ignoredAttributeTypes = array() | |
$_storeIdSessionField = 'store_id' |
Definition at line 34 of file Resource.php.
_getProduct | ( | $ | productId, | |
$ | store = null | |||
) | [protected] |
Return loaded product instance
int|string | $productId (SKU or ID) | |
int|string | $store |
Definition at line 105 of file Resource.php.
00106 { 00107 $product = Mage::getModel('catalog/product'); 00108 00109 /* @var $product Mage_Catalog_Model_Product */ 00110 00111 if (is_string($productId)) { 00112 $idBySku = $product->getIdBySku($productId); 00113 if ($idBySku) { 00114 $productId = $idBySku; 00115 } 00116 } 00117 if ($store !== null) { 00118 $product->setStoreId($this->_getStoreId($store)); 00119 } 00120 $product->load($productId); 00121 return $product; 00122 }
_getStoreId | ( | $ | store = null |
) | [protected] |
Retrives store id from store code, if no store id specified, it use seted session or admin store
string|int | $store |
Definition at line 82 of file Resource.php.
00083 { 00084 if (is_null($store)) { 00085 $store = ($this->_getSession()->hasData($this->_storeIdSessionField) 00086 ? $this->_getSession()->getData($this->_storeIdSessionField) : 0); 00087 } 00088 00089 try { 00090 $storeId = Mage::app()->getStore($store)->getId(); 00091 } catch (Mage_Core_Model_Store_Exception $e) { 00092 $this->_fault('store_not_exists'); 00093 } 00094 00095 return $storeId; 00096 }
_isAllowedAttribute | ( | $ | attribute, | |
$ | attributes = null | |||
) | [protected] |
Check is attribute allowed
Mage_Eav_Model_Entity_Attribute_Abstract | $attribute | |
array | $attributes |
Definition at line 63 of file Resource.php.
00064 { 00065 if (is_array($attributes) 00066 && !( in_array($attribute->getAttributeCode(), $attributes) 00067 || in_array($attribute->getAttributeId(), $attributes))) { 00068 return false; 00069 } 00070 00071 return !in_array($attribute->getFrontendInput(), $this->_ignoredAttributeTypes) 00072 && !in_array($attribute->getAttributeCode(), $this->_ignoredAttributeCodes); 00073 }
currentStore | ( | $ | store = null |
) |
Set current store for catalog.
string|int | $store |
Definition at line 130 of file Resource.php.
00131 { 00132 if (!is_null($store)) { 00133 try { 00134 $storeId = Mage::app()->getStore($store)->getId(); 00135 } catch (Mage_Core_Model_Store_Exception $e) { 00136 $this->_fault('store_not_exists'); 00137 } 00138 00139 $this->_getSession()->setData($this->_storeIdSessionField, $storeId); 00140 } 00141 00142 return $this->_getStoreId(); 00143 }
$_ignoredAttributeCodes = array('entity_id', 'attribute_set_id', 'entity_type_id') [protected] |
Definition at line 41 of file Resource.php.
$_ignoredAttributeTypes = array() [protected] |
Definition at line 48 of file Resource.php.
$_storeIdSessionField = 'store_id' [protected] |
Definition at line 54 of file Resource.php.