-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update Cart.php #39606
Update Cart.php #39606
Conversation
Hi @Genaker. Thank you for your contribution!
Allowed build names are:
You can find more information about the builds here For more details, review the Code Contributions documentation. |
'summary_count' => null, | ||
'subtotalAmount' => null, | ||
'subtotal' => null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These could return 0
'subtotalAmount' => null, | ||
'subtotal' => null, | ||
'possible_onepage_checkout' => null, | ||
'items' => null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This could return an empty array
It couldn't return []. Some front knockout waits for data or something and
brakes.
…On Wed, Feb 5, 2025 at 4:38 PM Kristof, Fooman ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In app/code/Magento/Checkout/CustomerData/Cart.php
<#39606 (comment)>:
> @@ -89,6 +89,19 @@ public function __construct(
public function getSectionData()
{
$totals = $this->getQuote()->getTotals();
+ if(null === $this->getQuote()->getId()) {
+ return [
+ 'summary_count' => null,
+ 'subtotalAmount' => null,
+ 'subtotal' => null,
+ 'possible_onepage_checkout' => null,
+ 'items' => null,
This could return an empty array
—
Reply to this email directly, view it on GitHub
<#39606 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACGJNZXWWCSCFHVNATBKLO32OKVIFAVCNFSM6AAAAABWSCYJ22VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDKOJXGI4TAOJQGI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
This couldn't be *null*. 0 it is when you have a cart with a free item
here; we don't have a cart at all it is NULL, not 0
…On Wed, Feb 5, 2025 at 4:38 PM Kristof, Fooman ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In app/code/Magento/Checkout/CustomerData/Cart.php
<#39606 (comment)>:
> + 'summary_count' => null,
+ 'subtotalAmount' => null,
+ 'subtotal' => null,
These could return 0
—
Reply to this email directly, view it on GitHub
<#39606 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACGJNZWG5QTFJBFK6CIRF6T2OKVHLAVCNFSM6AAAAABWSCYJ22VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDKOJXGI4TANZQGU>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Just check what section return when no cart it is not empty. Agree item
counter can be 0. However issue is. It in this code it is just some fix,
the issue is Magento processes cart ID even if it is Null
…On Wed, Feb 5, 2025 at 4:38 PM Kristof, Fooman ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In app/code/Magento/Checkout/CustomerData/Cart.php
<#39606 (comment)>:
> @@ -89,6 +89,19 @@ public function __construct(
public function getSectionData()
{
$totals = $this->getQuote()->getTotals();
+ if(null === $this->getQuote()->getId()) {
+ return [
+ 'summary_count' => null,
+ 'subtotalAmount' => null,
+ 'subtotal' => null,
+ 'possible_onepage_checkout' => null,
+ 'items' => null,
This could return an empty array
—
Reply to this email directly, view it on GitHub
<#39606 (review)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACGJNZXWWCSCFHVNATBKLO32OKVIFAVCNFSM6AAAAABWSCYJ22VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDKOJXGI4TAOJQGI>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Adobe have patched this now:
|
Where I can see this patch on GitHub, link? |
You'll need to get in touch with support for it @Genaker. |
After reviewing the conversation on this PR, it appears that the issue has already been addressed by the internal team. Therefore, I am closing this PR. Thank you for your contribution @Genaker. |
Thank you for informing me. Could you please provide a PR or commit where
the fix happened?
…On Tue, Feb 18, 2025 at 2:13 AM Abhinav Pathak ***@***.***> wrote:
After reviewing the conversation on this PR, it appears that the issue has
already been addressed by the internal team.
Therefore, I am closing this PR. Thank you for your contribution @Genaker
<https://github.com/Genaker>.
—
Reply to this email directly, view it on GitHub
<#39606 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACGJNZXL4GLQHJF6U4C76AT2QMBWPAVCNFSM6AAAAABWSCYJ22VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRVGE3TOMBVGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
[image: engcom-Hotel]*engcom-Hotel* left a comment
(magento/magento2#39606)
<#39606 (comment)>
After reviewing the conversation on this PR, it appears that the issue has
already been addressed by the internal team.
Therefore, I am closing this PR. Thank you for your contribution @Genaker
<https://github.com/Genaker>.
—
Reply to this email directly, view it on GitHub
<#39606 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/ACGJNZXL4GLQHJF6U4C76AT2QMBWPAVCNFSM6AAAAABWSCYJ22VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDMNRVGE3TOMBVGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
There is an issue and bug in magento. Magento is processing the cart even if the checkout cart is not set or is null. This mainly happened during section load. if no car is in session, it is = null, and still, magento tries to process with the id null. Magento throws an exception and tries to find cart with null id. Sure, it can be done at the repository level, but it breaks other logic. So, I fixed the section controller where it was fired. now, it returns empty data if cart ID is not set especially with the Hyva theme however Luma has the same issue.
So, I made some fixes for the section data.
I tested everything works :
Please check and merge ASAP. It is a critical production issue affecting many production websites.