本文整理汇总了PHP中Mage_Checkout_Controller_Action类的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Checkout_Controller_Action类的具体用法?PHP Mage_Checkout_Controller_Action怎么用?PHP Mage_Checkout_Controller_Action使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Mage_Checkout_Controller_Action类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: preDispatch
/**
* Action predispatch
*
* Check customer authentication for some actions
*
* @return Mage_Checkout_MultishippingController
*/
public function preDispatch()
{
parent::preDispatch();
$action = $this->getRequest()->getActionName();
if (!preg_match('#^(login|register)#', $action)) {
if (!AO::getSingleton('customer/session')->authenticate($this, $this->_getHelper()->getMSLoginUrl())) {
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
}
if (!AO::helper('checkout')->isMultishippingCheckoutAvailable()) {
$this->_redirectUrl($this->_getHelper()->getCartUrl());
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
return $this;
}
}
if (!$this->_preDispatchValidateCustomer()) {
return $this;
}
if (AO::getSingleton('checkout/session')->getCartWasUpdated(true) && !in_array($action, array('index', 'login', 'register', 'addresses', 'success'))) {
$this->_redirectUrl($this->_getHelper()->getCartUrl());
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
}
if ($action == 'success' && $this->_getCheckout()->getCheckoutSession()->getDisplaySuccess(true)) {
return $this;
}
$quote = $this->_getCheckout()->getQuote();
if (!$quote->hasItems() || $quote->getHasError() || $quote->isVirtual()) {
$this->_redirectUrl($this->_getHelper()->getCartUrl());
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
return;
}
return $this;
}
示例2: preDispatch
/**
* Check if customer is logged in or not
* If not logged in then redirect to customer login
*/
public function preDispatch()
{
parent::preDispatch();
if (!Mage::getSingleton('customer/session')->authenticate($this)) {
$this->setFlag('', 'no-dispatch', true);
}
}
示例3: preDispatch
/**
* @return Mage_Checkout_OnepageController
*/
public function preDispatch()
{
parent::preDispatch();
if (!$this->_preDispatchValidateCustomer()) {
return $this;
}
return $this;
}
示例4: preDispatch
/**
* Pre dispatch hook. Remove addresses created by multishipping checkout
*
*/
public function preDispatch()
{
parent::preDispatch();
$checkoutSessionQuote = Mage::getSingleton('checkout/session')->getQuote();
if ($checkoutSessionQuote->getIsMultiShipping()) {
$checkoutSessionQuote->setIsMultiShipping(false);
$checkoutSessionQuote->removeAllAddresses();
}
return $this;
}
示例5: preDispatch
/**
* @return Mage_Checkout_OnepageController
*/
public function preDispatch()
{
parent::preDispatch();
$this->_preDispatchValidateCustomer();
$checkoutSessionQuote = Mage::getSingleton('checkout/session')->getQuote();
if ($checkoutSessionQuote->getIsMultiShipping()) {
$checkoutSessionQuote->setIsMultiShipping(false);
$checkoutSessionQuote->removeAllAddresses();
}
if ($this->getRequest()->getActionName() != 'success') {
Mage::helper('anattadesign_awesomecheckout')->estimateShipping();
}
return $this;
}
示例6: preDispatch
/**
* Action predispatch
*
* Check customer authentication for some actions
*
* @return Mage_Checkout_MultishippingController
*/
public function preDispatch()
{
parent::preDispatch();
if ($this->getFlag('', 'redirectLogin')) {
return $this;
}
$action = strtolower($this->getRequest()->getActionName());
$checkoutSessionQuote = $this->_getCheckoutSession()->getQuote();
/**
* Catch index action call to set some flags before checkout/type_multishipping model initialization
*/
if ($action == 'index') {
$checkoutSessionQuote->setIsMultiShipping(true);
$this->_getCheckoutSession()->setCheckoutState(Mage_Checkout_Model_Session::CHECKOUT_STATE_BEGIN);
} elseif (!$checkoutSessionQuote->getIsMultiShipping() && !in_array($action, array('login', 'register', 'success'))) {
$this->_redirect('*/*/index');
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
return $this;
}
if (!in_array($action, array('login', 'register'))) {
if (!Mage::getSingleton('customer/session')->authenticate($this, $this->_getHelper()->getMSLoginUrl())) {
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
}
if (!Mage::helper('checkout')->isMultishippingCheckoutAvailable()) {
$error = $this->_getCheckout()->getMinimumAmountError();
$this->_getCheckoutSession()->addError($error);
$this->_redirectUrl($this->_getHelper()->getCartUrl());
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
return $this;
}
}
if (!$this->_preDispatchValidateCustomer()) {
return $this;
}
if ($this->_getCheckoutSession()->getCartWasUpdated(true) && !in_array($action, array('index', 'login', 'register', 'addresses', 'success'))) {
$this->_redirectUrl($this->_getHelper()->getCartUrl());
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
}
if ($action == 'success' && $this->_getCheckout()->getCheckoutSession()->getDisplaySuccess(true)) {
return $this;
}
$quote = $this->_getCheckout()->getQuote();
if (!$quote->hasItems() || $quote->getHasError() || $quote->isVirtual()) {
$this->_redirectUrl($this->_getHelper()->getCartUrl());
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
return;
}
return $this;
}
示例7: preDispatch
/**
* @return Mage_Checkout_OnepageController
*/
public function preDispatch()
{
parent::preDispatch();
$this->_preDispatchValidateCustomer();
$checkoutSessionQuote = Mage::getSingleton('buyback/session')->getQuote();
if ($checkoutSessionQuote->getIsMultiShipping()) {
$checkoutSessionQuote->setIsMultiShipping(false);
$checkoutSessionQuote->removeAllAddresses();
}
if (!$this->_canShowForUnregisteredUsers()) {
$this->norouteAction();
$this->setFlag('', self::FLAG_NO_DISPATCH, true);
return;
}
return $this;
}
示例8: preDispatch
/**
* Check query string paramters for order reference and/or access token
*/
public function preDispatch()
{
parent::preDispatch();
$this->_amazonOrderReferenceId = htmlentities($this->getRequest()->getParam('amazon_order_reference_id'));
if (!$this->_amazonOrderReferenceId) {
$this->_amazonOrderReferenceId = Mage::getSingleton('checkout/session')->getAmazonOrderReferenceId();
} else {
Mage::getSingleton('checkout/session')->setAmazonOrderReferenceId($this->_amazonOrderReferenceId);
}
// User is logging in...
$token = htmlentities($this->getRequest()->getParam('access_token'));
if ($token) {
$_amazonLogin = Mage::getModel('amazon_login/customer');
if (!Mage::getSingleton('customer/session')->isLoggedIn()) {
if (!$this->_getConfig()->isGuestCheckout() || !$this->_getOnepage()->getQuote()->isAllowedGuestCheckout()) {
$customer = $_amazonLogin->loginWithToken($token, $this->_checkoutUrl);
} else {
$amazonProfile = $_amazonLogin->getAmazonProfile($token);
if ($amazonProfile && isset($amazonProfile['email'])) {
Mage::getSingleton('checkout/session')->setCustomerEmail($amazonProfile['email']);
Mage::getSingleton('checkout/session')->setCustomerName($amazonProfile['name']);
}
}
}
Mage::getSingleton('checkout/session')->setAmazonAccessToken($token);
// Full-page redirect (user did not sign in using popup)
if ($this->getRequest()->getParam('nopopup')) {
$this->_redirectUrl(Mage::helper('amazon_payments')->getCheckoutUrl(false) . '#access_token=' . $token);
} else {
if (Mage::app()->getRequest()->getParams('account') == 'redirect') {
$this->_redirect('customer/account');
} else {
if (!$this->getRequest()->getParam('ajax')) {
$this->_redirect($this->_checkoutUrl, array('_secure' => true));
return;
}
}
}
}
}