Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
Advanced.php
Go to the documentation of this file.
1 <?php
7 
15 {
21  protected $_eventManager = null;
22 
28  protected $_storeManager;
29 
38  public function __construct(
39  \Magento\Framework\Model\ResourceModel\Db\Context $context,
41  \Magento\Framework\Event\ManagerInterface $eventManager,
42  $connectionName = null
43  ) {
44  $this->_storeManager = $storeManager;
45  $this->_eventManager = $eventManager;
46  parent::__construct($context, $connectionName);
47  }
48 
54  protected function _construct()
55  {
56  $this->_init('catalog_product_entity', 'entity_id');
57  }
58 
68  {
69  $condition = false;
70 
71  if (is_array($value)) {
72  if ($attribute->getBackendType() == 'varchar') { // multiselect
73  // multiselect
74  $condition = ['in_set' => $value];
75  } elseif (!isset($value['from']) && !isset($value['to'])) { // select
76  // select
77  $condition = ['in' => $value];
78  } elseif (isset($value['from']) && '' !== $value['from'] || isset($value['to']) && '' !== $value['to']) {
79  // range
80  $condition = $value;
81  }
82  } else {
83  if (strlen($value) > 0) {
84  if (in_array($attribute->getBackendType(), ['varchar', 'text', 'static'])) {
85  $condition = ['like' => $value]; // text search
86  } else {
87  $condition = $value;
88  }
89  }
90  }
91 
92  return $condition;
93  }
94 }
elseif(isset( $params[ 'redirect_parent']))
Definition: iframe.phtml:17
$storeManager
$value
Definition: gender.phtml:16
__construct(\Magento\Framework\Model\ResourceModel\Db\Context $context, \Magento\Store\Model\StoreManagerInterface $storeManager, \Magento\Framework\Event\ManagerInterface $eventManager, $connectionName=null)
Definition: Advanced.php:38