/** * Check whether attribute instance (attribute, backend, frontend or source) has method and applicable * * @param Mage_Eav_Model_Entity_Attribute_Abstract|Mage_Eav_Model_Entity_Attribute_Backend_Abstract|Mage_Eav_Model_Entity_Attribute_Frontend_Abstract|Mage_Eav_Model_Entity_Attribute_Source_Abstract $instance * @param string $method * @param array $args array of arguments * @return boolean */ protected function _isCallableAttributeInstance($instance, $method, $args) { if ($instance instanceof Mage_Eav_Model_Entity_Attribute_Backend_Abstract && ($method == 'beforeSave' || ($method = 'afterSave'))) { $attributeCode = $instance->getAttribute()->getAttributeCode(); if (isset($args[0]) && $args[0] instanceof Varien_Object && $args[0]->getData($attributeCode) === false) { return false; } } return parent::_isCallableAttributeInstance($instance, $method, $args); }
/** * Get file attribute's formatted value from an entity * * @param Varien_Object $object Entity owning file value * @return string */ public function getValue(Varien_Object $object) { $data = ''; if ($value = parent::getValue($object)) { $data = '<a href="' . Mage::helper('fileattributes')->getFileUrl($value) . '" target="_blank">' . $value . '</a>'; } return $data; }
/** * Retreive attribute value * * @param $object * @return mixed */ public function getValue(Varien_Object $object) { $value = parent::getValue($object); if (strlen($value)) { $url = sprintf('%sgoodahead/etm/images/%s/%s/%s', Mage::getBaseUrl('media'), $object->getEntityTypeInstance()->getEntityTypeCode(), $this->getAttribute()->getAttributeCode(), ltrim($value, '/')); return $url; } else { return $value; } }
/** * Retreive attribute value * * @param $object * @return mixed */ public function getValue(Varien_Object $object) { $data = ''; $value = parent::getValue($object); $format = Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_MEDIUM); if ($value) { try { $data = Mage::getSingleton('Mage_Core_Model_Locale')->date($value, Zend_Date::ISO_8601, null, false)->toString($format); } catch (Exception $e) { $data = Mage::getSingleton('Mage_Core_Model_Locale')->date($value, null, null, false)->toString($format); } } return $data; }
/** * * @return type resource input render class */ public function getInputRendererClass() { $this->getAttribute()->setData('frontend_input_renderer', 'web2print/system_entity_form_element_resourcebrowser'); return parent::getInputRendererClass(); }
/** * Retrieve Input Renderer Class * * @return string */ public function getInputRendererClass() { $this->getAttribute()->setData('frontend_input_renderer', 'onsale/system_entity_form_element_position'); return parent::getInputRendererClass(); }
/** * Retrieve Input Renderer Class * * @return string */ public function getInputRendererClass() { $this->getAttribute()->setData('frontend_input_renderer', 'magpleasure/system_entity_form_element_dropdown'); return parent::getInputRendererClass(); }
/** * Check whether attribute instance (attribute, backend, frontend or source) has method and applicable * * @param Mage_Eav_Model_Entity_Attribute_Abstract|Mage_Eav_Model_Entity_Attribute_Backend_Abstract|Mage_Eav_Model_Entity_Attribute_Frontend_Abstract|Mage_Eav_Model_Entity_Attribute_Source_Abstract $instance * @param string $method * @param array $args array of arguments * @return boolean */ protected function _isCallableAttributeInstance($instance, $method, $args) { if ($instance instanceof Mage_Eav_Model_Entity_Attribute_Backend_Abstract && ($method == 'beforeSave' || ($method = 'afterSave'))) { $attributeCode = $instance->getAttribute()->getAttributeCode(); if (isset($args[0]) && $args[0] instanceof Varien_Object && $args[0]->getData($attributeCode) === false) { return false; } } if (!is_object($instance) || !method_exists($instance, $method)) { return false; } if (method_exists(get_parent_class(__CLASS__), '_isCallableAttributeInstance')) { return parent::_isCallableAttributeInstance($instance, $method, $args); } else { return true; } }