How to override getAddUrl in class Mage_Checkout_Helper_Cart?Bypass Magento's form key usage to allow simple product to be added to cartExclude a specific categoryForm Key Problems After Changing Domains 1.9.2.1getVisitorData() returns NULL on Category Page only in magento-1.9.2.2How to add a custom page with cross-sell productsShopping cart is empty after cancel the payment in magento-1.9.1.1A problem in order details returnMagento model not fetching dataCheckout redirecting to the cart pageMagento 1.9.3.9 PayFlow API - Multiple Issues
What's the 1 inch size square knob sticking out of wall?
Extrapolation v. Interpolation
Some complicated clues
Sci-fi short story: plants attracting spaceship and using them as a agents of pollination between two planets
My current job follows "worst practices". How can I talk about my experience in an interview without giving off red flags?
What is the purpose of this "red room" in "Stranger Things"?
How can the artificial womb be made affordable for the common people?
Is an easily guessed plot twist a good plot twist?
Monty Hall Problem with a Fallible Monty
Why is chess failing to attract big name sponsors?
Can 々 stand for a duplicated kanji with a different reading?
Why does the salt in the oceans not sink to the bottom?
How can I show that the speed of light in vacuum is the same in all reference frames?
Can't understand how static works exactly
Why is DC so, so, so Democratic?
Are gangsters hired to attack people at a train station classified as a terrorist attack?
Why is the UH-60 tail rotor canted?
How to repair basic cable/wire issue for household appliances
what to say when a company asks you why someone (a friend) who was fired left?
In a script how can I signal who's winning the argument?
Is it possible to eat quietly in Minecraft?
how to add 1 milliseconds on a datetime string?
How can I tell if there was a power cut when I was out?
Are symplectomorphisms of Weil–Petersson symplectic form induced from surface diffeomorphisms?
How to override getAddUrl in class Mage_Checkout_Helper_Cart?
Bypass Magento's form key usage to allow simple product to be added to cartExclude a specific categoryForm Key Problems After Changing Domains 1.9.2.1getVisitorData() returns NULL on Category Page only in magento-1.9.2.2How to add a custom page with cross-sell productsShopping cart is empty after cancel the payment in magento-1.9.1.1A problem in order details returnMagento model not fetching dataCheckout redirecting to the cart pageMagento 1.9.3.9 PayFlow API - Multiple Issues
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I have a problem with changing getAddUrl() method in magento. In this method:
public function getAddUrl($product, $additional = array())
$routeParams = array(
Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->_getHelperInstance('core')
->urlEncode($this->getCurrentUrl()),
'product' => $product->getEntityId(),
Mage_Core_Model_Url::FORM_KEY => $this->_getSingletonModel('core/session')->getFormKey()
);
if (!empty($additional))
$routeParams = array_merge($routeParams, $additional);
if ($product->hasUrlDataObject())
$routeParams['_store'] = $product->getUrlDataObject()->getStoreId();
$routeParams['_store_to_url'] = true;
if ($this->_getRequest()->getRouteName() == 'checkout'
&& $this->_getRequest()->getControllerName() == 'cart')
$routeParams['in_cart'] = 1;
return $this->_getUrl('checkout/cart/add', $routeParams);
we have line:
Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->_getHelperInstance('core')
->urlEncode($this->getCurrentUrl()),
I need to change the current url to another:
Mage::getSingleton('core/session')->getLastUrl()
But i do not know what is the proper way to do this.
Thanks in advance for all tips.
magento-1.9
add a comment |
I have a problem with changing getAddUrl() method in magento. In this method:
public function getAddUrl($product, $additional = array())
$routeParams = array(
Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->_getHelperInstance('core')
->urlEncode($this->getCurrentUrl()),
'product' => $product->getEntityId(),
Mage_Core_Model_Url::FORM_KEY => $this->_getSingletonModel('core/session')->getFormKey()
);
if (!empty($additional))
$routeParams = array_merge($routeParams, $additional);
if ($product->hasUrlDataObject())
$routeParams['_store'] = $product->getUrlDataObject()->getStoreId();
$routeParams['_store_to_url'] = true;
if ($this->_getRequest()->getRouteName() == 'checkout'
&& $this->_getRequest()->getControllerName() == 'cart')
$routeParams['in_cart'] = 1;
return $this->_getUrl('checkout/cart/add', $routeParams);
we have line:
Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->_getHelperInstance('core')
->urlEncode($this->getCurrentUrl()),
I need to change the current url to another:
Mage::getSingleton('core/session')->getLastUrl()
But i do not know what is the proper way to do this.
Thanks in advance for all tips.
magento-1.9
add a comment |
I have a problem with changing getAddUrl() method in magento. In this method:
public function getAddUrl($product, $additional = array())
$routeParams = array(
Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->_getHelperInstance('core')
->urlEncode($this->getCurrentUrl()),
'product' => $product->getEntityId(),
Mage_Core_Model_Url::FORM_KEY => $this->_getSingletonModel('core/session')->getFormKey()
);
if (!empty($additional))
$routeParams = array_merge($routeParams, $additional);
if ($product->hasUrlDataObject())
$routeParams['_store'] = $product->getUrlDataObject()->getStoreId();
$routeParams['_store_to_url'] = true;
if ($this->_getRequest()->getRouteName() == 'checkout'
&& $this->_getRequest()->getControllerName() == 'cart')
$routeParams['in_cart'] = 1;
return $this->_getUrl('checkout/cart/add', $routeParams);
we have line:
Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->_getHelperInstance('core')
->urlEncode($this->getCurrentUrl()),
I need to change the current url to another:
Mage::getSingleton('core/session')->getLastUrl()
But i do not know what is the proper way to do this.
Thanks in advance for all tips.
magento-1.9
I have a problem with changing getAddUrl() method in magento. In this method:
public function getAddUrl($product, $additional = array())
$routeParams = array(
Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->_getHelperInstance('core')
->urlEncode($this->getCurrentUrl()),
'product' => $product->getEntityId(),
Mage_Core_Model_Url::FORM_KEY => $this->_getSingletonModel('core/session')->getFormKey()
);
if (!empty($additional))
$routeParams = array_merge($routeParams, $additional);
if ($product->hasUrlDataObject())
$routeParams['_store'] = $product->getUrlDataObject()->getStoreId();
$routeParams['_store_to_url'] = true;
if ($this->_getRequest()->getRouteName() == 'checkout'
&& $this->_getRequest()->getControllerName() == 'cart')
$routeParams['in_cart'] = 1;
return $this->_getUrl('checkout/cart/add', $routeParams);
we have line:
Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->_getHelperInstance('core')
->urlEncode($this->getCurrentUrl()),
I need to change the current url to another:
Mage::getSingleton('core/session')->getLastUrl()
But i do not know what is the proper way to do this.
Thanks in advance for all tips.
magento-1.9
magento-1.9
asked Jul 15 at 9:46
SebastianTSebastianT
526 bronze badges
526 bronze badges
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Try following way to overwrite class:
app/code/local/SR/MagentoCommunity/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<SR_MagentoCommunity>
<version>0.0.0.2</version>
</SR_MagentoCommunity>
</modules>
<global>
<helpers>
<checkout>
<rewrite>
<cart>SR_MagentoCommunity_Helper_Cart</cart>
</rewrite>
</checkout>
</helpers>
</global>
</config>
app/code/local/SR/MagentoCommunity/Helper/Cart.php
Modify here as your need
<?php
class SR_MagentoCommunity_Helper_Cart extends Mage_Checkout_Helper_Cart
public function getAddUrl($product, $additional = array())
$routeParams = array(
Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->_getHelperInstance('core')
->urlEncode($this->getCurrentUrl()),
'product' => $product->getEntityId(),
Mage_Core_Model_Url::FORM_KEY => $this->_getSingletonModel('core/session')->getFormKey()
);
if (!empty($additional))
$routeParams = array_merge($routeParams, $additional);
if ($product->hasUrlDataObject())
$routeParams['_store'] = $product->getUrlDataObject()->getStoreId();
$routeParams['_store_to_url'] = true;
if ($this->_getRequest()->getRouteName() == 'checkout'
&& $this->_getRequest()->getControllerName() == 'cart')
$routeParams['in_cart'] = 1;
return $this->_getUrl('checkout/cart/add', $routeParams);
app/etc/modules/SR_MagentoCommunity.xml
<?xml version="1.0"?>
<config>
<modules>
<SR_MagentoCommunity>
<active>true</active>
<codePool>local</codePool>
</SR_MagentoCommunity>
</modules>
</config>
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "479"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f282078%2fhow-to-override-getaddurl-in-class-mage-checkout-helper-cart%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try following way to overwrite class:
app/code/local/SR/MagentoCommunity/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<SR_MagentoCommunity>
<version>0.0.0.2</version>
</SR_MagentoCommunity>
</modules>
<global>
<helpers>
<checkout>
<rewrite>
<cart>SR_MagentoCommunity_Helper_Cart</cart>
</rewrite>
</checkout>
</helpers>
</global>
</config>
app/code/local/SR/MagentoCommunity/Helper/Cart.php
Modify here as your need
<?php
class SR_MagentoCommunity_Helper_Cart extends Mage_Checkout_Helper_Cart
public function getAddUrl($product, $additional = array())
$routeParams = array(
Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->_getHelperInstance('core')
->urlEncode($this->getCurrentUrl()),
'product' => $product->getEntityId(),
Mage_Core_Model_Url::FORM_KEY => $this->_getSingletonModel('core/session')->getFormKey()
);
if (!empty($additional))
$routeParams = array_merge($routeParams, $additional);
if ($product->hasUrlDataObject())
$routeParams['_store'] = $product->getUrlDataObject()->getStoreId();
$routeParams['_store_to_url'] = true;
if ($this->_getRequest()->getRouteName() == 'checkout'
&& $this->_getRequest()->getControllerName() == 'cart')
$routeParams['in_cart'] = 1;
return $this->_getUrl('checkout/cart/add', $routeParams);
app/etc/modules/SR_MagentoCommunity.xml
<?xml version="1.0"?>
<config>
<modules>
<SR_MagentoCommunity>
<active>true</active>
<codePool>local</codePool>
</SR_MagentoCommunity>
</modules>
</config>
add a comment |
Try following way to overwrite class:
app/code/local/SR/MagentoCommunity/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<SR_MagentoCommunity>
<version>0.0.0.2</version>
</SR_MagentoCommunity>
</modules>
<global>
<helpers>
<checkout>
<rewrite>
<cart>SR_MagentoCommunity_Helper_Cart</cart>
</rewrite>
</checkout>
</helpers>
</global>
</config>
app/code/local/SR/MagentoCommunity/Helper/Cart.php
Modify here as your need
<?php
class SR_MagentoCommunity_Helper_Cart extends Mage_Checkout_Helper_Cart
public function getAddUrl($product, $additional = array())
$routeParams = array(
Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->_getHelperInstance('core')
->urlEncode($this->getCurrentUrl()),
'product' => $product->getEntityId(),
Mage_Core_Model_Url::FORM_KEY => $this->_getSingletonModel('core/session')->getFormKey()
);
if (!empty($additional))
$routeParams = array_merge($routeParams, $additional);
if ($product->hasUrlDataObject())
$routeParams['_store'] = $product->getUrlDataObject()->getStoreId();
$routeParams['_store_to_url'] = true;
if ($this->_getRequest()->getRouteName() == 'checkout'
&& $this->_getRequest()->getControllerName() == 'cart')
$routeParams['in_cart'] = 1;
return $this->_getUrl('checkout/cart/add', $routeParams);
app/etc/modules/SR_MagentoCommunity.xml
<?xml version="1.0"?>
<config>
<modules>
<SR_MagentoCommunity>
<active>true</active>
<codePool>local</codePool>
</SR_MagentoCommunity>
</modules>
</config>
add a comment |
Try following way to overwrite class:
app/code/local/SR/MagentoCommunity/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<SR_MagentoCommunity>
<version>0.0.0.2</version>
</SR_MagentoCommunity>
</modules>
<global>
<helpers>
<checkout>
<rewrite>
<cart>SR_MagentoCommunity_Helper_Cart</cart>
</rewrite>
</checkout>
</helpers>
</global>
</config>
app/code/local/SR/MagentoCommunity/Helper/Cart.php
Modify here as your need
<?php
class SR_MagentoCommunity_Helper_Cart extends Mage_Checkout_Helper_Cart
public function getAddUrl($product, $additional = array())
$routeParams = array(
Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->_getHelperInstance('core')
->urlEncode($this->getCurrentUrl()),
'product' => $product->getEntityId(),
Mage_Core_Model_Url::FORM_KEY => $this->_getSingletonModel('core/session')->getFormKey()
);
if (!empty($additional))
$routeParams = array_merge($routeParams, $additional);
if ($product->hasUrlDataObject())
$routeParams['_store'] = $product->getUrlDataObject()->getStoreId();
$routeParams['_store_to_url'] = true;
if ($this->_getRequest()->getRouteName() == 'checkout'
&& $this->_getRequest()->getControllerName() == 'cart')
$routeParams['in_cart'] = 1;
return $this->_getUrl('checkout/cart/add', $routeParams);
app/etc/modules/SR_MagentoCommunity.xml
<?xml version="1.0"?>
<config>
<modules>
<SR_MagentoCommunity>
<active>true</active>
<codePool>local</codePool>
</SR_MagentoCommunity>
</modules>
</config>
Try following way to overwrite class:
app/code/local/SR/MagentoCommunity/etc/config.xml
<?xml version="1.0"?>
<config>
<modules>
<SR_MagentoCommunity>
<version>0.0.0.2</version>
</SR_MagentoCommunity>
</modules>
<global>
<helpers>
<checkout>
<rewrite>
<cart>SR_MagentoCommunity_Helper_Cart</cart>
</rewrite>
</checkout>
</helpers>
</global>
</config>
app/code/local/SR/MagentoCommunity/Helper/Cart.php
Modify here as your need
<?php
class SR_MagentoCommunity_Helper_Cart extends Mage_Checkout_Helper_Cart
public function getAddUrl($product, $additional = array())
$routeParams = array(
Mage_Core_Controller_Front_Action::PARAM_NAME_URL_ENCODED => $this->_getHelperInstance('core')
->urlEncode($this->getCurrentUrl()),
'product' => $product->getEntityId(),
Mage_Core_Model_Url::FORM_KEY => $this->_getSingletonModel('core/session')->getFormKey()
);
if (!empty($additional))
$routeParams = array_merge($routeParams, $additional);
if ($product->hasUrlDataObject())
$routeParams['_store'] = $product->getUrlDataObject()->getStoreId();
$routeParams['_store_to_url'] = true;
if ($this->_getRequest()->getRouteName() == 'checkout'
&& $this->_getRequest()->getControllerName() == 'cart')
$routeParams['in_cart'] = 1;
return $this->_getUrl('checkout/cart/add', $routeParams);
app/etc/modules/SR_MagentoCommunity.xml
<?xml version="1.0"?>
<config>
<modules>
<SR_MagentoCommunity>
<active>true</active>
<codePool>local</codePool>
</SR_MagentoCommunity>
</modules>
</config>
answered Jul 15 at 10:01
Sohel RanaSohel Rana
25.5k3 gold badges47 silver badges65 bronze badges
25.5k3 gold badges47 silver badges65 bronze badges
add a comment |
add a comment |
Thanks for contributing an answer to Magento Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmagento.stackexchange.com%2fquestions%2f282078%2fhow-to-override-getaddurl-in-class-mage-checkout-helper-cart%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown