Header Ad

Showing posts with label Manufacturers in Magento. Show all posts
Showing posts with label Manufacturers in Magento. Show all posts

Wednesday, April 21, 2010

Ability to retrieve products under a brand or manufacturer in MAGENTO

$brandId = "1"; //manufacturer id or brand id
$products = Mage::getModel('catalog/product')->getCollection();
$products->addAttributeToFilter('manufacturer', array('in' => array($brandId)));
$products->addAttributeToFilter('status', '1');
$products->addAttributeToSelect('*');
$products->load();

echo "
";
foreach($products as $product)
echo $product->getId()."
";

Thursday, April 1, 2010

Magento Vendor Notification

Hi,

This is one of the link which i came across in MAGENTO for vendor notification. This mighe be useful for somebody.

http://www.magentocommerce.com/extension/1193/vendor-notifications

Ability to get all the manufacurers or brands in Magento

We can use the following code to get the list of manufacturers in MAGENTO.

$product = Mage::getModel('catalog/product');

//Retriving the attribute values for the manufacturer id
$attributes = Mage::getResourceModel('eav/entity_attribute_collection')
->setEntityTypeFilter($product->getResource()->getTypeId())
->addFieldToFilter('attribute_code', 'manufacturer') // This can be changed to any attribute code
->load(false);

$attribute = $attributes->getFirstItem()->setEntity($product->getResource());

//This is an array of manufacturers
$manufacturers = $attribute->getSource()->getAllOptions(false);