How to get quote_id in “checkout_cart_product_add_after” event
I have added checkout_cart_product_add_after
event in my custom module like :
<checkout_cart_product_add_after>
<observers>
<custom_detect_product_changes>
<type>singleton</type>
<class>custom/observer</class>
<method>customFunction</method>
</custom_detect_product_changes>
</observers>
</checkout_cart_product_add_after>
And in Observer.php
I want to get quote_id like :
...
public function customFunction(Varien_Event_Observer $observer)
{
// here I want to get quote_id
}
...
How to get quote_id
in customFunction
?
magento-1.9 quote
bumped to the homepage by Community♦ 11 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
add a comment |
I have added checkout_cart_product_add_after
event in my custom module like :
<checkout_cart_product_add_after>
<observers>
<custom_detect_product_changes>
<type>singleton</type>
<class>custom/observer</class>
<method>customFunction</method>
</custom_detect_product_changes>
</observers>
</checkout_cart_product_add_after>
And in Observer.php
I want to get quote_id like :
...
public function customFunction(Varien_Event_Observer $observer)
{
// here I want to get quote_id
}
...
How to get quote_id
in customFunction
?
magento-1.9 quote
bumped to the homepage by Community♦ 11 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
have you got solution of it??
– aton1004
Feb 22 '17 at 12:20
I don't know your purpose of the customFunction but if you observer the checkout_cart_product_add_after you will miss actions like updating the cart or removing a product.
– Mr. Lewis
Dec 3 '18 at 14:40
add a comment |
I have added checkout_cart_product_add_after
event in my custom module like :
<checkout_cart_product_add_after>
<observers>
<custom_detect_product_changes>
<type>singleton</type>
<class>custom/observer</class>
<method>customFunction</method>
</custom_detect_product_changes>
</observers>
</checkout_cart_product_add_after>
And in Observer.php
I want to get quote_id like :
...
public function customFunction(Varien_Event_Observer $observer)
{
// here I want to get quote_id
}
...
How to get quote_id
in customFunction
?
magento-1.9 quote
I have added checkout_cart_product_add_after
event in my custom module like :
<checkout_cart_product_add_after>
<observers>
<custom_detect_product_changes>
<type>singleton</type>
<class>custom/observer</class>
<method>customFunction</method>
</custom_detect_product_changes>
</observers>
</checkout_cart_product_add_after>
And in Observer.php
I want to get quote_id like :
...
public function customFunction(Varien_Event_Observer $observer)
{
// here I want to get quote_id
}
...
How to get quote_id
in customFunction
?
magento-1.9 quote
magento-1.9 quote
asked Jan 30 '17 at 5:52
Vinaya Maheshwari
1,16211846
1,16211846
bumped to the homepage by Community♦ 11 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
bumped to the homepage by Community♦ 11 hours ago
This question has answers that may be good or bad; the system has marked it active so that they can be reviewed.
have you got solution of it??
– aton1004
Feb 22 '17 at 12:20
I don't know your purpose of the customFunction but if you observer the checkout_cart_product_add_after you will miss actions like updating the cart or removing a product.
– Mr. Lewis
Dec 3 '18 at 14:40
add a comment |
have you got solution of it??
– aton1004
Feb 22 '17 at 12:20
I don't know your purpose of the customFunction but if you observer the checkout_cart_product_add_after you will miss actions like updating the cart or removing a product.
– Mr. Lewis
Dec 3 '18 at 14:40
have you got solution of it??
– aton1004
Feb 22 '17 at 12:20
have you got solution of it??
– aton1004
Feb 22 '17 at 12:20
I don't know your purpose of the customFunction but if you observer the checkout_cart_product_add_after you will miss actions like updating the cart or removing a product.
– Mr. Lewis
Dec 3 '18 at 14:40
I don't know your purpose of the customFunction but if you observer the checkout_cart_product_add_after you will miss actions like updating the cart or removing a product.
– Mr. Lewis
Dec 3 '18 at 14:40
add a comment |
3 Answers
3
active
oldest
votes
public function customFunction(Varien_Event_Observer $observer){
$quoteId = $observer->getQuoteItem()->getQuote()->getId();
}
You can get quote Id like this.
It is not working when first item added into quote, it is only working when quote already initiated and have at least one item in cart.
– Vinaya Maheshwari
Jan 30 '17 at 6:33
What do you want to do in this function ? If you are use "checkout_cart_add_product_complete" observer instead of "checkout_cart_product_add_after"
– prathmeshb1
Jan 30 '17 at 6:44
I am using both event in my custom module, incheckout_cart_product_add_after
event, I want to set custom price to cart item.
– Vinaya Maheshwari
Jan 30 '17 at 6:47
add a comment |
You can get Quote id using this code:
<?php $quote = $cart = Mage::getModel('checkout/cart')->getQuote();
var_dump($quote->getQuoteId());
?>
I tried it, but it is not working.
– Vinaya Maheshwari
Jan 31 '17 at 7:30
add a comment |
You can get the quote id from checkout session like below:
$session = Mage::getSingleton('checkout/session');
$quote_id = $session->getQuoteId();
I hope this will help you.
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%2f156946%2fhow-to-get-quote-id-in-checkout-cart-product-add-after-event%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
public function customFunction(Varien_Event_Observer $observer){
$quoteId = $observer->getQuoteItem()->getQuote()->getId();
}
You can get quote Id like this.
It is not working when first item added into quote, it is only working when quote already initiated and have at least one item in cart.
– Vinaya Maheshwari
Jan 30 '17 at 6:33
What do you want to do in this function ? If you are use "checkout_cart_add_product_complete" observer instead of "checkout_cart_product_add_after"
– prathmeshb1
Jan 30 '17 at 6:44
I am using both event in my custom module, incheckout_cart_product_add_after
event, I want to set custom price to cart item.
– Vinaya Maheshwari
Jan 30 '17 at 6:47
add a comment |
public function customFunction(Varien_Event_Observer $observer){
$quoteId = $observer->getQuoteItem()->getQuote()->getId();
}
You can get quote Id like this.
It is not working when first item added into quote, it is only working when quote already initiated and have at least one item in cart.
– Vinaya Maheshwari
Jan 30 '17 at 6:33
What do you want to do in this function ? If you are use "checkout_cart_add_product_complete" observer instead of "checkout_cart_product_add_after"
– prathmeshb1
Jan 30 '17 at 6:44
I am using both event in my custom module, incheckout_cart_product_add_after
event, I want to set custom price to cart item.
– Vinaya Maheshwari
Jan 30 '17 at 6:47
add a comment |
public function customFunction(Varien_Event_Observer $observer){
$quoteId = $observer->getQuoteItem()->getQuote()->getId();
}
You can get quote Id like this.
public function customFunction(Varien_Event_Observer $observer){
$quoteId = $observer->getQuoteItem()->getQuote()->getId();
}
You can get quote Id like this.
answered Jan 30 '17 at 6:19
prathmeshb1
1244
1244
It is not working when first item added into quote, it is only working when quote already initiated and have at least one item in cart.
– Vinaya Maheshwari
Jan 30 '17 at 6:33
What do you want to do in this function ? If you are use "checkout_cart_add_product_complete" observer instead of "checkout_cart_product_add_after"
– prathmeshb1
Jan 30 '17 at 6:44
I am using both event in my custom module, incheckout_cart_product_add_after
event, I want to set custom price to cart item.
– Vinaya Maheshwari
Jan 30 '17 at 6:47
add a comment |
It is not working when first item added into quote, it is only working when quote already initiated and have at least one item in cart.
– Vinaya Maheshwari
Jan 30 '17 at 6:33
What do you want to do in this function ? If you are use "checkout_cart_add_product_complete" observer instead of "checkout_cart_product_add_after"
– prathmeshb1
Jan 30 '17 at 6:44
I am using both event in my custom module, incheckout_cart_product_add_after
event, I want to set custom price to cart item.
– Vinaya Maheshwari
Jan 30 '17 at 6:47
It is not working when first item added into quote, it is only working when quote already initiated and have at least one item in cart.
– Vinaya Maheshwari
Jan 30 '17 at 6:33
It is not working when first item added into quote, it is only working when quote already initiated and have at least one item in cart.
– Vinaya Maheshwari
Jan 30 '17 at 6:33
What do you want to do in this function ? If you are use "checkout_cart_add_product_complete" observer instead of "checkout_cart_product_add_after"
– prathmeshb1
Jan 30 '17 at 6:44
What do you want to do in this function ? If you are use "checkout_cart_add_product_complete" observer instead of "checkout_cart_product_add_after"
– prathmeshb1
Jan 30 '17 at 6:44
I am using both event in my custom module, in
checkout_cart_product_add_after
event, I want to set custom price to cart item.– Vinaya Maheshwari
Jan 30 '17 at 6:47
I am using both event in my custom module, in
checkout_cart_product_add_after
event, I want to set custom price to cart item.– Vinaya Maheshwari
Jan 30 '17 at 6:47
add a comment |
You can get Quote id using this code:
<?php $quote = $cart = Mage::getModel('checkout/cart')->getQuote();
var_dump($quote->getQuoteId());
?>
I tried it, but it is not working.
– Vinaya Maheshwari
Jan 31 '17 at 7:30
add a comment |
You can get Quote id using this code:
<?php $quote = $cart = Mage::getModel('checkout/cart')->getQuote();
var_dump($quote->getQuoteId());
?>
I tried it, but it is not working.
– Vinaya Maheshwari
Jan 31 '17 at 7:30
add a comment |
You can get Quote id using this code:
<?php $quote = $cart = Mage::getModel('checkout/cart')->getQuote();
var_dump($quote->getQuoteId());
?>
You can get Quote id using this code:
<?php $quote = $cart = Mage::getModel('checkout/cart')->getQuote();
var_dump($quote->getQuoteId());
?>
edited Jan 30 '17 at 9:26
answered Jan 30 '17 at 9:20
Arunendra
6,05331641
6,05331641
I tried it, but it is not working.
– Vinaya Maheshwari
Jan 31 '17 at 7:30
add a comment |
I tried it, but it is not working.
– Vinaya Maheshwari
Jan 31 '17 at 7:30
I tried it, but it is not working.
– Vinaya Maheshwari
Jan 31 '17 at 7:30
I tried it, but it is not working.
– Vinaya Maheshwari
Jan 31 '17 at 7:30
add a comment |
You can get the quote id from checkout session like below:
$session = Mage::getSingleton('checkout/session');
$quote_id = $session->getQuoteId();
I hope this will help you.
add a comment |
You can get the quote id from checkout session like below:
$session = Mage::getSingleton('checkout/session');
$quote_id = $session->getQuoteId();
I hope this will help you.
add a comment |
You can get the quote id from checkout session like below:
$session = Mage::getSingleton('checkout/session');
$quote_id = $session->getQuoteId();
I hope this will help you.
You can get the quote id from checkout session like below:
$session = Mage::getSingleton('checkout/session');
$quote_id = $session->getQuoteId();
I hope this will help you.
answered Mar 4 '18 at 6:18
Hardik Shah
88858
88858
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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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%2f156946%2fhow-to-get-quote-id-in-checkout-cart-product-add-after-event%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
have you got solution of it??
– aton1004
Feb 22 '17 at 12:20
I don't know your purpose of the customFunction but if you observer the checkout_cart_product_add_after you will miss actions like updating the cart or removing a product.
– Mr. Lewis
Dec 3 '18 at 14:40