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

[4.x]: Broken preview for products #3215

Closed
bavodeclercq opened this issue Jul 10, 2023 · 9 comments
Closed

[4.x]: Broken preview for products #3215

bavodeclercq opened this issue Jul 10, 2023 · 9 comments
Assignees
Labels
bug commerce4 Issues related to Commerce v4

Comments

@bavodeclercq
Copy link
Contributor

bavodeclercq commented Jul 10, 2023

What happened?

Description

The live preview feature for products in Craft Commerce is not functioning correctly. When accessing the preview, a blank screen is displayed, and in the network tab of the browser's developer tools, a 400 error is observed.

yii\web\BadRequestHttpException: Post request required in /var/www/html/vendor/craftcms/cms/src/web/Controller.php:465
Stack trace:
#0 /var/www/html/vendor/craftcms/commerce/src/controllers/ProductsPreviewController.php(43): craft\web\Controller->requirePostRequest()
#1 [internal function]: craft\commerce\controllers\ProductsPreviewController->actionPreviewProduct()
#2 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#3 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#4 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('preview-product', Array)
#5 /var/www/html/vendor/craftcms/cms/src/web/Application.php(304): yii\base\Module->runAction('commerce/produc...', Array)
#6 /var/www/html/vendor/craftcms/cms/src/controllers/LivePreviewController.php(121): craft\web\Application->runAction('commerce/produc...')
#7 [internal function]: craft\controllers\LivePreviewController->actionPreview('commerce/produc...', 1)
#8 /var/www/html/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#9 /var/www/html/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#10 /var/www/html/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('preview', Array)
#11 /var/www/html/vendor/craftcms/cms/src/web/Application.php(304): yii\base\Module->runAction('live-preview/pr...', Array)
#12 /var/www/html/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application->runAction('live-preview/pr...', Array)
#13 /var/www/html/vendor/craftcms/cms/src/web/Application.php(289): yii\web\Application->handleRequest(Object(craft\web\Request))
#14 /var/www/html/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#15 /var/www/html/web/index.php(12): yii\base\Application->run()
#16 {main}

This issue is not limited to my specific installation but can also be replicated in the "Spoke and Chain" demo. It's worth noting that the live preview of entries works correctly, indicating that the problem specifically affects the live preview of products.

Steps to reproduce

  1. Go to a product in the CP.
  2. Click on the "Preview" button.

Expected behavior

The live preview should display the product information correctly, allowing for a preview of how the product will appear on the website.

Actual behavior

The live preview shows a blank screen, and the network tab in the browser's developer tools displays a 400 error.

Craft CMS version

4.4.15

Craft Commerce version

4.2.11

PHP version

8.1.16

Operating system and version

Linux 6.3.12

Database type and version

MySQL 8.0.31

Image driver and version

Imagick 3.7.0

Installed plugins and versions

  • Colour Swatches 4.3.0
  • Cookies 4.0.0
  • CP Field Inspect 1.4.4
  • Craft Commerce 4.2.11
  • Database Translations 2.2.1
  • Default Dashboard 2.0.0
  • Eager Beaver 4.0.2
  • Elements Panel 2.0.0
  • Embedded Assets 3.1.5
  • Expanded Singles 2.0.1
  • Feed Me 5.1.4
  • Formie 2.0.32
  • Hyper 1.1.8
  • Image Resizer 3.0.6
  • Knock Knock 2.0.10
  • Mailchimp Transactional 2.0.1
  • Maps 4.0.4
  • Minify 4.0.0-beta.2
  • Mollie for Craft Commerce 4.1.0.1
  • Neo 3.8.0
  • PDF Transform 2.0.1
  • Preparse Field 2.0.2
  • Retour 4.1.12
  • Sentry SDK 2.0.1
  • SEOmatic 4.0.28
  • Sprig 2.6.2
  • Style Inliner 3.0.3
  • Super Table 3.0.9
  • Typogrify 4.0.1
  • Vite 4.0.6
  • Vizy 2.1.6
  • Sherlock 4.3.0
@bavodeclercq bavodeclercq added commerce4 Issues related to Commerce v4 bug labels Jul 10, 2023
@lukeholder lukeholder self-assigned this Jul 10, 2023
@bossanova808
Copy link
Contributor

Yep seeing this too. Error is: Unable to verify your data submission. - live preview of everything else seems to be working fine, it's just products as far as I can determine.

@lukeholder
Copy link
Member

lukeholder commented Jul 11, 2023

Looks like this broke 2 weeks ago in a recent Craft CMS release, since this commit: craftcms/cms@c0a37e1

I will raise the issue with the CMS team and get back to you both soon. Thanks.

@bossanova808
Copy link
Contributor

Sounds about right, I've been away most of the last couple weeks but my staff mentioned they've been seeing it a while. (Be handy if they'd told me earlier!)

Thanks Luke

@bossanova808
Copy link
Contributor

What's going on with this one please? Kind of an important piece of functionality we'd like to get working again ASAP...

@lukeholder
Copy link
Member

Apologies for not responding here. We looked into it and this was fixed upstream in Craft CMS and the fix will be in the next Craft CMS release.

@lukeholder
Copy link
Member

Fix is here:

craftcms/cms@a987c99

@bossanova808
Copy link
Contributor

No dramas - so the next point release, not 4.5, right?

@bossanova808
Copy link
Contributor

Just confirming this is all working again for us with the latest Craft update...

@nfourtythree
Copy link
Contributor

Thanks for updating us @bossanova808 !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug commerce4 Issues related to Commerce v4
Projects
None yet
Development

No branches or pull requests

4 participants