vynx Posted October 12, 2012 Share Posted October 12, 2012 Dear, anyone know how to get product image url in Prestashop 1.5.1 ? since i think its change than previous version. appreciate for any comment Link to comment Share on other sites More sharing options...
vekia Posted October 12, 2012 Share Posted October 12, 2012 Dear, anyone know how to get product image url in Prestashop 1.5.1 ? since i think its change than previous version. appreciate for any comment <img src="{$link->getImageLink($product.link_rewrite, $product.id_image, 'home_default')}" height="{$homeSize.height}" width="{$homeSize.width}" alt="{$product.name|escape:html:'UTF-8'}" /> Link to comment Share on other sites More sharing options...
vynx Posted October 12, 2012 Author Share Posted October 12, 2012 i try that code but the result is : http://www.domain.com/-home_default/.jpg Link to comment Share on other sites More sharing options...
vekia Posted October 12, 2012 Share Posted October 12, 2012 i try that code but the result is : http://www.domain.co...me_default/.jpg Maybe variables aren't defined properly? or are you sure that you give correct variables to getImageLink function ? try to {$product|print_r} and check variables Link to comment Share on other sites More sharing options...
vynx Posted October 12, 2012 Author Share Posted October 12, 2012 how to define variable properly? Link to comment Share on other sites More sharing options...
vekia Posted October 12, 2012 Share Posted October 12, 2012 how to define variable properly? Could you give module code? both template and php code with product parameters? Link to comment Share on other sites More sharing options...
vynx Posted October 12, 2012 Author Share Posted October 12, 2012 here is some code: module code : $product = new Product((int)Tools::getValue('id_product')); $images = Image::getImages((int)$id_lang, (int)$product->id); $this->context->smarty->assign('id_image', (int)$images[0]['id_image']); $this->context->smarty->assign('product_r', $product->link_rewrite[1]); template : {$link->getImageLink( $product_r, $id_image, 'large_default') Link to comment Share on other sites More sharing options...
vekia Posted October 12, 2012 Share Posted October 12, 2012 $product = new Product((int)Tools::getValue('id_product')); $images = Image::getImages((int)$id_lang, (int)$product->id); $this->context->smarty->assign('id_image', (int)$images[0]['id_image']); $this->context->smarty->assign('product_r', $product->link_rewrite[1]); template : {$link->getImageLink( $product_r, $id_image, 'large_default') what exactly is in $product array? // {$product|print_r} maybe try to pass to tpl $product variable with $product array php: $this->context->smarty->assign('product', $product); tpl: $link->getImageLink( $product.link_rewrite, $product.id_image, 'home_default') $_link->getImageLink( $product.link_rewrite, $product.id_image, 'large_default') Link to comment Share on other sites More sharing options...
vynx Posted October 12, 2012 Author Share Posted October 12, 2012 what exactly is in $product array? // {$product|print_r} maybe try to pass to tpl $product variable with $product array php: $this->context->smarty->assign('product', $product); tpl: $link->getImageLink( $product.link_rewrite, $product.id_image, 'home_default') $_link->getImageLink( $product.link_rewrite, $product.id_image, 'large_default') when i try {$product|print_r} the content is product object ( a lot of content so i can't paste here) Link to comment Share on other sites More sharing options...
vynx Posted October 12, 2012 Author Share Posted October 12, 2012 the result after i change this is server error ..... Link to comment Share on other sites More sharing options...
vekia Posted October 12, 2012 Share Posted October 12, 2012 the result after i change this is server error ..... i've sent you pm Link to comment Share on other sites More sharing options...
vynx Posted October 12, 2012 Author Share Posted October 12, 2012 (edited) ok i will PM you Edited October 12, 2012 by vynx (see edit history) Link to comment Share on other sites More sharing options...
vynx Posted October 13, 2012 Author Share Posted October 13, 2012 i found the workaround : php: $images = Image::getImages((int)$id_lang, (int)$product->id); $id_image = Product::getCover($product->id); // get Image by id if (sizeof($id_image) > 0) { $image = new Image($id_image['id_image']); // get image full URL $image_url = _PS_BASE_URL_._THEME_PROD_DIR_.$image->getExistingImgPath().".jpg"; } $this->context->smarty->assign('image_url', $image_url); tpl: {$image_url} 3 Link to comment Share on other sites More sharing options...
Jorge Vargas Posted October 13, 2012 Share Posted October 13, 2012 (edited) ok, this on line 32 and 50 in header.tpl of AddShoppers module. I tried it and it works. Edited October 13, 2012 by Jorge Vargas (see edit history) Link to comment Share on other sites More sharing options...
vynx Posted October 14, 2012 Author Share Posted October 14, 2012 also add this in tpl : <html xmlns:fb="http://ogp.me/ns/fb#"> Link to comment Share on other sites More sharing options...
Yurik Posted November 30, 2012 Share Posted November 30, 2012 Hi! I'm new here. How can I get a product image url? I tried your code but it doesn't work for me. Could you give me complete php code that will display product image url for my product_id = 2 ? Link to comment Share on other sites More sharing options...
kelvz Posted December 7, 2012 Share Posted December 7, 2012 hey i found this to other forum... $id_image = Product::getCover($id_product); // get Image by id if (sizeof($id_image) > 0) { $image = new Image($id_image['id_image']); // get image full URL $image_url = _PS_BASE_URL_._THEME_PROD_DIR_.$image->getExistingImgPath().".jpg"; } 1 Link to comment Share on other sites More sharing options...
prestaslo Posted December 20, 2012 Share Posted December 20, 2012 when I want to import products from my CSV file all is OK, but pictures is not shown in store in backoffice. Pictures are from my supplier website directly in format http://mysupplier.co...ctures/ipad.jpg is this ok or must be first uploaded to my server? Link to comment Share on other sites More sharing options...
wadhera69 Posted January 17, 2013 Share Posted January 17, 2013 when I want to import products from my CSV file all is OK, but pictures is not shown in store in backoffice. Pictures are from my supplier website directly in format http://mysupplier.co...ctures/ipad.jpg is this ok or must be first uploaded to my server? i am finding problem similar like yours. Any one help it out please... Link to comment Share on other sites More sharing options...
wadhera69 Posted January 17, 2013 Share Posted January 17, 2013 hey i found this to other forum... $id_image = Product::getCover($id_product); // get Image by id if (sizeof($id_image) > 0) { $image = new Image($id_image['id_image']); // get image full URL $image_url = _PS_BASE_URL_._THEME_PROD_DIR_.$image->getExistingImgPath().".jpg"; } Where to get the code and paste these one. Thanks Link to comment Share on other sites More sharing options...
SmartDataSoft Posted January 18, 2013 Share Posted January 18, 2013 i found the workaround : php: $images = Image::getImages((int)$id_lang, (int)$product->id); $id_image = Product::getCover($product->id); // get Image by id if (sizeof($id_image) > 0) { $image = new Image($id_image['id_image']); // get image full URL $image_url = _PS_BASE_URL_._THEME_PROD_DIR_.$image->getExistingImgPath().".jpg"; } $this->context->smarty->assign('image_url', $image_url); tpl: {$image_url} i found the workaround : php: $images = Image::getImages((int)$id_lang, (int)$product->id); $id_image = Product::getCover($product->id); // get Image by id if (sizeof($id_image) > 0) { $image = new Image($id_image['id_image']); // get image full URL $image_url = _PS_BASE_URL_._THEME_PROD_DIR_.$image->getExistingImgPath().".jpg"; } $this->context->smarty->assign('image_url', $image_url); tpl: {$image_url} Link to comment Share on other sites More sharing options...
wadhera69 Posted January 18, 2013 Share Posted January 18, 2013 Which FIle it has to be put in... PHP and tpl.. Can u tell me the file name, Thanks Link to comment Share on other sites More sharing options...
SmartDataSoft Posted January 18, 2013 Share Posted January 18, 2013 Which FIle it has to be put in... PHP and tpl.. Can u tell me the file name, Thanks in php but i can solved that Link to comment Share on other sites More sharing options...
SmartDataSoft Posted January 18, 2013 Share Posted January 18, 2013 in php but i can solved that i solve this by add the image name $image_url = _PS_BASE_URL_._THEME_PROD_DIR_.$image->getExistingImgPath()."-small_default".".jpg"; Link to comment Share on other sites More sharing options...
wadhera69 Posted January 18, 2013 Share Posted January 18, 2013 i solve this by add the image name $image_url = _PS_BASE_URL_._THEME_PROD_DIR_.$image->getExistingImgPath()."-small_default".".jpg"; Where to put this code on what file. Can u tell me the file name. U mean image.php or product.php file or what. Do reply. Thanks Link to comment Share on other sites More sharing options...
SmartDataSoft Posted January 18, 2013 Share Posted January 18, 2013 Where to put this code on what file. Can u tell me the file name. U mean image.php or product.php file or what. Do reply. Thanks i put that i search controller as we need some advanced function Link to comment Share on other sites More sharing options...
wadhera69 Posted January 18, 2013 Share Posted January 18, 2013 i put that i search controller as we need some advanced function U mean search.php.. I donot understand how u post it in what file name. Can u show me step by step... Thanks Link to comment Share on other sites More sharing options...
kundan1947 Posted January 28, 2015 Share Posted January 28, 2015 Hey I want to do there any option in admin panel to add image for bulk uploading, like for CSV file have to enter the image url. But where to add those bulk images???, I don't want to add these images in Cpanel, because the uploading team don't know about the file and if any thing gone wrong my site down. If there is any module which give me option like upload the CSV file with images, or any module with bulk image uploading in admin panel??? 1 Link to comment Share on other sites More sharing options...
alexiscruz007 Posted February 8, 2015 Share Posted February 8, 2015 I need the same. Link to comment Share on other sites More sharing options...
An'im Fahmy Posted September 18, 2015 Share Posted September 18, 2015 i solve this by add the image name $image_url = _PS_BASE_URL_._THEME_PROD_DIR_.$image->getExistingImgPath()."-small_default".".jpg"; How to use this code for my own php? what must I include? Thankyou Link to comment Share on other sites More sharing options...
ietax Posted November 7, 2015 Share Posted November 7, 2015 sorry in 1.5.6.2 i use this code section for mailalerts.php $image_url = ''; $image = Product::getCover((int)$product['id_product']); if (sizeof($image) > 0) { $link_rewrite = ''; $id_image = $product['id_product'].'-'.$image['id_image']; $image_url = __PS_BASE_URI__."img/p/{$id_image}-small_default.jpg"; $image_url = $context->link->getMediaLink($image_url); } Now, i use 1.6.1.2 but on mail I have no image. The format is like old version image ....img/p/1111-11111-small_default.jpg but now i Use new format image like ...img/p/5/0/7/507.jpg how can I change code for new image type, thanks. Link to comment Share on other sites More sharing options...
LazyCircles Posted May 10, 2016 Share Posted May 10, 2016 sorry in 1.5.6.2 i use this code section for mailalerts.php $image_url = ''; $image = Product::getCover((int)$product['id_product']); if (sizeof($image) > 0) { $link_rewrite = ''; $id_image = $product['id_product'].'-'.$image['id_image']; $image_url = __PS_BASE_URI__."img/p/{$id_image}-small_default.jpg"; $image_url = $context->link->getMediaLink($image_url); } Now, i use 1.6.1.2 but on mail I have no image. The format is like old version image ....img/p/1111-11111-small_default.jpg but now i Use new format image like ...img/p/5/0/7/507.jpg how can I change code for new image type, thanks. Did you find a solution? Im stuck trying to get the rest of the URL, only getting this "http://quartoscoimbra.pt/img/p/" Link to comment Share on other sites More sharing options...
M4rVe Posted October 6, 2016 Share Posted October 6, 2016 Se pudo lograr esto?, la verdad tengo muchas imagenes que no quisiera comprometer la banda ancha, existe algun addons de paga? gracias Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now