本文整理汇总了PHP中Mage_Eav_Model_Entity_Abstract类的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Eav_Model_Entity_Abstract类的具体用法?PHP Mage_Eav_Model_Entity_Abstract怎么用?PHP Mage_Eav_Model_Entity_Abstract使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mage_Eav_Model_Entity_Abstract类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _setAttribteValue
/**
* Initialize attribute value for object
*
* @param Varien_Object $object
* @param array $valueRow
* @return Mage_Eav_Model_Entity_Abstract
*/
protected function _setAttribteValue($object, $valueRow)
{
parent::_setAttribteValue($object, $valueRow);
if ($attribute = $this->getAttribute($valueRow['attribute_id'])) {
$attributeCode = $attribute->getAttributeCode();
if (isset($valueRow['store_value'])) {
$object->setAttributeDefaultValue($attributeCode, $valueRow['value']);
$object->setData($attributeCode, $valueRow['store_value']);
$attribute->getBackend()->setValueId($valueRow['store_value_id']);
}
}
return $this;
}
示例2: getAlias
/**
* Get attribute alias as "entity_type/attribute_code"
*
* @param Mage_Eav_Model_Entity_Abstract $entity exclude this entity
* @return string
*/
public function getAlias($entity = null)
{
$alias = '';
if ($entity === null || $entity->getType() !== $this->getEntity()->getType()) {
$alias .= $this->getEntity()->getType() . '/';
}
$alias .= $this->getAttributeCode();
return $alias;
}
示例3: _getCarriers
/**
* Retrieve shipping carriers for specified order
*
* @param Mage_Eav_Model_Entity_Abstract $object
* @return array
*/
protected function _getCarriers($object)
{
$carriers = array();
$carrierInstances = Mage::getSingleton('shipping/config')->getAllCarriers($object->getStoreId());
$carriers['custom'] = Mage::helper('sales')->__('Custom Value');
foreach ($carrierInstances as $code => $carrier) {
if ($carrier->isTrackingAvailable()) {
$carriers[$code] = $carrier->getConfigData('title');
}
}
return $carriers;
}
示例4: _getFitHeight
/**
* Added a fit size for items in large quantities.
* Means you can join items like two or more glasses, pots and vases.
* The calc is applied only for height side.
* Required attribute fit_size. Example:
*
* code: fit_size
* type: varchar
*
* After you can set a fit size for all products and improve your sells
*
* @param Mage_Eav_Model_Entity_Abstract $item Order Item
*
* @return number
*/
protected function _getFitHeight($item)
{
$product = $item->getProduct();
$height = $product->getData('volume_altura');
$height = $height > 0 ? $height : (int) $this->getConfigData('altura_padrao');
$fitSize = (double) $product->getData('fit_size');
if ($item->getQty() > 1 && is_numeric($fitSize) && $fitSize > 0) {
$totalSize = $height + $fitSize * ($item->getQty() - 1);
$height = $totalSize / $item->getQty();
}
return $height;
}
示例5: _afterSave
/**
* Save customer addresses and set default addresses in attributes backend
*
* @param Varien_Object $customer
* @return Mage_Eav_Model_Entity_Abstract
*/
protected function _afterSave(Varien_Object $customer)
{
$this->_saveAddresses($customer);
return parent::_afterSave($customer);
}
示例6: testCompareAttributes
/**
* @param array $attribute1SetInfo
* @param array $attribute2SetInfo
* @param float $expected
* @dataProvider compareAttributesDataProvider
*/
public function testCompareAttributes($attribute1Sort, $attribute2Sort, $expected)
{
$attribute1 = $this->getMock('Mage_Eav_Model_Entity_Attribute', null, array(), '', false);
$attribute1->setAttributeSetInfo(array(0 => $attribute1Sort));
$attribute2 = $this->getMock('Mage_Eav_Model_Entity_Attribute', null, array(), '', false);
$attribute2->setAttributeSetInfo(array(0 => $attribute2Sort));
$this->assertEquals($expected, $this->_model->attributesCompare($attribute1, $attribute2));
}
示例7: _getLoadRowSelect
/**
* Retrieve select object for loading base entity row
*
* @param Varien_Object $object
* @param mixed $rowId
* @return Zend_Db_Select
*/
protected function _getLoadRowSelect($object, $rowId)
{
$select = parent::_getLoadRowSelect($object, $rowId);
if ($object->getSharedStoreIds()) {
$select->where('store_id IN (?)', $object->getSharedStoreIds());
}
return $select;
}
示例8: _collectSaveData
protected function _collectSaveData($newObject)
{
// when deleting store specific values, value ids should be in place
if ($newObject->getStoreId()) {
foreach ($this->getAttributesByCode() as $code => $attribute) {
if ($attribute->getIsGlobal() == Mana_Core_Model_Attribute_Scope::_STORE && is_null($newObject->getData($code))) {
$attribute->getBackend()->setValueId($this->getStoreValueId($newObject, $attribute));
}
}
}
return parent::_collectSaveData($newObject);
}
示例9: load
/**
* Reset firstly loaded attributes
*
* @param Varien_Object $object
* @param integer $entityId
* @param array|null $attributes
* @return Mage_Catalog_Model_Resource_Abstract
*/
public function load($object, $entityId, $attributes = array())
{
$this->_attributes = array();
return parent::load($object, $entityId, $attributes);
}
示例10: _construct
/**
* Emulate customer resource model for easy access
*/
protected function _construct()
{
$this->setType('customer');
$this->setConnection('customer_read', 'customer_write');
return parent::_construct();
}
示例11: getAttribute
/**
* Enter description here...
*
* @return Mage_Eav_Model_Entity_Attribute_Abstract
*/
public function getAttribute($attr)
{
return $this->_entity->getAttribute($attr);
}
示例12: setNewIncrementId
/**
* Custom setter of increment ID if its needed
*
* @param Varien_Object $object
* @return Mage_Customer_Model_Resource_Customer
*/
public function setNewIncrementId(Varien_Object $object)
{
if (Mage::getStoreConfig(Mage_Customer_Model_Customer::XML_PATH_GENERATE_HUMAN_FRIENDLY_ID)) {
parent::setNewIncrementId($object);
}
return $this;
}
示例13: _getLoadRowSelect
/**
* Retrieve select object for loading base entity row
*
* @param Varien_Object $object
* @param mixed $rowId
* @return Zend_Db_Select
*/
protected function _getLoadRowSelect($object, $rowId)
{
$select = parent::_getLoadRowSelect($object, $rowId);
if ($object->getWebsiteId() && $object->getSharingConfig()->isWebsiteScope()) {
$select->where('website_id=?', (int) $object->getWebsiteId());
}
return $select;
}
示例14: _beforeSave
/**
* @param Varien_Object $object
* @return $this
*/
protected function _beforeSave(Varien_Object $object)
{
parent::_beforeSave($object);
$this->_changeTime($object);
return $this;
}
示例15: _beforeSave
/**
* Check customer address before saving
*
* @param Varien_Object $address
* @return Mage_Customer_Model_Resource_Address
*/
protected function _beforeSave(Varien_Object $address)
{
parent::_beforeSave($address);
$this->_validate($address);
return $this;
}