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


PHP Mage_Customer_Model_Address_Abstract::getData方法代码示例

本文整理汇总了PHP中Mage_Customer_Model_Address_Abstract::getData方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Customer_Model_Address_Abstract::getData方法的具体用法?PHP Mage_Customer_Model_Address_Abstract::getData怎么用?PHP Mage_Customer_Model_Address_Abstract::getData使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Customer_Model_Address_Abstract的用法示例。


在下文中一共展示了Mage_Customer_Model_Address_Abstract::getData方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _checkFields

 /**
  * Check fields
  *
  * @return array|null
  */
 protected function _checkFields()
 {
     /** @var Mage_Checkout_Model_Session $session */
     $session = Mage::getSingleton('checkout/session');
     if ($session->getPostType() == 'onepage') {
         $requiredFields = explode(",", $this->getHelper()->getFieldRequiredList());
         $fieldRules = explode(",", $this->getHelper()->getFieldRule());
         foreach ($requiredFields as $field) {
             $requiredFlag = 0;
             foreach ($fieldRules as $rule) {
                 if (preg_match("/street\\d/", $field)) {
                     $field = "street";
                 }
                 if ($field == "country") {
                     $field = "country_id";
                 }
                 if ($this->_mageAddress->getData($field) == $rule || !$this->_mageAddress->getData($field)) {
                     $requiredFlag = 1;
                 }
             }
             if ($requiredFlag) {
                 $errors = array();
                 $errors[] = $this->__('Invalid ') . $this->__($field);
                 return $errors;
             }
         }
     }
     return null;
 }
开发者ID:sojimaxi,项目名称:avatax,代码行数:34,代码来源:Address.php

示例2: render

 /**
  * Render address
  *
  * @param Mage_Customer_Model_Address_Abstract $address
  * @return string
  */
 public function render(Mage_Customer_Model_Address_Abstract $address, $format = null)
 {
     $address->getRegion();
     $address->getCountry();
     $address->explodeStreetAddress();
     $formater = new Varien_Filter_Template();
     $data = $address->getData();
     if ($this->getType()->getHtmlEscape()) {
         foreach ($data as $key => $value) {
             if (is_object($value)) {
                 unset($data[$key]);
             } else {
                 $data[$key] = $this->htmlEscape($value);
             }
         }
     }
     /**
      * Remove data that mustn't show
      */
     if (!$this->helper('customer/address')->canShowConfig('prefix_show')) {
         unset($data['prefix']);
     }
     if (!$this->helper('customer/address')->canShowConfig('middlename_show')) {
         unset($data['middlename']);
     }
     if (!$this->helper('customer/address')->canShowConfig('suffix_show')) {
         unset($data['suffix']);
     }
     $formater->setVariables(array_merge($data, array('country' => $address->getCountryModel()->getName())));
     $format = !is_null($format) ? $format : $this->getFormat($address);
     return $formater->filter($format);
 }
开发者ID:codercv,项目名称:urbansurprisedev,代码行数:38,代码来源:Default.php

示例3: saveCustomerAddress

 /**
  * Store date and score to customerAddress.
  * If the quoteAddress is not a saved customerAddress we do nothing
  * If it gets saved to the addressBook at end of checkout Magento´ convert functionality saves the data for us
  *
  * @param Mage_Customer_Model_Address_Abstract $address
  * @return bool
  */
 public function saveCustomerAddress(Mage_Customer_Model_Address_Abstract $address)
 {
     $customerAddressId = $address->getCustomerAddressId();
     if (empty($customerAddressId)) {
         return false;
     }
     $customerAddress = $this->getFactory()->getModelCustomerAddress();
     $customerAddress->load($customerAddressId);
     if (!$customerAddress->hasData()) {
         return false;
     }
     $customerAddress->setData($this->prefix . '_score', $address->getData($this->prefix . '_score'));
     $customerAddress->setData($this->prefix . '_date', $address->getData($this->prefix . '_date'));
     $customerAddress->setData($this->prefix . '_hash', $address->getData($this->prefix . '_hash'));
     $customerAddress->setCity($address->getCity());
     $customerAddress->setStreetFull($address->getStreetFull());
     $customerAddress->setZip($address->getZip());
     $customerAddress->save();
     return true;
 }
开发者ID:kirchbergerknorr,项目名称:payone-magento,代码行数:28,代码来源:Abstract.php

示例4: render

 /**
  * Render address
  *
  * @param Mage_Customer_Model_Address_Abstract $address
  * @return string
  */
 public function render(Mage_Customer_Model_Address_Abstract $address)
 {
     $format = $this->getType()->getDefaultFormat();
     $countryFormat = $address->getCountryModel()->getFormat($this->getType()->getCode());
     $address->getRegion();
     $address->getCountry();
     $address->explodeStreetAddress();
     if ($countryFormat) {
         $format = $countryFormat->getFormat();
     }
     $formater = new Varien_Filter_Template();
     $formater->setVariables(array_merge($address->getData(), array('country' => $address->getCountryModel()->getName())));
     return $formater->filter($format);
 }
开发者ID:arslbbt,项目名称:mangentovies,代码行数:20,代码来源:Default.php

示例5: render

 /**
  * Render address
  *
  * @param Mage_Customer_Model_Address_Abstract $address
  * @return string
  */
 public function render(Mage_Customer_Model_Address_Abstract $address, $format = null)
 {
     $address->getRegion();
     $address->getCountry();
     $address->explodeStreetAddress();
     $formater = new Varien_Filter_Template();
     $data = $address->getData();
     if ($this->getType()->getHtmlEscape()) {
         foreach ($data as $key => $value) {
             $data[$key] = $this->htmlEscape($value);
         }
     }
     $formater->setVariables(array_merge($data, array('country' => $address->getCountryModel()->getName())));
     $format = !is_null($format) ? $format : $this->getFormat($address);
     return $formater->filter($format);
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:22,代码来源:Address_Renderer_Default.php

示例6: checkAddress

 protected function checkAddress(Mage_Customer_Model_Address_Abstract $address, $validityInSeconds)
 {
     if (!$address->hasData()) {
         return false;
     }
     $savedDate = $address->getData($this->prefix . '_date');
     $savedScore = $address->getData($this->prefix . '_score');
     if (empty($savedDate) or empty($savedScore)) {
         return false;
     }
     if ($this->addressHasChanged($address)) {
         return false;
     }
     // Verify the validity period is not expired:
     if (!$this->helper()->isDateStillValid($savedDate, $validityInSeconds)) {
         return false;
     }
     $address->setData($this->prefix . '_score', $savedScore);
     return $savedScore;
 }
开发者ID:kirchbergerknorr,项目名称:payone-magento,代码行数:20,代码来源:Abstract.php

示例7: validate

 /**
  * Validates the address with the AvaTax validation API.
  * Returns true on success and an array with an error on failure.
  *
  * @return array|bool
  * @throws OnePica_AvaTax_Model_Avatax_Address_Exception
  */
 public function validate()
 {
     if (!$this->_mageAddress) {
         throw new OnePica_AvaTax_Model_Avatax_Address_Exception($this->__('An address must be set before validation.'));
     }
     /** @var OnePica_AvaTax_Model_Config $config */
     $config = Mage::getSingleton('avatax/config')->init($this->_storeId);
     /** @var Mage_Sales_Model_Quote $quote */
     $quote = $this->_mageAddress->getQuote();
     $isAddressValidationOn = $this->_getDataHelper()->isAddressValidationOn($this->_mageAddress, $this->_storeId);
     $isAddressNormalizationOn = $this->_getDataHelper()->isAddressNormalizationOn($this->_mageAddress, $this->_storeId);
     $isAddressActionable = $this->_getDataHelper()->isAddressActionable($this->_mageAddress, $quote->getStoreId());
     //if there is no use cases for AvaTax services, return address as valid without doing a lookup
     if (!$isAddressValidationOn && !$isAddressNormalizationOn && !$isAddressActionable) {
         return true;
     }
     //lookup in AvaTax (with caching)
     $key = $this->_mageAddress->getCacheHashKey();
     if (array_key_exists($key, $this->_cache)) {
         $result = unserialize($this->_cache[$key]);
     } elseif ($this->_mageAddress->getPostcode() && $this->_mageAddress->getPostcode() != '-') {
         $session = Mage::getSingleton('checkout/session');
         if ($session->getPostType() == 'onepage') {
             $requiredFields = explode(",", $this->getHelper()->getFieldRequiredList());
             $fieldRules = explode(",", $this->getHelper()->getFieldRule());
             foreach ($requiredFields as $field) {
                 $requiredFlag = 0;
                 foreach ($fieldRules as $rule) {
                     if (preg_match("/street\\d/", $field)) {
                         $field = "street";
                     }
                     if ($field == "country") {
                         $field = "country_id";
                     }
                     if ($this->_mageAddress->getData($field) == $rule || !$this->_mageAddress->getData($field)) {
                         $requiredFlag = 1;
                     }
                 }
                 if ($requiredFlag) {
                     $errors = array();
                     $errors[] = $this->__('Invalid ') . $this->__($field);
                     return $errors;
                 }
             }
         }
         $client = $config->getAddressConnection();
         $request = new ValidateRequest($this->_requestAddress, TextCase::$Mixed, 0);
         $request->setTaxability(true);
         $result = $client->Validate($request);
         $this->_log(OnePica_AvaTax_Model_Source_Logtype::VALIDATE, $request, $result, $this->_storeId, $config->getParams());
         $this->_cache[$key] = serialize($result);
     } else {
         $errors = array();
         $errors[] = $this->__('Invalid ZIP/Postal Code.');
         return $errors;
     }
     //normalization
     if ($isAddressNormalizationOn && $result->getResultCode() == SeverityLevel::$Success) {
         $responseAddress = $result->getValidAddresses();
         $responseAddress = array_pop($responseAddress);
         if ($responseAddress instanceof ValidAddress) {
             $this->_responseAddress = $responseAddress;
             $this->_convertResponseAddress();
         } else {
             throw new OnePica_AvaTax_Model_Avatax_Address_Exception($this->__('Invalid response address type.'));
         }
     }
     //validation
     if ($isAddressValidationOn == 1) {
         if ($result->getResultCode() == SeverityLevel::$Success) {
             $this->_mageAddress->setAddressValidated(true);
             return true;
         } else {
             $errors = array();
             foreach ($result->getMessages() as $message) {
                 $errors[] = $this->__($message->getSummary());
             }
             return $errors;
         }
     } elseif ($isAddressValidationOn == 2) {
         $this->_mageAddress->setAddressValidated(true);
         if ($result->getResultCode() == SeverityLevel::$Success) {
             return true;
         } else {
             if (!$this->_mageAddress->getAddressNotified()) {
                 $this->_mageAddress->setAddressNotified(true);
                 foreach ($result->getMessages() as $message) {
                     Mage::getSingleton('core/session')->addNotice($this->__($message->getSummary()));
                 }
             }
             return true;
         }
         //a valid address isn't required, but Avalara has to say there is
//.........这里部分代码省略.........
开发者ID:boostmagento,项目名称:avatax,代码行数:101,代码来源:Address.php

示例8: _extractValidatedAddressData

 /**
  * Extract only the data from the addres that gets validated.
  * The extracted data can be compared to the data in an existing
  * @param Mage_Customer_Model_Address_Abstract $address
  * @return Mage_Customer_Model_Address_Abstract - an address object containing only the data that gets validated
  */
 protected function _extractValidatedAddressData(Mage_Customer_Model_Address_Abstract $address)
 {
     $validatedAddress = Mage::getModel('customer/address')->setData(['street' => $address->getData('street'), 'city' => $address->getCity(), 'region_id' => $address->getRegionId(), 'country_id' => $address->getCountryId(), 'postcode' => $address->getPostcode(), 'address_type' => $address->getAddressType()]);
     return $validatedAddress;
 }
开发者ID:sirishreddyg,项目名称:magento-retail-order-management,代码行数:11,代码来源:Validator.php

示例9: setAddress

 /**
  * Set the billing address for the card.
  */
 public function setAddress(Mage_Customer_Model_Address_Abstract $address)
 {
     return parent::setAddress(serialize($address->getData()));
 }
开发者ID:billadams,项目名称:forever-frame,代码行数:7,代码来源:Card.php


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