-
Notifications
You must be signed in to change notification settings - Fork 340
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 when we save an optimizer with from date and/or to date values #917
Comments
Yup, I am able to reproduce this one with my back-office set to french. Feel free to propose us a PR if you have a working fix. But I'm not sure replacing Are you sure that However, since you are using an old and now unmaintained version of the module, we will probably not backport this fix into 2.3.x version. But since the issue is occuring on a public method, you should be able to fix it on your project with an "around" plugin. Thank you for reporting it. Best regards |
Would prefer a PR that fix the bug in the project !!! |
Good afternoon, This is seems related to an old bug already mentionned in previous versions of Magento. This is will be fixed in magento 2.3. The solution for now, if you do not want to extend smile elastic extension / magento core system, is to set your back-office in English language. I am able to reproduce this error on our staging website, magento 2.2.4. Regards, Ilan PARMENTIER |
@romainruaud : Can you have a look at this one ? |
I don't understand, it's fixed by PR #918 |
I want you to test the PR carefully. |
Or write acceptance test 😀 #troll |
That would be fine !!! |
PR is working as intended. Tested on an english Back-Office, and also with a french one. No issue, date is properly saved and displayed with both locales. |
Just one thing, the commit could be cherry picked to 2.5.x instead of master. |
PR merged |
Preconditions
The problem occurs when we try to create/update an optimizer with non null fromdate AND todate. The back office is configure to use French date format.
Magento Version : 2.1.12
ElasticSuite Version : 2.3.11
Environment : Dev and Prod
Steps to reproduce
Expected result
Actual result
Optimizer not saved and error : DateTime::__construct(): Failed to parse time string (23/05/2018) at position 0 (2): Unexpected character
Exception #0 (Exception): DateTime::__construct(): Failed to parse time string (23/05/2018) at position 0 (2): Unexpected character
#0 /var/www/algam/vendor/smile/elasticsuite/src/module-elasticsuite-catalog-optimizer/Model/Optimizer.php(289): DateTime->__construct('23/05/2018')
#1 /var/www/algam/vendor/smile/elasticsuite/src/module-elasticsuite-catalog-optimizer/Controller/Adminhtml/Optimizer/Save.php(55): Smile\ElasticsuiteCatalogOptimizer\Model\Optimizer->validateData(Object(Magento\Framework\DataObject))
#2 /var/www/algam/var/generation/Smile/ElasticsuiteCatalogOptimizer/Controller/Adminhtml/Optimizer/Save/Interceptor.php(24): Smile\ElasticsuiteCatalogOptimizer\Controller\Adminhtml\Optimizer\Save->execute()
#3 /var/www/algam/vendor/magento/framework/App/Action/Action.php(102): Smile\ElasticsuiteCatalogOptimizer\Controller\Adminhtml\Optimizer\Save\Interceptor->execute()
#4 /var/www/algam/vendor/magento/module-backend/App/AbstractAction.php(226): Magento\Framework\App\Action\Action->dispatch(Object(Magento\Framework\App\Request\Http))
#5 /var/www/algam/vendor/magento/framework/Interception/Interceptor.php(74): Magento\Backend\App\AbstractAction->dispatch(Object(Magento\Framework\App\Request\Http))
#6 /var/www/algam/vendor/magento/framework/Interception/Chain/Chain.php(70): Smile\ElasticsuiteCatalogOptimizer\Controller\Adminhtml\Optimizer\Save\Interceptor->___callParent('dispatch', Array)
#7 /var/www/algam/vendor/magento/framework/Interception/Chain/Chain.php(63): Magento\Framework\Interception\Chain\Chain->invokeNext('Smile\Elasticsu...', 'dispatch', Object(Smile\ElasticsuiteCatalogOptimizer\Controller\Adminhtml\Optimizer\Save\Interceptor), Array, 'adminAuthentica...')
One solution I found: /home/pilem/Travail/SmileProject/algam/vendor/smile/elasticsuite/src/module-elasticsuite-catalog-optimizer/Model/Optimizer.php:l288-289 -> replace new \DateTime() by $this->dateFilter->filter()
The text was updated successfully, but these errors were encountered: