当前位置: 首页>>代码示例>>PHP>>正文


PHP Varien_Object::hasData方法代码示例

本文整理汇总了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;
 }
开发者ID:ridhoq,项目名称:mxpi-twitter,代码行数:11,代码来源:Request.php

示例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;
 }
开发者ID:buttasg,项目名称:cowgirlk,代码行数:12,代码来源:Abstract.php

示例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;
 }
开发者ID:nitronaj,项目名称:magentofa,代码行数:38,代码来源:Datetime.php

示例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'));
 }
开发者ID:natxetee,项目名称:magento2,代码行数:10,代码来源:ObjectTest.php

示例5: insertInObject

 public function insertInObject(Varien_Object $obj)
 {
     if (!$obj->hasData('aitunits_mark')) {
         $obj->setAitunitsMark($this);
         return $this;
     }
     return $this;
 }
开发者ID:finelinePG,项目名称:finelink-dev,代码行数:8,代码来源:Mark.php

示例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)));
     }
 }
开发者ID:jpbender,项目名称:mage_virtual,代码行数:12,代码来源:Serialized.php

示例7: _hasMark

 protected function _hasMark(Varien_Object $obj)
 {
     if ($obj->hasData('aitunits_mark')) {
         if ($obj->getAitunitsMark()->hasHandler(get_class($this))) {
             return true;
         }
     }
     return false;
 }
开发者ID:finelinePG,项目名称:finelink-dev,代码行数:9,代码来源:Abstract.php

示例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;
 }
开发者ID:artmouse,项目名称:Magento-CustomFormElements,代码行数:15,代码来源:Json.php

示例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));
         }
     }
 }
开发者ID:sereban,项目名称:magento-marketo-integration,代码行数:13,代码来源:Abstract.php

示例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;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:16,代码来源:Website.php

示例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;
 }
开发者ID:programmerrahul,项目名称:vastecom,代码行数:17,代码来源:Savedtokens.php

示例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;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:19,代码来源:Store.php

示例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;
 }
开发者ID:chucky515,项目名称:Magento-CE-Mirror,代码行数:21,代码来源:Product.php

示例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;
 }
开发者ID:relue,项目名称:magento2,代码行数:28,代码来源:Datetime.php

示例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();
 }
开发者ID:hueyl77,项目名称:fourwindsgear,代码行数:45,代码来源:Price.php


注:本文中的Varien_Object::hasData方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。