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

Error trying to view order PDF #1626

Closed
jameslindeman opened this issue Aug 7, 2020 · 5 comments
Closed

Error trying to view order PDF #1626

jameslindeman opened this issue Aug 7, 2020 · 5 comments
Assignees
Labels
ℹ️ status: need more info When waiting for user to supply database or more information.

Comments

@jameslindeman
Copy link

Description
Any template with <a href="{{ order.getPdfUrl() }}">PDF</a> shows a PHP Notice: Trying to get property 'fileNameFormat' of non-object

To Reproduce
After an upgrade to Craft 3.5.1 and Commerce 3.2.1

  1. Commerce > System Settings > PDFs has just one PDF setup:
    • Name: Receipt
    • Handle: receipt
    • PDF Template Path: path/to/template (template has no errors)
    • Order PDF Filename Format: left empty
  2. Use example templates and navigate to Shop > My Account > select an Order
  3. Click the PDF: Download link

Additional info

  • Craft version: 3.5.1
  • Commerce version: 3.2.1
  • PHP version: 7.2.24
@nfourtythree
Copy link
Contributor

Hi @jameslindeman

Could you provide a stack trace for the notice, this will help us track what is going on.

Thanks!

@nfourtythree nfourtythree added ℹ️ status: need more info When waiting for user to supply database or more information. and removed New labels Aug 7, 2020
@jameslindeman
Copy link
Author

yii\base\ErrorException: Trying to get property 'fileNameFormat' of non-object in …/vendor/craftcms/commerce/src/controllers/DownloadsController.php:54
Stack trace:
#0 …/vendor/craftcms/cms/src/web/ErrorHandler.php(75): yii\base\ErrorHandler->handleError(8, 'Trying to get p...', '/Users/...', 54)
#1 …/vendor/craftcms/commerce/src/controllers/DownloadsController.php(54): craft\web\ErrorHandler->handleError(8, 'Trying to get p...', '/Users/...', 54, Array)
#2 [internal function]: craft\commerce\controllers\DownloadsController->actionPdf()
#3 …/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#4 …/vendor/yiisoft/yii2/base/Controller.php(180): yii\base\InlineAction->runWithParams(Array)
#5 …/vendor/craftcms/cms/src/web/Controller.php(181): yii\base\Controller->runAction('pdf', Array)
#6 …/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('pdf', Array)
#7 …/vendor/craftcms/cms/src/web/Application.php(294): yii\base\Module->runAction('commerce/downlo...', Array)
#8 …/vendor/craftcms/cms/src/web/Application.php(597): craft\web\Application->runAction('commerce/downlo...', Array)
#9 …/vendor/craftcms/cms/src/web/Application.php(273): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#10 …/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))
#11 …/web/index.php(21): yii\base\Application->run()
#12 /Users/…/.composer/vendor/weprovide/valet-plus/server.php(131): require('/Users/...')
#13 {main}

Thanks @nfourtythree

@PopaWeb
Copy link

PopaWeb commented Aug 9, 2020

Same thing here but PHP 7.3.17

@lukeholder lukeholder self-assigned this Aug 10, 2020
@lukeholder
Copy link
Member

Thanks for reporting that! I’ve just fixed it for the next release.

To get the fix early, change your craftcms/commerce requirement in composer.json to:

"require": {
  "craftcms/commerce": "dev-develop#80cd4036cf5a9c00c31d72f6a2c8fa0cb2b1675f as 3.2.1",
  "...": "..."
}

Then run composer update.

@brandonkelly
Copy link
Member

Commerce 3.2.2 is out now with this fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ℹ️ status: need more info When waiting for user to supply database or more information.
Projects
None yet
Development

No branches or pull requests

5 participants