Skip to content

Commit 0146900

Browse files
authored
Merge pull request #38 from landofcoder/fix-admin-issue
update files
2 parents fa110c0 + f83075f commit 0146900

File tree

3 files changed

+32
-3
lines changed

3 files changed

+32
-3
lines changed

Api/TagRepositoryInterface.php

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,4 +62,11 @@ public function delete($tagId);
6262
* @throws \Magento\Framework\Exception\LocalizedException
6363
*/
6464
public function deleteById($tagId);
65+
/**
66+
* Retrieve Tag
67+
* @param string $tagId
68+
* @return \Lof\ProductTags\Api\Data\TagInterface
69+
* @throws \Magento\Framework\Exception\LocalizedException
70+
*/
71+
public function getListTag($tagId);
6572
}

Model/Data/Tag.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ public function setTagDescription($tagDescription){
115115
* @return int|null
116116
*/
117117
public function getStoreId(){
118-
return $this->_get("store_id");
118+
return $this->_get(self::STORE_ID);
119119
}
120120
/**
121121
* Set storeId
@@ -124,7 +124,7 @@ public function getStoreId(){
124124
* @return $this
125125
*/
126126
public function setStoreId($storeId){
127-
return $this->setData("store_id", $storeId);
127+
return $this->setData(self::STORE_ID, $storeId);
128128
}
129129
/**
130130
* Set products

Model/TagRepository.php

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,8 @@ class TagRepository implements TagRepositoryInterface
5858

5959
private $collectionProcessor;
6060

61+
protected $_resource;
62+
6163

6264
/**
6365
* @param ResourceTag $resource
@@ -79,9 +81,11 @@ public function __construct(
7981
DataObjectHelper $dataObjectHelper,
8082
DataObjectProcessor $dataObjectProcessor,
8183
StoreManagerInterface $storeManager,
82-
CollectionProcessorInterface $collectionProcessor
84+
CollectionProcessorInterface $collectionProcessor,
85+
\Magento\Framework\App\ResourceConnection $Resource
8386
) {
8487
$this->resource = $resource;
88+
$this->_resource = $Resource;
8589
$this->tagFactory = $tagFactory;
8690
$this->tagCollectionFactory = $tagCollectionFactory;
8791
$this->searchResultsFactory = $searchResultsFactory;
@@ -199,4 +203,22 @@ public function getByTagCode($tagCode){
199203
}
200204
return $tagModel->getDataModel();
201205
}
206+
public function getListTag($args){
207+
$tagModel = $this->tagFactory->create();
208+
$collection = $tagModel->getCollection();
209+
$collection->addFieldToSelect('*');
210+
if(isset($args['tag_id']) && $args['tag_id']){
211+
$collection->addFieldToFilter('tag_id', array('eq' => (int)$args['tag_id']));
212+
}
213+
if(isset($args['identifiers']) && $args['identifiers']){
214+
$collection->addFieldToFilter('identifier', array('like' => "%{$args['identifiers']}%"));
215+
}
216+
if(isset($args['tag_title']) && $args['tag_title']){
217+
$collection->addFieldToFilter('tag_title', array('like' => "%{$args['tag_title']}%"));
218+
}
219+
if(isset($args['status']) && $args['status']){
220+
$collection->addFieldToFilter('status', array('eq' => $args['status']));
221+
}
222+
return $collection;
223+
}
202224
}

0 commit comments

Comments
 (0)