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

PHP Mage_Core_Controller_Varien_Action类代码示例

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

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



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

示例1: match

 /**
  * Match conversion to controller object
  *
  * @param Mage_Core_Controller_Varien_Action $action
  */
 public function match(Mage_Core_Controller_Varien_Action $action)
 {
     $actionName = $action->getFullActionName();
     $match = $this->getAction() == $actionName;
     $this->setIsMatching($match);
     Mage::dispatchEvent('luka_googleaw_match_controller', array('action' => $action, 'conversion' => $this));
     return (bool) $this->getIsMatching();
 }
开发者ID:Thinlt,项目名称:simicart,代码行数:13,代码来源:Conversion.php


示例2: _renderPage

 /**
  * Renders CMS page
  *
  * @param Mage_Core_Controller_Front_Action|Mage_Core_Controller_Varien_Action $action
  * @param integer $pageId
  * @param bool $renderLayout
  * @return boolean
  */
 protected function _renderPage(Mage_Core_Controller_Varien_Action $action, $pageId = null, $renderLayout = true)
 {
     $page = Mage::getSingleton('Mage_Cms_Model_Page');
     if (!is_null($pageId) && $pageId !== $page->getId()) {
         $delimeterPosition = strrpos($pageId, '|');
         if ($delimeterPosition) {
             $pageId = substr($pageId, 0, $delimeterPosition);
         }
         $page->setStoreId(Mage::app()->getStore()->getId());
         if (!$page->load($pageId)) {
             return false;
         }
     }
     if (!$page->getId()) {
         return false;
     }
     $inRange = Mage::app()->getLocale()->isStoreDateInInterval(null, $page->getCustomThemeFrom(), $page->getCustomThemeTo());
     if ($page->getCustomTheme()) {
         if ($inRange) {
             Mage::getDesign()->setDesignTheme($page->getCustomTheme());
         }
     }
     $action->addPageLayoutHandles(array('id' => $page->getIdentifier()));
     $action->addActionLayoutHandles();
     if ($page->getRootTemplate()) {
         $handle = $page->getCustomRootTemplate() && $page->getCustomRootTemplate() != 'empty' && $inRange ? $page->getCustomRootTemplate() : $page->getRootTemplate();
         $action->getLayout()->helper('Mage_Page_Helper_Layout')->applyHandle($handle);
     }
     Mage::dispatchEvent('cms_page_render', array('page' => $page, 'controller_action' => $action));
     $action->loadLayoutUpdates();
     $layoutUpdate = $page->getCustomLayoutUpdateXml() && $inRange ? $page->getCustomLayoutUpdateXml() : $page->getLayoutUpdateXml();
     if (!empty($layoutUpdate)) {
         $action->getLayout()->getUpdate()->addUpdate($layoutUpdate);
     }
     $action->generateLayoutXml()->generateLayoutBlocks();
     $contentHeadingBlock = $action->getLayout()->getBlock('page_content_heading');
     if ($contentHeadingBlock) {
         $contentHeading = $this->escapeHtml($page->getContentHeading());
         $contentHeadingBlock->setContentHeading($contentHeading);
     }
     if ($page->getRootTemplate()) {
         $action->getLayout()->helper('Mage_Page_Helper_Layout')->applyTemplate($page->getRootTemplate());
     }
     /* @TODO: Move catalog and checkout storage types to appropriate modules */
     $messageBlock = $action->getLayout()->getMessagesBlock();
     foreach (array('Mage_Catalog_Model_Session', 'Mage_Checkout_Model_Session', 'Mage_Customer_Model_Session') as $storageType) {
         $storage = Mage::getSingleton($storageType);
         if ($storage) {
             $messageBlock->addStorageType($storageType);
             $messageBlock->addMessages($storage->getMessages(true));
         }
     }
     if ($renderLayout) {
         $action->renderLayout();
     }
     return true;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:65,代码来源:Page.php


示例3: _authorizeFrontendAccess

 /**
  * Authorize store access
  *
  * @param Mage_Core_Controller_Varien_Action $action
  */
 protected function _authorizeFrontendAccess($action)
 {
     /* @var $session Mage_Customer_Model_Session */
     $session = Mage::getSingleton('customer/session');
     /* @var $helper Tangkoko_Authorization_Helper_Store */
     $helper = Mage::helper('tangkoko_authorization/store');
     // Check if customer is authorized
     if (!$helper->isAuthorized($session->getCustomer())) {
         $request = $action->getRequest();
         $path = $action->getFullActionName('/');
         $allowedActions = $helper->getPublicActions();
         if ($allowedActions != "" && preg_match($allowedActions, $path)) {
             // Do not redirect on allowed actions
             return;
         } elseif (preg_match('#^cms/#', $path)) {
             // Do not redirect on allowed CMS page
             $identifier = $request->getParam('page_id', $request->getParam('id', Mage::getStoreConfig(Mage_Cms_Helper_Page::XML_PATH_HOME_PAGE)));
             $page = Mage::getModel('cms/page')->load($identifier);
             if (in_array($page->getIdentifier(), $helper->getPublicCmsPages())) {
                 return;
             }
         }
         // Path is not an allowed page or action
         $url = null;
         $parameters = array();
         $message = null;
         $redirectMode = null;
         // Define redirect mode
         if ($session->isLoggedIn()) {
             // Customer is loged in
             $redirectMode = $helper->getUnauthorizedCustomerRedirect();
         } else {
             // Customer is not logged in
             $redirectMode = $helper->getAnonymousCustomerRedirect();
         }
         // Define redirection parameters depending on redirect mode
         if ($redirectMode == Tangkoko_Authorization_Helper_Store::PAGE_REDIRECT) {
             // Page redirection
             $url = $helper->getErrorPage();
         } elseif ($redirectMode == Tangkoko_Authorization_Helper_Store::CUSTOM_REDIRECT) {
             // Url redirection
             $url = $helper->getCustomRedirectUrl();
         } elseif ($redirectMode == Tangkoko_Authorization_Helper_Store::LOGIN_REDIRECT) {
             // Visitor with redirect mode equal to login
             $url = Mage_Customer_Helper_Data::ROUTE_ACCOUNT_LOGIN;
             $parameters = Mage::helper('customer')->getLoginUrlParams();
         }
         // Get redirect message
         $message = $helper->getErrorMessage();
         if (!empty($message)) {
             $errorMessage = new Mage_Core_Model_Message_Error($message);
             $session->addUniqueMessages($errorMessage);
         }
         return Mage::app()->getResponse()->setRedirect(Mage::getUrl($url, $parameters));
     }
 }
开发者ID:jocelyn1,项目名称:basemagento,代码行数:61,代码来源:Observer.php


示例4: _getAddressBlockHtml

 /**
  * Render the suggestions block to be added into the response.
  * @param Mage_Core_Controller_Varien_Action $controller
  * @return string - rendered block
  */
 protected function _getAddressBlockHtml(Mage_Core_Controller_Varien_Action $controller)
 {
     $layout = $controller->getLayout();
     $update = $layout->getUpdate();
     $update->load('checkout_onepage_address_suggestions');
     $layout->generateXml();
     $layout->generateBlocks();
     $output = $layout->getOutput();
     return $output;
 }
开发者ID:WinstonN,项目名称:magento-retail-order-management,代码行数:15,代码来源:Observer.php


示例5: getRedirectionUrl

 protected function getRedirectionUrl(Mage_Core_Controller_Varien_Action $controller)
 {
     $headers = $controller->getResponse()->getHeaders();
     $redirectLocation = "";
     foreach ($headers as $item) {
         if ($item['name'] == 'Location') {
             $redirectLocation = $item['value'];
         }
     }
     return $redirectLocation;
 }
开发者ID:jronatay,项目名称:ultimo-magento-jron,代码行数:11,代码来源:MotoObserver.php


示例6: _renderPage

 /**
  * Renders CMS page
  *
  * @param Mage_Core_Controller_Front_Action $action
  * @param integer $pageId
  * @param bool $renderLayout
  * @return boolean
  */
 protected function _renderPage(Mage_Core_Controller_Varien_Action $action, $pageId = null, $renderLayout = true)
 {
     $page = Mage::getSingleton('cms/page');
     if (!is_null($pageId) && $pageId !== $page->getId()) {
         $delimeterPosition = strrpos($pageId, '|');
         if ($delimeterPosition) {
             $pageId = substr($pageId, 0, $delimeterPosition);
         }
         $page->setStoreId(Mage::app()->getStore()->getId());
         if (!$page->load($pageId)) {
             return false;
         }
     }
     if (!$page->getId()) {
         return false;
     }
     $inRange = Mage::app()->getLocale()->isStoreDateInInterval(null, $page->getCustomThemeFrom(), $page->getCustomThemeTo());
     if ($page->getCustomTheme()) {
         if ($inRange) {
             list($package, $theme) = explode('/', $page->getCustomTheme());
             Mage::getSingleton('core/design_package')->setPackageName($package)->setTheme($theme);
         }
     }
     $action->getLayout()->getUpdate()->addHandle('default')->addHandle('cms_page');
     $action->addActionLayoutHandles();
     if ($page->getRootTemplate()) {
         $handle = $page->getCustomRootTemplate() && $page->getCustomRootTemplate() != 'empty' && $inRange ? $page->getCustomRootTemplate() : $page->getRootTemplate();
         $action->getLayout()->helper('page/layout')->applyHandle($handle);
     }
     Mage::dispatchEvent('cms_page_render', array('page' => $page, 'controller_action' => $action));
     $action->loadLayoutUpdates();
     $layoutUpdate = $page->getCustomLayoutUpdateXml() && $inRange ? $page->getCustomLayoutUpdateXml() : $page->getLayoutUpdateXml();
     $action->getLayout()->getUpdate()->addUpdate($layoutUpdate);
     $action->generateLayoutXml()->generateLayoutBlocks();
     $contentHeadingBlock = $action->getLayout()->getBlock('page_content_heading');
     if ($contentHeadingBlock) {
         $contentHeadingBlock->setContentHeading($page->getContentHeading());
     }
     if ($page->getRootTemplate()) {
         $action->getLayout()->helper('page/layout')->applyTemplate($page->getRootTemplate());
     }
     // @nelkaake Replaced with next line  to separate dependency: foreach (array('catalog/session', 'checkout/session') as $class_name) {
     foreach (array('core/session', 'customer/session') as $class_name) {
         $storage = Mage::getSingleton($class_name);
         if ($storage) {
             $action->getLayout()->getMessagesBlock()->addMessages($storage->getMessages(true));
         }
     }
     if ($renderLayout) {
         $action->renderLayout();
     }
     return true;
 }
开发者ID:Airmal,项目名称:Magento-Em,代码行数:61,代码来源:Page.php


示例7: responseAction

 public function responseAction()
 {
     if ($this->getRequest()->isPost()) {
         /*
         /* Your gateway's code to make sure the reponse you
         /* just got is from the gatway and not from some weirdo.
         /* This generally has some checksum or other checks,
         /* and is provided by the gateway.
         /* For now, we assume that the gateway's response is valid
         */
         $validated = true;
         $orderId = '123';
         // Generally sent by gateway
         if ($validated) {
             // Payment was successful, so update the order's state, send order email and move to the success page
             $order = Mage::getModel('sales/order');
             $order->loadByIncrementId($orderId);
             $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, 'Gateway has authorized the payment.');
             $order->sendNewOrderEmail();
             $order->setEmailSent(true);
             $order->save();
             Mage::getSingleton('checkout/session')->unsQuoteId();
             Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/success', array('_secure' => true));
         } else {
             // There is a problem in the response we got
             $this->cancelAction();
             Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/failure', array('_secure' => true));
         }
     } else {
         Mage_Core_Controller_Varien_Action::_redirect('');
     }
 }
开发者ID:kozinthetdbp,项目名称:shopmyar,代码行数:32,代码来源:PaymentController.php


示例8: preDispatch

 /**
  * Controller pre-dispatch method
  *
  * @return Mage_XmlConnect_Controller_AdminAction
  */
 public function preDispatch()
 {
     Mage::getSingleton('adminhtml/url')->turnOffSecretKey();
     // override admin store design settings via stores section
     Mage::getDesign()->setArea($this->_currentArea)->setPackageName((string) Mage::getConfig()->getNode('stores/admin/design/package/name'))->setTheme((string) Mage::getConfig()->getNode('stores/admin/design/theme/default'));
     foreach (array('layout', 'template', 'skin', 'locale') as $type) {
         $value = (string) Mage::getConfig()->getNode("stores/admin/design/theme/{$type}");
         if ($value) {
             Mage::getDesign()->setTheme($type, $value);
         }
     }
     $this->getLayout()->setArea($this->_currentArea);
     Mage::dispatchEvent('adminhtml_controller_action_predispatch_start', array());
     Mage_Core_Controller_Varien_Action::preDispatch();
     if ($this->getRequest()->isDispatched() && $this->getRequest()->getActionName() !== 'denied' && !$this->_isAllowed()) {
         $this->_forward('denied');
         $this->setFlag('', self::FLAG_NO_DISPATCH, true);
         return $this;
     }
     if (is_null(Mage::getSingleton('adminhtml/session')->getLocale())) {
         Mage::getSingleton('adminhtml/session')->setLocale(Mage::app()->getLocale()->getLocaleCode());
     }
     $this->getResponse()->setHeader('Content-type', 'text/xml; charset=UTF-8');
     if ($this->_isCheckCookieRequired()) {
         $this->_checkCookie();
     }
     return $this;
 }
开发者ID:QiuLihua83,项目名称:magento-enterprise-1.13.1.0,代码行数:33,代码来源:AdminAction.php


示例9: indexAction

 public function indexAction()
 {
     //echo "mbnsdfjkn";
     $model = Mage::getModel('importexport/export');
     $model->setData(array('entity' => 'catalog_product', 'file_format' => 'csv', 'frontend_label' => '', 'attribute_code' => '', 'export_filter' => array('abc' => '', 'attr_config_sort' => '', 'color' => '', 'cost' => array('0' => '', '1' => ''), 'country_of_manufacture' => '', 'created_at' => array('0' => '', '1' => ''), 'custom_design' => '', 'custom_design_from' => array('0' => '', '1' => ''), 'custom_design_to' => array('0' => '', '1' => ''), 'custom_layout_update' => '', 'description' => '', 'enable_googlecheckout' => '', 'gallery' => '', 'gift_message_available' => '', 'has_options' => '', 'image' => '', 'image_label' => '', 'media_gallery' => '', 'meta_description' => '', 'meta_keyword' => '', 'meta_title' => '', 'minimal_price' => array('0' => '', '1' => ''), 'msrp' => array('0' => '', '1' => ''), 'msrp_display_actual_price_type' => '', 'msrp_enabled' => '', 'name' => '', 'news_from_date' => '', array('0' => '', '1' => ''), 'news_to_date' => '', array('0' => '', '1' => ''), 'options_container' => '', 'page_layout' => '', 'price' => array('0' => '', '1' => ''), 'required_options' => '', 'short_description' => '', 'sku' => '', 'small_image' => '', 'small_image_label' => '', 'special_from_date' => array('0' => '', '1' => ''), 'special_price' => array('0' => '', '1' => ''), 'special_to_date' => array('0' => '', '1' => ''), 'status' => '', 'tax_class_id' => '', 'thumbnail' => '', 'thumbnail_label' => '', 'updated_at' => array('0' => '', '1' => ''), 'url_key' => '', 'url_path' => '', 'visibility' => '', 'weight' => array('0' => '', '1' => ''))));
     //$obj = Mage_Adminhtml_Controller_Action();
     return Mage_Core_Controller_Varien_Action::_prepareDownloadResponse($model->getFileName(), $model->export(), $model->getContentType());
 }
开发者ID:shebin512,项目名称:Magento_Zoff,代码行数:8,代码来源:IndexController.php


示例10: loadOrder

 public function loadOrder($orderId)
 {
     $_order = Mage::getModel('sales/order');
     if (!$_order) {
         Mage_Core_Controller_Varien_Action::_redirect('checkout/cart', array('_secure' => true));
     }
     $_order->loadByIncrementId($orderId);
     $this->order = $_order;
 }
开发者ID:payfort,项目名称:magento-payfort,代码行数:9,代码来源:Order.php


示例11: responseAction

 public function responseAction()
 {
     if ($this->getRequest()->isPost()) {
         /*
         /* Your gateway's code to make sure the reponse you
         /* just got is from the gatway and not from some weirdo.
         /* This generally has some checksum or other checks,
         /* and is provided by the gateway.
         /* For now, we assume that the gateway's response is valid
         */
         $cmob = $_POST['cmob'];
         $ctrxid = $_POST['ctrxid'];
         $tnxId = $_POST['orderId'];
         if ($cmob != "" && $ctrxid != "") {
             $validated = true;
             $orderId = $tnxId;
             $trnsactionId = $ctrxid;
             $customerMobileNumber = $cmob;
         } else {
             if ($cmob != "") {
                 $validated = true;
                 $orderId = $tnxId;
                 $customerMobileNumber = $cmob;
             } else {
                 if ($ctrxid != "") {
                     $validated = true;
                     $orderId = $tnxId;
                     $trnsactionId = $ctrxid;
                 } else {
                     $validated = false;
                 }
             }
         }
         if ($validated) {
             // Payment was successful, so update the order's state, send order email and move to the success page
             $order = Mage::getModel('sales/order');
             $order->loadByIncrementId($orderId);
             $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, 'Gateway has authorized the payment.');
             $order->sendNewOrderEmail();
             $order->setEmailSent(true);
             // customer bkash mobile number and transaction id saved for tracking
             $notification = "Customer mobile: " . $customerMobileNumber . " Transaction ID: " . $trnsactionId;
             $order->addStatusToHistory($order->getStatus(), $notification);
             //saving the transaction id
             $order->save();
             Mage::getSingleton('checkout/session')->unsQuoteId();
             Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/success', array('_secure' => true));
         } else {
             // There is a problem in the response we got
             $this->cancelAction();
             Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/failure', array('_secure' => true));
         }
     } else {
         Mage_Core_Controller_Varien_Action::_redirect('');
     }
 }
开发者ID:abefimrs,项目名称:DBBL-mobile-payment-in-Magento,代码行数:56,代码来源:PaymentController.php


示例12: indexAction

 public function indexAction()
 {
     Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/failure');
     /*$this->loadLayout();
             $block = $this->getLayout()->createBlock(
     		'Mage_Core_Block_Template',
     		'clictopay_echec',
     		array('template' => 'clictopay/echec.phtml')
     		);
     		$this->getLayout()->getBlock('content')->append($block);
             $this->renderLayout();*/
 }
开发者ID:unicomfr,项目名称:magento-clictopay,代码行数:12,代码来源:EchecController.php


示例13: authenticate

 public function authenticate(Mage_Core_Controller_Varien_Action $action, $loginUrl = null)
 {
     if (!$this->isLoggedIn()) {
         $this->setBeforeAuthUrl(Mage::getUrl('*/*/*', array('_current' => true)));
         if (is_null($loginUrl)) {
             $loginUrl = Mage::getUrl('udropship/vendor/login');
         }
         $action->getResponse()->setRedirect($loginUrl);
         return false;
     }
     return true;
 }
开发者ID:xiaoguizhidao,项目名称:magento,代码行数:12,代码来源:Session.php


示例14: responseAction

 public function responseAction()
 {
     if ($this->getRequest()->get("flag") == "1" && $this->getRequest()->get("orderId")) {
         $orderId = $this->getRequest()->get("orderId");
         $order = Mage::getModel('sales/order')->loadByIncrementId($orderId);
         $order->setState(Mage_Sales_Model_Order::STATE_PAYMENT_REVIEW, true, 'Payment Success.');
         $order->save();
         Mage::getSingleton('checkout/session')->unsQuoteId();
         Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/success', array('_secure' => false));
     } else {
         Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/error', array('_secure' => false));
     }
 }
开发者ID:cloudipsp,项目名称:magento,代码行数:13,代码来源:PaymentController.php


示例15: authenticate

 /**
  * Authenticate controller action by login customer
  *
  * @param   Mage_Core_Controller_Varien_Action $action
  * @param   bool $loginUrl
  * @return  bool
  */
 public function authenticate(Mage_Core_Controller_Varien_Action $action, $loginUrl = null)
 {
     if (!$this->_getSession()->isLoggedIn()) {
         if ($action->getRequest()->isAjax()) {
             $this->_getSession()->setBeforeVendorAuthUrl(Mage::getUrl('*/vendor/', array('_current' => true, '_secure' => true, '_nosid' => true)));
         } else {
             $oAuthUrl = Mage::getUrl('*/*/*', array('_current' => true, '_secure' => true, '_nosid' => true));
             $this->_getSession()->setBeforeVendorAuthUrl($oAuthUrl);
         }
         if (is_null($loginUrl)) {
             if (Mage::getConfig()->getModuleConfig('Ced_CsVendorPanel')->is('active', 'true')) {
                 $url = 'csmarketplace/account/login';
             } else {
                 $url = 'customer/account/login';
             }
             $loginUrl = Mage::getUrl($url, array('_secure' => Mage::app()->getFrontController()->getRequest()->isSecure(), '_nosid' => true));
         }
         if ($action->getRequest()->isAjax()) {
             $ajaxResponse = array();
             $ajaxResponse['ajaxExpired'] = true;
             $ajaxResponse['ajaxRedirect'] = $loginUrl;
             $action->getResponse()->setBody(json_encode($ajaxResponse));
             return;
         }
         $action->getResponse()->setRedirect($loginUrl);
         return false;
     }
     if ($this->_getSession()->isLoggedIn() && Mage::helper('csmarketplace')->authenticate($this->_getSession()->getCustomerId())) {
         $vendor = Mage::getModel('csmarketplace/vendor')->loadByCustomerId($this->_getSession()->getCustomerId());
         if ($vendor && $vendor->getId()) {
             $this->_getSession()->setData('vendor_id', $vendor->getId());
             $this->_getSession()->setData('vendor', $vendor);
             Mage::dispatchEvent('ced_csmarketplace_vendor_authenticate_after', array('session' => $this->_getSession()));
         }
     }
     Mage::dispatchEvent('ced_csmarketplace_vendor_acl_check', array('current' => $this, 'action' => $action));
     return $this->_allowedResource;
 }
开发者ID:sixg,项目名称:mkAnagh,代码行数:45,代码来源:AbstractController.php


示例16: returnAction

 public function returnAction()
 {
     /* Your gateway's code to make sure the reponse you
     			/* just got is from the gatway and not from some weirdo.
     			/* This generally has some checksum or other checks,
     			/* and is provided by the gateway.
     			/* For now, we assume that the gateway's response is valid
     			*/
     $data = $this->getRequest()->getParams();
     $orderId = substr($data['txnid'], 2);
     // Generally sent by gateway
     $status = $data['status'];
     $payRef = "reference number";
     if (!empty($orderId)) {
         $validated = true;
     }
     if ($validated) {
         // Payment was successful, so update the order's state, send order email and move to the success page
         $order = Mage::getSingleton('sales/order');
         $order->loadByIncrementId($orderId);
         switch ($status) {
             case "S":
                 $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, 'Gateway has authorized the payment.');
                 break;
             case "P":
                 $order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, true, 'Awaiting Payment.');
                 break;
             default:
                 $order->setState(Mage_Sales_Model_Order::STATE_PENDING_PAYMENT, true, 'Pending');
         }
         $order->sendNewOrderEmail();
         $order->setEmailSent(true);
         $order->save();
         Mage::getSingleton('checkout/session')->unsQuoteId();
         Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/success', array('_secure' => true));
     } else {
         // There is a problem in the response we got
         $this->cancelAction();
         Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/failure', array('_secure' => true));
     }
 }
开发者ID:lordmodkore,项目名称:dragonpay_payment,代码行数:41,代码来源:PaymentController.php


示例17: responseAction

 public function responseAction()
 {
     $orderId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
     $order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
     /*
      * $order = Mage::getModel('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
      * $order->getGrandTotal();
      *
      * */
     /*
              * * Most frequent transaction statuses:
              * *
     			0 - Invalid or incomplete
     			1 - Cancelled by customer
     			2 - Authorisation declined
     			5 - Authorised
     			9 - Payment requested
     */
     $response_code = $this->getRequest()->getParam('f_code');
     $error = false;
     $status = "";
     if ($response_code == "Ok") {
         $response_type = "accept";
     } else {
         $response_type = "decline";
     }
     switch ($response_type) {
         case 'accept':
             /** trying to create invoice * */
             try {
                 if (!$order->canInvoice()) {
                     //Mage::throwException(Mage::helper('core')->__('cannot create an invoice !'));
                     $response_message = $this->__('Error: cannot create an invoice !');
                     $this->renderResponse($response_message);
                     return false;
                 } else {
                     /** create invoice  **/
                     //$invoiceId = Mage::getModel('sales/order_invoice_api')->create($order->getIncremenetId(), array());
                     $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
                     if (!$invoice->getTotalQty()) {
                         //Mage::throwException(Mage::helper('core')->__('cannot create an invoice without products !'));
                         $response_message = $this->__('Error: cannot create an invoice without products !');
                         $this->renderResponse($response_message);
                         return false;
                     }
                     $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
                     $invoice->register();
                     $transactionSave = Mage::getModel('core/resource_transaction')->addObject($invoice)->addObject($invoice->getOrder());
                     $transactionSave->save();
                     $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, 'Payfort has accepted the payment.');
                     /** load invoice * */
                     //$invoice = Mage::getModel('sales/order_invoice')->loadByIncrementId($invoiceId);
                     /** pay invoice * */
                     //$invoice->capture()->save();
                 }
             } catch (Mage_Core_Exception $e) {
                 //Mage::throwException(Mage::helper('core')->__('cannot create an invoice !'));
             }
             $order->sendNewOrderEmail();
             $order->setEmailSent(true);
             $order->save();
             $response_status = 9;
             if ($response_status == 9) {
                 $response_message = $this->__('Your payment is accepted.');
             } elseif ($response_status == 5) {
                 $response_message = $this->__('Your payment is authorized.');
             } else {
                 $response_message = $this->__('Unknown response status.');
             }
             // $this->renderResponse($response_message);
             // Mage::getSingleton('checkout/session')->setSuccessMessage($response_status_message);
             Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/success', array('_secure' => true));
             return;
             break;
         case 'decline':
             // There is a problem in the response we got
             $this->cancelAction();
             // $response_status_message = Mage::helper('payfort/data')->getResponseCodeDescription($response_status);
             Mage::getSingleton('checkout/session')->setErrorMessage($response_status_message);
             Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/failure', array('_secure' => true));
             // $this->renderResponse($response_message);
             return;
             break;
         case 'exception':
             // There is a problem in the response we got
             $this->cancelAction();
             // $response_status_message = Mage::helper('payfort/data')->getResponseCodeDescription($response_status);
             Mage::getSingleton('checkout/session')->setErrorMessage($response_status_message);
             Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/failure', array('_secure' => true));
             // $this->renderResponse($response_message);
             return;
             break;
         case 'cancel':
             // There is a problem in the response we got
             $this->cancelAction();
             // $response_status_message = Mage::helper('payfort/data')->getResponseCodeDescription($response_status);
             Mage::getSingleton('checkout/session')->setErrorMessage($response_status_message);
             Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/failure', array('_secure' => true));
             // $this->renderResponse($response_message);
             return;
//.........这里部分代码省略.........
开发者ID:Atom-Technology,项目名称:Paynetz_Payment,代码行数:101,代码来源:PaymentController.php


示例18: authenticate

 /**
  * Authenticate controller action by login customer
  *
  * @param   Mage_Core_Controller_Varien_Action $action
  * @return  bool
  */
 public function authenticate(Mage_Core_Controller_Varien_Action $action, $loginUrl = null)
 {
     if (!$this->isLoggedIn()) {
         $this->setBeforeAuthUrl(AO::getUrl('*/*/*', array('_current' => true)));
         if (is_null($loginUrl)) {
             $loginUrl = AO::helper('customer')->getLoginUrl();
         }
         $action->getResponse()->setRedirect($loginUrl);
         return false;
     }
     return true;
 }
开发者ID:ronseigel,项目名称:agent-ohm,代码行数:18,代码来源:Session.php


示例19: cancelAction

 public function cancelAction()
 {
     /*
             $session = Mage::getSingleton('checkout/session');
             $session->setQuoteId($session->getCcavenuepayStandardQuoteId(true));
     
      
     $order_history_comment='';	
             
             if ($session->getLastRealOrderId()) {
                 $order = Mage::getModel('sales/order')->loadByIncrementId($session->getLastRealOrderId());
                 if ($order->getId()) {
     		 
     		$order_history_comments = $this->getCheckout()->getCcavenuepayErrorMessage();
     		foreach($order_history_comments as $order_history_comment)
     		{
     			if($order_history_comment !='') $order->addStatusHistoryComment($order_history_comment,true);
     		}			
                     $order->cancel()->save();
                 }
             }
     
            
     Mage::getSingleton('checkout/session')->addError("CcavenuePay Payment has been cancelled and the transaction has been declined.");
     if($order_history_comment!='')	Mage::getSingleton('checkout/session')->addError($order_history_comment);
     $this->_redirect('checkout/cart');
     */
     if (Mage::getSingleton('checkout/session')->getLastRealOrderId()) {
         $this->cancelOrder(Mage::helper('ccavenuepay')->__('The payment was cancelled at CC Avenue.'));
         Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/failure', array('_secure' => true));
     } else {
         Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/failure', array('_secure' => true));
     }
 }
开发者ID:sagmahajan,项目名称:aswan_release,代码行数:34,代码来源:CcavenuepayController.php


示例20: cancelAction

 /**
  * Triggered when a user cancels a payment at CC Avenue
  * or when there was a proble with the payment
  */
 public function cancelAction()
 {
     $this->cancelOrder(Mage::helper('ccavenue')->__('The payment was cancelled at CC Avenue.'));
     Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/failure', array('_secure' => true));
 }
开发者ID:vinayshuklasourcefuse,项目名称:sareez,代码行数:9,代码来源:PaymentController.php



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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