• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP Mage_Customer_Model_Address类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: addressIsValid

 /**
  * @param Mage_Customer_Model_Address $address
  * @return bool
  */
 public function addressIsValid($address)
 {
     $isValid = true;
     foreach ($this->_requiredFields as $field => $validator) {
         if (!Zend_Validate::is($address->getData($field), $validator)) {
             $isValid = false;
         }
     }
     return $isValid;
 }
开发者ID:jronatay,项目名称:ultimo-magento-jron,代码行数:14,代码来源:Data.php


示例2: _canProcessAddress

 /**
  * Check whether specified address should be processed in after_save event handler
  *
  * @param Mage_Customer_Model_Address $address
  * @return bool
  */
 protected function _canProcessAddress($address)
 {
     if ($address->getForceProcess()) {
         return true;
     }
     if (Mage::registry(self::VIV_CURRENTLY_SAVED_ADDRESS) != $address->getId()) {
         return false;
     }
     $configAddressType = Mage::helper('customer/address')->getTaxCalculationAddressType();
     if ($configAddressType == Mage_Customer_Model_Address_Abstract::TYPE_SHIPPING) {
         return $this->_isDefaultShipping($address);
     }
     return $this->_isDefaultBilling($address);
 }
开发者ID:hyhoocchan,项目名称:mage-local,代码行数:20,代码来源:Observer.php


示例3: prepareAddressData

 /**
  * Collect address data to xml node
  * Remove objects from data array and escape data values
  *
  * @param Mage_Customer_Model_Address $address
  * @param Mage_XmlConnect_Model_Simplexml_Element $item
  * @return array
  */
 public function prepareAddressData(Mage_Customer_Model_Address $address, Mage_XmlConnect_Model_Simplexml_Element $item)
 {
     if (!$address) {
         return array();
     }
     $attributes = Mage::helper('Mage_Customer_Helper_Address')->getAttributes();
     $data = array('entity_id' => $address->getId());
     foreach ($attributes as $attribute) {
         /* @var $attribute Mage_Customer_Model_Attribute */
         if (!$attribute->getIsVisible()) {
             continue;
         }
         if ($attribute->getAttributeCode() == 'country_id') {
             $data['country'] = $address->getCountryModel()->getName();
             $data['country_id'] = $address->getCountryId();
         } else {
             if ($attribute->getAttributeCode() == 'region') {
                 $data['region'] = $address->getRegion();
             } else {
                 $dataModel = Mage_Customer_Model_Attribute_Data::factory($attribute, $address);
                 $value = $dataModel->outputValue(Mage_Customer_Model_Attribute_Data::OUTPUT_FORMAT_ONELINE);
                 if ($attribute->getFrontendInput() == 'multiline') {
                     $values = $dataModel->outputValue(Mage_Customer_Model_Attribute_Data::OUTPUT_FORMAT_ARRAY);
                     // explode lines
                     foreach ($values as $k => $v) {
                         $key = sprintf('%s%d', $attribute->getAttributeCode(), $k + 1);
                         $data[$key] = $v;
                     }
                 }
                 $data[$attribute->getAttributeCode()] = $value;
             }
         }
     }
     foreach ($data as $key => $value) {
         if (empty($value)) {
             continue;
         }
         $item->addChild($key, $item->escapeXml($value));
     }
 }
开发者ID:nemphys,项目名称:magento2,代码行数:48,代码来源:List.php


示例4: isValidDataForChangeAssociationWithCountry

 /**
  * Validate data for change association with the country
  *
  * @param Mage_Customer_Model_Address $address
  * @param array $data
  * @return bool
  */
 public function isValidDataForChangeAssociationWithCountry(Mage_Customer_Model_Address $address, array $data)
 {
     if (!isset($data['country_id']) && !isset($data['region'])) {
         return true;
     }
     // If country is in data - it has been already validated. If no - load current country.
     if (isset($data['country_id'])) {
         $country = Mage::getModel('directory/country')->loadByCode($data['country_id']);
     } else {
         $country = $address->getCountryModel();
     }
     return $this->_checkRegion($data, $country);
 }
开发者ID:ravi2jdesign,项目名称:solvingmagento_1.7.0,代码行数:20,代码来源:Validator.php


示例5: convertAddress

 /**
  * Takes a magento address object and generates an array 
  * containing data for gateway request
  *
  * @param Mage_Customer_Model_Address $address
  *
  * @return array
  */
 public function convertAddress($address)
 {
     if ($this->getConfig()->isConsumerCheck()) {
         switch ($address->getCountryId()) {
             case 'AT':
                 $staat = '040';
                 break;
             case 'CH':
                 $staat = '756';
                 break;
             case 'DE':
                 $staat = '280';
                 break;
             default:
                 $staat = '276';
                 break;
         }
     } else {
         $staat = 'DE' == $address->getCountryId() ? '280' : '276';
     }
     $addressData = array($this->_getFirstNameFieldName() => utf8_decode($this->_getFirstNameValue($address)), $this->_getLastNameFieldName() => utf8_decode($this->_getLastNameValue($address)), 'STRASSE' => utf8_decode($this->getStreet(implode(' ', $address->getStreet()))), 'HAUS_NR' => utf8_decode($this->getStreetNumber(implode(' ', $address->getStreet()))), 'ORT' => utf8_decode($address->getCity()), 'PLZ' => utf8_decode($address->getPostcode()), 'STAAT' => $staat);
     return $addressData;
 }
开发者ID:kirchbergerknorr,项目名称:netresearch_buergel,代码行数:31,代码来源:Request.php


示例6: getAddressAsString

 /**
  * Return customer address formated as one-line string
  *
  * @param Mage_Customer_Model_Address $address
  * @return string
  */
 public function getAddressAsString($address)
 {
     return $this->htmlEscape($address->format('oneline'));
 }
开发者ID:ravi2jdesign,项目名称:solvingmagento_1.7.0,代码行数:10,代码来源:Address.php


示例7: _createPhoneNumber

 /**
  * @param Mage_Customer_Model_Address $address
  * @return array|null
  */
 protected function _createPhoneNumber(Mage_Customer_Model_Address $address)
 {
     $primaryPhone = $address->getTelephone();
     $data = array('number' => $primaryPhone, 'type' => 'UNKNOWN');
     return $data;
 }
开发者ID:ridhoq,项目名称:mxpi-twitter,代码行数:10,代码来源:Guest.php


示例8: _getFilterRegion

 /**
  * Get region filter
  *
  * @param Mage_Customer_Model_Address $address
  * @param int                         $storeId
  * @return string|bool
  */
 protected function _getFilterRegion($address, $storeId)
 {
     $filter = false;
     $regionFilters = explode(',', Mage::getStoreConfig('tax/avatax/region_filter_list', $storeId));
     $entityId = $address->getRegionId() ?: $address->getCountryId();
     if (!in_array($entityId, $regionFilters)) {
         $filter = 'region';
     }
     return $filter;
 }
开发者ID:shabirm,项目名称:avatax,代码行数:17,代码来源:Data.php


示例9: _toBraintreeAddress

 /**
  * Convert magento address to array for braintree
  * 
  * @param Mage_Customer_Model_Address $address
  * @return array
  */
 protected function _toBraintreeAddress($address)
 {
     if ($address) {
         return array('firstName' => $address->getFirstname(), 'lastName' => $address->getLastname(), 'company' => $address->getCompany(), 'streetAddress' => $address->getStreet(1), 'extendedAddress' => $address->getStreet(2), 'locality' => $address->getCity(), 'region' => $address->getRegion(), 'postalCode' => $address->getPostcode(), 'countryCodeAlpha2' => $address->getCountry());
     } else {
         return array();
     }
 }
开发者ID:portchris,项目名称:NaturalRemedyCompany,代码行数:14,代码来源:Paymentmethod.php


示例10: _anonymizeOrderAddresses

 /**
  * @param Mage_Customer_Model_Address $customerAddress
  * @param array $randomData
  */
 protected function _anonymizeOrderAddresses($customerAddress, $randomData)
 {
     $orderAddresses = Mage::getModel('sales/order_address')->getCollection()->addFieldToFilter('customer_address_id', $customerAddress->getId());
     foreach ($orderAddresses as $orderAddress) {
         $this->_anonymizeOrderAddress($orderAddress, $randomData);
     }
 }
开发者ID:buro71a,项目名称:Anonymizer,代码行数:11,代码来源:Anonymizer.php


示例11: buildAddress

 /**
  * Build a Magento address model into a Braintree array
  *
  * @param Mage_Sales_Model_Order_Address|Mage_Sales_Model_Quote_Address|Mage_Customer_Model_Address $address
  *
  * @return array
  */
 private function buildAddress($address)
 {
     // Build up the initial array
     $return = array('firstName' => $address->getFirstname(), 'lastName' => $address->getLastname(), 'streetAddress' => $address->getStreet1(), 'locality' => $address->getCity(), 'postalCode' => $address->getPostcode(), 'countryCodeAlpha2' => $address->getCountry());
     // Any extended address?
     if ($address->getStreet2()) {
         $return['extendedAddress'] = $address->getStreet2();
     }
     // Region
     if ($address->getRegion()) {
         $return['region'] = $address->getRegionCode();
     }
     // Check to see if we have a company
     if ($address->getCompany()) {
         $return['company'] = $address->getCompany();
     }
     return $return;
 }
开发者ID:kiutisuperking,项目名称:eatsmartboxdev,代码行数:25,代码来源:Braintree.php


示例12: importAddress

 /**
  * Sets up address data to the GiftRegistry entity  object
  *
  * @param Mage_Customer_Model_Address $address
  * @return $this
  */
 public function importAddress(Mage_Customer_Model_Address $address)
 {
     $skip = array('increment_id', 'entity_type_id', 'parent_id', 'entity_id', 'attribute_set_id');
     $data = array();
     $attributes = $address->getAttributes();
     foreach ($attributes as $attribute) {
         if (!in_array($attribute->getAttributeCode(), $skip)) {
             $data[$attribute->getAttributeCode()] = $address->getData($attribute->getAttributeCode());
         }
     }
     $this->setData('shipping_address', serialize($data));
     return $this;
 }
开发者ID:hazaeluz,项目名称:magento_connect,代码行数:19,代码来源:Entity.php


示例13: importFromTextArray

 /**
  * Importing customer data from text array
  *
  * @param array $row
  * @return uMage_Customer_Model_Customer
  */
 public function importFromTextArray(array $row)
 {
     $this->resetErrors();
     $hlp = Mage::helper('customer');
     $line = $row['i'];
     $row = $row['row'];
     $regions = Mage::getResourceModel('directory/region_collection');
     //        $config = Mage::getSingleton('eav/config')->getEntityType('customer');
     $website = Mage::getModel('core/website')->load($row['website_code'], 'code');
     if (!$website->getId()) {
         $this->addError($hlp->__('Invalid website, skipping the record, line: %s.', $line));
     } else {
         $row['website_id'] = $website->getWebsiteId();
         $this->setWebsiteId($row['website_id']);
     }
     // Validate Email
     if (empty($row['email'])) {
         $this->addError($hlp->__('Missing email, skipping the record, line: %s.', $line));
     } else {
         $this->loadByEmail($row['email']);
     }
     if (empty($row['entity_id'])) {
         if ($this->getData('entity_id')) {
             $this->addError($hlp->__('The customer email (%s) already exists, skipping the record, line: %s.', $row['email'], $line));
         }
     } else {
         if ($row['entity_id'] != $this->getData('entity_id')) {
             $this->addError($hlp->__('The customer ID and email did not match, skipping the record, line: %s.', $line));
         } else {
             $this->unsetData();
             $this->load($row['entity_id']);
             if (isset($row['store_view'])) {
                 $storeId = Mage::app()->getStore($row['store_view'])->getId();
                 if ($storeId) {
                     $this->setStoreId($storeId);
                 }
             }
         }
     }
     if (empty($row['website_code'])) {
         $this->addError($hlp->__('Missing website, skipping the record, line: %s.', $line));
     }
     if (empty($row['group'])) {
         $row['group'] = 'General';
     }
     if (empty($row['firstname'])) {
         $this->addError($hlp->__('Missing first name, skipping the record, line: %s.', $line));
     }
     if (empty($row['lastname'])) {
         $this->addError($hlp->__('Missing last name, skipping the record, line: %s.', $line));
     }
     if (!empty($row['password_new'])) {
         $this->setPassword($row['password_new']);
         unset($row['password_new']);
         if (!empty($row['password_hash'])) {
             unset($row['password_hash']);
         }
     }
     if ($errors = $this->getErrors()) {
         $this->unsetData();
         $this->printError(join("<br />", $errors));
         return;
     }
     //        $entity = $this->getResource();
     foreach ($row as $field => $value) {
         //            $attribute = $entity->getAttribute($field);
         //            if (!$attribute) {
         //                echo $field;
         //                continue;
         //            }
         //            if ($attribute->usesSource()) {
         //                $source = $attribute->getSource();
         //                $optionId = $config->getSourceOptionId($source, $value);
         //                if (is_null($optionId)) {
         //                    $this->printError($hlp->__("Invalid attribute option specified for attribute attribute %s (%s).", $field, $value), $line);
         //                }
         //                $value = $optionId;
         //            }
         $this->setData($field, $value);
     }
     if (!$this->validateAddress($row, 'billing')) {
         $this->printError($hlp->__('Invalid billing address for (%s).', $row['email']), $line);
     } else {
         // Handling billing address
         $billingAddress = $this->getPrimaryBillingAddress();
         if (!$billingAddress instanceof Mage_Customer_Model_Address) {
             $billingAddress = new Mage_Customer_Model_Address();
         }
         $regions->addRegionNameFilter($row['billing_region'])->load();
         if ($regions) {
             foreach ($regions as $region) {
                 $regionId = $region->getId();
             }
         }
//.........这里部分代码省略.........
开发者ID:jpbender,项目名称:mage_virtual,代码行数:101,代码来源:Customer.php


示例14: _cleanPhone

 /**
  * _cleanPhone
  *
  * strip non-digit characters from phone/fax numbers
  *
  * @param  Mage_Customer_Model_Address $address
  * @param  string                      $type    # (i.e., 'fax' or 'telephone')
  * @param  string                      $pattern # regex pattern to use
  * @return string
  */
 protected function _cleanPhone(Mage_Customer_Model_Address $address, $type = 'telephone', $pattern = "/[^\\d]/")
 {
     $number = $address->getData($type);
     $cleanNum = preg_replace($pattern, "", $number);
     return $cleanNum;
 }
开发者ID:AleksNesh,项目名称:pandora,代码行数:16,代码来源:Observer.php


示例15: withAddress

 /**
  * @param \Mage_Customer_Model_Address $address
  * @return $this
  */
 public function withAddress($address)
 {
     $this->model->getBillingAddress()->addData($address->getData());
     $this->model->getShippingAddress()->addData($address->getData())->setCollectShippingRates(true)->collectShippingRates()->setShippingMethod($this->attributes['shipping_method'])->setPaymentMethod($this->attributes['payment_method']);
     return $this;
 }
开发者ID:jonathanselander,项目名称:Manager,代码行数:10,代码来源:Quote.php


示例16: Mage_Customer_Model_Customer

 * to [email protected] so we can send you a copy immediately.
 *
 * DISCLAIMER
 *
 * Do not edit or add to this file if you wish to upgrade Magento to newer
 * versions in the future. If you wish to customize Magento for your
 * needs please refer to http://www.magentocommerce.com for more information.
 *
 * @category    Magento
 * @package     Mage_ImportExport
 * @subpackage  integration_tests
 * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 */
//Create customer
$customer = new Mage_Customer_Model_Customer();
$customer->setWebsiteId(1)->setEntityId(1)->setEntityTypeId(1)->setAttributeSetId(0)->setEmail('[email protected]')->setPassword('password')->setGroupId(1)->setStoreId(1)->setIsActive(1)->setFirstname('Charles')->setLastname('Alston')->setGender(2);
$customer->isObjectNew(true);
// Create address
$address = new Mage_Customer_Model_Address();
//  default_billing and default_shipping information would not be saved, it is needed only for simple check
$address->addData(array('firstname' => 'Charles', 'lastname' => 'Alston', 'street' => '3781 Neuport Lane', 'city' => 'Panola', 'country_id' => 'US', 'region_id' => '51', 'postcode' => '30058', 'telephone' => '770-322-3514', 'default_billing' => 1, 'default_shipping' => 1));
// Assign customer and address
$customer->addAddress($address);
$customer->save();
// Mark last address as default billing and default shipping for current customer
$customer->setDefaultBilling($address->getId());
$customer->setDefaultShipping($address->getId());
$customer->save();
Mage::unregister('_fixture/Mage_ImportExport_Customer');
Mage::register('_fixture/Mage_ImportExport_Customer', $customer);
开发者ID:nemphys,项目名称:magento2,代码行数:31,代码来源:customer.php


示例17: _validateCustomer

 /**
  * Do validation of customer and its address using validate methods in models
  *
  * @param Mage_Customer_Model_Customer $customer
  * @param Mage_Customer_Model_Address|null $address
  * @throws Magento_Validator_Exception
  */
 protected function _validateCustomer($customer, $address = null)
 {
     $errors = array();
     if ($address) {
         $addressErrors = $address->validate();
         if (is_array($addressErrors)) {
             $errors = array_merge($errors, $addressErrors);
         }
     }
     $customerErrors = $customer->validate();
     if (is_array($customerErrors)) {
         $errors = array_merge($errors, $customerErrors);
     }
     if (count($errors) > 0) {
         throw new Magento_Validator_Exception(array($errors));
     }
 }
开发者ID:natxetee,项目名称:magento2,代码行数:24,代码来源:AccountController.php


示例18: getCustomerId

 /**
  * Return customer id
  * @deprecated
  *
  * @param Mage_Customer_Model_Address $object
  * @return int
  */
 public function getCustomerId($object)
 {
     return $object->getData('customer_id') ? $object->getData('customer_id') : $object->getParentId();
 }
开发者ID:hientruong90,项目名称:ee_14_installer,代码行数:11,代码来源:Address.php


示例19: Mage_Customer_Model_Customer

$customer->setDefaultBilling($address->getId());
$customer->setDefaultShipping($address->getId());
$customer->save();
$customers[] = $customer;
$customer = new Mage_Customer_Model_Customer();
$customer->setWebsiteId(1)->setEntityId(2)->setEntityTypeId(1)->setAttributeSetId(0)->setEmail('[email protected]')->setPassword('password')->setGroupId(1)->setStoreId(1)->setIsActive(1)->setFirstname('Anthony')->setLastname('Nealy')->setGender(1);
$customer->isObjectNew(true);
$address = new Mage_Customer_Model_Address();
$address->addData(array('firstname' => 'Anthony', 'lastname' => 'Nealy', 'street' => '3176 Cambridge Court', 'city' => 'Fayetteville', 'country_id' => 'US', 'region_id' => '5', 'postcode' => '72701', 'telephone' => '479-899-9849', 'default_billing' => 0, 'default_shipping' => 0));
$customer->addAddress($address);
$address = new Mage_Customer_Model_Address();
$address->addData(array('firstname' => 'Anthony', 'lastname' => 'Nealy', 'street' => '4709 Pleasant Hill Road', 'city' => 'Irvine', 'country_id' => 'US', 'region_id' => '12', 'postcode' => '92664', 'telephone' => '562-208-2310', 'default_billing' => 1, 'default_shipping' => 1));
$customer->addAddress($address);
$customer->save();
$customer->setDefaultBilling($address->getId());
$customer->setDefaultShipping($address->getId());
$customer->save();
$customers[] = $customer;
$customer = new Mage_Customer_Model_Customer();
$customer->setWebsiteId(1)->setEntityId(3)->setEntityTypeId(1)->setAttributeSetId(0)->setEmail('[email protected]')->setPassword('password')->setGroupId(1)->setStoreId(1)->setIsActive(1)->setFirstname('Lori')->setLastname('Banks')->setGender(2);
$customer->isObjectNew(true);
$address = new Mage_Customer_Model_Address();
$address->addData(array('firstname' => 'Lori', 'lastname' => 'Banks', 'street' => '2573 Goodwin Avenue', 'city' => 'Wenatchee', 'country_id' => 'US', 'region_id' => '62', 'postcode' => '98801', 'telephone' => '509-421-4364', 'default_billing' => 1, 'default_shipping' => 1));
$customer->addAddress($address);
$customer->save();
$customer->setDefaultBilling($address->getId());
$customer->setDefaultShipping($address->getId());
$customer->save();
$customers[] = $customer;
Mage::unregister('_fixture/Mage_ImportExport_Customers_Array');
Mage::register('_fixture/Mage_ImportExport_Customers_Array', $customers);
开发者ID:nemphys,项目名称:magento2,代码行数:31,代码来源:customer_with_addresses.php


示例20: getShopgateCustomerGender

 /**
  * get gender according to shopgate needs
  *
  * @param Mage_Customer_Model_Customer|Mage_Customer_Model_Address $data
  * @return string
  */
 public function getShopgateCustomerGender($data)
 {
     $options = Mage::getResourceModel('customer/customer')->getAttribute('gender')->getSource()->getAllOptions(false);
     $gender = null;
     foreach ($options as $option) {
         if ($option['value'] == $data->getGender()) {
             $gender = $option['label'];
         }
     }
     switch ($gender) {
         case 'Male':
             return ShopgateCustomer::MALE;
             break;
         case 'Female':
             return ShopgateCustomer::FEMALE;
             break;
         default:
             return '';
     }
 }
开发者ID:buttasg,项目名称:cowgirlk,代码行数:26,代码来源:Customer.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP Mage_Customer_Model_Address_Abstract类代码示例发布时间:2022-05-23
下一篇:
PHP Mage_Customer_Block_Widget_Abstract类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap