_storeManager = $storeManager; } /** * Add store availability filter. Include availability product * for store website * * @param null|int|StoreInterface $store * @return $this * @throws NoSuchEntityException */ public function addStoreFilter($store = null) { if ($store === null) { $store = $this->getStoreId(); } $store = $this->_storeManager->getStore($store); $this->getSelect()->where( "(`store_id` = 0 OR `store_id` LIKE '?,%' OR `store_id` = ? OR `store_id` LIKE '%,?' OR `store_id` LIKE '%,?,%')", $store->getId(), 'int' ); return $this; } /** * Return current store id * * @return int|null * @throws NoSuchEntityException */ public function getStoreId() { if ($this->_storeId === null) { $this->setStoreId($this->_storeManager->getStore()->getId()); } return $this->_storeId; } /** * Set store scope * * @param int|StoreInterface $store * @return $this */ public function setStoreId($store) { if ($store instanceof StoreInterface) { $store = $store->getId(); } $this->_storeId = (int)$store; return $this; } /** * Define resource model * * @return void */ protected function _construct() { $this->_init( \Olegnax\GoogleMap\Model\Location::class, Location::class ); } }