Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php if(Mage::getSingleton('customer/session')->isLoggedIn()){
- // Get group Id
- $groupId = Mage::getSingleton('customer/session')->getCustomerGroupId();
- //Get customer Group name
- $group = Mage::getModel('customer/group')->load($groupId);
- echo $group->getCode();} ?>
- protected function _createVatNumberValidationSoapClient($trace = false) {
- $options = array( 'soap_version'=>SOAP_1_1,
- 'exceptions'=>true,
- 'trace'=>1,
- 'cache_wsdl'=> WSDL_CACHE_NONE,
- 'user_agent' => 'Mozilla',
- 'proxy_port' => 80);
- return new SoapClient(self::VAT_VALIDATION_WSDL_URL, $options); }
- {
- $vatClass = self::VAT_CLASS_DOMESTIC;
- } elseif ($isVatNumberValid) {
- $vatClass = self::VAT_CLASS_INTRA_UNION;
- } else {
- $vatClass = self::VAT_CLASS_INVALID;
- }
- if (!$vatValidationResult->getRequestSuccess()) {
- $vatClass = self::VAT_CLASS_ERROR;
- }
- {
- $vatClass = self::VAT_CLASS_DOMESTIC;
- $vatMessage='Sprzedaz krajowa';
- Mage::getSingleton('customer/session')->addNotice($customerCountryCode.$vatNumber .' '. $this->__($vatMessage));
- } elseif ($isVatNumberValid) {
- $vatClass = self::VAT_CLASS_INTRA_UNION;
- $vatMessage='Your VIES VAT Number has been verified. 0% tax rate applied.';
- Mage::getSingleton('customer/session')->addSuccess($customerCountryCode.$vatNumber .' '. $this->__($vatMessage));
- } else {
- $vatClass = self::VAT_CLASS_INVALID;
- $vatMessage='Your UE VAT Number is invalid! Please verify your account information and contact our customer support.';
- Mage::getSingleton('customer/session')->addError($customerCountryCode.$vatNumber .' '. $this->__($vatMessage));
- }
- if (!$vatValidationResult->getRequestSuccess()) {
- $vatClass = self::VAT_CLASS_ERROR;
- $vatMessage='There was an error during validation of your UE VAT Number. Probably the VIES verification services are currently unavailable. Normal tax rate has been applied.';
- Mage::getSingleton('customer/session')->addError($customerCountryCode.$vatNumber .' '. $this->__($vatMessage));
- }
- return $vatClass;
- }
- <?php echo Mage::getSingleton('customer/session')->getMessages()->count(); ?>
- <?php if($this->getMessagesBlock()->getMessageCollection()->count()): ?>
- <?php foreach($this->getMessagesBlock()->getMessageCollection()->getItems() as $message): ?>
- <div class="alert alert-<?php echo $message->getType()?> fade in">
- <a class="close" data-dismiss="alert">×</a>
- <h4 class="alert-heading">
- <?php echo $this->__('Notice!') ?></h4>
- <?php echo $message->getCode()?>
- </div>
- <?php endforeach;?>
- <?php endif; ?>
- <?php $this->getMessagesBlock()->getMessageCollection()->clear(); ?>
- if (Mage::getSingleton('customer/session')->isLoggedIn()){
- $customer = $observer->getEvent()->getCustomer();
- if( // vat id condition):
- $customerHelper = Mage::helper('customer');
- $defaultGroupId = $customerHelper->getDefaultCustomerGroupId($customer->getStore());
- if (!$customer->getDisableAutoGroupChange() && $customer->getGroupId() != $defaultGroupId) {
- $customer->setGroupId($defaultGroupId);
- $customer->save();
- }
- endif;
- }
Add Comment
Please, Sign In to add comment