Cart Stopped Working for New Sesssions
I had a complaint about the cart stopping working on a Magento 2.2.3 instance and noticed the following errors showing within php logs:
[Fri Apr 06 15:28:54.964616 2018]
[:error] [pid 58985] [client 77.96.38.47:55599] PHP Fatal error: Uncaught Error: Call to a member function getThumbnail() on null in /home/sites/magento/public_html/vendor/magento/module-configurable-product/CustomerData/ConfigurableItem.php:63
Stack trace:
#0
/home/sites/magento/public_html/vendor/magento/module-checkout/CustomerData/DefaultItem.php(66): MagentoConfigurableProductCustomerDataConfigurableItem->getProductForThumbnail()
#1
/home/sites/magento/public_html/vendor/magento/module-checkout/CustomerData/AbstractItem.php(31): MagentoCheckoutCustomerDataDefaultItem->doGetItemData()
#2
/home/sites/magento/public_html/vendor/magento/module-checkout/CustomerData/ItemPool.php(63): MagentoCheckoutCustomerDataAbstractItem->getItemData(Object(MagentoQuoteModelQuoteItem))
#3
/home/sites/magento/public_html/vendor/magento/module-checkout/CustomerData/Cart.php(167): MagentoCheckoutCustomerDataItemPool->getItemData(Object(MagentoQuoteModelQuoteItem))
#4
/home/sites/magento/public_html/vendor/magento/module-checkout/CustomerData/Cart.php(98): MagentoCheckou in /home/sites/magento/public_html/vendor/magento/module-configurable-product/CustomerData/ConfigurableItem.php on line 63
Cart seemed to be working for most people except a new user who had just started and a few customers seemed to have been having the issues from looking over the logs.
I flushed the redis cache as felt it was session related and this was handled by redis. This stopped the issue occurring for now however am worried it will come back so was wondering if anyone can suggest what may have gone wrong here?
Redis does not have any memory limits configured and there were no errors in Redis logs so feel that is fine but am out of ideas of how this has happened.
magento2 checkout cart
add a comment |
I had a complaint about the cart stopping working on a Magento 2.2.3 instance and noticed the following errors showing within php logs:
[Fri Apr 06 15:28:54.964616 2018]
[:error] [pid 58985] [client 77.96.38.47:55599] PHP Fatal error: Uncaught Error: Call to a member function getThumbnail() on null in /home/sites/magento/public_html/vendor/magento/module-configurable-product/CustomerData/ConfigurableItem.php:63
Stack trace:
#0
/home/sites/magento/public_html/vendor/magento/module-checkout/CustomerData/DefaultItem.php(66): MagentoConfigurableProductCustomerDataConfigurableItem->getProductForThumbnail()
#1
/home/sites/magento/public_html/vendor/magento/module-checkout/CustomerData/AbstractItem.php(31): MagentoCheckoutCustomerDataDefaultItem->doGetItemData()
#2
/home/sites/magento/public_html/vendor/magento/module-checkout/CustomerData/ItemPool.php(63): MagentoCheckoutCustomerDataAbstractItem->getItemData(Object(MagentoQuoteModelQuoteItem))
#3
/home/sites/magento/public_html/vendor/magento/module-checkout/CustomerData/Cart.php(167): MagentoCheckoutCustomerDataItemPool->getItemData(Object(MagentoQuoteModelQuoteItem))
#4
/home/sites/magento/public_html/vendor/magento/module-checkout/CustomerData/Cart.php(98): MagentoCheckou in /home/sites/magento/public_html/vendor/magento/module-configurable-product/CustomerData/ConfigurableItem.php on line 63
Cart seemed to be working for most people except a new user who had just started and a few customers seemed to have been having the issues from looking over the logs.
I flushed the redis cache as felt it was session related and this was handled by redis. This stopped the issue occurring for now however am worried it will come back so was wondering if anyone can suggest what may have gone wrong here?
Redis does not have any memory limits configured and there were no errors in Redis logs so feel that is fine but am out of ideas of how this has happened.
magento2 checkout cart
add a comment |
I had a complaint about the cart stopping working on a Magento 2.2.3 instance and noticed the following errors showing within php logs:
[Fri Apr 06 15:28:54.964616 2018]
[:error] [pid 58985] [client 77.96.38.47:55599] PHP Fatal error: Uncaught Error: Call to a member function getThumbnail() on null in /home/sites/magento/public_html/vendor/magento/module-configurable-product/CustomerData/ConfigurableItem.php:63
Stack trace:
#0
/home/sites/magento/public_html/vendor/magento/module-checkout/CustomerData/DefaultItem.php(66): MagentoConfigurableProductCustomerDataConfigurableItem->getProductForThumbnail()
#1
/home/sites/magento/public_html/vendor/magento/module-checkout/CustomerData/AbstractItem.php(31): MagentoCheckoutCustomerDataDefaultItem->doGetItemData()
#2
/home/sites/magento/public_html/vendor/magento/module-checkout/CustomerData/ItemPool.php(63): MagentoCheckoutCustomerDataAbstractItem->getItemData(Object(MagentoQuoteModelQuoteItem))
#3
/home/sites/magento/public_html/vendor/magento/module-checkout/CustomerData/Cart.php(167): MagentoCheckoutCustomerDataItemPool->getItemData(Object(MagentoQuoteModelQuoteItem))
#4
/home/sites/magento/public_html/vendor/magento/module-checkout/CustomerData/Cart.php(98): MagentoCheckou in /home/sites/magento/public_html/vendor/magento/module-configurable-product/CustomerData/ConfigurableItem.php on line 63
Cart seemed to be working for most people except a new user who had just started and a few customers seemed to have been having the issues from looking over the logs.
I flushed the redis cache as felt it was session related and this was handled by redis. This stopped the issue occurring for now however am worried it will come back so was wondering if anyone can suggest what may have gone wrong here?
Redis does not have any memory limits configured and there were no errors in Redis logs so feel that is fine but am out of ideas of how this has happened.
magento2 checkout cart
I had a complaint about the cart stopping working on a Magento 2.2.3 instance and noticed the following errors showing within php logs:
[Fri Apr 06 15:28:54.964616 2018]
[:error] [pid 58985] [client 77.96.38.47:55599] PHP Fatal error: Uncaught Error: Call to a member function getThumbnail() on null in /home/sites/magento/public_html/vendor/magento/module-configurable-product/CustomerData/ConfigurableItem.php:63
Stack trace:
#0
/home/sites/magento/public_html/vendor/magento/module-checkout/CustomerData/DefaultItem.php(66): MagentoConfigurableProductCustomerDataConfigurableItem->getProductForThumbnail()
#1
/home/sites/magento/public_html/vendor/magento/module-checkout/CustomerData/AbstractItem.php(31): MagentoCheckoutCustomerDataDefaultItem->doGetItemData()
#2
/home/sites/magento/public_html/vendor/magento/module-checkout/CustomerData/ItemPool.php(63): MagentoCheckoutCustomerDataAbstractItem->getItemData(Object(MagentoQuoteModelQuoteItem))
#3
/home/sites/magento/public_html/vendor/magento/module-checkout/CustomerData/Cart.php(167): MagentoCheckoutCustomerDataItemPool->getItemData(Object(MagentoQuoteModelQuoteItem))
#4
/home/sites/magento/public_html/vendor/magento/module-checkout/CustomerData/Cart.php(98): MagentoCheckou in /home/sites/magento/public_html/vendor/magento/module-configurable-product/CustomerData/ConfigurableItem.php on line 63
Cart seemed to be working for most people except a new user who had just started and a few customers seemed to have been having the issues from looking over the logs.
I flushed the redis cache as felt it was session related and this was handled by redis. This stopped the issue occurring for now however am worried it will come back so was wondering if anyone can suggest what may have gone wrong here?
Redis does not have any memory limits configured and there were no errors in Redis logs so feel that is fine but am out of ideas of how this has happened.
magento2 checkout cart
magento2 checkout cart
edited Apr 9 '18 at 15:10
harri
asked Apr 9 '18 at 15:05
harriharri
2,9791553
2,9791553
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
This issue because the function $this->getChildProduct()
is empty or this product is not available now, there are two files use this:
vendor/magento/module-configurable-product/Block/Cart/Item/Renderer/Configurable.php line 71
vendor/magento/module-configurable-product/CustomerData/ConfigurableItem.php line 63
I add a new condition as below:
vendor/magento/module-configurable-product/Block/Cart/Item/Renderer/Configurable.php:71
if (empty($this->getChildProduct()) && ($this->_scopeConfig->getValue(
self::CONFIG_THUMBNAIL_SOURCE,
MagentoStoreModelScopeInterface::SCOPE_STORE
) == ThumbnailSource::OPTION_USE_PARENT_IMAGE ||
!($this->getChildProduct()->getThumbnail() && $this->getChildProduct()->getThumbnail() != 'no_selection'))
) {
$product = $this->getProduct();
} else {
$product = $this->getChildProduct();
}
return $product;
vendor/magento/module-configurable-product/CustomerData/ConfigurableItem.php:63
$product = $config == empty($this->getChildProduct()) && (ThumbnailSource::OPTION_USE_PARENT_IMAGE
|| (!$this->getChildProduct()->getThumbnail() || $this->getChildProduct()->getThumbnail() == 'no_selection'))
? $this->getProduct()
: $this->getChildProduct();
Now it is working properly you can use override block on Magento to do this.
add a comment |
I have seen and implemented your suggestions and seems it's perfect solutions, i just want to modify some more detail, i faced this issue in Magento 2.2.5 and i have used some more corrections to resolve the issue.
You can see the following code which can help you to get rid the mentioned issue
PHP Fatal error: Uncaught Error: Call to a member function getThumbnail()
/vendor/magento/module-configurable-product/Block/Cart/Item/Renderer/Configurable.php
public function getChildProduct(){
$option = $this->getItem()->getCustomOption('simple_product');
if ($option !== null ) {
return $option->getProduct();
}
return $this->getProduct();
}
And in the following file, you can modify the code and this issue will be resolved.
/vendor/magento/module-catalog/Block/Product/ImageBuilder.php
public function create() {
$simpleOption = $this->product->getCustomOption('simple_product');
if ($simpleOption !== null) {
$optionProduct = $simpleOption->getProduct();
//$this->setProduct($optionProduct);
if ($optionProduct->getThumbnail() !== null) {
$this->setProduct($optionProduct);
}
}
New contributor
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%2f221607%2fcart-stopped-working-for-new-sesssions%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
This issue because the function $this->getChildProduct()
is empty or this product is not available now, there are two files use this:
vendor/magento/module-configurable-product/Block/Cart/Item/Renderer/Configurable.php line 71
vendor/magento/module-configurable-product/CustomerData/ConfigurableItem.php line 63
I add a new condition as below:
vendor/magento/module-configurable-product/Block/Cart/Item/Renderer/Configurable.php:71
if (empty($this->getChildProduct()) && ($this->_scopeConfig->getValue(
self::CONFIG_THUMBNAIL_SOURCE,
MagentoStoreModelScopeInterface::SCOPE_STORE
) == ThumbnailSource::OPTION_USE_PARENT_IMAGE ||
!($this->getChildProduct()->getThumbnail() && $this->getChildProduct()->getThumbnail() != 'no_selection'))
) {
$product = $this->getProduct();
} else {
$product = $this->getChildProduct();
}
return $product;
vendor/magento/module-configurable-product/CustomerData/ConfigurableItem.php:63
$product = $config == empty($this->getChildProduct()) && (ThumbnailSource::OPTION_USE_PARENT_IMAGE
|| (!$this->getChildProduct()->getThumbnail() || $this->getChildProduct()->getThumbnail() == 'no_selection'))
? $this->getProduct()
: $this->getChildProduct();
Now it is working properly you can use override block on Magento to do this.
add a comment |
This issue because the function $this->getChildProduct()
is empty or this product is not available now, there are two files use this:
vendor/magento/module-configurable-product/Block/Cart/Item/Renderer/Configurable.php line 71
vendor/magento/module-configurable-product/CustomerData/ConfigurableItem.php line 63
I add a new condition as below:
vendor/magento/module-configurable-product/Block/Cart/Item/Renderer/Configurable.php:71
if (empty($this->getChildProduct()) && ($this->_scopeConfig->getValue(
self::CONFIG_THUMBNAIL_SOURCE,
MagentoStoreModelScopeInterface::SCOPE_STORE
) == ThumbnailSource::OPTION_USE_PARENT_IMAGE ||
!($this->getChildProduct()->getThumbnail() && $this->getChildProduct()->getThumbnail() != 'no_selection'))
) {
$product = $this->getProduct();
} else {
$product = $this->getChildProduct();
}
return $product;
vendor/magento/module-configurable-product/CustomerData/ConfigurableItem.php:63
$product = $config == empty($this->getChildProduct()) && (ThumbnailSource::OPTION_USE_PARENT_IMAGE
|| (!$this->getChildProduct()->getThumbnail() || $this->getChildProduct()->getThumbnail() == 'no_selection'))
? $this->getProduct()
: $this->getChildProduct();
Now it is working properly you can use override block on Magento to do this.
add a comment |
This issue because the function $this->getChildProduct()
is empty or this product is not available now, there are two files use this:
vendor/magento/module-configurable-product/Block/Cart/Item/Renderer/Configurable.php line 71
vendor/magento/module-configurable-product/CustomerData/ConfigurableItem.php line 63
I add a new condition as below:
vendor/magento/module-configurable-product/Block/Cart/Item/Renderer/Configurable.php:71
if (empty($this->getChildProduct()) && ($this->_scopeConfig->getValue(
self::CONFIG_THUMBNAIL_SOURCE,
MagentoStoreModelScopeInterface::SCOPE_STORE
) == ThumbnailSource::OPTION_USE_PARENT_IMAGE ||
!($this->getChildProduct()->getThumbnail() && $this->getChildProduct()->getThumbnail() != 'no_selection'))
) {
$product = $this->getProduct();
} else {
$product = $this->getChildProduct();
}
return $product;
vendor/magento/module-configurable-product/CustomerData/ConfigurableItem.php:63
$product = $config == empty($this->getChildProduct()) && (ThumbnailSource::OPTION_USE_PARENT_IMAGE
|| (!$this->getChildProduct()->getThumbnail() || $this->getChildProduct()->getThumbnail() == 'no_selection'))
? $this->getProduct()
: $this->getChildProduct();
Now it is working properly you can use override block on Magento to do this.
This issue because the function $this->getChildProduct()
is empty or this product is not available now, there are two files use this:
vendor/magento/module-configurable-product/Block/Cart/Item/Renderer/Configurable.php line 71
vendor/magento/module-configurable-product/CustomerData/ConfigurableItem.php line 63
I add a new condition as below:
vendor/magento/module-configurable-product/Block/Cart/Item/Renderer/Configurable.php:71
if (empty($this->getChildProduct()) && ($this->_scopeConfig->getValue(
self::CONFIG_THUMBNAIL_SOURCE,
MagentoStoreModelScopeInterface::SCOPE_STORE
) == ThumbnailSource::OPTION_USE_PARENT_IMAGE ||
!($this->getChildProduct()->getThumbnail() && $this->getChildProduct()->getThumbnail() != 'no_selection'))
) {
$product = $this->getProduct();
} else {
$product = $this->getChildProduct();
}
return $product;
vendor/magento/module-configurable-product/CustomerData/ConfigurableItem.php:63
$product = $config == empty($this->getChildProduct()) && (ThumbnailSource::OPTION_USE_PARENT_IMAGE
|| (!$this->getChildProduct()->getThumbnail() || $this->getChildProduct()->getThumbnail() == 'no_selection'))
? $this->getProduct()
: $this->getChildProduct();
Now it is working properly you can use override block on Magento to do this.
edited Jun 6 '18 at 4:02
Rama Chandran M
2,73781530
2,73781530
answered Jun 6 '18 at 3:39
Tuan Bui QuangTuan Bui Quang
111
111
add a comment |
add a comment |
I have seen and implemented your suggestions and seems it's perfect solutions, i just want to modify some more detail, i faced this issue in Magento 2.2.5 and i have used some more corrections to resolve the issue.
You can see the following code which can help you to get rid the mentioned issue
PHP Fatal error: Uncaught Error: Call to a member function getThumbnail()
/vendor/magento/module-configurable-product/Block/Cart/Item/Renderer/Configurable.php
public function getChildProduct(){
$option = $this->getItem()->getCustomOption('simple_product');
if ($option !== null ) {
return $option->getProduct();
}
return $this->getProduct();
}
And in the following file, you can modify the code and this issue will be resolved.
/vendor/magento/module-catalog/Block/Product/ImageBuilder.php
public function create() {
$simpleOption = $this->product->getCustomOption('simple_product');
if ($simpleOption !== null) {
$optionProduct = $simpleOption->getProduct();
//$this->setProduct($optionProduct);
if ($optionProduct->getThumbnail() !== null) {
$this->setProduct($optionProduct);
}
}
New contributor
add a comment |
I have seen and implemented your suggestions and seems it's perfect solutions, i just want to modify some more detail, i faced this issue in Magento 2.2.5 and i have used some more corrections to resolve the issue.
You can see the following code which can help you to get rid the mentioned issue
PHP Fatal error: Uncaught Error: Call to a member function getThumbnail()
/vendor/magento/module-configurable-product/Block/Cart/Item/Renderer/Configurable.php
public function getChildProduct(){
$option = $this->getItem()->getCustomOption('simple_product');
if ($option !== null ) {
return $option->getProduct();
}
return $this->getProduct();
}
And in the following file, you can modify the code and this issue will be resolved.
/vendor/magento/module-catalog/Block/Product/ImageBuilder.php
public function create() {
$simpleOption = $this->product->getCustomOption('simple_product');
if ($simpleOption !== null) {
$optionProduct = $simpleOption->getProduct();
//$this->setProduct($optionProduct);
if ($optionProduct->getThumbnail() !== null) {
$this->setProduct($optionProduct);
}
}
New contributor
add a comment |
I have seen and implemented your suggestions and seems it's perfect solutions, i just want to modify some more detail, i faced this issue in Magento 2.2.5 and i have used some more corrections to resolve the issue.
You can see the following code which can help you to get rid the mentioned issue
PHP Fatal error: Uncaught Error: Call to a member function getThumbnail()
/vendor/magento/module-configurable-product/Block/Cart/Item/Renderer/Configurable.php
public function getChildProduct(){
$option = $this->getItem()->getCustomOption('simple_product');
if ($option !== null ) {
return $option->getProduct();
}
return $this->getProduct();
}
And in the following file, you can modify the code and this issue will be resolved.
/vendor/magento/module-catalog/Block/Product/ImageBuilder.php
public function create() {
$simpleOption = $this->product->getCustomOption('simple_product');
if ($simpleOption !== null) {
$optionProduct = $simpleOption->getProduct();
//$this->setProduct($optionProduct);
if ($optionProduct->getThumbnail() !== null) {
$this->setProduct($optionProduct);
}
}
New contributor
I have seen and implemented your suggestions and seems it's perfect solutions, i just want to modify some more detail, i faced this issue in Magento 2.2.5 and i have used some more corrections to resolve the issue.
You can see the following code which can help you to get rid the mentioned issue
PHP Fatal error: Uncaught Error: Call to a member function getThumbnail()
/vendor/magento/module-configurable-product/Block/Cart/Item/Renderer/Configurable.php
public function getChildProduct(){
$option = $this->getItem()->getCustomOption('simple_product');
if ($option !== null ) {
return $option->getProduct();
}
return $this->getProduct();
}
And in the following file, you can modify the code and this issue will be resolved.
/vendor/magento/module-catalog/Block/Product/ImageBuilder.php
public function create() {
$simpleOption = $this->product->getCustomOption('simple_product');
if ($simpleOption !== null) {
$optionProduct = $simpleOption->getProduct();
//$this->setProduct($optionProduct);
if ($optionProduct->getThumbnail() !== null) {
$this->setProduct($optionProduct);
}
}
New contributor
New contributor
answered 18 mins ago
Zahid BashirZahid Bashir
11
11
New contributor
New contributor
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%2f221607%2fcart-stopped-working-for-new-sesssions%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