Smile\ElasticsuiteCatalogRule\Model\Rule\Condition\Product::getValue PHP Method

getValue() public method

{@inheritDoc}
public getValue ( )
    public function getValue()
    {
        if (in_array($this->getAttribute(), ['stock.is_in_stock', 'has_image', 'price.is_discount'])) {
            $this->setData('value', 1);
        }
        return $this->getData('value');
    }

Usage Example

Example #1
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;
 }