Author: Aurelien FOUCRET (aurelien.foucret@smile.fr)
Inheritance: extends Magento\Rule\Model\Condition\Product\AbstractProduct
Ejemplo n.º 1
0
 /**
  * Build a search query for the current rule.
  *
  * @param array $excludedCategories Categories excluded of query building (avoid infinite recursion).
  *
  * @return QueryInterface
  */
 public function getSearchQuery($excludedCategories = [])
 {
     $searchQuery = parent::getSearchQuery();
     if ($this->getAttribute() === 'category_ids') {
         $searchQuery = $this->getCategorySearchQuery($excludedCategories);
     }
     return $searchQuery;
 }
Ejemplo n.º 2
0
 /**
  * Update the condition value to ignore empty array items.
  *
  * @param ProductCondition $productCondition Product condition.
  *
  * @return $this
  */
 private function prepareFieldValue(ProductCondition $productCondition)
 {
     $value = $productCondition->getValue();
     if (is_array($value)) {
         $value = array_filter($value);
     }
     $productCondition->setValue($value);
     return $this;
 }