Reputation: 550
When I create categories in Magento, I currently add all the products manually.
Problem is that we are getting more and more products and that some of our products change quite often.
So is it possible to dynamically change the category products depending on the product attributes?
i.e. to create categories that each contain all the products with a specific attribute value.
For example the category "blue", dynamically containing all the products where the attribute "color" is set to "blue".
Thanks.
Upvotes: 0
Views: 337
Reputation: 443
See www.proxiblue.com.au, there is a module that does exactly this.
Products can Be Assigned to categories, using any attribute combination.
Disclaimer: this is my site and module.
Upvotes: 0
Reputation: 5660
$collection = Mage::getModel('catalog/product')->getCollection()->addAttributeToFilter('color', 'blue');
$_category = Mage::getModel('catalog/category')->loadByAttribute('name', 'blue');
foreach ($collection as $_item){
$_item->setCategoryIds(array($_category->getId()));
$_item->save();
}
Its just a stupid dummy you may need another foreach loop for all colors....but it shows what needs to be done...
Upvotes: 0
Reputation: 2174
Why are you doing data entry Manually?.
Magento has an inbuilt stable product import export system.Did you try this?
If this import export system does not solve your purpose then you will have to write a script and run it via cron once every day.
Upvotes: 0