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

PHP Zend_Filter_LocalizedToNormalized类代码示例

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

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



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

示例1: execute

 /**
  * Update product configuration for a cart item
  *
  * @return void
  */
 public function execute()
 {
     $id = (int) $this->getRequest()->getParam('id');
     $params = $this->getRequest()->getParams();
     if (!isset($params['options'])) {
         $params['options'] = array();
     }
     try {
         if (isset($params['qty'])) {
             $filter = new \Zend_Filter_LocalizedToNormalized(array('locale' => $this->_objectManager->get('Magento\\Framework\\Locale\\ResolverInterface')->getLocaleCode()));
             $params['qty'] = $filter->filter($params['qty']);
         }
         $quoteItem = $this->cart->getQuote()->getItemById($id);
         if (!$quoteItem) {
             throw new \Magento\Framework\Model\Exception(__("We can't find the quote item."));
         }
         $item = $this->cart->updateItem($id, new \Magento\Framework\Object($params));
         if (is_string($item)) {
             throw new \Magento\Framework\Model\Exception($item);
         }
         if ($item->getHasError()) {
             throw new \Magento\Framework\Model\Exception($item->getMessage());
         }
         $related = $this->getRequest()->getParam('related_product');
         if (!empty($related)) {
             $this->cart->addProductsByIds(explode(',', $related));
         }
         $this->cart->save();
         $this->_checkoutSession->setCartWasUpdated(true);
         $this->_eventManager->dispatch('checkout_cart_update_item_complete', array('item' => $item, 'request' => $this->getRequest(), 'response' => $this->getResponse()));
         if (!$this->_checkoutSession->getNoCartRedirect(true)) {
             if (!$this->cart->getQuote()->getHasError()) {
                 $message = __('%1 was updated in your shopping cart.', $this->_objectManager->get('Magento\\Framework\\Escaper')->escapeHtml($item->getProduct()->getName()));
                 $this->messageManager->addSuccess($message);
             }
             $this->_goBack();
         }
     } catch (\Magento\Framework\Model\Exception $e) {
         if ($this->_checkoutSession->getUseNotice(true)) {
             $this->messageManager->addNotice($e->getMessage());
         } else {
             $messages = array_unique(explode("\n", $e->getMessage()));
             foreach ($messages as $message) {
                 $this->messageManager->addError($message);
             }
         }
         $url = $this->_checkoutSession->getRedirectUrl(true);
         if ($url) {
             $this->getResponse()->setRedirect($url);
         } else {
             $cartUrl = $this->_objectManager->get('Magento\\Checkout\\Helper\\Cart')->getCartUrl();
             $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl($cartUrl));
         }
     } catch (\Exception $e) {
         $this->messageManager->addException($e, __('We cannot update the item.'));
         $this->_objectManager->get('Magento\\Framework\\Logger')->logException($e);
         $this->_goBack();
     }
     $this->_redirect('*/*');
 }
开发者ID:aiesh,项目名称:magento2,代码行数:65,代码来源:UpdateItemOptions.php


示例2: _updateShoppingCart

 /**
  * Update customer's shopping cart
  *
  * @return void
  */
 protected function _updateShoppingCart()
 {
     try {
         $cartData = $this->getRequest()->getParam('cart');
         if (is_array($cartData)) {
             $filter = new \Zend_Filter_LocalizedToNormalized(array('locale' => $this->_objectManager->get('Magento\\Framework\\Locale\\ResolverInterface')->getLocaleCode()));
             foreach ($cartData as $index => $data) {
                 if (isset($data['qty'])) {
                     $cartData[$index]['qty'] = $filter->filter(trim($data['qty']));
                 }
             }
             if (!$this->cart->getCustomerSession()->getCustomerId() && $this->cart->getQuote()->getCustomerId()) {
                 $this->cart->getQuote()->setCustomerId(null);
             }
             $cartData = $this->cart->suggestItemsQty($cartData);
             $this->cart->updateItems($cartData)->save();
         }
         $this->_checkoutSession->setCartWasUpdated(true);
     } catch (\Magento\Framework\Model\Exception $e) {
         $this->messageManager->addError($this->_objectManager->get('Magento\\Framework\\Escaper')->escapeHtml($e->getMessage()));
     } catch (\Exception $e) {
         $this->messageManager->addException($e, __('We cannot update the shopping cart.'));
         $this->_objectManager->get('Magento\\Framework\\Logger')->logException($e);
     }
 }
开发者ID:aiesh,项目名称:magento2,代码行数:30,代码来源:UpdatePost.php


示例3: updateItemOptionsAction

 /**
  * Update product configuration for a cart item
  */
 public function updateItemOptionsAction()
 {
     $cart = $this->_getCart();
     $id = (int) $this->getRequest()->getParam('id');
     $params = $this->getRequest()->getParams();
     if (!isset($params['options'])) {
         $params['options'] = array();
     }
     try {
         if (isset($params['qty'])) {
             $filter = new Zend_Filter_LocalizedToNormalized(array('locale' => Mage::app()->getLocale()->getLocaleCode()));
             $params['qty'] = $filter->filter($params['qty']);
         }
         $quoteItem = $cart->getQuote()->getItemById($id);
         if (!$quoteItem) {
             Mage::throwException($this->__('Quote item is not found.'));
         }
         $item = $cart->updateItem($id, new Varien_Object($params));
         if (is_string($item)) {
             Mage::throwException($item);
         }
         if ($item->getHasError()) {
             Mage::throwException($item->getMessage());
         }
         $related = $this->getRequest()->getParam('related_product');
         if (!empty($related)) {
             $cart->addProductsByIds(explode(',', $related));
         }
         $cart->save();
         $this->_getSession()->setCartWasUpdated(true);
         $this->getLayout()->getUpdate()->addHandle('ajaxcart');
         $this->loadLayout();
         Mage::dispatchEvent('checkout_cart_update_item_complete', array('item' => $item, 'request' => $this->getRequest(), 'response' => $this->getResponse()));
         if (!$this->_getSession()->getNoCartRedirect(true)) {
             if (!$cart->getQuote()->getHasError()) {
                 $message = $this->__('%s was updated in your shopping cart.', Mage::helper('core')->htmlEscape($item->getProduct()->getName()));
                 $this->_getSession()->addSuccess($message);
             }
             $this->_goBack();
         }
     } catch (Mage_Core_Exception $e) {
         $_response = Mage::getModel('ajaxcart/response');
         $_response->setError(true);
         $messages = array_unique(explode("\n", $e->getMessage()));
         $json_messages = array();
         foreach ($messages as $message) {
             $json_messages[] = Mage::helper('core')->escapeHtml($message);
         }
         $_response->setMessages($json_messages);
         $url = $this->_getSession()->getRedirectUrl(true);
         $_response->send();
     } catch (Exception $e) {
         $this->_getSession()->addException($e, $this->__('Cannot update the item.'));
         Mage::logException($e);
         $_response = Mage::getModel('ajaxcart/response');
         $_response->setError(true);
         $_response->setMessage($this->__('Cannot update the item.'));
         $_response->send();
     }
 }
开发者ID:Madhurabhat,项目名称:test,代码行数:63,代码来源:CartController.php


示例4: _updateShoppingCart

 protected function _updateShoppingCart()
 {
     try {
         $cartData = $this->getRequest()->getParam('cart');
         if (is_array($cartData)) {
             $filter = new Zend_Filter_LocalizedToNormalized(array('locale' => Mage::app()->getLocale()->getLocaleCode()));
             foreach ($cartData as $index => $data) {
                 if (isset($data['qty'])) {
                     $cartData[$index]['qty'] = $filter->filter(trim($data['qty']));
                 }
             }
             $cart = $this->_getCart();
             if (!$cart->getCustomerSession()->getCustomer()->getId() && $cart->getQuote()->getCustomerId()) {
                 $cart->getQuote()->setCustomerId(null);
             }
             $cartData = $cart->suggestItemsQty($cartData);
             $cart->updateItems($cartData)->save();
         }
         $this->_getSession()->setCartWasUpdated(true);
     } catch (Mage_Core_Exception $e) {
         $this->_getSession()->addError(Mage::helper('core')->escapeHtml($e->getMessage()));
     } catch (Exception $e) {
         $this->_getSession()->addException($e, $this->__('Cannot update shopping cart.'));
         Mage::logException($e);
     }
 }
开发者ID:novayadi85,项目名称:navicet,代码行数:26,代码来源:IndexController.php


示例5: _set

 public function _set($fieldName, $value, $load = true)
 {
     if (strstr($fieldName, 'week_')) {
         $zendFilter = new Zend_Filter_LocalizedToNormalized();
         $value = $zendFilter->filter($value);
     }
     parent::_set($fieldName, $value, $load);
 }
开发者ID:jaspermeijaard,项目名称:home-booking-system,代码行数:8,代码来源:Percentage.php


示例6: outputFilter

 /**
  * Returns the result of filtering $value
  *
  * @param string $value
  * @return string
  */
 public function outputFilter($value)
 {
     $filterInput = new Zend_Filter_LocalizedToNormalized(array('date_format' => Varien_Date::DATE_INTERNAL_FORMAT, 'locale' => $this->_locale));
     $filterInternal = new Zend_Filter_NormalizedToLocalized(array('date_format' => $this->_dateFormat, 'locale' => $this->_locale));
     $value = $filterInput->filter($value);
     $value = $filterInternal->filter($value);
     return $value;
 }
开发者ID:barneydesmond,项目名称:propitious-octo-tribble,代码行数:14,代码来源:Date.php


示例7: _convertDate

 /**
  * Convert date from localized to internal format
  *
  * @param string $date
  * @param string $locale
  * @return string
  */
 protected function _convertDate($date, $locale)
 {
     $filterInput = new Zend_Filter_LocalizedToNormalized(array('date_format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT)));
     $filterInternal = new Zend_Filter_NormalizedToLocalized(array('date_format' => Varien_Date::DATE_INTERNAL_FORMAT));
     $date = $filterInput->filter($date);
     $date = $filterInternal->filter($date);
     return $date;
 }
开发者ID:hazaeluz,项目名称:magento_connect,代码行数:15,代码来源:Date.php


示例8: outputFilter

 /**
  * Returns the result of filtering $value
  *
  * @param string $value
  * @return string
  */
 public function outputFilter($value)
 {
     $filterInput = new \Zend_Filter_LocalizedToNormalized(['date_format' => DateTime::DATE_INTERNAL_FORMAT, 'locale' => $this->localeResolver->getLocale()]);
     $filterInternal = new \Zend_Filter_NormalizedToLocalized(['date_format' => $this->_dateFormat, 'locale' => $this->localeResolver->getLocale()]);
     $value = $filterInput->filter($value);
     $value = $filterInternal->filter($value);
     return $value;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:14,代码来源:Date.php


示例9: filterDateValue

 public function filterDateValue($value)
 {
     $filterInput = new Zend_Filter_LocalizedToNormalized(array('date_format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT)));
     $filterInternal = new Zend_Filter_NormalizedToLocalized(array('date_format' => Varien_Date::DATE_INTERNAL_FORMAT));
     $value = $filterInput->filter($value);
     $value = $filterInternal->filter($value);
     return $value;
 }
开发者ID:xiaoguizhidao,项目名称:blingjewelry-prod,代码行数:8,代码来源:Editor.php


示例10: addAction

 /**
  * Add product to shopping cart action
  * Overides the addAction() function from Mage_Checkout_CartController.
  */
 public function addAction()
 {
     $cart = $this->_getCart();
     $params = $this->getRequest()->getParams();
     try {
         if (isset($params['qty'])) {
             $filter = new Zend_Filter_LocalizedToNormalized(array('locale' => Mage::app()->getLocale()->getLocaleCode()));
             $params['qty'] = $filter->filter($params['qty']);
         }
         $product = $this->_initProduct();
         $related = $this->getRequest()->getParam('related_product');
         /**
          * Check product availability
          */
         if (!$product) {
             $this->_goBack();
             return;
         }
         $cart->addProduct($product, $params);
         if (!empty($related)) {
             $cart->addProductsByIds(explode(',', $related));
         }
         $cart->save();
         $this->_getSession()->setCartWasUpdated(true);
         /**
          * @todo remove wishlist observer processAddToCart
          */
         Mage::dispatchEvent('checkout_cart_add_product_complete', array('product' => $product, 'request' => $this->getRequest(), 'response' => $this->getResponse()));
         if (!$this->_getSession()->getNoCartRedirect(true)) {
             //Remove the added to cart message by calling the isDisplayMsg() function with && logic operator
             if (!$cart->getQuote()->getHasError() && $this->isDisplayMsg()) {
                 $message = $this->__('%s was added to your shopping cart.', Mage::helper('core')->escapeHtml($product->getName()));
                 $this->_getSession()->addSuccess($message);
             }
             $this->_goBack();
         }
     } catch (Mage_Core_Exception $e) {
         if ($this->_getSession()->getUseNotice(true)) {
             $this->_getSession()->addNotice(Mage::helper('core')->escapeHtml($e->getMessage()));
         } else {
             $messages = array_unique(explode("\n", $e->getMessage()));
             foreach ($messages as $message) {
                 $this->_getSession()->addError(Mage::helper('core')->escapeHtml($message));
             }
         }
         $url = $this->_getSession()->getRedirectUrl(true);
         if ($url) {
             $this->getResponse()->setRedirect($url);
         } else {
             $this->_redirectReferer(Mage::helper('checkout/cart')->getCartUrl());
         }
     } catch (Exception $e) {
         $this->_getSession()->addException($e, $this->__('Cannot add the item to shopping cart.'));
         Mage::logException($e);
         $this->_goBack();
     }
 }
开发者ID:vinayshuklasourcefuse,项目名称:sareez,代码行数:61,代码来源:CartController.php


示例11: save

 public function save()
 {
     $price = trim(str_replace(array(Core_Model_Language::getCurrencySymbol(), ' '), '', $this->getData('price')));
     $filter = new Zend_Filter_LocalizedToNormalized();
     $filter->setOptions(array('locale' => Zend_Registry::get('Zend_Locale')));
     $this->setData('price', $filter->filter($price));
     parent::save();
     return $this;
 }
开发者ID:bklein01,项目名称:SiberianCMS,代码行数:9,代码来源:Option.php


示例12: updateItemOptionsAction

 public function updateItemOptionsAction()
 {
     if (!$this->getRequest()->isXmlHttpRequest()) {
         return parent::updateItemOptionsAction();
     }
     $message = '';
     $cart = $this->_getCart();
     $id = (int) $this->getRequest()->getParam('id');
     $params = $this->getRequest()->getParams();
     if (!isset($params['options'])) {
         $params['options'] = array();
     }
     try {
         if (isset($params['qty'])) {
             $filter = new Zend_Filter_LocalizedToNormalized(array('locale' => Mage::app()->getLocale()->getLocaleCode()));
             $params['qty'] = $filter->filter($params['qty']);
         }
         $quoteItem = $cart->getQuote()->getItemById($id);
         if (!$quoteItem) {
             //Mage::throwException($this->__('Quote item is not found.'));
             return;
         }
         $item = $cart->updateItem($id, new Varien_Object($params));
         if (is_string($item)) {
             //Mage::throwException($item);
             return;
         }
         if ($item->getHasError()) {
             //Mage::throwException($item->getMessage());
             return;
         }
         $related = $this->getRequest()->getParam('related_product');
         if (!empty($related)) {
             $cart->addProductsByIds(explode(',', $related));
         }
         $cart->save();
         $this->_getSession()->setCartWasUpdated(true);
         Mage::dispatchEvent('checkout_cart_update_item_complete', array('item' => $item, 'request' => $this->getRequest(), 'response' => $this->getResponse()));
         if (!$cart->getQuote()->getHasError()) {
             $message = $this->__('<span><strong>%s</strong> was added to your shopping cart.</span><br /><p><a class="simple-button" href="%s">Continue Shopping</a><span> or </span><a class="button" href="%s">Checkout</a></p>', Mage::helper('core')->escapeHtml($item->getProduct()->getName()), 'javascript:weltpixel.lightbox.close()', Mage::helper('checkout/url')->getCheckoutUrl());
         }
     } catch (Mage_Core_Exception $e) {
         $message = Mage::helper('core')->escapeHtml($e->getMessage());
     } catch (Exception $e) {
         $message = $this->__('Cannot update the item.');
         Mage::logException($e);
     }
     $this->loadLayout();
     $body = array('message' => $message, 'blocks' => array());
     if ($this->getLayout()->getBlock('cart_sidebar')) {
         $body['blocks']['cart_sidebar'] = array('class' => Mage::helper('weltpixel_quickview')->isMageEnterprise() ? 'top-cart' : 'block-cart', 'content' => preg_replace('/\\/uenc\\/[^\\/]*/', '', $this->getLayout()->getBlock('cart_sidebar')->toHtml()));
     }
     if ($this->getLayout()->getBlock('quick_access')) {
         $body['blocks']['quick_access'] = array('id' => 'quick-access', 'content' => preg_replace('/\\/uenc\\/[^\\/]*/', '', $this->getLayout()->getBlock('quick_access')->toHtml()));
     }
     $this->getResponse()->setHeader('Content-Type', 'application/json', true)->setBody(Mage::helper('core')->jsonEncode($body));
 }
开发者ID:aayushKhandpur,项目名称:aayush-renting,代码行数:57,代码来源:CartController.php


示例13: execute

 /**
  * Add product to shopping cart action
  *
  * @return void
  */
 public function execute()
 {
     $params = $this->getRequest()->getParams();
     try {
         if (isset($params['qty'])) {
             $filter = new \Zend_Filter_LocalizedToNormalized(array('locale' => $this->_objectManager->get('Magento\\Framework\\Locale\\ResolverInterface')->getLocaleCode()));
             $params['qty'] = $filter->filter($params['qty']);
         }
         $product = $this->_initProduct();
         $related = $this->getRequest()->getParam('related_product');
         /**
          * Check product availability
          */
         if (!$product) {
             $this->_goBack();
             return;
         }
         $this->cart->addProduct($product, $params);
         if (!empty($related)) {
             $this->cart->addProductsByIds(explode(',', $related));
         }
         $this->cart->save();
         $this->_checkoutSession->setCartWasUpdated(true);
         /**
          * @todo remove wishlist observer processAddToCart
          */
         $this->_eventManager->dispatch('checkout_cart_add_product_complete', array('product' => $product, 'request' => $this->getRequest(), 'response' => $this->getResponse()));
         if (!$this->_checkoutSession->getNoCartRedirect(true)) {
             if (!$this->cart->getQuote()->getHasError()) {
                 $message = __('You added %1 to your shopping cart.', $this->_objectManager->get('Magento\\Framework\\Escaper')->escapeHtml($product->getName()));
                 $this->messageManager->addSuccess($message);
             }
             $this->_goBack();
         }
     } catch (\Magento\Framework\Model\Exception $e) {
         if ($this->_checkoutSession->getUseNotice(true)) {
             $this->messageManager->addNotice($this->_objectManager->get('Magento\\Framework\\Escaper')->escapeHtml($e->getMessage()));
         } else {
             $messages = array_unique(explode("\n", $e->getMessage()));
             foreach ($messages as $message) {
                 $this->messageManager->addError($this->_objectManager->get('Magento\\Framework\\Escaper')->escapeHtml($message));
             }
         }
         $url = $this->_checkoutSession->getRedirectUrl(true);
         if ($url) {
             $this->getResponse()->setRedirect($url);
         } else {
             $cartUrl = $this->_objectManager->get('Magento\\Checkout\\Helper\\Cart')->getCartUrl();
             $this->getResponse()->setRedirect($this->_redirect->getRedirectUrl($cartUrl));
         }
     } catch (\Exception $e) {
         $this->messageManager->addException($e, __('We cannot add this item to your shopping cart'));
         $this->_objectManager->get('Magento\\Framework\\Logger')->logException($e);
         $this->_goBack();
     }
 }
开发者ID:pavelnovitsky,项目名称:magento2,代码行数:61,代码来源:Add.php


示例14: _processLocalizedQty

 /**
  * Processes localized qty (entered by user at frontend) into internal php format
  *
  * @param string $qty
  * @return float|int|null
  */
 protected function _processLocalizedQty($qty)
 {
     if (!$this->_localFilter) {
         $this->_localFilter = new Zend_Filter_LocalizedToNormalized(array('locale' => Mage::app()->getLocale()->getLocaleCode()));
     }
     $qty = $this->_localFilter->filter($qty);
     if ($qty < 0) {
         $qty = null;
     }
     return $qty;
 }
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:17,代码来源:SearchController.php


示例15: process

 /**
  * Process localized quantity to internal format
  *
  * @param float $qty
  * @return array|string
  */
 public function process($qty)
 {
     if (!$this->localFilter) {
         $this->localFilter = new \Zend_Filter_LocalizedToNormalized(array('locale' => $this->localeResolver->getLocaleCode()));
     }
     $qty = $this->localFilter->filter((double) $qty);
     if ($qty < 0) {
         $qty = null;
     }
     return $qty;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:17,代码来源:LocaleQuantityProcessor.php


示例16: processProduct

 public function processProduct()
 {
     Mage::log("Processing Product");
     $cart = $this->_getCart();
     $params = $this->getRequest()->getParams();
     if (isset($params['qty'])) {
         $filter = new Zend_Filter_LocalizedToNormalized(array('locale' => Mage::app()->getLocale()->getLocaleCode()));
         $params['qty'] = $filter->filter($params['qty']);
     }
     $_product = $this->_initProduct();
     Mage::log("Product SKU : " . $_product->getSku());
     $related = $this->getRequest()->getParam('related_product');
     $cart->addProduct($_product, $params);
     return $_product;
 }
开发者ID:sohagan,项目名称:magento-modules,代码行数:15,代码来源:CartController.php


示例17: _filterDates

 protected function _filterDates($array, $dateFields)
 {
     if (empty($dateFields)) {
         return $array;
     }
     $filterInput = new Zend_Filter_LocalizedToNormalized(array('date_format' => Mage::app()->getLocale()->getDateFormat(Mage_Core_Model_Locale::FORMAT_TYPE_SHORT)));
     $filterInternal = new Zend_Filter_NormalizedToLocalized(array('date_format' => Varien_Date::DATE_INTERNAL_FORMAT));
     foreach ($dateFields as $dateField) {
         if (array_key_exists($dateField, $array) && !empty($dateField)) {
             $array[$dateField] = $filterInput->filter($array[$dateField]);
             $array[$dateField] = $filterInternal->filter($array[$dateField]);
         }
     }
     return $array;
 }
开发者ID:xiaoguizhidao,项目名称:devfashion,代码行数:15,代码来源:Arraypointsusage.php


示例18: addAction

 /**
  * Add product to shopping cart action, from a styla script request
  *
  * @return Mage_Core_Controller_Varien_Action
  * @throws Exception
  */
 public function addAction()
 {
     $cart = $this->_getCart();
     $params = $this->getRequest()->getParams();
     try {
         if (isset($params['qty'])) {
             $filter = new Zend_Filter_LocalizedToNormalized(array('locale' => Mage::app()->getLocale()->getLocaleCode()));
             $params['qty'] = $filter->filter($params['qty']);
         }
         $product = $this->_initProduct();
         /**
          * Check product availability
          */
         if (!$product) {
             throw new Exception('Error initializing product.');
         }
         $cart->addProduct($product, $params)->save();
         $this->_getSession()->setCartWasUpdated(true);
         Mage::dispatchEvent('checkout_cart_add_product_complete', array('product' => $product, 'request' => $this->getRequest(), 'response' => $this->getResponse()));
         if (!$this->_getSession()->getNoCartRedirect(true)) {
             if ($cart->getQuote()->getHasError()) {
                 throw new Exception("Quote error.");
             }
         }
     } catch (Mage_Core_Exception $e) {
         /**
          * TODO: we should be returning the error messages back to user
          */
         /* $messages = array_unique(explode("\n", $e->getMessage()));
            foreach ($messages as $message) {
                $this->_getSession()->addError(Mage::helper('core')->escapeHtml($message));
            } */
         Mage::logException($e);
         $this->getResponse()->setHeader('HTTP/1.0', '500', true);
         if ($e->getMessage()) {
             $this->getResponse()->setBody(json_encode($e->getMessage()));
         }
         return;
     } catch (Exception $e) {
         Mage::logException($e);
         $this->getResponse()->setHeader('HTTP/1.0', '500', true);
         return;
     }
     $resultArray = array('html' => $this->_getCartHtmlContent(), 'meta' => $this->_getCartMetaData());
     $this->getResponse()->setHeader('Content-type', 'application/json');
     $this->getResponse()->setBody(json_encode($resultArray));
     return;
 }
开发者ID:styladev,项目名称:magentoStylaConnect,代码行数:54,代码来源:CartController.php


示例19: getTransactionList

 /**
  * (non-PHPdoc)
  * @see library/Oara/Network/Oara_Network_Publisher_Interface#getTransactionList($aMerchantIds, $dStartDate, $dEndDate)
  */
 public function getTransactionList($merchantList = null, Zend_Date $dStartDate = null, Zend_Date $dEndDate = null, $merchantMap = null)
 {
     $totalTransactions = array();
     $filter = new Zend_Filter_LocalizedToNormalized(array('precision' => 2));
     $number = self::returnApiData("https://api.clickbank.com/rest/1.3/orders/count?startDate=" . $dStartDate->toString("yyyy-MM-dd") . "&endDate=" . $dEndDate->toString("yyyy-MM-dd"));
     if ($number[0] != 0) {
         $transactionXMLList = self::returnApiData("https://api.clickbank.com/rest/1.3/orders/list?startDate=" . $dStartDate->toString("yyyy-MM-dd") . "&endDate=" . $dEndDate->toString("yyyy-MM-dd"));
         foreach ($transactionXMLList as $transactionXML) {
             $transactionXML = simplexml_load_string($transactionXML, null, LIBXML_NOERROR | LIBXML_NOWARNING);
             foreach ($transactionXML->orderData as $singleTransaction) {
                 $transaction = array();
                 $transaction['merchantId'] = 1;
                 $transactionDate = new Zend_Date(self::findAttribute($singleTransaction, 'date'), 'yyyy-MM-ddTHH:mm:ss');
                 $transaction['date'] = $transactionDate->toString("yyyy-MM-dd HH:mm:ss");
                 unset($transactionDate);
                 if (self::findAttribute($singleTransaction, 'affi') != null) {
                     $transaction['custom_id'] = self::findAttribute($singleTransaction, 'affi');
                 }
                 $transaction['unique_id'] = self::findAttribute($singleTransaction, 'receipt');
                 $transaction['amount'] = (double) $filter->filter(self::findAttribute($singleTransaction, 'amount'));
                 $transaction['commission'] = (double) $filter->filter(self::findAttribute($singleTransaction, 'amount'));
                 //if (self::findAttribute($singleTransaction, 'txnType') == 'RFND'){
                 //	$transaction['status'] = Oara_Utilities::STATUS_DECLINED;
                 //} else {
                 $transaction['status'] = Oara_Utilities::STATUS_CONFIRMED;
                 //}
                 $totalTransactions[] = $transaction;
             }
         }
     }
     return $totalTransactions;
 }
开发者ID:netzkind,项目名称:php-oara,代码行数:36,代码来源:ClickBank.php


示例20: processTiercomFixedRates

 public function processTiercomFixedRates($vendor, $serialize = false)
 {
     $tiercomRates = $vendor->getData('tiercom_fixed_rates');
     if (is_string($tiercomRates)) {
         $tiercomRates = unserialize($tiercomRates);
     }
     if (!is_array($tiercomRates)) {
         $tiercomRates = array();
     }
     $udtcFixedConfig = $tiercomRates;
     if (is_array($udtcFixedConfig) && !empty($udtcFixedConfig) && !empty($udtcFixedConfig['limit']) && is_array($udtcFixedConfig['limit'])) {
         reset($udtcFixedConfig['limit']);
         $firstTitleKey = key($udtcFixedConfig['limit']);
         if (!is_numeric($firstTitleKey)) {
             $newudtcFixedConfig = array();
             $filter = new Zend_Filter_LocalizedToNormalized(array('locale' => Mage::app()->getLocale()->getLocaleCode()));
             foreach ($udtcFixedConfig['limit'] as $_k => $_t) {
                 if (($_limit = $filter->filter($udtcFixedConfig['limit'][$_k])) && false !== ($_value = $filter->filter($udtcFixedConfig['value'][$_k]))) {
                     $_limit = is_numeric($_limit) ? $_limit : '*';
                     $_sk = is_numeric($_limit) ? $_limit : '9999999999';
                     $_sk = 'str' . str_pad((string) $_sk, 20, '0', STR_PAD_LEFT);
                     $newudtcFixedConfig[$_sk] = array('limit' => $_limit, 'value' => $_value);
                 }
             }
             ksort($newudtcFixedConfig);
             $newudtcFixedConfig = array_values($newudtcFixedConfig);
             $tiercomRates = array_values($newudtcFixedConfig);
         }
     }
     if ($serialize) {
         if (is_array($tiercomRates)) {
             $tiercomRates = serialize($tiercomRates);
         }
     } else {
         if (is_string($tiercomRates)) {
             $tiercomRates = unserialize($tiercomRates);
         }
         if (!is_array($tiercomRates)) {
             $tiercomRates = array();
         }
     }
     $vendor->setData('tiercom_fixed_rates', $tiercomRates);
 }
开发者ID:xiaoguizhidao,项目名称:magento,代码行数:43,代码来源:Data.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
PHP Zend_Filter_NormalizedToLocalized类代码示例发布时间:2022-05-23
下一篇:
PHP Zend_Filter_Input类代码示例发布时间: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