Skip to content

Commit

Permalink
product attr model
Browse files Browse the repository at this point in the history
  • Loading branch information
fancyecommerce committed Mar 4, 2021
1 parent 65a71cb commit 3e5a7be
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 0 deletions.
15 changes: 15 additions & 0 deletions services/product/attr/AttrMysqldb.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,21 @@ public function getByPrimaryKey($primaryKey = null)
}
}

public function getByAttrTypeAndName($attr_type, $name)
{
if ($attr_type && $name) {
$one = $this->_attrModel->findOne([
'attr_type' => $attr_type,
'name' => $name,
]);

return $one;
} else {

return new $this->_attrModel();
}
}

public function getByRemoteId($remoteId)
{
if (!$remoteId) {
Expand Down
12 changes: 12 additions & 0 deletions services/product/attrgroup/AttrGroupMysqldb.php
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,18 @@ public function getByPrimaryKey($primaryKey = null)
}
}

public function getByName($name)
{
if ($name) {
$one = $this->_attrGroupModel->findOne(['name' => $name]);

return $one;
} else {

return new $this->_attrGroupModel();
}
}

/*
* example filter:
* [
Expand Down

0 comments on commit 3e5a7be

Please sign in to comment.