prestashop_newuser Posted March 5, 2014 Share Posted March 5, 2014 Hi, I want to know by which pattern prestashop shows the product default image? I mean lets say I have a mysql query for prestashop like this SELECT ps_product.id_product,ps_product.id_category_default,description_short,ps_product_lang.name FROM ps_product_lang,ps_product WHERE ps_product_lang.id_lang=1 AND ps_product.id_product=ps_product_lang.id_product Now here I will get the product id, product category, description, and name. Now according to prestashop default products and database I have for the product iPod Nano the database fields are like id_product id_category_default 1 3 Now if I want to get the product image I will use img/p/id_product/id_category_default/id_product.id_category_default This will make the img src like img/p/1/3/13.jpg Now when I used that I got the image for Belkin Leather Folio for iPod but with the same condition I got the exact image for ipod shuffle. So can someone kindly tell me how to get the exact default image for the product name? Any help and suggestions will be reallyu appreciable. Thanks Link to comment Share on other sites More sharing options...
prestashop_newuser Posted March 7, 2014 Author Share Posted March 7, 2014 Hi, I want to know by which pattern prestashop shows the product default image? I mean lets say I have a mysql query for prestashop like this SELECT ps_product.id_product,ps_product.id_category_default,description_short,ps_product_lang.name FROM ps_product_lang,ps_product WHERE ps_product_lang.id_lang=1 AND ps_product.id_product=ps_product_lang.id_product Now here I will get the product id, product category, description, and name. Now according to prestashop default products and database I have for the product iPod Nano the database fields are like id_product id_category_default 1 3 Now if I want to get the product image I will use img/p/id_product/id_category_default/id_product.id_category_default This will make the img src like img/p/1/3/13.jpg Now when I used that I got the image for Belkin Leather Folio for iPod but with the same condition I got the exact image for ipod shuffle. So can someone kindly tell me how to get the exact default image for the product name? Any help and suggestions will be reallyu appreciable. Thanks Any solution from experts? Link to comment Share on other sites More sharing options...
prestashop_newuser Posted March 11, 2014 Author Share Posted March 11, 2014 Any solution from experts? Is there anyone who can solve this issue? Link to comment Share on other sites More sharing options...
Eder Posted January 26, 2016 Share Posted January 26, 2016 I'm not sure if this can help, but you can try this: SELECT ps_product.id_product, ps_image.cover, ps_image.id_image FROM ps_image INNER JOIN ps_product ON ps_image.id_product = ps_product.id_product WHERE ps_image.cover = 1 And then http://yourshop/prestashop/{id_image}-cart_default/img.jpg cart_default can be replaced by any value of name in table ps_image_type. You can also check "public static function getCover" in classes/Product.php Hope it helps someone. Eder Link to comment Share on other sites More sharing options...
realmagic Posted March 20, 2016 Share Posted March 20, 2016 That can help: $id_image = Product::getCover($id_product); if ($id_image > 0) { $image = new Image($id_image['id_image']); $image_url = _THEME_PROD_DIR_.$image->getExistingImgPath().'.jpg'; } 1 Link to comment Share on other sites More sharing options...
Recommended Posts