To bulk update magento product images to be excluded or non-excluded you can run this SQL update command:
UPDATE catalog_product_entity_media_gallery_value SET disabled = 0
0 = Not excluded
1 = Excluded
Did this post help you?
I recently had to create a collection of special offer products to list on the clients homepage. There’s a few different attributes that we need to filter to get the proper results.
1. The products visibility must NOT be set to 1. This means that the product is going to be visible individually. If we tried to link to a product that was not visible individually we might get a 404 or even worse, the mage error screen! See this post for a list of visibility options ->addAttributeToFilter(‘visibility’, array(‘neq’=>1)) View full article »
I recently searched high and low for product visibility options constants or just their IDs. It actually took me a surprisingly long time. Anyway I’m going to put them here so I don’t forget them again!
VISIBILITY_BOTH = 4
VISIBILITY_IN_CATALOG = 2
VISIBILITY_IN_SEARCH = 3
VISIBILITY_NOT_VISIBLE = 1
I was looking around for a quick solution to remove the top links block at the top of the Magento theme. All the solutions I found had me removing each link individually, and they actually didn’t work. So thinking there must be a better way I wrote a little XML to remove the entire top links block in one go. I use a local.xml file for layout XML modifications. If you don’t know why to use this check this blog post by Classy Llama. View full article »
There are 2 ways (that I know of) to get rid of the ‘Search Options’ left nav on the search results page. The first is a bit of a lazy trick and the second is I guess the proper way:
1. Go to System > Configuration > Catalog and find the ‘Catalog Search’ dropdown tab. Inside there is a text fields labelled ‘Apply Layered Navigation if Search Results are Less Than’. By setting this to -1 it sorta bypasses the proper use. If we set it to 0 then it’ll show for all, if we set it to 1 it still shows when 1 item is listed but setting it to -1 seems to work fine.
2. Go to Catalog -> Attributes -> Manage Attributes and select the attributes that appear in the ‘Search Options’, and select “NO” from “Use In Layered Navigation” drop down.
I had a client this week who asked to have the number of product to be backordered added to the default new order email template. This is one of the things you would think Magento does by default since it is displayed in the cart but it doesn’t. The file that controls the new order email is a template that calls a .phtml file to loop over the order. It is in that file where we are going to add our own code. Remember to copy this file (and structure) into your own template to avoid chaos the next time you upgrade! View full article »
There a couple of modules out there for restricting access to your catalog for logged in users only but I find it easier to add a couple of lines of code to get the job done. It involves using the customer helper to check if the user is logged in. I think what the helper method does is check for a user session ID and returns true or false depending on if it exists. What I’ve done here is add a little extra bit to check if the user is logged in AND it is a specific category because maybe we want restrict some products to only be viewed if the user is online.
If the user is NOT logged in and the category has the ID of 12 then set an error message and redirect them back to the homepage.
To use this add this code to the top of catalog/category/view.phtml
<?php
$_category = Mage::registry('current_category');
$id = $_category->getId();
if(!$this->helper('customer')->isLoggedIn() && $id == 5):
$message = $this->__('You need to be a logged-in member to access our catalog');
Mage::getSingleton('core/session')->addError($message);
Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('', $arguments= array()));
endif;
?>
All new attributes whether it’s a product attribute, or you’ve managed to create a new category attribute are stored in the same place thanks to Magento’s use of EAV structuring. The “eav_attribute” table stores some of the attribute data of which includes the frontend_label. Simply find your attribute in this table and change it’s label using your favourite DB software.
Alternatively use this SQL if you know the attribute_code:
UPDATE 'eav_attribute' SET 'frontend_label'='New label text' WHERE 'attribute_code'='the_attribute_code' LIMIT 1;
I recently got myself an Airport Express so I could stream my audio wirelessly to my speakers. If you didn’t know, Apple’s Airport Express is a little device that plugs into a standard wall socket. Connect it to your network (wirelessly), then plug in your speaker’s 3.5mm audio jack into it and whatever audio is streamed to it comes out your speakers. Simples.
Although the device was a breeze to install I was a little disappointed at first. Because it turns out only sound played via iTunes could be streamed. Now this is my fault because Apple actually state very clearly on the products page that you can
“Play iTunes music through your stereo or powered speakers using AirPlay”
However my sadness was short-lived after I stumbled upon Airfoil. This application literally hijacks your audio and sends it to an airport extreme, apple TV, or third-party device. At a mere £18 (at the time) I was able to stream audio from Spotify, BBC iPlayer, 4OD, Hulu, etc, etc. I can hear no sound degradation and the Airflow video player corrects the ~2 second delay in sound when playing videos. It really is an incredible piece of software and one I would much recommend to anyone thinking about buying an Airport Express.
If you use a CMS page but load a block to use instead of content you have to at least put a no break space in the content field. The problem with this is it adds this to the page:
<div class="std"> </div>
You can remove this from the page using a simple piece of jQuery:
$('div.std').each(function(i) {
if ($(this).html()===' ') {
$(this).remove();
}
});
This searches the page for any divs with a class of std. It checks to see if it’s contents is only a space, if so it removes the div element.