ethercreative / seo

SEO utilities including a unique field type, sitemap & redirect manager
MIT License
275 stars 95 forks source link

SEO-related server error when opening product modal from relations field #298

Open jmauzyk opened 4 years ago

jmauzyk commented 4 years ago

Description

Getting the following error logged when opening a product modal from a product relations field on an entry:

2020-04-23 15:24:28 [-][10982][-][error][yii\base\InvalidConfigException] yii\base\InvalidConfigException: Invalid product type ID: 22 in /home/parktool/parktoolweb2019/vendor/craftcms/commerce/src/elements/Product.php:288
Stack trace:
#0 /home/parktool/parktoolweb2019/vendor/ether/seo/src/models/data/SeoData.php(446): craft\commerce\elements\Product->getType()
#1 /home/parktool/parktoolweb2019/vendor/ether/seo/src/models/data/SeoData.php(293): ether\seo\models\data\SeoData->_getVariables()
#2 /home/parktool/parktoolweb2019/vendor/yiisoft/yii2/base/BaseObject.php(136): ether\seo\models\data\SeoData->getTitle()
#3 /home/parktool/parktoolweb2019/vendor/ether/seo/src/models/data/SeoData.php(424): yii\base\BaseObject->__get()
#4 /home/parktool/parktoolweb2019/vendor/ether/seo/src/models/data/SeoData.php(259): ether\seo\models\data\SeoData->_getSocialFallback()
#5 /home/parktool/parktoolweb2019/vendor/yiisoft/yii2/base/BaseObject.php(109): ether\seo\models\data\SeoData->init()
#6 /home/parktool/parktoolweb2019/vendor/ether/seo/src/models/data/SeoData.php(210): yii\base\BaseObject->__construct()
#7 /home/parktool/parktoolweb2019/vendor/ether/seo/src/fields/SeoField.php(107): ether\seo\models\data\SeoData->__construct()
#8 /home/parktool/parktoolweb2019/vendor/craftcms/cms/src/base/Element.php(2682): ether\seo\fields\SeoField->normalizeValue()
#9 /home/parktool/parktoolweb2019/vendor/craftcms/cms/src/base/Element.php(1096): craft\base\Element->normalizeFieldValue()
#10 /home/parktool/parktoolweb2019/vendor/ether/seo/src/controllers/SeoController.php(82): craft\base\Element->__get()
#11 [internal function]: ether\seo\controllers\SeoController->actionRenderData()
#12 /home/parktool/parktoolweb2019/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array()
#13 /home/parktool/parktoolweb2019/vendor/yiisoft/yii2/base/Controller.php(157): yii\base\InlineAction->runWithParams()
#14 /home/parktool/parktoolweb2019/vendor/craftcms/cms/src/web/Controller.php(178): yii\base\Controller->runAction()
#15 /home/parktool/parktoolweb2019/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction()
#16 /home/parktool/parktoolweb2019/vendor/craftcms/cms/src/web/Application.php(291): yii\base\Module->runAction()
#17 /home/parktool/parktoolweb2019/vendor/craftcms/cms/src/web/Application.php(559): craft\web\Application->runAction()
#18 /home/parktool/parktoolweb2019/vendor/craftcms/cms/src/web/Application.php(270): craft\web\Application->_processActionRequest()
#19 /home/parktool/parktoolweb2019/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest()
#20 /home/parktool/parktoolweb2019/web/index.php(21): yii\base\Application->run()
#21 {main}
2020-04-23 15:24:28 [-][10982][-][info][application] $_GET = [
    'p' => 'admin/actions/seo/seo/render-data'
]

Similar to #273. Seems to only occur when opening the modal from an entry. For example, if I open a product modal from a relations field on a product edit page, no error occurs. It seems like maybe the POST request to the render-data endpoint is combining the product data with the entry data, resulting in it looking for a typeId that doesn't exist for products.

Steps to reproduce

  1. Open CP entry page that has a product relations field. Entry's typeId must be a number different than any typeIds available for products.
  2. Double-click a product in the product relations field to open modal. Flash message displays at top of page reading "A server error occurred."

Additional info

Cynder70 commented 4 years ago

Not particularly helpful but I am having the same issue though it reads slightly differently than above. `2020-09-14 19:12:07 - error - yii\base\UnknownPropertyException yii\base\UnknownPropertyException: Getting unknown property: craft\commerce\elements\Order::typeId in /home/cyngra6/cleverzebra.xyz/craft/vendor/yiisoft/yii2/base/Component.php:154 Stack trace:

0 /home/cyngra6/cleverzebra.xyz/craft/vendor/craftcms/cms/src/base/Element.php(1414): yii\base\Component->__get('typeId')

1 /home/cyngra6/cleverzebra.xyz/craft/vendor/ether/seo/src/fields/SeoField.php(253): craft\base\Element->__get('typeId')

2 /home/cyngra6/cleverzebra.xyz/craft/vendor/craftcms/cms/src/base/Field.php(386): ether\seo\fields\SeoField->getInputHtml(Object(ether\seo\models\data\SeoData), Object(craft\commerce\elements\Order))

3 /home/cyngra6/cleverzebra.xyz/craft/vendor/craftcms/cms/src/fieldlayoutelements/CustomField.php(243): craft\base\Field->getStaticHtml(Object(ether\seo\models\data\SeoData), Object(craft\commerce\elements\Order))

4 /home/cyngra6/cleverzebra.xyz/craft/vendor/craftcms/cms/src/fieldlayoutelements/BaseField.php(202): craft\fieldlayoutelements\CustomField->inputHtml(Object(craft\commerce\elements\Order), true)

5 /home/cyngra6/cleverzebra.xyz/craft/vendor/craftcms/cms/src/fieldlayoutelements/CustomField.php(227): craft\fieldlayoutelements\BaseField->formHtml(Object(craft\commerce\elements\Order), true)

6 /home/cyngra6/cleverzebra.xyz/craft/vendor/craftcms/cms/src/models/FieldLayout.php(476): craft\fieldlayoutelements\CustomField->formHtml(Object(craft\commerce\elements\Order), true)

7 /home/cyngra6/cleverzebra.xyz/craft/vendor/craftcms/commerce/src/controllers/OrdersController.php(870): craft\models\FieldLayout->createForm(Object(craft\commerce\elements\Order), true, Array)

8 /home/cyngra6/cleverzebra.xyz/craft/vendor/craftcms/commerce/src/controllers/OrdersController.php(152): craft\commerce\controllers\OrdersController->_updateTemplateVariables(Array)

9 [internal function]: craft\commerce\controllers\OrdersController->actionEditOrder('1005', Object(craft\commerce\elements\Order))

10 /home/cyngra6/cleverzebra.xyz/craft/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)

11 /home/cyngra6/cleverzebra.xyz/craft/vendor/yiisoft/yii2/base/Controller.php(180): yii\base\InlineAction->runWithParams(Array)

12 /home/cyngra6/cleverzebra.xyz/craft/vendor/craftcms/cms/src/web/Controller.php(189): yii\base\Controller->runAction('edit-order', Array)

13 /home/cyngra6/cleverzebra.xyz/craft/vendor/yiisoft/yii2/base/Module.php(528): craft\web\Controller->runAction('edit-order', Array)

14 /home/cyngra6/cleverzebra.xyz/craft/vendor/craftcms/cms/src/web/Application.php(280): yii\base\Module->runAction('commerce/orders...', Array)

15 /home/cyngra6/cleverzebra.xyz/craft/vendor/yiisoft/yii2/web/Application.php(103): craft\web\Application->runAction('commerce/orders...', Array)

16 /home/cyngra6/cleverzebra.xyz/craft/vendor/craftcms/cms/src/web/Application.php(265): yii\web\Application->handleRequest(Object(craft\web\Request))

17 /home/cyngra6/cleverzebra.xyz/craft/vendor/yiisoft/yii2/base/Application.php(386): craft\web\Application->handleRequest(Object(craft\web\Request))

18 /home/cyngra6/cleverzebra.xyz/index.php(21): yii\base\Application->run()

19 {main}`

Craft version: 3.5.9 Craft Commerce: 3.2.6 SEO version: 3.6.6 PHP version: 7.4.3 DB: MySQL: MySQL 5.7.28