Here I want to display only those data who has emailstatus=1 from my custom table. Here I have xml code. filepath : app/code/chirag/stockproduct/view/adminhtml/layout/stockproduct_index_newlist.xml
< ?xml version="1.0"?>
Out of Stock Product Notifier : Display New List
- spinner_columns
-
-
- add
- Add New Post
- primary
- */*/new
id
ChiragStockproductModelResourceModelTestNewlistcollection
id
DESC
1
- 1
ID
id
text
col-id
col-id
ProductId
productid
text
col-id
col-id
Product Name
productname
text
col-id
col-id
Emailid
emailid
text
col-id
col-id
Emailstatus
emailstatus
text
col-id
col-id
Created at
created_at
datetime
col-id
col-id
Sent date
sentdate
datetime
col-id
col-id
Filepath : ChiragStockproductModelResourceModelTestNewlistcollection.php
< ?php
namespace ChiragStockproductModelResourceModelTest;
class Newlistcollection extends MagentoFrameworkModelResourceModelDbCollectionAbstractCollection
{
/**
* Define model & resource model
*/
protected function _construct()
{
$this->_init(
'ChiragStockproductModelTest',
'ChiragStockproductModelResourceModelTest'
);
/*public function update($argument)
{
$argument->addFieldToFilter('emailstatus',array('eq' => '1'));
return $argument;
}*/
}
}
?>
This code give this result :
I want to display data with condition (emailstatus == 1) from my custom table. Here all data display and total row is 15. But there are 3 rows which has emailstatus =0. So I want to display 12 rows instead of 15. All 3 rows not display which has emailstatus=0.
If you want to more code, inform me. I will put it. Thanks in advance…