public function execute() { $app_settings_model = new waAppSettingsModel(); $settings = $app_settings_model->get(shopPricePlugin::$plugin_id); $ccm = new waContactCategoryModel(); $categories = array(array('id' => 0, 'name' => 'Все покупатели')); foreach ($ccm->getAll() as $c) { if ($c['app_id'] == 'shop') { $categories[$c['id']] = $c; } } $price_model = new shopPricePluginModel(); $prices = $price_model->getAll(); $_prices = array(); foreach ($prices as $price) { $_prices[$price['domain_hash']][] = $price; } $domain_routes = wa()->getRouting()->getByApp('shop'); $domains_settings = shopPrice::getDomainsSettings(); $this->view->assign('prices', $_prices); $this->view->assign('domain_routes', $domain_routes); $this->view->assign('categories', $categories); $this->view->assign('settings', $settings); $this->view->assign('domain_settings', $domains_settings); }
public function execute() { try { $app_settings_model = new waAppSettingsModel(); $shop_price = waRequest::post('shop_price'); $domains_settings = waRequest::post('domains_settings', array()); foreach ($shop_price as $key => $value) { $app_settings_model->set(shopPricePlugin::$plugin_id, $key, $value); } shopPrice::saveDomainsSettings($domains_settings); $this->response['message'] = "Сохранено"; } catch (Exception $e) { $this->setError($e->getMessage()); } }
public function frontendProducts(&$params) { if ($this->getSettings('status') && shopPrice::getDomainSetting('status')) { if (!empty($params['products'])) { $params['products'] = $this->prepareProducts($params['products']); } if (!empty($params['skus'])) { $params['skus'] = $this->prepareSkus($params['skus']); } } }