# 常见问题 四 ## 54,'Vertex\\Tax\\Model\\Flexfield\\Processor\\InvoiceFlexFieldProcessorInterface' not found > PHP Fatal error: Interface 'Vertex\Tax\Model\Flexfield\Processor\InvoiceFlexFieldProcessorInterface' not found in vendor/vertex/module-tax/Model/FlexField/Processor/OrderCurrencyGetterProcessor.php on line 24 这是2.3.3的一个bug, [https://github.com/magento/magento2/issues/24930](https://github.com/magento/magento2/issues/24930) 解决办法: 打开 `/vendor/vertex/module-tax/Model/FlexField/Processor/OrderCurrencyGetterProcessor.php` 添加2个`use` ``` use Vertex\Tax\Model\FlexField\Processor\InvoiceFlexFieldProcessorInterface; use Vertex\Tax\Model\FlexField\Processor\TaxCalculationFlexFieldProcessorInterface; ``` ## 55,Invalid Form Key. Please refresh the page 后台产品保存的时候报错 `Invalid Form Key. Please refresh the page` 这是产品编辑页面的表单数据太大了,或者说是上传的产品图片太大了,超出了php限制。需要改下php.ini 找到 `max_input_vars`,改成: ``` max_input_vars 10000 ``` ## 56,Call to a member function getOptionsJson() on null in vendor/magento/module-catalog/view/frontend/templates/product/view/gallery.phtml:46 在2.3.3及以上版本会出现这种错误,是因为你的主题有重写gallery.phtml,缺少参数,需要加进去。 解决办法: ``` grep -irn 'View.Gallery' app/design ``` 找到catalog_product_view.xml文件里的 ``` <block class="Magento\Catalog\Block\Product\View\Gallery" name="product.info.media.image" template="product/view/gallery.phtml"> ``` 类似这样的代码,改成 ``` <block class="Magento\Catalog\Block\Product\View\Gallery" name="product.info.media.image" template="product/view/gallery.phtml"> <arguments> <argument name="gallery_options" xsi:type="object">Magento\Catalog\Block\Product\View\GalleryOptions</argument> </arguments> </block> ``` 也就是把 ``` <arguments> <argument name="gallery_options" xsi:type="object">Magento\Catalog\Block\Product\View\GalleryOptions</argument> </arguments> ``` 加进去就行了。 参考: [https://github.com/magento/magento2/issues/23432](https://github.com/magento/magento2/issues/23432) ## 57,禁用Temando_Shipping插件后 后台产品编辑页面打开报错 Uncaught Error: Cannot instantiate interface Temando\Shipping\Model\ResourceModel\Repository\PackagingR epositoryInterface in /var/www/magento2demo.com/vendor/magento/framework/ObjectManager/Factory/Dynamic/Developer.php:50 **解决办法:** 把产品属性source_model含有Temando相关的属性删掉 ``` DELETE FROM `eav_attribute` WHERE `source_model` LIKE '%Temando%' ``` 再编译清缓存 ``` php bin/magento setup:di:compile rm -rf var/cache/* var/page_cache/* generated/code/* ``` ## 58, Notice: Undefined offset: 2 in vendor/magento/framework/Encryption/Encryptor.php on line 591 在php7.2以上 / m2 2.3.3及以上版本会出现这问题。 解决办法有2种, 1),重新创建admin user 比如创建新用户test ``` php bin/magento admin:user:create --admin-user test --admin-password test123456 --admin-email =zouhongzhao@126.com --admin-firstname test --admin-lastname test ``` 2),安装php sodium扩展 具体的google ## 59,DateTimeZone::__construct(): Unknown or bad timezone () ~~~ 1 exception(s): Exception #0 (Exception): DateTimeZone::__construct(): Unknown or bad timezone () ~~~ 这应该是主题或者插件因为某种特殊原因在core_config_data表里创建了个value为null的记录,比如 ~~~ select * FROM `core_config_data` WHERE path = 'general' ~~~ 有`general`这条记录的话,就删掉试试 ~~~ DELETE FROM `core_config_data` WHERE path = 'general' ~~~ 然后 再刷新页面测试下看是不好了。 参考:[https://magento.stackexchange.com/questions/135188/my-magento-2-website-is-crashed-unknown-or-bad-timezone-error](https://magento.stackexchange.com/questions/135188/my-magento-2-website-is-crashed-unknown-or-bad-timezone-error) ## 60,PayPal gateway has rejected request. Payment has already been made for this InvoiceID (#10412: Duplicate invoice) 具有相同ID的发票多次发送到PayPal时,会发生此问题。 也就是说你在支付页面 反复点paypal 但是又不付款的话 就会出现这问题。 在多个Magento站点(甚至在本地和暂存环境中)使用相同的凭据时,可能会发生这种情况。特殊情况可能如下: * 多家商店将发票提交到PayPal,并使用相同的发票ID * 新商店会发送带有旧商店先前提交的ID的发票 默认情况下,PayPal不允许两次处理同一张发票。 解决办法: 更改您的PayPal个人资料,以允许每个发票ID进行多次付款。您需要通过PayPal进行这些更改。 1. 通过[https://www.paypal.com](https://www.paypal.com/)登录到您的帐户 。 2. 单击**配置文件**\>**配置文件和设置 **(右上角)。 3. 转到**我的销售工具**。 4. 导航到“ **收款并管理我的风险”**\>“**阻止付款”**,然后单击“**更新”**。 5. **在“销售首选项”中**,单击“ **付款接收首选项”**。 6. 在 **阻止意外付款下**,选择 **否,每个发票ID允许多次付款**。 ![paypal_allow_multiple_payments_per_invoice_id.png](https://support.magento.com/hc/article_attachments/115003047154/paypal_allow_multiple_payments_per_invoice_id.png) 7. 滚动到底部,然后单击 **保存**。 见: [https://support.magento.com/hc/en-us/articles/115002457473-PayPal-gateway-rejected-request-duplicate-invoice-issue](https://support.magento.com/hc/en-us/articles/115002457473-PayPal-gateway-rejected-request-duplicate-invoice-issue) ## 61, Elasticsearch: Types cannot be provided in put mapping requests, unless the include\_type\_name parameter is set to true. 执行reindex或者bin/magento indexer:reindex catalogsearch_fulltext后,报错: > Catalog Search indexer process unknown error: {"error":{"root_cause":[{"type":"illegal_argument_exception","reason":"Types cannot be provided in put mapping requests, unless the include_type_name parameter is set to true."}],"type":"illegal_argument_exception","reason":"Types cannot be provided in put mapping requests, unless the include_type_name parameter is set to true."},"status":400} 这是因为你的m2版本低于2.3.5,并且安装的Elasticsearch服务端版本是7.x的,导致兼容性有问题,因为m2 2.3.5以下版本只支持es 5.x和6.x,不支持7.x。 解决办法有2种: 第1种:升级m2到最新的2.3.5版本 第2种:不升级m2,直接修改源码,修改 `vendor/magento/module-elasticsearch-6/Model/Client/Elasticsearch.php` 在大约252行的位置,addFieldsMapping这个function里,在$params数组里添加一行 `'include_type_name' => true,` 类似这样 ``` public function addFieldsMapping(array $fields, $index, $entityType) { $params = [ 'index' => $index, 'type' => $entityType, 'include_type_name' => true, .... ``` ## 62,upstream sent too big header while reading response header from upstream nginx报错 `upstream sent too big header while reading response header from upstream` **解决办法:** 在M2的`vhost`里,找到`location ~ (index|get|static|report|404|503|health_check`这一行,在里面添加: ``` fastcgi_buffers 1024 4k; fastcgi_buffer_size 128k; ``` 类似这样 ``` # PHP entry point for main application location ~ (index|get|static|report|404|503|health_check|test|dafo_importer|_intellij_phpdebug_validator)\.php$ { .... fastcgi_buffers 1024 4k; fastcgi_buffer_size 128k; .... } ```