cancel
Showing results for 
Search instead for 
Did you mean: 

Fix Update Basket - Something went wrong while saving this page

   Did you know you can see the translated content as per your choice?

Translation is in progress. Please check again after few minutes.

Fix Update Basket - Something went wrong while saving this page

Can anyone help me with this error in the basket? I am unsure how to go about debugging this?

Thanks in advance!

 

Screenshot_2019-11-12 Shopping Cart.png

9 REPLIES 9

Re: Fix Update Basket - Something went wrone while saving this page

Hi @neil_widdowson,

Check once the browser console errors.

There should be some error.

Re: Fix Update Basket - Something went wrone while saving this page

I don't see any errors in the browser console. The minicart is working for updating qty however?

Re: Fix Update Basket - Something went wrone while saving this page

Hi @neil_widdowson 

 

Can you try to reproduce the same problem with any other product.

 

If you can't then we got to know the problem is with this product only and after i can suggest some solutions to you.

 

Thanks

---
If you've found my answer useful, please give"Kudos" and "Accept as Solution".

Re: Fix Update Basket - Something went wrone while saving this page

It doesn't work on any product.

https://theyarnstore.co.uk/newstore/checkout/cart/ 

Re: Fix Update Basket - Something went wrone while saving this page

Hi @neil_widdowson 

 

I checked it.

 

Please confirm are you using any 3 party extension or have you make any changes in the file.

 

Because you'r updateQty() is returning {"success":false,"error_message":"Something went wrong while saving the page. Please refresh the page and try again."}

 

You have to check this function.

 

Thanks

---
If you've found my answer useful, please give"Kudos" and "Accept as Solution".

Re: Fix Update Basket - Something went wrone while saving this page

Hi

I have updated some files, I've not got plugins.

 

cart/item/default.phtml:

<?php
/**
 * Copyright © Magento, Inc. All rights reserved.
 * See COPYING.txt for license details.
 */

// @codingStandardsIgnoreFile

/** @var $block \Magento\Checkout\Block\Cart\Item\Renderer */

$_item = $block->getItem();
$product = $_item->getProduct();
$isVisibleProduct = $product->isVisibleInSiteVisibility();
/** @var \Magento\Msrp\Helper\Data $helper */
$helper = $this->helper('Magento\Msrp\Helper\Data');
$canApplyMsrp = $helper->isShowBeforeOrderConfirm($product) && $helper->isMinimalPriceLessMsrp($product);
?>
<tbody class="cart item">
    <tr class="item-info">
        <td data-th="<?= $block->escapeHtml(__('Item')) ?>" class="col item">
            <?php if ($block->hasProductUrl()):?>
                <a href="<?= /* @escapeNotVerified */ $block->getProductUrl() ?>"
                   title="<?= $block->escapeHtml($block->getProductName()) ?>"
                   tabindex="-1"
                   class="product-item-photo">
            <?php else:?>
                <span class="product-item-photo">
            <?php endif;?>
            <?= $block->getImage($block->getProductForThumbnail(), 'cart_page_product_thumbnail')->toHtml() ?>
            <?php if ($block->hasProductUrl()):?>
                </a>
            <?php else: ?>
                </span>
            <?php endif; ?>
            <div class="product-item-details">
                <strong class="product-item-name">
                    <?php if ($block->hasProductUrl()):?>
                        <a href="<?= /* @escapeNotVerified */ $block->getProductUrl() ?>"><?= $block->escapeHtml($block->getProductName()) ?></a>
                    <?php else: ?>
                        <?= $block->escapeHtml($block->getProductName()) ?>
                    <?php endif; ?>
                </strong>
                <?php if ($_options = $block->getOptionList()):?>
                    <dl class="item-options">
                        <?php foreach ($_options as $_option) : ?>
                            <?php $_formatedOptionValue = $block->getFormatedOptionValue($_option) ?>
                            <dt><?= $block->escapeHtml($_option['label']) ?></dt>
                            <dd>
                                <?php if (isset($_formatedOptionValue['full_view'])): ?>
                                    <?= /* @escapeNotVerified */ $_formatedOptionValue['full_view'] ?>
                                <?php else: ?>
                                    <?= $block->escapeHtml($_formatedOptionValue['value'], ['span']) ?>
                                <?php endif; ?>
                            </dd>
                        <?php endforeach; ?>
                    </dl>
                <?php endif;?>
                <?php if ($messages = $block->getMessages()): ?>
                    <?php foreach ($messages as $message): ?>
                        <div class="cart item message <?= /* @escapeNotVerified */ $message['type'] ?>"><div><?= $block->escapeHtml($message['text']) ?></div></div>
                    <?php endforeach; ?>
                <?php endif; ?>
                <?php $addInfoBlock = $block->getProductAdditionalInformationBlock(); ?>
                <?php if ($addInfoBlock): ?>
                    <?= $addInfoBlock->setItem($_item)->toHtml() ?>
                <?php endif;?>
            </div>
        </td>

        <?php if ($canApplyMsrp): ?>
            <td class="col msrp" data-th="<?= $block->escapeHtml(__('Price')) ?>">
                <span class="pricing msrp">
                    <span class="msrp notice"><?= /* @escapeNotVerified */ __('See price before order confirmation.') ?></span>
                    <?php $helpLinkId = 'cart-msrp-help-' . $_item->getId(); ?>
                    <a href="#" class="action help map" id="<?= /* @escapeNotVerified */ ($helpLinkId) ?>" data-mage-init='{"addToCart":{"helpLinkId": "#<?= /* @escapeNotVerified */ $helpLinkId ?>","productName": "<?= /* @escapeNotVerified */ $product->getName() ?>","showAddToCart": false}}'>
                        <span><?= /* @escapeNotVerified */ __("What's this?") ?></span>
                    </a>
                </span>
            </td>
        <?php else: ?>
            <td class="col price" data-th="<?= $block->escapeHtml(__('Price')) ?>">
                <?= $block->getUnitPriceHtml($_item) ?>
            </td>
        <?php endif; ?>
        <td class="col qty" data-th="<?= $block->escapeHtml(__('Qty')) ?>">
            <div class="field qty">
                <label class="label" for="cart-<?= /* @escapeNotVerified */ $_item->getId() ?>-qty">
                    <span><?= /* @escapeNotVerified */ __('Qty') ?></span>
                </label>
                <div class="control qty">
                
                
                <?php
                	$testtest = $product->getData('weight');
                	//$testtest = $block->getProductDefaultQty()
			//var_dump($category->getData());
			
			//$_product = $block->getProduct();
			//echo "<pre>"; print_r($_product->debug());die("dead");
		?>
		
		
                    <input id="cart-<?= /* @escapeNotVerified */ $_item->getId() ?>-qty"
                           name="cart[<?= /* @escapeNotVerified */ $_item->getId() ?>][qty]"
                           data-cart-item-id="<?= $block->escapeHtml($_item->getSku()) ?>"
                           value="<?= /* @escapeNotVerified */ $block->getQty() ?>"
                           type="number"
                           size="4"
                           step="<?= /* @escapeNotVerified */ $testtest ?>"
                           title="<?= $block->escapeHtml(__('Qty')) ?>"
                           class="input-text qty"
                           data-validate="{required:true,'validate-greater-than-zero':true}"
                           data-role="cart-item-qty"/>
                </div>
            </div>
        </td>

        <td class="col subtotal" data-th="<?= $block->escapeHtml(__('Subtotal')) ?>">
            <?php if ($canApplyMsrp): ?>
                <span class="cart msrp subtotal">--</span>
            <?php else: ?>
                <?= $block->getRowTotalHtml($_item) ?>
            <?php endif; ?>
        </td>
    </tr>
    <tr class="item-actions">
        <td colspan="4">
            <div class="actions-toolbar">
                <?= /* @escapeNotVerified */ $block->getActions($_item) ?>
            </div>
        </td>
    </tr>
</tbody>

and in the head tag:

<script> <!--PREVENT NUMBER BEING TYPED IN AND SHOW BUTTONS UP/DOWN-->
 require(['jquery', 'jquery/ui'], function($){ 

    jQuery('<div class="control-button control-up">+</div><div class="control-button control-down">-</div>').insertAfter("input[id$='qty']");
    jQuery("input[id$='qty']").css({"-moz-appearance": "textfield", "-webkit-appearance": "textfield"});
    jQuery('.field.qty .control').each(function() {
      var step =  parseFloat(jQuery("input[id$='qty']").attr("step"));
      var spinner = jQuery(this),
        input = spinner.find("input[id$='qty']"),
        btnUp = spinner.find('.control-up'),
        btnDown = spinner.find('.control-down'),
        min = input.attr('min'),
        max = input.attr('max');

      btnUp.click(function() {
        var oldValue = parseFloat(input.val());
        if (oldValue >= max) {
          var newVal = oldValue;
        } else {
          var newVal = oldValue + step;
        }
        spinner.find("input").val(newVal);
        spinner.find("input").trigger("change");
      });

      btnDown.click(function() {
        var oldValue = parseFloat(input.val());
        if (oldValue <= min) {
          var newVal = oldValue;
        } else {
          var newVal = oldValue - step;
        }
        spinner.find("input").val(newVal);
        spinner.find("input").trigger("change");
      });

    });

    jQuery("input[id$='qty']").keydown(function(e) {
        e.preventDefault();
    return false;
});
jQuery('.control-down')
.disableSelection();
jQuery('.control-up')
.disableSelection();
});

</script>

Re: Fix Update Basket - Something went wrone while saving this page

i have the same issue 

magento 2.3.1

 

upon clicking "Update Cart" I get 

{"success":false,"error_message":"Something went wrong while saving the page. Please refresh the page and try again."}

 

from updateItemQty

No error in console log

 

 

Re: Fix Update Basket - Something went wrone while saving this page

Hi,

I have the same issue Magento 2.3.1

When clicking on "Update Cart" I get {"success":false,"error_message":"Something went wrong while saving the page. Please refresh the page and try again."} from updateItemQty.

Re: Fix Update Basket - Something went wrone while saving this page

Hi,

I have also the same issue in Magento 2.3.4.

Is someone founded a solution please ?