Skip to content

Commit

Permalink
add code argument in TheliaCollectionItem loop
Browse files Browse the repository at this point in the history
  • Loading branch information
leanormandon committed Feb 12, 2024
1 parent 964c1c0 commit 40b5d4c
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions Loop/TheliaCollectionItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
* @method string getItemType()
* @method int getItemId()
* @method int getTheliaCollectionId()
* @method string getCode()
*/
class TheliaCollectionItem extends BaseLoop implements PropelSearchLoopInterface
{
Expand All @@ -27,7 +28,8 @@ protected function getArgDefinitions()
Argument::createIntTypeArgument('id'),
Argument::createIntTypeArgument('item_id'),
Argument::createAlphaNumStringTypeArgument('item_type'),
Argument::createIntTypeArgument('thelia_collection_id')
Argument::createIntTypeArgument('thelia_collection_id'),
Argument::createAlphaNumStringTypeArgument('code')
);
}

Expand All @@ -43,6 +45,13 @@ public function buildModelCriteria()
$query->filterByTheliaCollectionId($theliaCollectionId);
}

if (null !== $code = $this->getCode()) {
$query
->useTheliaCollectionQuery()
->filterByCode($code)
->endUse();
}

if (null !== $itemId = $this->getItemId()) {
$query->filterByItemId($itemId);
}
Expand All @@ -66,8 +75,7 @@ public function parseResults(LoopResult $loopResult)
->set('THELIA_COLLECTION_ID', $entry->getTheliaCollectionId())
->set('POSITION', $entry->getPosition())
->set('ITEM_TYPE', $entry->getItemType())
->set('ITEM_ID', $entry->getItemId())
;
->set('ITEM_ID', $entry->getItemId());

$this->addOutputFields($row, $entry);

Expand Down

0 comments on commit 40b5d4c

Please sign in to comment.