Find Unused Product Attributes
Just to keep things tidy!
SELECT attribute_id, attribute_code, frontend_label
FROM eav_attribute
WHERE entity_type_id = 4
AND attribute_id NOT IN(SELECT attribute_id FROM eav_entity_attribute);
Related cards:
Removing Custom Attributes Across Multiple Products
If you have custom attributes named the same across multiple products, you
wish to remove said attributes, this might come in useful. The SQL below restricts
the removal of the attributes to a certain attribute set name, but you can remove
this is...
Product EAV Attribute Set, Group and Attribute List
To see a list of all attribute sets, groups, and associated attributes for products, use this SQL. BONUS! Also shows the sort ordering, useful for determining which sort_order
you need to place an attribute in a certain position:
SELECT...
Product Attribute Addition
This code shows all possible configuration options for an attribute that I know of, you need not include all of these when adding an attribute (although it won't hurt)
$installer = Mage::getResourceModel('catalog/setup', 'catalog_setup');
...
Dataflow Per-Store Import Causing Copy of All Attributes
Fancy importing a subset of some product attributes on a per-store basis, whilst keeping the attributes that weren't imported using the defaults?
Tough, you can't!
Well, not with dataflow anyway. [This card](https://makandracards.com/magento...
In Stock Product Collection
This snippet provides a collection of in-stock products, or products which do not have stock management enabled on them
$productCollection = Mage::getResourceModel('catalog/product_collection');
Mage::getSingleton('cataloginventory/stock'...
Product Types
Type | Composite[^1] | Inventory[^2] | Description | Example |
---|---|---|---|---|
Simple | - | Yes | The most basic form of product | Example |
Grouped | Yes | No | Several simple products displ... |
Getting A Products URL
Potentially confusing due to the 3 methods you could use, all of which are in Mage_Catalog_Model_Product
:
public function getUrlPath($category=null)
public function getUrlInStore($params = array())
public function getProductUrl($use...
Adding Attribute To Category List Product Collection
Only a core set of attributes are added to the product collection (for the list page) by default. This bit of XML will allow you to add additional attributes to that collection:
<config>
<frontend>
<product>
...
Import Resetting visibility and stock attributes
If you are updating an existing product you need to include the stock and visibility attributes, otherwise the stock for the product will get set to 0 and out of stock, and the visibility will be reset to Catalog, Search.
![](http://mikewhitby.co...
Product Price Index
The Display Out Of Stock Configuration Option
is implemented by this index. If you have chosen not to display out of stock products,
then the effect is that a prod...