Closed davekleijn closed 2 years ago
Getting a different error when trying to re-order with one of the products being out of stock. Magento 2.3.2 with SubstituteOrders 1.0.22
1 exception(s): Exception #0 (Exception): Warning: Division by zero in /data/web/magento2/vendor/magento/module-tax/Model/Calculation/AbstractAggregateCalculator.php on line 158
Exception #0 (Exception): Warning: Division by zero in /data/web/magento2/vendor/magento/module-tax/Model/Calculation/AbstractAggregateCalculator.php on line 158
#1 Magento\Tax\Model\Calculation\AbstractAggregateCalculator->calculateWithTaxNotInPrice() called at [vendor/magento/module-tax/Model/Calculation/AbstractCalculator.php:220] #2 Magento\Tax\Model\Calculation\AbstractCalculator->calculate() called at [vendor/magento/module-tax/Model/TaxCalculation.php:284] #3 Magento\Tax\Model\TaxCalculation->processItem() called at [vendor/magento/module-tax/Model/TaxCalculation.php:186] #4 Magento\Tax\Model\TaxCalculation->calculateTax() called at [vendor/magento/module-tax/Model/Sales/Total/Quote/Subtotal.php:43] #5 Magento\Tax\Model\Sales\Total\Quote\Subtotal->collect() called at [generated/code/Magento/Tax/Model/Sales/Total/Quote/Subtotal/Interceptor.php:24] #6 Magento\Tax\Model\Sales\Total\Quote\Subtotal\Interceptor->collect() called at [vendor/magento/module-quote/Model/Quote/TotalsCollector.php:274] #7 Magento\Quote\Model\Quote\TotalsCollector->collectAddressTotals() called at [vendor/magento/framework/Interception/Interceptor.php:58] #8 Magento\Quote\Model\Quote\TotalsCollector\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138] #9 Magento\Quote\Model\Quote\TotalsCollector\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/amasty/promo/Plugin/Quote/Model/Quote/TotalsCollectorPlugin.php:119] #10 Amasty\Promo\Plugin\Quote\Model\Quote\TotalsCollectorPlugin->aroundCollectAddressTotals() called at [vendor/magento/framework/Interception/Interceptor.php:135] #11 Magento\Quote\Model\Quote\TotalsCollector\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153] #12 Magento\Quote\Model\Quote\TotalsCollector\Interceptor->___callPlugins() called at [generated/code/Magento/Quote/Model/Quote/TotalsCollector/Interceptor.php:52] #13 Magento\Quote\Model\Quote\TotalsCollector\Interceptor->collectAddressTotals() called at [vendor/magento/module-quote/Model/Quote/TotalsCollector.php:148] #14 Magento\Quote\Model\Quote\TotalsCollector->collect() called at [vendor/magento/framework/Interception/Interceptor.php:58] #15 Magento\Quote\Model\Quote\TotalsCollector\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138] #16 Magento\Quote\Model\Quote\TotalsCollector\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153] #17 Magento\Quote\Model\Quote\TotalsCollector\Interceptor->___callPlugins() called at [generated/code/Magento/Quote/Model/Quote/TotalsCollector/Interceptor.php:39] #18 Magento\Quote\Model\Quote\TotalsCollector\Interceptor->collect() called at [vendor/magento/module-quote/Model/Quote.php:1983] #19 Magento\Quote\Model\Quote->collectTotals() called at [vendor/magento/framework/Interception/Interceptor.php:58] #20 Magento\Quote\Model\Quote\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138] #21 Magento\Quote\Model\Quote\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153] #22 Magento\Quote\Model\Quote\Interceptor->___callPlugins() called at [generated/code/Magento/Quote/Model/Quote/Interceptor.php:1066] #23 Magento\Quote\Model\Quote\Interceptor->collectTotals() called at [vendor/magento/module-checkout/Model/Cart.php:580] #24 Magento\Checkout\Model\Cart->save() called at [vendor/magento/framework/Interception/Interceptor.php:58] #25 Magento\Checkout\Model\Cart\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138] #26 Magento\Checkout\Model\Cart\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153] #27 Magento\Checkout\Model\Cart\Interceptor->___callPlugins() called at [generated/code/Magento/Checkout/Model/Cart/Interceptor.php:78] #28 Magento\Checkout\Model\Cart\Interceptor->save() called at [vendor/dealer4dealer/module-substituteorders/Controller/Order/Reorder.php:178] #29 Dealer4Dealer\SubstituteOrders\Controller\Order\Reorder->reorderByProduct() called at [vendor/dealer4dealer/module-substituteorders/Controller/Order/Reorder.php:116] #30 Dealer4Dealer\SubstituteOrders\Controller\Order\Reorder->execute() called at [vendor/magento/framework/App/Action/Action.php:108] #31 Magento\Framework\App\Action\Action->dispatch() called at [vendor/dealer4dealer/module-substituteorders/Controller/Order/Reorder.php:91] #32 Dealer4Dealer\SubstituteOrders\Controller\Order\Reorder->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58] #33 Dealer4Dealer\SubstituteOrders\Controller\Order\Reorder\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138] #34 Dealer4Dealer\SubstituteOrders\Controller\Order\Reorder\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153] #35 Dealer4Dealer\SubstituteOrders\Controller\Order\Reorder\Interceptor->___callPlugins() called at [generated/code/Dealer4Dealer/SubstituteOrders/Controller/Order/Reorder/Interceptor.php:26] #36 Dealer4Dealer\SubstituteOrders\Controller\Order\Reorder\Interceptor->dispatch() called at [vendor/magento/framework/App/FrontController.php:159] #37 Magento\Framework\App\FrontController->processRequest() called at [vendor/magento/framework/App/FrontController.php:99] #38 Magento\Framework\App\FrontController->dispatch() called at [vendor/magento/framework/Interception/Interceptor.php:58] #39 Magento\Framework\App\FrontController\Interceptor->___callParent() called at [vendor/magento/framework/Interception/Interceptor.php:138] #40 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/module-store/App/FrontController/Plugin/RequestPreprocessor.php:94] #41 Magento\Store\App\FrontController\Plugin\RequestPreprocessor->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135] #42 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/module-page-cache/Model/App/FrontController/BuiltinPlugin.php:69] #43 Magento\PageCache\Model\App\FrontController\BuiltinPlugin->aroundDispatch() called at [vendor/magento/framework/Interception/Interceptor.php:135] #44 Magento\Framework\App\FrontController\Interceptor->Magento\Framework\Interception\{closure}() called at [vendor/magento/framework/Interception/Interceptor.php:153] #45 Magento\Framework\App\FrontController\Interceptor->___callPlugins() called at [generated/code/Magento/Framework/App/FrontController/Interceptor.php:26] #46 Magento\Framework\App\FrontController\Interceptor->dispatch() called at [vendor/magento/framework/App/Http.php:137] #47 Magento\Framework\App\Http->launch() called at [generated/code/Magento/Framework/App/Http/Interceptor.php:24] #48 Magento\Framework\App\Http\Interceptor->launch() called at [vendor/magento/framework/App/Bootstrap.php:261] #49 Magento\Framework\App\Bootstrap->run() called at [pub/index.php:40]
@Timothy-V
I also got that error when trying to add a try catch block. Looks like that is caused by $this->cart->save();
in \Dealer4Dealer\SubstituteOrders\Controller\Order\Reorder::reorderByOrderItems
. But I don't know why.
When I try to reorder an order, I get an error message if one of the products is out of stock.
Steps to reproduce
Expected result
A user-friendly error message. Products that are in stock are placed in the shopping cart.
Actual result