I have this table in my Magento database:

    entity_id  product_id  user_id
       3          35          2 
       4          36          2

It shows all the products that have been added by each user(seller)
I can access the user_id value in my phtml file in this directory:


by this code:

$seller = $this->sellerProfile();

but $seller which is an array of objects, doesn't have any product_id. So I should use that table to get all product_id into an array
but the Magento framework is unknown for me.

Help me please, thanks!

  • 1
    You need to get collection for your table using model. And then add filter on the collection to get Products of a seller. Jun 15 '17 at 7:58
  • thanks with your guidance i found that I have model with 'vendorproduct.php' name and with this code I can access to values: $seller = Mage::getModel('marketplace/vendorproduct')->getCollection(); $seller->getData();
    – Mohsen
    Jun 15 '17 at 9:06
  • did you get solution for your problem? Jun 19 '17 at 9:46

Try below code to get product IDs for a seller.

$sellerData = Mage::getModel('marketplace/vendorproduct')->getCollection()‌​
->addFieldToFilter('user_id',$seller['user_id']) // Filter using seller Id
->getColumnValues('product_id'); // Get Only Product IDs

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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