Skip to content
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

Cannot view inactive carts #826

Closed
carolineboeykens opened this issue Apr 16, 2019 · 1 comment
Closed

Cannot view inactive carts #826

carolineboeykens opened this issue Apr 16, 2019 · 1 comment

Comments

@carolineboeykens
Copy link

Description

We can't open the inactive carts in the control panel when devmode is false.
We found this error in the console.log:
2019-04-16 14:49:21 [-][1][424370eaa766512384c5348572c5fe13][error][TypeError] TypeError: Argument 1 passed to craft\commerce\services\Countries::getCountryById() must be of the type integer, null given, called in /Users/carolineboeykens/Documents/Sites/woosho/vendor/twig/twig/src/Extension/CoreExtension.php on line 1681 and defined in /Users/carolineboeykens/Documents/Sites/woosho/vendor/craftcms/commerce/src/services/Countries.php:61 Stack trace: #0 /Users/carolineboeykens/Documents/Sites/woosho/vendor/twig/twig/src/Extension/CoreExtension.php(1681): craft\commerce\services\Countries->getCountryById(NULL) #1 /Users/carolineboeykens/Documents/Sites/woosho/vendor/craftcms/cms/src/helpers/Template.php(79): twig_get_attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(craft\commerce\services\Countries), 'getCountryById', Array, 'method', false, false) #2 /Users/carolineboeykens/Documents/Sites/woosho/storage/runtime/compiled_templates/7d/7d2f9a08f58310a1835240d3e5d74702d9efd05d000613963054def7835520a1.php(331): craft\helpers\Template::attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(craft\commerce\services\Countries), 'getCountryById', Array, 'method') #3 /Users/carolineboeykens/Documents/Sites/woosho/vendor/twig/twig/src/Template.php(379): __TwigTemplate_238d78511b5390458fe6e9d98a8167ad22229c3388f163a954fdad5220342b35->doDisplay(Array, Array) #4 /Users/carolineboeykens/Documents/Sites/woosho/vendor/craftcms/cms/src/web/twig/Template.php(52): Twig\Template->displayWithErrorHandling(Array, Array) #5 /Users/carolineboeykens/Documents/Sites/woosho/vendor/twig/twig/src/Template.php(356): craft\web\twig\Template->displayWithErrorHandling(Array, Array) #6 /Users/carolineboeykens/Documents/Sites/woosho/vendor/craftcms/cms/src/web/twig/Template.php(34): Twig\Template->display(Array, Array) #7 /Users/carolineboeykens/Documents/Sites/woosho/vendor/twig/twig/src/Template.php(364): craft\web\twig\Template->display(Array) #8 /Users/carolineboeykens/Documents/Sites/woosho/vendor/twig/twig/src/TemplateWrapper.php(45): Twig\Template->render(Array, Array) #9 /Users/carolineboeykens/Documents/Sites/woosho/vendor/twig/twig/src/Environment.php(319): Twig\TemplateWrapper->render(Array) #10 /Users/carolineboeykens/Documents/Sites/woosho/vendor/craftcms/cms/src/web/View.php(343): Twig\Environment->render('_shop/_email/_p...', Array) #11 /Users/carolineboeykens/Documents/Sites/woosho/vendor/craftcms/commerce/src/services/Pdf.php(86): craft\web\View->renderTemplate('_shop/_email/_p...', Array) #12 /Users/carolineboeykens/Documents/Sites/woosho/vendor/craftcms/commerce/src/elements/Order.php(1031): craft\commerce\services\Pdf->renderPdfForOrder(Object(craft\commerce\elements\Order), NULL) #13 /Users/carolineboeykens/Documents/Sites/woosho/vendor/twig/twig/src/Extension/CoreExtension.php(1681): craft\commerce\elements\Order->getPdfUrl() #14 /Users/carolineboeykens/Documents/Sites/woosho/vendor/craftcms/cms/src/helpers/Template.php(79): twig_get_attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(craft\commerce\elements\Order), 'getPdfUrl', Array, 'method', false, false) #15 /Users/carolineboeykens/Documents/Sites/woosho/storage/runtime/compiled_templates/f4/f4b22d116146733827610f7dc76ee2fb9ac0e5a703fa2e4a9ae7c54e09e3fe99.php(51): craft\helpers\Template::attribute(Object(craft\web\twig\Environment), Object(Twig\Source), Object(craft\commerce\elements\Order), 'getPdfUrl', Array, 'method') #16 /Users/carolineboeykens/Documents/Sites/woosho/vendor/twig/twig/src/Template.php(379): __TwigTemplate_54f2f1d28965c5be399688dca950d93270a4865b888333a062d45470a3068a5a->doDisplay(Array, Array) #17 /Users/carolineboeykens/Documents/Sites/woosho/vendor/craftcms/cms/src/web/twig/Template.php(52): Twig\Template->displayWithErrorHandling(Array, Array) #18 /Users/carolineboeykens/Documents/Sites/woosho/vendor/twig/twig/src/Template.php(356): craft\web\twig\Template->displayWithErrorHandling(Array, Array) #19 /Users/carolineboeykens/Documents/Sites/woosho/vendor/craftcms/cms/src/web/twig/Template.php(34): Twig\Template->display(Array, Array) #20 /Users/carolineboeykens/Documents/Sites/woosho/vendor/twig/twig/src/Template.php(364): craft\web\twig\Template->display(Array) #21 /Users/carolineboeykens/Documents/Sites/woosho/vendor/twig/twig/src/TemplateWrapper.php(45): Twig\Template->render(Array, Array) #22 /Users/carolineboeykens/Documents/Sites/woosho/vendor/twig/twig/src/Environment.php(319): Twig\TemplateWrapper->render(Array) #23 /Users/carolineboeykens/Documents/Sites/woosho/vendor/craftcms/cms/src/web/View.php(343): Twig\Environment->render('commerce/orders...', Array) #24 /Users/carolineboeykens/Documents/Sites/woosho/vendor/craftcms/cms/src/web/View.php(393): craft\web\View->renderTemplate('commerce/orders...', Array) #25 /Users/carolineboeykens/Documents/Sites/woosho/vendor/craftcms/cms/src/web/Controller.php(161): craft\web\View->renderPageTemplate('commerce/orders...', Array) #26 /Users/carolineboeykens/Documents/Sites/woosho/vendor/craftcms/commerce/src/controllers/OrdersController.php(114): craft\web\Controller->renderTemplate('commerce/orders...', Array) #27 [internal function]: craft\commerce\controllers\OrdersController->actionEditOrder('4898', NULL) #28 /Users/carolineboeykens/Documents/Sites/woosho/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array) #29 /Users/carolineboeykens/Documents/Sites/woosho/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams(Array) #30 /Users/carolineboeykens/Documents/Sites/woosho/vendor/craftcms/cms/src/web/Controller.php(109): yii\base\Controller->runAction('edit-order', Array) #31 /Users/carolineboeykens/Documents/Sites/woosho/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('edit-order', Array) #32 /Users/carolineboeykens/Documents/Sites/woosho/vendor/craftcms/cms/src/web/Application.php(297): yii\base\Module->runAction('commerce/orders...', Array) #33 /Users/carolineboeykens/Documents/Sites/woosho/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application->runAction('commerce/orders...', Array) #34 /Users/carolineboeykens/Documents/Sites/woosho/vendor/craftcms/cms/src/web/Application.php(286): yii\web\Application->handleRequest(Object(craft\web\Request)) #35 /Users/carolineboeykens/Documents/Sites/woosho/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request)) #36 /Users/carolineboeykens/Documents/Sites/woosho/public/index.php(21): yii\base\Application->run() #37 {main}

Steps to reproduce

  1. Set devMode = true in general.php
  2. In control panel, go to Commerce orders
  3. Try to open an inactive cart

Additional info

  • Craft version: 3.1.22
  • PHP version: 7.2.13
  • Database driver & version: MySQL 5.7
  • Plugins & versions: Craft Commerce Pro 2.1.3.1
@lukeholder
Copy link
Member

This is due to something in your order PDF template expecting a completed order. For now, we will just disable the PDF button for carts in the control panel, since receipts don't make sense for non-orders. Fixed for the next release.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants