How to get quote details in helperDetach quote from customer sessionproblem unsetting quote (cart), data is not savedHow to set customer id for a quote in Magento?Replacing current quote with a stored QuoteNot getting updated merge quote id using customer_login observerHow to get the billing address from a quote instance: Magento 2How to get the order items and quote items whenever create order from admin panel?Removing items from quote depending on custom conditionMagento 2 Session getting reset after placing orderGet Quote Item from Product Id
Movie about a boy who was born old and grew young
Do simulator games use a realistic trajectory to get into orbit?
Basic question about swap/swap spreads
What is the advantage of carrying a tripod and ND-filters when you could use image stacking instead?
Remove sudoers using script
Do the English have an ancient (obsolete) verb for the action of the book opening?
Payment instructions from HomeAway look fishy to me
After the loss of Challenger, why weren’t Galileo and Ulysses launched by Centaurs on expendable boosters?
Cause of continuous spectral lines
Strange symbol for two functions
When conversion from Integer to Single may lose precision
Company did not petition for visa in a timely manner. Is asking me to work from overseas, but wants me to take a paycut
SF novella separating the dumb majority from the intelligent part of mankind
Avoiding cliches when writing gods
Does the "6 seconds per round" rule apply to speaking/roleplaying during combat situations?
Notation of last measure of a song with a pickup measure
Trapping Rain Water
What LISP compilers and interpreters were available for 8-bit machines?
Can a user sell my software (MIT license) without modification?
Does an ice chest packed full of frozen food need ice?
Translating 'Liber'
How many times can you cast a card exiled by Release to the Wind?
Can you really not move between grapples/shoves?
Russian equivalents of "no love lost"
How to get quote details in helper
Detach quote from customer sessionproblem unsetting quote (cart), data is not savedHow to set customer id for a quote in Magento?Replacing current quote with a stored QuoteNot getting updated merge quote id using customer_login observerHow to get the billing address from a quote instance: Magento 2How to get the order items and quote items whenever create order from admin panel?Removing items from quote depending on custom conditionMagento 2 Session getting reset after placing orderGet Quote Item from Product Id
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I want to see if there is anything exists in the cart if I am in a phtml page
I have tried to use session and cart but I am getting null
When I tried to use session I wasn’t sure how to get the quote ID in order to get cart ID but I don’t know which is the right approach to take
Could anyone help me out with this
cart session quote quoteitem
add a comment |
I want to see if there is anything exists in the cart if I am in a phtml page
I have tried to use session and cart but I am getting null
When I tried to use session I wasn’t sure how to get the quote ID in order to get cart ID but I don’t know which is the right approach to take
Could anyone help me out with this
cart session quote quoteitem
add a comment |
I want to see if there is anything exists in the cart if I am in a phtml page
I have tried to use session and cart but I am getting null
When I tried to use session I wasn’t sure how to get the quote ID in order to get cart ID but I don’t know which is the right approach to take
Could anyone help me out with this
cart session quote quoteitem
I want to see if there is anything exists in the cart if I am in a phtml page
I have tried to use session and cart but I am getting null
When I tried to use session I wasn’t sure how to get the quote ID in order to get cart ID but I don’t know which is the right approach to take
Could anyone help me out with this
cart session quote quoteitem
cart session quote quoteitem
asked May 28 at 19:09
Jack BrooksJack Brooks
356
356
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Something like this should work
app/code/Xigen/Cart/Helper/Quote.php
namespace XigenCartHelper;
use MagentoFrameworkAppHelperAbstractHelper;
class Quote extends AbstractHelper
/**
* @param MagentoFrameworkAppHelperContext $context
*/
public function __construct(
MagentoFrameworkAppHelperContext $context,
MagentoCheckoutModelCart $cart
)
$this->cart = $cart;
parent::__construct($context);
public function getAllVisibleItems()
return $this->cart->getQuote()->getAllVisibleItems();
public function getAllVisibleItemsCount()
return count($this->getAllVisibleItems());
Then in template for example
$visibleItems = $this->helper('XigenCartHelperQuote')->getAllVisibleItemsCount();
How does it know to take the active cart? I mean for each customer a different cart.
– vitoriodachef
May 28 at 20:35
1
It's always only the cart of the current session. Unless the block is cached of course.
– Dominic Xigen
May 28 at 20:43
1
I was about to say the session as well. @DominicXigen thank you for this I will take a look at this and get back to you. Thanks for showing the count part
– Jack Brooks
May 28 at 20:46
@DominicXigen hi there. I have tried this it worked for maybe once like it did work but then when I refresh the page it won’t come up like it’s null but my cart has product
– Jack Brooks
May 29 at 19:31
Can you disable frontend caches and see if still the samephp bin/magento cache:disable layout block_html full_page
– Dominic Xigen
May 29 at 20:27
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%2f276467%2fhow-to-get-quote-details-in-helper%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
Something like this should work
app/code/Xigen/Cart/Helper/Quote.php
namespace XigenCartHelper;
use MagentoFrameworkAppHelperAbstractHelper;
class Quote extends AbstractHelper
/**
* @param MagentoFrameworkAppHelperContext $context
*/
public function __construct(
MagentoFrameworkAppHelperContext $context,
MagentoCheckoutModelCart $cart
)
$this->cart = $cart;
parent::__construct($context);
public function getAllVisibleItems()
return $this->cart->getQuote()->getAllVisibleItems();
public function getAllVisibleItemsCount()
return count($this->getAllVisibleItems());
Then in template for example
$visibleItems = $this->helper('XigenCartHelperQuote')->getAllVisibleItemsCount();
How does it know to take the active cart? I mean for each customer a different cart.
– vitoriodachef
May 28 at 20:35
1
It's always only the cart of the current session. Unless the block is cached of course.
– Dominic Xigen
May 28 at 20:43
1
I was about to say the session as well. @DominicXigen thank you for this I will take a look at this and get back to you. Thanks for showing the count part
– Jack Brooks
May 28 at 20:46
@DominicXigen hi there. I have tried this it worked for maybe once like it did work but then when I refresh the page it won’t come up like it’s null but my cart has product
– Jack Brooks
May 29 at 19:31
Can you disable frontend caches and see if still the samephp bin/magento cache:disable layout block_html full_page
– Dominic Xigen
May 29 at 20:27
add a comment |
Something like this should work
app/code/Xigen/Cart/Helper/Quote.php
namespace XigenCartHelper;
use MagentoFrameworkAppHelperAbstractHelper;
class Quote extends AbstractHelper
/**
* @param MagentoFrameworkAppHelperContext $context
*/
public function __construct(
MagentoFrameworkAppHelperContext $context,
MagentoCheckoutModelCart $cart
)
$this->cart = $cart;
parent::__construct($context);
public function getAllVisibleItems()
return $this->cart->getQuote()->getAllVisibleItems();
public function getAllVisibleItemsCount()
return count($this->getAllVisibleItems());
Then in template for example
$visibleItems = $this->helper('XigenCartHelperQuote')->getAllVisibleItemsCount();
How does it know to take the active cart? I mean for each customer a different cart.
– vitoriodachef
May 28 at 20:35
1
It's always only the cart of the current session. Unless the block is cached of course.
– Dominic Xigen
May 28 at 20:43
1
I was about to say the session as well. @DominicXigen thank you for this I will take a look at this and get back to you. Thanks for showing the count part
– Jack Brooks
May 28 at 20:46
@DominicXigen hi there. I have tried this it worked for maybe once like it did work but then when I refresh the page it won’t come up like it’s null but my cart has product
– Jack Brooks
May 29 at 19:31
Can you disable frontend caches and see if still the samephp bin/magento cache:disable layout block_html full_page
– Dominic Xigen
May 29 at 20:27
add a comment |
Something like this should work
app/code/Xigen/Cart/Helper/Quote.php
namespace XigenCartHelper;
use MagentoFrameworkAppHelperAbstractHelper;
class Quote extends AbstractHelper
/**
* @param MagentoFrameworkAppHelperContext $context
*/
public function __construct(
MagentoFrameworkAppHelperContext $context,
MagentoCheckoutModelCart $cart
)
$this->cart = $cart;
parent::__construct($context);
public function getAllVisibleItems()
return $this->cart->getQuote()->getAllVisibleItems();
public function getAllVisibleItemsCount()
return count($this->getAllVisibleItems());
Then in template for example
$visibleItems = $this->helper('XigenCartHelperQuote')->getAllVisibleItemsCount();
Something like this should work
app/code/Xigen/Cart/Helper/Quote.php
namespace XigenCartHelper;
use MagentoFrameworkAppHelperAbstractHelper;
class Quote extends AbstractHelper
/**
* @param MagentoFrameworkAppHelperContext $context
*/
public function __construct(
MagentoFrameworkAppHelperContext $context,
MagentoCheckoutModelCart $cart
)
$this->cart = $cart;
parent::__construct($context);
public function getAllVisibleItems()
return $this->cart->getQuote()->getAllVisibleItems();
public function getAllVisibleItemsCount()
return count($this->getAllVisibleItems());
Then in template for example
$visibleItems = $this->helper('XigenCartHelperQuote')->getAllVisibleItemsCount();
answered May 28 at 20:17
Dominic XigenDominic Xigen
92511
92511
How does it know to take the active cart? I mean for each customer a different cart.
– vitoriodachef
May 28 at 20:35
1
It's always only the cart of the current session. Unless the block is cached of course.
– Dominic Xigen
May 28 at 20:43
1
I was about to say the session as well. @DominicXigen thank you for this I will take a look at this and get back to you. Thanks for showing the count part
– Jack Brooks
May 28 at 20:46
@DominicXigen hi there. I have tried this it worked for maybe once like it did work but then when I refresh the page it won’t come up like it’s null but my cart has product
– Jack Brooks
May 29 at 19:31
Can you disable frontend caches and see if still the samephp bin/magento cache:disable layout block_html full_page
– Dominic Xigen
May 29 at 20:27
add a comment |
How does it know to take the active cart? I mean for each customer a different cart.
– vitoriodachef
May 28 at 20:35
1
It's always only the cart of the current session. Unless the block is cached of course.
– Dominic Xigen
May 28 at 20:43
1
I was about to say the session as well. @DominicXigen thank you for this I will take a look at this and get back to you. Thanks for showing the count part
– Jack Brooks
May 28 at 20:46
@DominicXigen hi there. I have tried this it worked for maybe once like it did work but then when I refresh the page it won’t come up like it’s null but my cart has product
– Jack Brooks
May 29 at 19:31
Can you disable frontend caches and see if still the samephp bin/magento cache:disable layout block_html full_page
– Dominic Xigen
May 29 at 20:27
How does it know to take the active cart? I mean for each customer a different cart.
– vitoriodachef
May 28 at 20:35
How does it know to take the active cart? I mean for each customer a different cart.
– vitoriodachef
May 28 at 20:35
1
1
It's always only the cart of the current session. Unless the block is cached of course.
– Dominic Xigen
May 28 at 20:43
It's always only the cart of the current session. Unless the block is cached of course.
– Dominic Xigen
May 28 at 20:43
1
1
I was about to say the session as well. @DominicXigen thank you for this I will take a look at this and get back to you. Thanks for showing the count part
– Jack Brooks
May 28 at 20:46
I was about to say the session as well. @DominicXigen thank you for this I will take a look at this and get back to you. Thanks for showing the count part
– Jack Brooks
May 28 at 20:46
@DominicXigen hi there. I have tried this it worked for maybe once like it did work but then when I refresh the page it won’t come up like it’s null but my cart has product
– Jack Brooks
May 29 at 19:31
@DominicXigen hi there. I have tried this it worked for maybe once like it did work but then when I refresh the page it won’t come up like it’s null but my cart has product
– Jack Brooks
May 29 at 19:31
Can you disable frontend caches and see if still the same
php bin/magento cache:disable layout block_html full_page
– Dominic Xigen
May 29 at 20:27
Can you disable frontend caches and see if still the same
php bin/magento cache:disable layout block_html full_page
– Dominic Xigen
May 29 at 20:27
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%2f276467%2fhow-to-get-quote-details-in-helper%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