Here is a small tip how to import images that use regional symbols in the file names, for example such as “Rødvin”.
The thing is that the default import is not able to upload pictures that have such characters in the name, that is why as a result you will see just a picture with a grey question mark instead of the product image. The problem is that AdminImportController::productImport() uses the URL of the image just as it is:
1 |
AdminImportController::copyImg($product->id, $image->id, $url, 'products', !Tools::getValue('regenerate')) |
However, if you replace that line with this one:
Partner With Us
Let's discuss how to grow your business. Get a Free Quote.
Talk to Andrey
1 |
AdminImportController::copyImg($product->id, $image->id, dirname($url) . '/' .urlencode(basename($url)), 'products', !Tools::getValue('regenerate')) |
This will fix the problem. I.e, you need to replace the variable ‘$url’ with ‘dirname($url) . ‘/’ .urlencode(basename($url)’.
Partner With Us
Looking for a partner to grow your business? We are the right company to bring your webstore to success.
Talk to Andrey
Pavel,
Thanks a lot!
1. If you look at the productImport() method you see that variable $url is «partially encoded» with $url = str_replace(‘ ‘, ‘%20’, $url); So if there was space in the original file name your encoding will corrupt it.
2. You encode only the last part of the URL. But there can be more places to encode. Ex.: http://example.com/some strange symbol folder/image name with some strange symbols.jpg
3. Method call is not the correct place where to make such modifications.
Update AdminImportController::copyImg() method. Change
to the
UPD: this patch was added to the Prestashop repo