當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。