Skip to content

Instantly share code, notes, and snippets.

@6ui11em
Last active May 19, 2022 11:01
Show Gist options
  • Save 6ui11em/a991dd5c1db48a5e6a5867c6309f54f6 to your computer and use it in GitHub Desktop.
Save 6ui11em/a991dd5c1db48a5e6a5867c6309f54f6 to your computer and use it in GitHub Desktop.
Magento 2: Aplicar conditions al collection #mageno2
<?php
use Magento\Rule\Model\Condition\Sql\Builder as SqlBuilder;
...
/** @var $collection Collection */
$collection = $this->productCollectionFactory->create();
$conditions = $this->getConditions();
$productConditions = $this->getProductConditions();
$conditions->collectValidatedAttributes($collection);
$this->sqlBuilder->attachConditionToCollection($collection, $productConditions, $conditions);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment