JK11 Posted July 3, 2014 Share Posted July 3, 2014 Hi all, I use: PrestaShop™ 1.5.6.0 I have problem with my XML import: Fatal error: Class 'Image' not found in /www/path/import.php on line 212 line 212: $productHasImages = (bool)Image::getImages(1, (int)($product_id)); This import work fine on this server: http://fitness-sport.sk/info.php But problem is with this server: http://hiphop-oblecenie.sk/info.php Image classes are the same in the prestashop /classes Any idea? Thanks for any help. Link to comment Share on other sites More sharing options...
vekia Posted July 3, 2014 Share Posted July 3, 2014 what is import.php file? it's not default prestashop file Link to comment Share on other sites More sharing options...
JK11 Posted July 3, 2014 Author Share Posted July 3, 2014 No. It's my own import file. Link to comment Share on other sites More sharing options...
vekia Posted July 3, 2014 Share Posted July 3, 2014 so you use there code that doesn't work, as long as we will not know the sources - it will be impossible to help Link to comment Share on other sites More sharing options...
JK11 Posted July 3, 2014 Author Share Posted July 3, 2014 Yes, but this code work well on the other server. Here is the code: Function: function addImages($images,$product_id,$product_name=""){ - $images - array of images urls echo "adding "; $image_ids=array(); foreach($images as $url){ $productHasImages = (bool)Image::getImages(1, (int)($product_id)); - on this line is the problem $image = new Image(); $image->id_product = (int)($product_id); $image->position = Image::getHighestPosition($product_id) + 1; $image->cover = (!$productHasImages) ? true : false; $image->legend = createMultiLangField($product_name); $image->add(); if(!cpimage($product_id,$image->id,"tmp_img.jpg",$image->cover,$image->position)) echo "FAILED COPY<br>"; $image->associateTo(1); echo "image added"; $image_ids[]=$image->id; } return $image_ids[0]; } Is this enough information for you? Do you want whole file? Thanks for your help. Link to comment Share on other sites More sharing options...
vekia Posted July 4, 2014 Share Posted July 4, 2014 where are all necessary files? it's important to include them to your file without prestashop libraries simple .php file will not work well. Link to comment Share on other sites More sharing options...
JK11 Posted July 6, 2014 Author Share Posted July 6, 2014 Thanks for reply. I think, that import file is flawless, because the same file works very well on the other website, where PrestaShop™ 1.5.6.0 is running too. In my opinion the problem can be only on server side (but the web provider told me, that everything is setup correctly, the problem must be on the application side) or application side. I have compared prestashop classes in /classes folder, but classes are same like on the website, where import works well. Do you know, where could be the problem? Really thank you for your time. Link to comment Share on other sites More sharing options...
El Patron Posted July 6, 2014 Share Posted July 6, 2014 do you have this statement at the top of your file? include(_PS_ADMIN_DIR_.'/../config/config.inc.php'); Link to comment Share on other sites More sharing options...
JK11 Posted July 6, 2014 Author Share Posted July 6, 2014 Thank you for your time. I solved the problem by deleting all cache files. 1 Link to comment Share on other sites More sharing options...
Recommended Posts