Important
- For the pre-sale question, please feel free to contact us via live chat on Landofcoder.com ( From Monday to Friday 8:30 am - 5:30 pm GMT+7 ) or leave an offline message, we will give you a response asap.
- For technical questions, please submit a ticket below (recommended option) or send us an email via [email protected]. Our dev will support you within 24 hours since the submitted time (DO NOT support free extensions)
Hello Team,
I will be able to get the seller data by using this code:
$objectManager->create ( 'Lof\MarketPlace\Model\ResourceModel\Seller\Collection' )->load();
But How can I apply filter with LIKE operator in this query. (addStoreFilter and addStoreFilter are not working in the LIKE case). Please let me know how to apply LIKE and OR operators here.
Eg:
this code returns empty array but there is entry in back end
$seller = $objectManager->create ( 'Lof\MarketPlace\Model\ResourceModel\Seller\Collection' )
->addFilter('name', ['like' => '%hari%'])
->load();
$aData = $seller->getData();
Thanks,
Hi
Please use
Thanks
Hi Guys,
I'm getting this error "Call to undefined method Lof\MarketPlace\Model\ResourceModel\Seller\Collection::addAttributeToFilter()" when using your solution.
Note : we are using your latest version.
Kindly give us the solution.
Thanks
Hi
Please try
$objectManager = \Magento\Framework\App\ObjectManager::getInstance ();
$seller = $objectManager->create ( 'Lof\MarketPlace\Model\ResourceModel\Seller\Collection' )->load();
$needle = 'hari';
$seller->getSelect()->where('name LIKE "%' . addslashes($needle) . '%"');
echo '<pre>';
print_r(($seller->getData()));
echo '</pre>';
die('test');
That works. Many Thanks :)