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 productCustomFields() { if ($this->getSettings('status')) { $domains = $this->getDomains(); $price_model = new shopPricePluginModel(); $prices = $price_model->getAll(); $sku_fields = array(); foreach ($prices as $price) { $field = 'price_plugin_' . $price['id']; $field_name = $price['name'] . " (" . $domains[$price['domain_hash']] . ")"; $sku_fields[$field] = $field_name; } return array('sku' => $sku_fields); } }
<?php $price_model = new shopPricePluginModel(); $prices = $price_model->getAll(); try { foreach ($prices as $price) { $sql = "ALTER TABLE `shop_product_skus` DROP `price_plugin_" . $price_model->escape($price['id']) . "`"; $price_model->query($sql); $price_model->deleteById($price['id']); } } catch (waDbException $e) { }