Tufanayd Posted August 9, 2013 Share Posted August 9, 2013 Hi, I am not very good at PHP however I am trying to edit a php function for Magento. $categoryID = $this->getCategoryId(); //the value is like 7,3,6,9 $cats = explode(',', $categoryID); $collection = Mage::getModel('catalog/product') ->getCollection() ->joinField('category_id', 'catalog/category_product', 'category_id', 'product_id = entity_id', null, 'left') ->addAttributeToSelect('*') ->addAttributeToFilter('category_id', array( array('finset' => '7'), array('finset' => '3'), array('finset' => '6'), array('finset' => '9') ) ); I want to generate the below part automatically based on the value(s) of $cats array('finset' => '7'),array('finset' => '3'), array('finset' => '6'), array('finset' => '9') How can I do it, urgent help will be extremely appreciated. Thanks in advance Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.