本文整理汇总了PHP中Varien_Event_Observer::getCustomerAddress方法的典型用法代码示例。如果您正苦于以下问题:PHP Varien_Event_Observer::getCustomerAddress方法的具体用法?PHP Varien_Event_Observer::getCustomerAddress怎么用?PHP Varien_Event_Observer::getCustomerAddress使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Varien_Event_Observer
的用法示例。
在下文中一共展示了Varien_Event_Observer::getCustomerAddress方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: SendSmsRegister
public function SendSmsRegister(Varien_Event_Observer $observer)
{
$msisdn = $observer->getCustomerAddress()->getTelephone();
// Customer Mobile No
//START SMS API Code here your code
//$msisdn2='0171767xxxx'; // Store Admin Mobile No
$sms = 'Congrats! You have successfully Register. Thank You.@SSLW';
//May Change SMS Body here
$user = "UserID";
$pass = "UserPassword";
//if change login password isms.sslwireless.com then change new here
$sid = "StakeHolderName";
//Stake Holder Name here
$url = "http://sms.sslwireless.com/pushapi/dynamic/server.php";
$unique_id_1 = uniqid();
$unique_id_2 = uniqid();
$param = "user={$user}&pass={$pass}&sid={$sid}&";
$sms = "sms[0][0]={$msisdn}&sms[0][1]=" . urlencode($sms) . "&sms[0][2]=" . $unique_id_1 . "&sms[1][0]={$msisdn2}&sms[1][1]=" . urlencode($sms) . "&sms[1][2]=" . $unique_id_2 . "";
$data = $param . $sms . $sid;
$crl = curl_init();
curl_setopt($crl, CURLOPT_SSL_VERIFYPEER, FALSE);
curl_setopt($crl, CURLOPT_SSL_VERIFYHOST, 2);
curl_setopt($crl, CURLOPT_URL, $url);
curl_setopt($crl, CURLOPT_HEADER, 0);
curl_setopt($crl, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($crl, CURLOPT_POST, 1);
curl_setopt($crl, CURLOPT_POSTFIELDS, $data);
$response = curl_exec($crl);
curl_close($crl);
//echo $response;
//ENd SMS API Code here your code
//Mage::log('obersver custave_after12'.'Mobile=='.$msisdn,null,'SendSmsRegister.log' );
}
示例2: customer_address_save_before
/**
* Strip non-digit characters from phone/fax numbers in customer addresses
*
* @param Varien_Event_Observer $observer
* @return void
*/
public function customer_address_save_before(Varien_Event_Observer $observer)
{
$customer_address = $observer->getCustomerAddress();
$cleanPhone = $this->_cleanPhone($customer_address, 'telephone');
$cleanFax = $this->_cleanPhone($customer_address, 'fax');
$customer_address->setTelephone($cleanPhone);
$customer_address->setFax($cleanFax);
}
示例3: afterAddressSave
/**
* Validate vat id if given and assign tax class to customer address
*
* @param Varien_Event_Observer $observer
*/
public function afterAddressSave($observer)
{
/** @var $customerAddress Mage_Customer_Model_Address */
$customerAddress = $observer->getCustomerAddress();
$customer = $customerAddress->getCustomer();
if (!Mage::helper('customer/address')->isVatValidationEnabled($customer->getStore()) || Mage::registry(self::VIV_PROCESSED_FLAG) || !$this->_canProcessAddress($customerAddress)) {
return;
}
try {
Mage::register(self::VIV_PROCESSED_FLAG, true);
/** @var $customerHelper Mage_Customer_Helper_Data */
$customerHelper = Mage::helper('customer');
if ($customerAddress->getVatId() == '' || !Mage::helper('core')->isCountryInEU($customerAddress->getCountry())) {
$defaultGroupId = $customerHelper->getDefaultCustomerGroupId($customer->getStore());
if (!$customer->getDisableAutoGroupChange() && $customer->getGroupId() != $defaultGroupId) {
$customerGroup = Mage::getModel('customer/group')->load($customer->getGroupId());
$customerAddress->setTaxClassId($customerGroup->getTaxClassId());
$customerAddress->save();
}
} else {
$result = $customerHelper->checkVatNumber($customerAddress->getCountryId(), $customerAddress->getVatId());
if (!$customer->getDisableAutoGroupChange()) {
$customerGroup = Mage::getModel('customer/group')->load($customer->getGroupId());
if ($result->getIsValid()) {
$customerAddress->setTaxClassId($customerGroup->getTaxClassIdVatId());
} else {
$customerAddress->setTaxClassId($customerGroup->getTaxClassId());
}
$customerAddress->save();
}
if (!Mage::app()->getStore()->isAdmin()) {
$validationMessage = Mage::helper('customer')->getVatValidationUserMessage($customerAddress, $customer->getDisableAutoGroupChange(), $result);
if (!$validationMessage->getIsError()) {
Mage::getSingleton('customer/session')->addSuccess($validationMessage->getMessage());
} else {
Mage::getSingleton('customer/session')->addError($validationMessage->getMessage());
}
}
}
} catch (Exception $e) {
Mage::register(self::VIV_PROCESSED_FLAG, false, true);
}
}
示例4: updateCustomerAddressAtQuotes
/**
* Save changed customer address at customer quotes that are linked
*
* @param Varien_Event_Observer $observer
* @return $this
* @throws Exception
*/
public function updateCustomerAddressAtQuotes(Varien_Event_Observer $observer)
{
/** @noinspection PhpUndefinedMethodInspection */
/** @var Mage_Customer_Model_Address $address */
$address = $observer->getCustomerAddress();
$subscriptions = Mage::getModel('adyen_subscription/subscription')->getCollection()->addFieldToFilter('customer_id', $address->getCustomerId());
foreach ($subscriptions as $subscription) {
/** @var Adyen_Subscription_Model_Subscription $subscription */
foreach ($subscription->getQuoteAdditionalCollection() as $quoteAdditional) {
/** @var Adyen_Subscription_Model_Subscription_Quote $quoteAdditional */
$quote = $quoteAdditional->getQuote();
$billingAddress = $quote->getBillingAddress();
if ($billingAddress->getCustomerAddressId() == $address->getId()) {
$billingAddress->addData($address->getData());
$billingAddress->save();
}
$shippingAddress = $quote->getShippingAddress();
if ($shippingAddress->getCustomerAddressId() == $address->getId()) {
$shippingAddress->addData($address->getData());
$shippingAddress->save();
}
}
}
return $this;
}