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


PHP mage::getVersion方法代码示例

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


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

示例1: getVersion

 /**
  * return version
  *
  * @return unknown
  */
 private function getVersion()
 {
     $version = mage::getVersion();
     $t = explode('.', $version);
     return $t[0] . '.' . $t[1];
 }
开发者ID:TrygveSkogsholm,项目名称:Magento-Patch,代码行数:11,代码来源:MagentoVersionCompatibility.php

示例2: createPostAction

 /**
  * Create customer account action
  */
 public function createPostAction()
 {
     $data = $this->getRequest()->getPost();
     $isKeyHash = false;
     $field_1 = Mage::helper("nomorespam")->getNmsField1();
     $empty_text = Mage::helper("nomorespam")->getNmsField2();
     if (isset($data[$field_1]) && isset($data[$empty_text])) {
         $isKeyHash = $this->checkHashKey($data[$field_1], $data[$empty_text]);
     }
     //else $isKeyHash = true; //
     $enable_create_account = mage::getStoreConfig("no_more_spam/no_spam/create_account");
     if (!$enable_create_account) {
         $isKeyHash = true;
     }
     // if this section is off in nomorespam config then don't check our fields
     $version_magento = substr(mage::getVersion(), 0, 3);
     /** @var $session Mage_Customer_Model_Session */
     $session = $this->_getSession();
     if ($session->isLoggedIn()) {
         $this->_redirect('*/*/');
         return;
     }
     $session->setEscapeMessages(true);
     // prevent XSS injection in user input
     if ($version_magento == '1.9') {
         if (!$this->getRequest()->isPost()) {
             $errUrl = $this->_getUrl('*/*/create', array('_secure' => true));
             $this->_redirectError($errUrl);
             return;
         }
     }
     if ($version_magento == '1.9') {
         if ($isKeyHash) {
             $customer = $this->_getCustomer();
             try {
                 $errors = $this->_getCustomerErrors($customer);
                 if (empty($errors)) {
                     $customer->cleanPasswordsValidationData();
                     $customer->save();
                     $this->_dispatchRegisterSuccess($customer);
                     $this->_successProcessRegistration($customer);
                     return;
                 } else {
                     $this->_addSessionError($errors);
                 }
             } catch (Mage_Core_Exception $e) {
                 $session->setCustomerFormData($this->getRequest()->getPost());
                 if ($e->getCode() === Mage_Customer_Model_Customer::EXCEPTION_EMAIL_EXISTS) {
                     $url = $this->_getUrl('customer/account/forgotpassword');
                     $message = $this->__('There is already an account with this email address. If you are sure that it is your email address, <a href="%s">click here</a> to get your password and access your account.', $url);
                     $session->setEscapeMessages(false);
                 } else {
                     $message = $e->getMessage();
                 }
                 $session->addError($message);
             } catch (Exception $e) {
                 $session->setCustomerFormData($this->getRequest()->getPost())->addException($e, $this->__('Cannot save the customer.'));
             }
         }
     } elseif ($version_magento != '1.9') {
         if ($isKeyHash) {
             if ($this->getRequest()->isPost()) {
                 $errors = array();
                 if (!($customer = Mage::registry('current_customer'))) {
                     $customer = Mage::getModel('customer/customer')->setId(null);
                 }
                 /* @var $customerForm Mage_Customer_Model_Form */
                 $customerForm = Mage::getModel('customer/form');
                 $customerForm->setFormCode('customer_account_create')->setEntity($customer);
                 $customerData = $customerForm->extractData($this->getRequest());
                 if ($this->getRequest()->getParam('is_subscribed', false)) {
                     $customer->setIsSubscribed(1);
                 }
                 /**
                  * Initialize customer group id
                  */
                 $customer->getGroupId();
                 if ($this->getRequest()->getPost('create_address')) {
                     /* @var $address Mage_Customer_Model_Address */
                     $address = Mage::getModel('customer/address');
                     /* @var $addressForm Mage_Customer_Model_Form */
                     $addressForm = Mage::getModel('customer/form');
                     $addressForm->setFormCode('customer_register_address')->setEntity($address);
                     $addressData = $addressForm->extractData($this->getRequest(), 'address', false);
                     $addressErrors = $addressForm->validateData($addressData);
                     if ($addressErrors === true) {
                         $address->setId(null)->setIsDefaultBilling($this->getRequest()->getParam('default_billing', false))->setIsDefaultShipping($this->getRequest()->getParam('default_shipping', false));
                         $addressForm->compactData($addressData);
                         $customer->addAddress($address);
                         $addressErrors = $address->validate();
                         if (is_array($addressErrors)) {
                             $errors = array_merge($errors, $addressErrors);
                         }
                     } else {
                         $errors = array_merge($errors, $addressErrors);
                     }
                 }
//.........这里部分代码省略.........
开发者ID:portchris,项目名称:NaturalRemedyCompany,代码行数:101,代码来源:AccountController.php


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