I am trying to get current seller id by product id in magento 2. I am try this also but its not useful for me.
public function getMy(){
if(Mage::getSingleton('customer/session')->isLoggedIn()) {
$customerData = Mage::getSingleton('customer/session')->getCustomer();
$seller_id= $customerData->getId();
}
$collection = Mage::getResourceModel('catalog/product_collection');
$collection->addAttributeToFilter('status',1); //only enabled product
$collection->addAttributeToSelect('*'); //add product attribute to be fetched
$collection->getSelect()->order('rand()');
$collection->getSelect()->limit(5);
$collection->addAttributeToFilter($seller_id);
$collection->addStoreFilter();
return $collection;
}
I also try this
$collection = $objectManager->create(
'Webkul\Marketplace\Model\Product'
)
->getCollection()
->addFieldToFilter(
'mageproduct_id',
$id
);
Please help me..