1

I know my question are like this

But in my case when I check errors I see this

Magento\Customer\Model\Customer\Interceptor::_getResource","trace":"#0 /backup/html/toph/vendor/magento/framework/Interception/Interceptor.php(146): Magento\Checkout\Model\PaymentInformationManagement->savePaymentInformationAndPlaceOrder(151, Object(Magento\Quote\Model\Quote\Payment), Object(Magento\Quote\Model\Quote\Address))\n#1 /backup/html/toph/var/generation/Magento/Checkout/Model/PaymentInformationManagement/Interceptor.php(26):

I remove var/generation and re compile my code and set permission to file but error does not fixed .

6
  • What is happening after the error ? Still the quote persist or cart is getting empty ? Jan 28, 2018 at 11:36
  • @KalyanChakravarthiV no just show error and stay on checkout error occur when i click place order Jan 28, 2018 at 11:38
  • Please attach complete stack trace Jan 28, 2018 at 11:40
  • @KalyanChakravarthiV it is here paste.ubuntu.ir/kegr Jan 28, 2018 at 11:41
  • Thanks, did you try different payment methods ? Jan 28, 2018 at 11:42

2 Answers 2

2

It is possible to display the real error by editing the model files based on the error ajax call

Edit the function savePaymentInformationAndPlaceOrder in

vendor/magento/module-checkout/Model/PaymentInformationManagement.php

or for Guest orders in

vendor/magento/module-checkout/Model/GuestPaymentInformationManagement.php

Change the function from:

public function savePaymentInformationAndPlaceOrder(
    $cartId,
    $email,
    \Magento\Quote\Api\Data\PaymentInterface $paymentMethod,
    \Magento\Quote\Api\Data\AddressInterface $billingAddress = null
) {
    $this->savePaymentInformation($cartId, $email, $paymentMethod, $billingAddress);
    try {
        $orderId = $this->cartManagement->placeOrder($cartId);
    } catch (\Exception $e) {
        throw new CouldNotSaveException(
            __('An error occurred on the server. Please try to place the order again.'),
            $e
        );
    }
    return $orderId;
}

to:

public function savePaymentInformationAndPlaceOrder(
    $cartId,
    $email,
    \Magento\Quote\Api\Data\PaymentInterface $paymentMethod,
    \Magento\Quote\Api\Data\AddressInterface $billingAddress = null
) {
    $this->savePaymentInformation($cartId, $email, $paymentMethod, $billingAddress);
    try {
        $orderId = $this->cartManagement->placeOrder($cartId);
    } catch (\Exception $e) {
        throw new CouldNotSaveException(
            __($e->getMessage()),
            $e
        );
    }
    return $orderId;
}

Now you get the actual error and you should find the full exception in the exception.log file

Thanks :)

0

That was because of some observer have error .. after disable observer order was placed best way for check error is change

vendor/magento/module-checkout/Model/PaymentInformationManagement.php

line 70 to

 catch (\Exception $e) {
        throw new CouldNotSaveException(
            __('An error occurred on the server. Please try to place the order again.'.$e->getMessage()),
            $e
        );
    }

and also check the console log

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.