本文整理汇总了PHP中Varien_Object::hasData方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Object::hasData方法的具体用法?PHP Varien_Object::hasData怎么用?PHP Varien_Object::hasData使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Object
的用法示例。
在下文中一共展示了Varien_Object::hasData方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getLocaleRecord
/**
* @param Varien_Object $data
* @return array|null
*/
protected function _getLocaleRecord(Varien_Object $data)
{
if ($data->hasData('language') && $data->hasData('country')) {
return array('language' => (string) $data->getData('language'), 'country' => (string) $data->getData('country'), 'variant' => null);
}
return null;
}
示例2: _getPayoneStateMapping
/**
* @param $key
*
* @return mixed
*/
protected function _getPayoneStateMapping($key)
{
if ($this->_statusMapping instanceof Varien_Object) {
return $this->_statusMapping->hasData($key) ? $this->_statusMapping->getData($key) : false;
}
return false;
}
示例3: beforeSave
/**
* Formating date value before save
*
* Should set (bool, string) correct type for empty value from html form,
* neccessary for farther proccess, else date string
*
* @param Varien_Object $object
* @throws Mage_Eav_Exception
* @return Mage_Eav_Model_Entity_Attribute_Backend_Datetime
*/
public function beforeSave($object)
{
$attributeName = $this->getAttribute()->getName();
$_formated = $object->getData($attributeName . '_is_formated');
if (!$_formated && $object->hasData($attributeName)) {
try {
if (Mage::app()->getLocale()->getLocale() == 'fa_IR') {
require_once Mage::getBaseDir('lib') . '/pdate/pdate.php';
if ($object->getData($attributeName) != NULL) {
list($j_y, $j_m, $j_d) = explode('/', $object->getData($attributeName));
$gregorianlArray = jalali_to_gregorian($j_y, $j_m, $j_d);
$date = implode('-', $gregorianlArray);
$object->setData($attributeName, $date);
}
}
$value = $this->formatDate($object->getData($attributeName));
} catch (Exception $e) {
throw Mage::exception('Mage_Eav', Mage::helper('eav')->__('Invalid date'));
}
if (is_null($value)) {
$value = $object->getData($attributeName);
}
//Mage::log( "$attributeName, $value ") ;
$object->setData($attributeName, $value);
$object->setData($attributeName . '_is_formated', true);
}
return $this;
}
示例4: testHasData
/**
* Tests Varien_Object->hasData()
*/
public function testHasData()
{
$this->assertFalse($this->_object->hasData());
$this->assertFalse($this->_object->hasData('key'));
$this->_object->setData('key', 'value');
$this->assertTrue($this->_object->hasData('key'));
}
示例5: insertInObject
public function insertInObject(Varien_Object $obj)
{
if (!$obj->hasData('aitunits_mark')) {
$obj->setAitunitsMark($this);
return $this;
}
return $this;
}
示例6: beforeSave
/**
* Serialize before saving
* @param Varien_Object $object
*/
public function beforeSave($object)
{
// parent::beforeSave() is not called intentionally
$attrCode = $this->getAttribute()->getAttributeCode();
if ($object->hasData($attrCode)) {
$object->setData($attrCode, serialize($object->getData($attrCode)));
}
}
示例7: _hasMark
protected function _hasMark(Varien_Object $obj)
{
if ($obj->hasData('aitunits_mark')) {
if ($obj->getAitunitsMark()->hasHandler(get_class($this))) {
return true;
}
}
return false;
}
示例8: beforeSave
/**
* Serialize before saving
*
* @param Varien_Object $object
* @return Mage_Eav_Model_Entity_Attribute_Backend_Serialized
*/
public function beforeSave($object)
{
// parent::beforeSave() is not called intentionally
$attrCode = $this->getAttribute()->getAttributeCode();
if ($object->hasData($attrCode)) {
$object->setData($attrCode, Mage::helper('aligent_customformelements')->jsonEncodeIfRequired($object->getData($attrCode)));
}
return $this;
}
示例9: _prepareData
/**
* Prepare non standard fields like attributes with type integer
* @param Varien_Object $_object
*/
protected function _prepareData(Varien_Object $_object)
{
foreach ($this->_preparedCallbacks as $callback => $key) {
if ($_object->hasData($key)) {
//only for this object
call_user_func_array(array($this, $callback), array(&$_object));
}
}
}
示例10: beforeSave
/**
* Before save
*
* @param Varien_Object $object
* @return Mage_Customer_Model_Customer_Attribute_Backend_Website
*/
public function beforeSave($object)
{
if ($object->getId()) {
return $this;
}
if (!$object->hasData('website_id')) {
$object->setData('website_id', Mage::app()->getStore()->getWebsiteId());
}
return $this;
}
示例11: beforeSave
/**
* Serialize array in saved_tokens field, then encrypt it and save it into saved_tokens_json attribute
*
* @param Varien_Object $object
* @return $this|Mage_Eav_Model_Entity_Attribute_Backend_Abstract
*/
public function beforeSave($object)
{
$attrCode = $this->getAttribute()->getAttributeCode();
if ($object->hasData('saved_tokens') && ($savedTokens = $object->getData('saved_tokens'))) {
/* @var Eway_Rapid31_Model_Customer_Savedtokens $savedTokens */
if ($savedTokens && $savedTokens instanceof Eway_Rapid31_Model_Customer_Savedtokens) {
$object->setData($attrCode, Mage::helper('core')->encrypt($savedTokens->jsonSerialize()));
}
}
return $this;
}
示例12: beforeSave
/**
* Before save
*
* @param Varien_Object $object
* @return Mage_Customer_Model_Customer_Attribute_Backend_Store
*/
public function beforeSave($object)
{
if ($object->getId()) {
return $this;
}
if (!$object->hasStoreId()) {
$object->setStoreId(Mage::app()->getStore()->getId());
}
if (!$object->hasData('created_in')) {
$object->setData('created_in', Mage::app()->getStore($object->getStoreId())->getName());
}
return $this;
}
示例13: validate
/**
* Validate product attribute value for condition
*
* @param Varien_Object $object
* @return bool
*/
public function validate(Varien_Object $object)
{
$attrCode = $this->getAttribute();
if ('category_ids' == $attrCode) {
return $this->validateAttribute($object->getCategoryIds());
}
if ('attribute_set_id' == $attrCode) {
return $this->validateAttribute($object->getData($attrCode));
}
$oldAttrValue = $object->hasData($attrCode) ? $object->getData($attrCode) : null;
$object->setData($attrCode, $this->_getAttributeValue($object));
$result = $this->_validateProduct($object);
$this->_restoreOldAttrValue($object, $oldAttrValue);
return (bool) $result;
}
示例14: beforeSave
/**
* Formating date value before save
*
* Should set (bool, string) correct type for empty value from html form,
* neccessary for farther proccess, else date string
*
* @param Varien_Object $object
* @throws Mage_Eav_Exception
* @return Mage_Eav_Model_Entity_Attribute_Backend_Datetime
*/
public function beforeSave($object)
{
$attributeName = $this->getAttribute()->getName();
$_formated = $object->getData($attributeName . '_is_formated');
if (!$_formated && $object->hasData($attributeName)) {
try {
$value = $this->formatDate($object->getData($attributeName));
} catch (Exception $e) {
throw Mage::exception('Mage_Eav', Mage::helper('Mage_Eav_Helper_Data')->__('Invalid date'));
}
if (is_null($value)) {
$value = $object->getData($attributeName);
}
$object->setData($attributeName, $value);
$object->setData($attributeName . '_is_formated', true);
}
return $this;
}
示例15: render
/**
* Renders grid column
*
* @param Varien_Object $row
* @return string
*/
public function render(Varien_Object $_row)
{
$data = $_row->getData($this->getColumn()->getIndex());
$priceAmount = 0;
if ($data && $_row->getTypeId() != 'reservation') {
$priceAmount = $data;
} elseif ($_row->hasData('reservation_price')) {
$priceAmount = $_row->getData('reservation_price');
} elseif (is_null($data) || $_row->getTypeId() == 'reservation') {
$product = $_row->load($_row->getId());
if ($product->getTypeId() != ITwebexperts_Payperrentals_Helper_Data::PRODUCT_TYPE_BUNDLE || $product->getBundlePricingtype() == ITwebexperts_Payperrentals_Model_Product_Bundlepricingtype::PRICING_BUNDLE_FORALL) {
/** TODO move calculation to mysql join first record */
$priceCollection = Mage::getModel('payperrentals/reservationprices')->getCollection()->addFieldToFilter('entity_id', array('eq' => $_row->getData('entity_id')));
if (count($priceCollection)) {
$firstRecord = $priceCollection->getFirstItem();
$priceAmount = $firstRecord->getPrice();
$_row->setData('reservation_number', $firstRecord->getNumberof());
$_row->setData('price_type', $firstRecord->getPtype());
}
} elseif ($product->getTypeId() == ITwebexperts_Payperrentals_Helper_Data::PRODUCT_TYPE_BUNDLE) {
$priceAmount = 0;
}
}
if ($priceAmount) {
$data = floatval($priceAmount) * $this->_getRate($_row);
$currency_code = $this->_getCurrencyCode($_row);
if (!$currency_code) {
return $data;
}
$data = sprintf("%f", $data);
$data = Mage::app()->getLocale()->currency($currency_code)->toCurrency($data);
if ($_row->hasData('reservation_number') && $_row->hasData('price_type')) {
$periodAr = Mage::getModel('payperrentals/product_periodtype')->getOptionArray($_row->getData('reservation_number'));
$data .= '/<b>' . $_row->getData('reservation_number') . ' ' . $periodAr[$_row->getData('price_type')] . '</b>';
}
return $data;
}
return $this->getColumn()->getDefault();
}