本文整理汇总了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类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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();
}
示例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;
}
示例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));
}
}
示例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;
}
示例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;
}
示例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;
}
示例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('');
}
}
示例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;
}
示例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());
}
示例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;
}
示例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('');
}
}
示例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();*/
}
示例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;
}
示例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));
}
}
示例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;
}