ifoxxy Posted August 19, 2013 Share Posted August 19, 2013 Hey guys, I'm pretty new to PrestaShop and have to continue one guy's development. There is a horrible thing that happend after some of his actions: Images does not display in the shop for some reasons... I checked a couple of solutions but it didn't work for me. The image url is something like: http://www.sdveles.ru/c/34-category/RUSSIAN.jpg'>http://www.sdveles.ru/c/34-category/RUSSIAN.jpg And if I connect to the server via FileZilla, I can find a correct image at this location : /c/34-category/RUSSIAN.jpg .. I've seen that problem can appear after enabling Friendly URLs. In those cases people usually can't locate an image in the ftp-folder same as URL. So I think this is not my case... And I'm afraid of re-enabling Friendly URLs, because i think it may cause some harmfull actions to the store (please correct me if Im wrong)... So. Could you please advise me something of your huge experience, because I'm really out of ideas... PrestaShop 1.5.4 http://www.sdveles.ru Example with images not displaying: http://www.sdveles.ru/34-RUSSIAN Thanks in advance, Anton Link to comment Share on other sites More sharing options...
vekia Posted August 19, 2013 Share Posted August 19, 2013 everything is okay. path that you mentioned: http://www.sdveles.ru/c/34-category/RUSSIAN.jpg isnt "real" path to the file. It's virtual path created with prestashop feature "friendly url". category images you can find in the /img/ directory located in root dir of your prestashop store. And url above is a "virtual" redirection to the /img/ directory Link to comment Share on other sites More sharing options...
ifoxxy Posted August 20, 2013 Author Share Posted August 20, 2013 (edited) everything is okay. path that you mentioned: http://www.sdveles.r...ory/RUSSIAN.jpg isnt "real" path to the file. It's virtual path created with prestashop feature "friendly url". category images you can find in the /img/ directory located in root dir of your prestashop store. And url above is a "virtual" redirection to the /img/ directory Uhm.. Yes, I lied and you are right so the path to an image is like /c/34-category/RUSSIAN.jpg By the same time, at the FTP-server, the correct image is in the folder /http/img/c/34-category.jpg. Does it mean, that I should be able to access an image through the following url: sitename/img/c/34-category.jpg? UPDATED: Well, I tried to access an image through sitename/img/c/34-category.jpg and it was quite fine. May be there is something wrong with those friendly urls? Edited August 20, 2013 by ifoxxy (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted August 20, 2013 Share Posted August 20, 2013 mod rewrite (friendly urls) feature exist on your hosting account (your website works well) the problem is with .htaccess file, try to regenerate it Link to comment Share on other sites More sharing options...
ifoxxy Posted August 20, 2013 Author Share Posted August 20, 2013 mod rewrite (friendly urls) feature exist on your hosting account (your website works well) the problem is with .htaccess file, try to regenerate it I've Googled a bit about regenerating .htaccess file and found the following article: http://mypresta.eu/en/art/basic-tutorials/how-to-regenerate-htaccess-in-prestashop-1-5.html I used the last method: Regenerate in back office: Turning multistore on, and then turning multistore off Should it be enough? If so, It didn't affect anything... Link to comment Share on other sites More sharing options...
ifoxxy Posted August 20, 2013 Author Share Posted August 20, 2013 Well, I moved an .htaccess file from the root directory and saved settings in BO. After that new .htaccess file appeared, so i think I regenerated it successfully. But still no result any more suggestions please? Link to comment Share on other sites More sharing options...
vekia Posted August 20, 2013 Share Posted August 20, 2013 it's wierd that you've got RUSSIAN in the url, maybe it's issue related to the template? have you changed something related to the getimagelink() function? Link to comment Share on other sites More sharing options...
ifoxxy Posted August 20, 2013 Author Share Posted August 20, 2013 it's wierd that you've got RUSSIAN in the url, maybe it's issue related to the template? have you changed something related to the getimagelink() function? Thanks for a new idea.. As I understood "RUSSIAN" is a friendly url selected for the specific category.. Where can I find this getimageling() function to get sure that it is correct? Link to comment Share on other sites More sharing options...
ifoxxy Posted August 21, 2013 Author Share Posted August 21, 2013 it's wierd that you've got RUSSIAN in the url, maybe it's issue related to the template? have you changed something related to the getimagelink() function? I've found a getimagelink() function in Link.php: public function getImageLink($name, $ids, $type = null) { $not_default = false; // legacy mode or default image $theme = ((Shop::isFeatureActive() && file_exists(_PS_PROD_IMG_DIR_.$ids.($type ? '-'.$type : '').'-'.(int)Context::getContext()->shop->id_theme.'.jpg')) ? '-'.Context::getContext()->shop->id_theme : ''); if ((Configuration::get('PS_LEGACY_IMAGES') && (file_exists(_PS_PROD_IMG_DIR_.$ids.($type ? '-'.$type : '').$theme.'.jpg'))) || ($not_default = strpos($ids, 'default') !== false)) { if ($this->allow == 1 && !$not_default) $uri_path = __PS_BASE_URI__.$ids.($type ? '-'.$type : '').$theme.'/'.$name.'.jpg'; else $uri_path = _THEME_PROD_DIR_.$ids.($type ? '-'.$type : '').$theme.'.jpg'; } else { // if ids if of the form id_product-id_image, we want to extract the id_image part $split_ids = explode('-', $ids); $id_image = (isset($split_ids[1]) ? $split_ids[1] : $split_ids[0]); $theme = ((Shop::isFeatureActive() && file_exists(_PS_PROD_IMG_DIR_.Image::getImgFolderStatic($id_image).$id_image.($type ? '-'.$type : '').'-'.(int)Context::getContext()->shop->id_theme.'.jpg')) ? '-'.Context::getContext()->shop->id_theme : ''); if ($this->allow == 1) $uri_path = __PS_BASE_URI__.$id_image.($type ? '-'.$type : '').$theme.'/'.$name.'.jpg'; else $uri_path = _THEME_PROD_DIR_.Image::getImgFolderStatic($id_image).$id_image.($type ? '-'.$type : '').$theme.'.jpg'; } return $this->protocol_content.Tools::getMediaServer($uri_path).$uri_path; } Is it the same as default one? I couldn't find any examples... Link to comment Share on other sites More sharing options...
ifoxxy Posted August 22, 2013 Author Share Posted August 22, 2013 Guys? Link to comment Share on other sites More sharing options...
vekia Posted August 22, 2013 Share Posted August 22, 2013 it looks well, can you show how the function looks like in the .tpl files? Link to comment Share on other sites More sharing options...
ifoxxy Posted August 22, 2013 Author Share Posted August 22, 2013 it looks well, can you show how the function looks like in the .tpl files? I found this in Category.tpl: <img src="{$link->getCatImageLink($category->link_rewrite, $category->id_image, 'category')}" alt="{$category->name|escape:'htmlall':'UTF-8'}" title="{$category->name|escape:'htmlall':'UTF-8'}" id="categoryImage" width="{$categorySize.width}" height="{$categorySize.height}" /> And here is the function getCatImageLink() from Link.php public function getCatImageLink($name, $id_category, $type = null) { $uri_path = ($this->allow == 1) ? (__PS_BASE_URI__.'c/'.$id_category.($type ? '-'.$type : '').'/'.$name.'.jpg') : (_THEME_CAT_DIR_.$id_category.($type ? '-'.$type : '').'.jpg'); return $this->protocol_content.Tools::getMediaServer($uri_path).$uri_path; } It doesn't seem wrong... What should I be looking for? Link to comment Share on other sites More sharing options...
ifoxxy Posted August 27, 2013 Author Share Posted August 27, 2013 Well, I'm going to try turning friendly URLs off.. Will this affect site productivity? I have already tried to turn it off at a prestashop test BO site and have broken it Link to comment Share on other sites More sharing options...
ifoxxy Posted August 28, 2013 Author Share Posted August 28, 2013 Guys? Link to comment Share on other sites More sharing options...
ifoxxy Posted August 30, 2013 Author Share Posted August 30, 2013 After creating a site and db backup, I dared to turn friendly urls off. No images are shown correctly... What is wrong with this friendly urls?.. Link to comment Share on other sites More sharing options...
leonardo molano b. Posted August 30, 2013 Share Posted August 30, 2013 Hi i have the same problem, on my virtual shop www.decoracionparatusfiestas.com, what i do, was delete the file .htaccess, and do it again with the option seo, work, now i regenerate all images... Link to comment Share on other sites More sharing options...
vekia Posted August 31, 2013 Share Posted August 31, 2013 so you regenerated images and everything works for you now? i understood you well? Link to comment Share on other sites More sharing options...
Recommended Posts