Magento: Prevent products without images from showing - magento

We've just done a mass import. We have allot of products showing up without images and we need to prevent that. There not supposed to have images or show but we can't set them to "Not visible anywhere" in the CSV.
So if images = 0 don't show anywhere.
Any help is greatly appreciated. Thanks in advance.

You can modify the category collection so that it only loads Products that have images. If you use flat tables (recommended), it should not be very difficult to add a filter method to the collection Mage_Catalog_Model_Resource_Eav_Mysql4_Product_Collection.
A more dirty but easier way would be to just not display the products without images in the product listing template (app/design/frontend/templates/catalog/product/list.phtml). The image helper is used there to display the product images. Whenever the default image is about to be shown, you could continue to the next product. But remember, that the products without images are loaded anyway, which is really dirty.

Try putting "Not Visible Individually" in the "Visibility" column of your CSV whenever the "image" column is empty.

Related

Product image not displaying in category or search view

I have a test site where some imported product images are not being displayed on the category view or the search view.
It does however show up on the product page.
These products were imported / updated to reflect new images.
Category view
http://sales.magentocommerce.net.au/index.php/irrigation/driptube.html
Product view page
http://sales.magentocommerce.net.au/index.php/irrigation/driptube/221002-drip-eze-pc-13mm-2l-h-0-3m-50m.html
Other products whose images were uploaded manually is showing up.
All cache has been cleared and disabled in Magento.
What else am I missing.
I suspect the database records got screwed up somewhere on these products.
I am running out of ideas to what else to look out for and need a fresh pair of eyes.
Magento ver. 1.9.0.1
It sounds like you forgot to reindex your data.
Go to System -> Index Management, click select all (or at least select the first four indexes) and then press submit to reindex.
I note your image is almost 2MB. On my shared hosting with 1and1, I cannot use such large images as Magento's image processing (eg producing thumbnails) falls over as it runs out of memory. I therefore have to preprocess any large images to shrink them down to something my Magento can handle.
One other thing, png files tend to be significantly larger than jpg files.

Magento: how to display the correct images for configurable products in search results

I'm building configurable products on my Magento site (a simple way of showing each of our textiles with the swatches of the different colors of the same item under the main product image) and I have associated simple products for each individual color.
I don't seem to be able to obtain the desired behavior from the site and I'm writing to ask if you have a suggestion that might solve my problem.
At the moment I experience this behavior: when filtering products through color-level attributes I get both the simple and configurable products in my result set. Once I do that if I click on a simple product I find myself the simple product detail page, which doesn't show the box with the other color swatches.. while I would like every product detail page to show the other colors of the same item.
The intended usage is very basic really but I can't figure out if Magento can achieve that on its own or if it will require extra code; what I need is:
1) all product detail pages to show all the color swatches
2) the result list when filtering by the color attribute (for example "whites") should show the correct color images of the individual colors, without duplicates (and not the main image for that product, which would probably be in the wrong color)
Do you have a suggestion of maybe know of a plugin to achieve this?
Thanks a lot,
Sergio
Sergio,
There are two features in particular that might help you solve your problem.
First:
Click to expand the Shopping Cart section. Then, set Configurable Product Image to one
of the following:
l Product Thumbnail Itself
l Parent Product Thumbnail
Second:
To prevent the associated products from being listed individually in the catalog, set Visibility to “Not Visible Individually.” Or in your case, you may decide to do it the other way around.
Please be aware that I was not able to get this feature to work myself.

Product image is not showing up in poduct page where as showing list

Magento product images are showing in list or grid. when i click on the product, the product image is not displaying in the product page. Remaining things Add to cart, Add to compare, wishlist everything is working fine. I think the media.phtml is not loading, Please suggest me in right way.
Thanks in advance.
Firstly, you must confirm whether the media.phtml is loaded. You may insert some dummy characters in the media.phtml to see whether it will show in the frontend.
Thus, if the characters show, congratulations, you are just close to find the problem. In this situation, most problems are caused by image attributes not loading to the model object. Simply just reload the object with the following snippets:
$_product = Mage::getModel('catalog/product')->load($_product->getId());
Otherwise, you may confirm the following things:
Is the media.phtml is overload by the other theme?
Compare with the default catalog.xml with your current one, to find out the media.phtml is correctly loaded, including path, block type, name, as, etc.
Check the permission settings for the xml and template files
These are stuffs coming to my mind when reading your problems. Hope it helps.

Exclude main image from Magento product gallery

I need to update my database of products to mark the "base" image of every product as Excluded. Some products have 1 image, some have more than 1. In each case one image is marked as being the Base, Small and Thumb image. In every case, where an image is marked as such, I need it to be excluded from the gallery.
Currently, without it being excluded, that image will show up twice in the lightbox gallery (Magento 1.4.0.1).
Does someone know the database structure well enough to give me a mySQL solution to update this?
I can manage future new products easily enough, but there's no way I'm running through 22000 products manually! :-)
Thanks in advance!
The SQL to do this in Magento 1.4.0.1 is:
UPDATE `catalog_product_entity_media_gallery_value`
SET Disabled = 1
WHERE Position = 1
I agree that updating the gallery code would have been a good/better solution, but in my case I am easily able to keep on top of this as new products are added in future.
It is easier to update your gallery code to exclude the first image you also do not have an ongoing need to update the product images.

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