0

I have this table in my Magento database:
'manthan_marketplace_vendorproduct':

    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:

app\design\frontend\base\default\template\marketplace\seller\profile.phtml

by this code:

$seller = $this->sellerProfile();
$seller['user_id']; 

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!

3
  • 1
    You need to get collection for your table using model. And then add filter on the collection to get Products of a seller. Commented Jun 15, 2017 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(); Commented Jun 15, 2017 at 9:06
  • did you get solution for your problem? Commented Jun 19, 2017 at 9:46

1 Answer 1

2

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
print_r($sellerData);

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.