1

I need some experience-based advice please. Using Magento CE 1.7.0.2.

I'm writing a custom extension to store featured products. I need to be able to create simple lists, store them in the database and then assign products to each list. I need to know the following:

  1. Do I need to create a custom table to hook into or should/could I use an existing table?
  2. If the above answer is 'yes', which one(s)?

Any other helpful advice would be gratefully received. Thanks.

0

1 Answer 1

1

If you don't need any additional info for each list (just a title) then I recommend you not to use lists. You can generate these lists based on an attribute.
Let's say the attribute is called 'custom_attribute', you can get the list products like this:

$collection = Mage::getModel('product/collection')->addAttributeToFilter('custom_attribute', VALUE_HERE);
Mage::getSingleton('catalog/product_status')->addVisibleFilterToCollection($collection);
Mage::getSingleton('catalog/product_visibility')->addVisibleInCatalogFilterToCollection($collection);

If you want to be able to put a product in more than one list you need to create a custom entity in a 'many to many' relation with the products.
I may recommend you this extension that will allow you to build such an entity and relate it to the products. It will build your table and code needed to do this. You may need to change the design a little. (I hope the link is not considered as self promotion).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.