Edit sanitize method in vendor file
Forum rules
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Laravel, Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Edit sanitize method in vendor file
Hello,
I need to overide method sanitize in \vendor\aimeos\aimeos-core\lib\mwlib\src\MW\Common\Base.php
What is the best practice to do that to avoid upgrade issues in the future ?
One similiar solution I made before:
When the product is saved in admin, it generates sanitized URL for url.segment. I was able to edit this function right in ext file :
I left there original function sanitize() added my own function sanitize2() and now original method calling my own function.
It is right to edit functions in ext folder like that ?
But now the problem is:
When product url.segment is empty, it is generated from product.label. And this logic is only in vendor files as I wrote at the beginning. So what is the best practice to solve this problem please ?
Thank you
Laravel 7
Aimeos 2020.04
PHP 7.4
Xampp
I need to overide method sanitize in \vendor\aimeos\aimeos-core\lib\mwlib\src\MW\Common\Base.php
What is the best practice to do that to avoid upgrade issues in the future ?
One similiar solution I made before:
When the product is saved in admin, it generates sanitized URL for url.segment. I was able to edit this function right in ext file :
Code: Select all
ext/ai-laravel/lib/custom/src/MW/View/Helper/Url/Laravel5.php
It is right to edit functions in ext folder like that ?
But now the problem is:
When product url.segment is empty, it is generated from product.label. And this logic is only in vendor files
Code: Select all
\vendor\aimeos\aimeos-core\lib\mwlib\src\MW\Common\Base.php
Thank you
Laravel 7
Aimeos 2020.04
PHP 7.4
Xampp
Re: Edit sanitize method in vendor file
The only way is to extend the classes and overwrite the methods where it's used.
Why do you want to change it?
Why do you want to change it?
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Edit sanitize method in vendor file
Thanks for your response. So I can do it with service provider, as mentioned here ? https://laracasts.com/discuss/channels/ ... or-methods
I need to change it, because there are missing letters, when you write product label in Czech / Slovak language.
When you write a Czech/Slovak title of a product for example "Počítač ASUS" it generates url "po-ta-asus" instead of "pocitac-asus"
So I edited function sanitize() and now no character is missing, which is very desirable for SEO.
I need to change it, because there are missing letters, when you write product label in Czech / Slovak language.
When you write a Czech/Slovak title of a product for example "Počítač ASUS" it generates url "po-ta-asus" instead of "pocitac-asus"
So I edited function sanitize() and now no character is missing, which is very desirable for SEO.
Re: Edit sanitize method in vendor file
In dev-master, we use that code:
https://github.com/aimeos/aimeos-core/b ... #L147-L148
Does this work for you (requires "voku/portable-ascii": "^1.4")?
If yes, it will be in the new release in three weeks. This is much easier than changing all occurrences the method is used in the code.
https://github.com/aimeos/aimeos-core/b ... #L147-L148
Does this work for you (requires "voku/portable-ascii": "^1.4")?
If yes, it will be in the new release in three weeks. This is much easier than changing all occurrences the method is used in the code.
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: Edit sanitize method in vendor file
Yes it works, thanks. And in case of similiar problem in future, the best practice is to extend original class with service provider ?
If you publish new upgrade, only vendor files are changed or files in root folder (for example /ext/ folder) too ?
Thanks
If you publish new upgrade, only vendor files are changed or files in root folder (for example /ext/ folder) too ?
Thanks
Re: Edit sanitize method in vendor file
No, because it's not implemented as Laravel service provider which you can overwrite. It's only a class that's used.
Yes
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star