Store images in prestashop from URL - image

I have a web service that is called to get products for a prestashop project. The web service is returning information about the product and also each product have a link representing the image of the product. I know that prestashop stores images into "img/p/id/picture.ext", but I want to find a solution to store that URL in the database and output everywhere in template files that picture. I want to know if there is a module for this, or how should I solve this the fastest way ? Thank you guys!

The easiest way would be to save the product image URL in an unused product field (e.g., Reference) and modify the src attribute of the product image img tag in product.tpl:
<img src="{$product->reference}">

Related

How to give product images external url in magento 1.9.0.1

I Need to use product images in external server in magento 1.9.0.1. how can i give external image url to the product. Please help me.
This is what I've done in the meantime:
Edit app/design/frontend/base/default/template/catalog/product/list.phtml In the file you'll find two instances of img src, for each of those two src attributes I changed the value to:
src="<?php echo $_product->getSmallImage() ?>"
Edit app/design/frontend/base/default/template/catalog/product/view/media.phtml Search for id="image" changed the src attribute to be:
src="'.$_product->getImage().'"
In my product CSV, I'm loading the image and small_image values accordingly (as being the entire url including protocol and host etc).
There are undoubtedly other places where this similar changes should be made (such as wishlist pages), but at the moment, that gets the proper images showing in the grid data and product details view which is good enough for me for now.

Add an image attribute to a Magento product

Suppose I have a clothes e-commerce and I have a Clothes attribute set with clothing_size. The e-commerce manager wants to be able to attach an image to the product that will display some laundry instructions.
I thought I could accomplish that by creating an attribute typed 'Image Media' and add it to the Clothes attribute set.
I set it as:
Code: launtry_instructions_image
Scope: Global
Entry type: Media Image
Apply to: [Simple Product, Configurable Product]
I hoped that would give the store manager a file input so he could upload an image, but I was wrong. Nothing changed.
Am I missing something or there's no simple way of accomplishing that?
Thnak you in advance.
Edit
As #marius pointed out this input will be placed in the Images tab.
I was able to get the image by
$this->helper('catalog/image')->init($product, 'laundry_instructions_image');
Thanks!
The new image attribute should appear as a column inside the Images tab.

Path of image code in magento

I am using magento 1.6.I want to know which files contains the code for image functions like when you uploading the image ,excluding the image etc.Actually i want to hide products as per user category.
There are several files handling your images. Look at app/code/core/Mage/Catalog/Helper/Image.php as an entry point.

Allowing For Multiple Images in Product Gallery for One Attribute

If you edit a product and browse to the media gallery, you will notice that each type of image (Base, small, thumbnail) is a radio button. Furthermore, if you create your own product attribute and assign it to the product, it too is a radio button.
The intended functionality I would like is to upload many images and assign it to that attribute. I am creating a gallery on product view pages, and each product has an arbitrary amount of images.
I would like to know if there is an easy way to do it, and if not, what the best solution would be. I am running Magento 1.6.0 for this project.
If you upload images and do not assign them as base/small/thumb, then Magento will automatically create an image gallery for you on the product page. you could also extend the catalog/product/list.phtml to display a gallery on the category and search results listing if you wanted.
So, AFAIK, there's no need for you to change the application functionality in the way that you describe.

use the category default image as products default image

In magento you can set an image to a category which is shown above products.
Is it possible to use the category image as the default product image instead?
If a product has an image it'll use it but if it doesn't and its first category has an image it will use it.
The simplest way is to override the product block and template and to find the category and image for each product without an image but that will add many queries. For category view I can make one query but for search result I'll have to make one query per product because each product can be from a different category.
Is there a better way to do it?
Maybe with custom category design or overriding indexes?
Thanks
The helper usually used to generate those images (Mage_Catalog_Helper_Image) has a method placeholder($filename) that should set the placeholder image URL. You should be able to set that image before displaying the category products to use the category image as the placeholder image.
Hope that helps!
Thanks,
Joe
To complete Joseph and Pablo answer, on Magento 1.9.1, it is used in the __toString() method of the helper.
Note that when calling $this->helper('catalog/image')->placeholder($placeholder), $placeholder is a relative file path in the skin directory, so it can barely be used for your problem (mine neither, I'll do with your solution :) )

Resources