public function init() { if (Tools::getValue('supplier_rewrite')) { $name_supplier = str_replace('-', '%', Tools::getValue('supplier_rewrite')); // // TODO:: need to core update Prestashop code and // DB for link_rewrite for suppliers // Should we use the Mysql FullText Index Search ?? // $sql = 'SELECT sp.`id_supplier` FROM `' . _DB_PREFIX_ . 'supplier` sp LEFT JOIN `' . _DB_PREFIX_ . 'supplier_shop` s ON (sp.`id_supplier` = s.`id_supplier`) WHERE sp.`name` LIKE \'' . $name_supplier . '\''; if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP) { $sql .= ' AND s.`id_shop` = ' . (int) Shop::getContextShopID(); } $id_supplier = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql); if ($id_supplier > 0) { $_GET['id_supplier'] = $id_supplier; } else { //TODO: Do we need to send 404? header('HTTP/1.1 404 Not Found'); header('Status: 404 Not Found'); } } parent::init(); }
public function install() { if (Shop::isFeatureActive()) { Shop::setContext(Shop::CONTEXT_ALL); } return parent::install() && $this->registerHook('actionObjectCustomerUpdateAfter') && $this->registerHook('actionObjectCustomerUpdateBefore'); }
public function init() { if ($product_rewrite = Tools::getValue('product_rewrite')) { $url_id_pattern = '/.*?([0-9]+)\\-([a-zA-Z0-9-]*)(\\.html)?/'; $lang_id = (int) Context::getContext()->language->id; $sql = 'SELECT `id_product` FROM `' . _DB_PREFIX_ . 'product_lang` WHERE `link_rewrite` = \'' . pSQL(str_replace('.html', '', $product_rewrite)) . '\' AND `id_lang` = ' . $lang_id; if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP) { $sql .= ' AND `id_shop` = ' . (int) Shop::getContextShopID(); } $id_product = (int) Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql); if ($id_product > 0) { $_GET['id_product'] = $id_product; } elseif (preg_match($url_id_pattern, $this->request_uri, $url_parts)) { $sql = 'SELECT `id_product` FROM `' . _DB_PREFIX_ . 'product_lang` WHERE `id_product` = \'' . pSQL($url_parts[1]) . '\' AND `id_lang` = ' . $lang_id; if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP) { $sql .= ' AND `id_shop` = ' . (int) Shop::getContextShopID(); } $id_product = (int) Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql); if ($id_product > 0) { $_GET['id_product'] = $id_product; } } } parent::init(); }
public function install() { if (Shop::isFeatureActive()) { Shop::setContext(Shop::CONTEXT_ALL); } //Ajout d'un onglet à la racine du site $parentTab = Tab::getIdFromClassName('AdminImporter'); if (empty($parentTab)) { $parentTab = self::createTab(0, $this->name, 'EDC feeds importer', 'AdminImporter'); } self::createTab($parentTab, $this->name, 'Import des produits', 'AdminImporterRunning'); self::createTab($parentTab, $this->name, 'Configuration', 'AdminImporterConfiguration'); self::createTab($parentTab, $this->name, 'Counter', 'AdminImporterCounter'); self::createTab($parentTab, $this->name, 'Labo', 'AdminImporterLab'); // self::createTab($parentTab, $this->name, 'CRON', 'AdminImporterCron'); Configuration::updateValue('IMPORTER_URL_FULL_FEED', 'http://graphics.edc-internet.nl/b2b_feed.php?key=[KEY]&sort=xml&type=xml&lang=[LANG]&version=2015'); Configuration::updateValue('IMPORTER_URL_NEW_PRODUCTS', 'http://graphics.edc-internet.nl/b2b_feed.php?key=[KEY]&sort=xml&type=xml&lang=[LANG]&version=2015&new=1'); Configuration::updateValue('IMPORTER_URL_STOCK', 'http://graphics.edc-internet.nl/xml/eg_xml_feed_stock.xml'); Configuration::updateValue('IMPORTER_DISCONTINUED', 'http://graphics.edc-internet.nl/xml/deleted_products.xml'); Configuration::updateValue('IMPORTER_IMPORT_CURRENT_STEP', 0); Configuration::updateValue('IMPORTER_IMPORT_CURRENT_KEY_IN_XML', 0); Configuration::updateValue('IMPORTER_XML_FILE', ''); Configuration::updateValue('IMPORTER_XML_COUNT'); //Créer le dossier import if (!parent::install() || !$this->installDb()) { return false; } return true; }
public function renderForm() { $this->initFormToolBar(); if (!$this->loadObject(true)) { return; } $cover = false; $obj = $this->loadObject(true); if (isset($obj->id)) { $this->display = 'edit'; $cover = ImageManager::thumbnail(_PS_MODULE_DIR_ . 'ph_simpleblog/covers_cat/' . $obj->id . '.' . $obj->cover, 'ph_simpleblog_cat_' . $obj->id . '.' . $obj->cover, 350, $obj->cover, false); } else { $this->display = 'add'; } $this->fields_value = array('cover' => $cover ? $cover : false, 'cover_size' => $cover ? filesize(_PS_MODULE_DIR_ . 'ph_simpleblog/covers_cat/' . $obj->id . '.' . $obj->cover) / 1000 : false); $categories = SimpleBlogCategory::getCategories($this->context->language->id, true, true); array_unshift($categories, array('id' => 0, 'name' => $this->l('No parent'))); foreach ($categories as $key => $category) { if (isset($obj->id) && $obj->id) { if ($category['id'] == $obj->id_simpleblog_category) { unset($category[$key]); } } } $this->fields_form = array('legend' => array('title' => $this->l('Category'), 'image' => '../img/admin/tab-categories.gif'), 'input' => array(array('type' => 'select', 'label' => $this->l('Parent Category:'), 'name' => 'id_parent', 'required' => true, 'options' => array('id' => 'id', 'query' => $categories, 'name' => 'name')), array('type' => 'text', 'label' => $this->l('Name:'), 'name' => 'name', 'required' => true, 'lang' => true, 'class' => 'copy2friendlyUrl'), array('type' => 'textarea', 'label' => $this->l('Description:'), 'name' => 'description', 'lang' => true, 'rows' => 5, 'cols' => 40, 'autoload_rte' => true), array('type' => 'text', 'label' => $this->l('Meta title:'), 'name' => 'meta_title', 'lang' => true), array('type' => 'text', 'label' => $this->l('Meta description:'), 'name' => 'meta_description', 'lang' => true), array('type' => 'text', 'label' => $this->l('Meta keywords:'), 'name' => 'meta_keywords', 'lang' => true), array('type' => 'text', 'label' => $this->l('Friendly URL:'), 'name' => 'link_rewrite', 'required' => true, 'lang' => true), array('type' => 'switch', 'label' => $this->l('Displayed'), 'name' => 'active', 'required' => false, 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'file', 'label' => $this->l('Category image:'), 'display_image' => true, 'name' => 'cover', 'desc' => $this->l('Upload a image from your computer.'))), 'submit' => array('title' => $this->l('Save'), 'class' => 'button')); if (Shop::isFeatureActive()) { $this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association:'), 'name' => 'checkBoxShopAsso'); } $this->tpl_form_vars['PS_ALLOW_ACCENTED_CHARS_URL'] = (int) Configuration::get('PS_ALLOW_ACCENTED_CHARS_URL'); $this->tpl_form_vars['PS_FORCE_FRIENDLY_PRODUCT'] = (int) Configuration::get('PS_FORCE_FRIENDLY_PRODUCT'); return parent::renderForm(); }
public function init() { if ($cms_rewrite = Tools::getValue('cms_rewrite')) { $sql = 'SELECT l.`id_cms` FROM `' . _DB_PREFIX_ . 'cms_lang` l LEFT JOIN `' . _DB_PREFIX_ . 'cms_shop` s ON (l.`id_cms` = s.`id_cms`) WHERE l.`link_rewrite` = \'' . pSQL(str_replace('.html', '', $cms_rewrite)) . '\''; if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP) { $sql .= ' AND s.`id_shop` = ' . (int) Shop::getContextShopID(); } $id_cms = (int) Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql); if ($id_cms > 0) { $_GET['id_cms'] = $id_cms; } } elseif ($cms_category_rewrite = Tools::getValue('cms_category_rewrite')) { $sql = 'SELECT `id_cms_category` FROM `' . _DB_PREFIX_ . 'cms_category_lang` WHERE `link_rewrite` = \'' . pSQL($cms_category_rewrite) . '\''; if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP) { $sql .= ' AND s.`id_shop` = ' . (int) Shop::getContextShopID(); } $id_cms_category = (int) Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql); if ($id_cms_category > 0) { $_GET['id_cms_category'] = $id_cms_category; } } parent::init(); }
public function install() { $e = get_headers(ERP_WS); if ($e[0] == 'HTTP/1.1 200 OK') { if ($this->isCurlInstalled() == false) { $this->_errors[] = $this->l('Error while installing the module. CURL Extension is not active on your server. Please contact your server administrator.'); return false; } if (Shop::isFeatureActive()) { Shop::setContext(Shop::CONTEXT_ALL); } if (!Configuration::hasKey('ERP_ADMIN_PARENT_ORDERS_TAB_ID')) { Configuration::updateValue('ERP_ADMIN_PARENT_ORDERS_TAB_ID', Tab::getIdFromClassName('AdminParentOrders')); } if (parent::install() != false && $this->parseSQL('install.sql') != false && $this->installStockMvtReason() != false && $this->installErpTab() != false && $this->addTrashCategory() != false && $this->addOrderState($this->l('Order to the supplier')) != false && $this->registerHook('actionOrderStatusUpdate') != false && $this->registerHook('displayBackOfficeHeader') != false) { foreach ($this->field_name_configuration as $field_name => $param) { Configuration::updateValue(Tools::strtoupper($field_name), $param['default']); } // load a licence if exits $this->loadLicenceIfExists(); // save the first install date if (!Configuration::hasKey('ERP_FIRST_INSTALL_DATE') || Configuration::get('ERP_FIRST_INSTALL_DATE') == '' || Configuration::get('ERP_FIRST_INSTALL_DATE') == false) { Configuration::updateValue('ERP_FIRST_INSTALL_DATE', date("Y-m-d H:i:s")); } return true; } return false; } else { $this->_errors[] = $this->l('Error while getting headers of WS ! Please contact the customer service.'); return false; } }
public function renderForm() { $this->fields_form = array('legend' => array('title' => $this->l('Stores'), 'image' => '../img/admin/home.gif'), 'input' => array(array('type' => 'text', 'label' => $this->l('Name'), 'name' => 'name', 'size' => 33, 'required' => false, 'hint' => sprintf($this->l('Allowed characters: letters, spaces and %s'), '().-'), 'desc' => $this->l('Store name (e.g. Citycentre Mall Store)')), array('type' => 'text', 'label' => $this->l('Address'), 'name' => 'address1', 'size' => 33, 'required' => true), array('type' => 'text', 'label' => $this->l('Address (2)'), 'name' => 'address2', 'size' => 33), array('type' => 'text', 'label' => $this->l('Postal Code/Zip Code'), 'name' => 'postcode', 'size' => 6, 'required' => true), array('type' => 'text', 'label' => $this->l('City'), 'name' => 'city', 'size' => 33, 'required' => true), array('type' => 'select', 'label' => $this->l('Country'), 'name' => 'id_country', 'required' => true, 'default_value' => (int) $this->context->country->id, 'options' => array('query' => Country::getCountries($this->context->language->id), 'id' => 'id_country', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('State'), 'name' => 'id_state', 'required' => true, 'options' => array('id' => 'id_state', 'name' => 'name', 'query' => null)), array('type' => 'latitude', 'label' => $this->l('Latitude / Longitude'), 'name' => 'latitude', 'required' => true, 'size' => 11, 'maxlength' => 12, 'desc' => $this->l('Store coordinates (e.g. 45.265469/-47.226478)')), array('type' => 'text', 'label' => $this->l('Phone'), 'name' => 'phone', 'size' => 33), array('type' => 'text', 'label' => $this->l('Fax'), 'name' => 'fax', 'size' => 33), array('type' => 'text', 'label' => $this->l('E-mail address'), 'name' => 'email', 'size' => 33), array('type' => 'textarea', 'label' => $this->l('Note'), 'name' => 'note', 'cols' => 42, 'rows' => 4), array('type' => 'radio', 'label' => $this->l('Status'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))), 'desc' => $this->l('Whether or not to display this store'))), 'rightCols' => array('input' => array('type' => 'file', 'label' => $this->l('Picture'), 'name' => 'image', 'desc' => $this->l('Storefront picture'))), 'submit' => array('title' => $this->l(' Save '), 'class' => 'button')); if (Shop::isFeatureActive()) { $this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association:'), 'name' => 'checkBoxShopAsso'); } if (!($obj = $this->loadObject(true))) { return; } $image = ImageManager::thumbnail(_PS_STORE_IMG_DIR_ . '/' . $obj->id . '.jpg', $this->table . '_' . (int) $obj->id . '.' . $this->imageType, 350, $this->imageType, true); $days = array(); $days[1] = $this->l('Monday'); $days[2] = $this->l('Tuesday'); $days[3] = $this->l('Wednesday'); $days[4] = $this->l('Thursday'); $days[5] = $this->l('Friday'); $days[6] = $this->l('Saturday'); $days[7] = $this->l('Sunday'); $hours = $this->getFieldValue($obj, 'hours'); if (!empty($hours)) { $hours_unserialized = Tools::unSerialize($hours); } $this->fields_value = array('latitude' => $this->getFieldValue($obj, 'latitude') ? $this->getFieldValue($obj, 'latitude') : Configuration::get('PS_STORES_CENTER_LAT'), 'longitude' => $this->getFieldValue($obj, 'longitude') ? $this->getFieldValue($obj, 'longitude') : Configuration::get('PS_STORES_CENTER_LONG'), 'image' => $image ? $image : false, 'size' => $image ? filesize(_PS_STORE_IMG_DIR_ . '/' . $obj->id . '.jpg') / 1000 : false, 'days' => $days, 'hours' => isset($hours_unserialized) ? $hours_unserialized : false); return parent::renderForm(); }
public function renderForm() { if (!$this->object->id) { $this->object->price = -1; } $this->fields_form = array('legend' => array('title' => $this->l('Catalog price rules'), 'icon' => 'icon-dollar'), 'input' => array(array('type' => 'text', 'label' => $this->l('Name'), 'name' => 'name', 'maxlength' => 32, 'required' => true, 'hint' => $this->l('Forbidden characters') . ' <>;=#{}'), array('type' => 'select', 'label' => $this->l('Shop'), 'name' => 'shop_id', 'options' => array('query' => Shop::getShops(), 'id' => 'id_shop', 'name' => 'name'), 'condition' => Shop::isFeatureActive(), 'default_value' => Shop::getContextShopID()), array('type' => 'select', 'label' => $this->l('Currency'), 'name' => 'id_currency', 'options' => array('query' => array_merge(array(0 => array('id_currency' => 0, 'name' => $this->l('All currencies'))), Currency::getCurrencies()), 'id' => 'id_currency', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Country'), 'name' => 'id_country', 'options' => array('query' => array_merge(array(0 => array('id_country' => 0, 'name' => $this->l('All countries'))), Country::getCountries((int) $this->context->language->id)), 'id' => 'id_country', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Group'), 'name' => 'id_group', 'options' => array('query' => array_merge(array(0 => array('id_group' => 0, 'name' => $this->l('All groups'))), Group::getGroups((int) $this->context->language->id)), 'id' => 'id_group', 'name' => 'name')), array('type' => 'text', 'label' => $this->l('From quantity'), 'name' => 'from_quantity', 'maxlength' => 10, 'required' => true), array('type' => 'text', 'label' => $this->l('Price (tax excl.)'), 'name' => 'price', 'disabled' => $this->object->price == -1 ? 1 : 0, 'maxlength' => 10, 'suffix' => $this->context->currency->getSign('right')), array('type' => 'checkbox', 'name' => 'leave_bprice', 'values' => array('query' => array(array('id' => 'on', 'name' => $this->l('Leave base price'), 'val' => '1', 'checked' => '1')), 'id' => 'id', 'name' => 'name')), array('type' => 'datetime', 'label' => $this->l('From'), 'name' => 'from'), array('type' => 'datetime', 'label' => $this->l('To'), 'name' => 'to'), array('type' => 'select', 'label' => $this->l('Reduction type'), 'name' => 'reduction_type', 'options' => array('query' => array(array('reduction_type' => 'amount', 'name' => $this->l('Amount')), array('reduction_type' => 'percentage', 'name' => $this->l('Percentage'))), 'id' => 'reduction_type', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('Reduction with or without taxes'), 'name' => 'reduction_tax', 'align' => 'center', 'options' => array('query' => array(array('lab' => $this->l('Tax included'), 'val' => 1), array('lab' => $this->l('Tax excluded'), 'val' => 0)), 'id' => 'val', 'name' => 'lab')), array('type' => 'text', 'label' => $this->l('Reduction'), 'name' => 'reduction', 'required' => true)), 'submit' => array('title' => $this->l('Save'))); if (($value = $this->getFieldValue($this->object, 'price')) != -1) { $price = number_format($value, 6); } else { $price = ''; } $this->fields_value = array('price' => $price, 'from_quantity' => ($value = $this->getFieldValue($this->object, 'from_quantity')) ? $value : 1, 'reduction' => number_format(($value = $this->getFieldValue($this->object, 'reduction')) ? $value : 0, 6), 'leave_bprice_on' => $price ? 0 : 1); $attribute_groups = array(); $attributes = Attribute::getAttributes((int) $this->context->language->id); foreach ($attributes as $attribute) { if (!isset($attribute_groups[$attribute['id_attribute_group']])) { $attribute_groups[$attribute['id_attribute_group']] = array('id_attribute_group' => $attribute['id_attribute_group'], 'name' => $attribute['attribute_group']); } $attribute_groups[$attribute['id_attribute_group']]['attributes'][] = array('id_attribute' => $attribute['id_attribute'], 'name' => $attribute['name']); } $features = Feature::getFeatures((int) $this->context->language->id); foreach ($features as &$feature) { $feature['values'] = FeatureValue::getFeatureValuesWithLang((int) $this->context->language->id, $feature['id_feature'], true); } $this->tpl_form_vars = array('manufacturers' => Manufacturer::getManufacturers(), 'suppliers' => Supplier::getSuppliers(), 'attributes_group' => $attribute_groups, 'features' => $features, 'categories' => Category::getSimpleCategories((int) $this->context->language->id), 'conditions' => $this->object->getConditions(), 'is_multishop' => Shop::isFeatureActive()); return parent::renderForm(); }
/** * Get Product object by code * @param string $code Code * @return Product Product object */ public static function getProductByCode($code, $id_lang) { $powatag_sku = Configuration::get('POWATAG_SKU'); switch ($powatag_sku) { case Powatag::EAN: $id_product = (int) self::getProductIdByEan13($code); break; case Powatag::UPC: $id_product = (int) self::getProductIdByUPC($code); break; case Powatag::REFERENCE: $id_product = (int) self::getProductIdByReference($code); break; default: $id_product = (int) self::getProductIdByIdProduct($code); break; } $product = new Product($id_product, true, (int) $id_lang); //Check if multishop is enabled if (Shop::isFeatureActive() && $product) { //Check that product exists in current shop $id_shops = Product::getShopsByProduct($product->id); $product_exists = false; foreach ($id_shops as $id_shop) { if ($id_shop['id_shop'] == Context::getContext()->shop->id) { $product_exists = true; break; } } if (!$product_exists) { $product = false; } } return $product; }
public function install() { if (Shop::isFeatureActive()) { Shop::setContext(Shop::CONTEXT_ALL); } return parent::install() && $this->registerHook('header') && Configuration::updateValue('FKVSEOTK_HREFLANG_ENABLED', false) && Configuration::updateValue('FKVSEOTK_CANONICAL_ENABLED', false) && Configuration::updateValue('FKVSEOTK_NOBOTS_ENABLED', false); }
/** * @return boolean */ public function install() { if (Shop::isFeatureActive()) { Shop::setContext(Shop::CONTEXT_ALL); } // Install invisible tab $tab = new Tab(); $tab->name[$this->context->language->id] = $this->l('SecurionPay'); $tab->class_name = 'AdminSecurionPay'; $tab->id_parent = -1; // No parent tab $tab->module = $this->name; $tab->add(); //Init Configuration::updateValue('SECURIONPAY_CONF', ''); if (!parent::install()) { return false; } if (!Configuration::updateValue(self::MODE, self::MODE_TEST)) { return false; } if (!$this->registerHook('payment') || !$this->registerHook('displayAdminOrder')) { return false; } return true; }
public function install() { if (Shop::isFeatureActive()) { Shop::setContext(Shop::CONTEXT_ALL); } return parent::install() && $this->registerHook('lampAccessories') && $this->registerHook('header') && Configuration::updateValue('LAMPACCESSORIES_NAME', 'Lamp Accessories'); }
public function install() { if (Shop::isFeatureActive()) { Shop::setContext(Shop::CONTEXT_ALL); } return parent::install() && $this->registerHook('invoice') && $this->registerHook('payment') && $this->registerHook('paymentReturn') && $this->createDebitNoteTable() && $this->createOrderState() && Configuration::updateValue('DEBITNOTE_CREDITOR_IDENTIFIER', DEXXXX); }
public function renderForm() { if (!($obj = $this->loadObject(true))) { return; } $address_layout = AddressFormat::getAddressCountryFormat($obj->id); if ($value = Tools::getValue('address_layout')) { $address_layout = $value; } $default_layout = ''; $default_layout_tab = array(array('firstname', 'lastname'), array('company'), array('vat_number'), array('address1'), array('address2'), array('postcode', 'city'), array('Country:name'), array('phone'), array('phone_mobile')); foreach ($default_layout_tab as $line) { $default_layout .= implode(' ', $line) . "\r\n"; } $this->fields_form = array('legend' => array('title' => $this->l('Countries'), 'image' => '../img/admin/world.gif'), 'input' => array(array('type' => 'text', 'label' => $this->l('Country:'), 'name' => 'name', 'lang' => true, 'size' => 30, 'required' => true, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}', 'desc' => $this->l('Country name')), array('type' => 'text', 'label' => $this->l('ISO code:'), 'name' => 'iso_code', 'size' => 4, 'maxlength' => 3, 'class' => 'uppercase', 'required' => true, 'desc' => $this->l('Two -- or three -- letter ISO code (e.g. U.S. for United States)') . '. <a href="http://www.iso.org/iso/country_codes/iso_3166_code_lists/country_names_and_code_elements.htm" target="_blank">' . $this->l('Official list here') . ' </a>.'), array('type' => 'text', 'label' => $this->l('Call prefix:'), 'name' => 'call_prefix', 'size' => 4, 'maxlength' => 3, 'class' => 'uppercase', 'required' => true, 'desc' => $this->l('International call prefix, (e.g. 1 for United States)')), array('type' => 'select', 'label' => $this->l('Default currency:'), 'name' => 'id_currency', 'options' => array('query' => Currency::getCurrencies(), 'id' => 'id_currency', 'name' => 'name', 'default' => array('label' => $this->l('Default store currency'), 'value' => 0))), array('type' => 'select', 'label' => $this->l('Zone:'), 'name' => 'id_zone', 'options' => array('query' => Zone::getZones(), 'id' => 'id_zone', 'name' => 'name'), 'desc' => $this->l('Geographical region')), array('type' => 'radio', 'label' => $this->l('Need zip/postal code:'), 'name' => 'need_zip_code', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'need_zip_code_on', 'value' => 1, 'label' => $this->l('Yes')), array('id' => 'need_zip_code_off', 'value' => 0, 'label' => $this->l('No')))), array('type' => 'text', 'label' => $this->l('Zip/post code format:'), 'name' => 'zip_code_format', 'class' => 'uppercase', 'required' => true, 'desc' => $this->l('Zip Code format (L for a letter, N for a number and C for the ISO code). For example, NNNNN for the United States. No verification if undefined.')), array('type' => 'address_layout', 'label' => $this->l('Address format:'), 'name' => 'address_layout', 'address_layout' => $address_layout, 'encoding_address_layout' => urlencode($address_layout), 'encoding_default_layout' => urlencode($default_layout), 'display_valid_fields' => $this->displayValidFields()), array('type' => 'radio', 'label' => $this->l('Address Standardization:'), 'name' => 'standardization', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'standardization_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'standardization_off', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'radio', 'label' => $this->l('Active:'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))), 'desc' => $this->l('Display this country to your customers (the selected country will always be displayed in the Back Office)')), array('type' => 'radio', 'label' => $this->l('Contains following states:'), 'name' => 'contains_states', 'required' => false, 'class' => 't', 'values' => array(array('id' => 'contains_states_on', 'value' => 1, 'label' => '<img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" />' . $this->l('Yes')), array('id' => 'contains_states_off', 'value' => 0, 'label' => '<img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" />' . $this->l('No')))), array('type' => 'radio', 'label' => $this->l('Do you need a tax identification number?'), 'name' => 'need_identification_number', 'required' => false, 'class' => 't', 'values' => array(array('id' => 'need_identification_number_on', 'value' => 1, 'label' => '<img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" />' . $this->l('Yes')), array('id' => 'need_identification_number_off', 'value' => 0, 'label' => '<img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" />' . $this->l('No')))), array('type' => 'radio', 'label' => $this->l('Display tax label (e.g. "Tax incl."):'), 'name' => 'display_tax_label', 'required' => false, 'class' => 't', 'values' => array(array('id' => 'display_tax_label_on', 'value' => 1, 'label' => '<img src="../img/admin/enabled.gif" alt="' . $this->l('Yes') . '" title="' . $this->l('Yes') . '" />' . $this->l('Yes')), array('id' => 'display_tax_label_off', 'value' => 0, 'label' => '<img src="../img/admin/disabled.gif" alt="' . $this->l('No') . '" title="' . $this->l('No') . '" />' . $this->l('No')))))); if (Shop::isFeatureActive()) { $this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association:'), 'name' => 'checkBoxShopAsso'); } $this->fields_form['submit'] = array('title' => $this->l('Save '), 'class' => 'button'); if ($this->object->iso_code == 'US') { $this->object->standardization = Configuration::get('PS_TAASC'); } return parent::renderForm(); }
public function renderForm() { // loads current warehouse if (!($obj = $this->loadObject(true))) { return; } $image = _PS_SUPP_IMG_DIR_ . $obj->id . '.jpg'; $image_url = ImageManager::thumbnail($image, $this->table . '_' . (int) $obj->id . '.' . $this->imageType, 350, $this->imageType, true, true); $image_size = file_exists($image) ? filesize($image) / 1000 : false; $tmp_addr = new Address(); $res = $tmp_addr->getFieldsRequiredDatabase(); $required_fields = array(); foreach ($res as $row) { $required_fields[(int) $row['id_required_field']] = $row['field_name']; } $this->fields_form = array('legend' => array('title' => $this->l('Suppliers'), 'icon' => 'icon-truck'), 'input' => array(array('type' => 'hidden', 'name' => 'id_address'), array('type' => 'text', 'label' => $this->l('Name'), 'name' => 'name', 'required' => true, 'col' => 4, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), in_array('company', $required_fields) ? array('type' => 'text', 'label' => $this->l('Company'), 'name' => 'company', 'display' => in_array('company', $required_fields), 'required' => in_array('company', $required_fields), 'maxlength' => 16, 'col' => 4, 'hint' => $this->l('Company name for this supplier')) : null, array('type' => 'textarea', 'label' => $this->l('Description'), 'name' => 'description', 'lang' => true, 'hint' => array($this->l('Invalid characters:') . ' <>;=#{}', $this->l('Will appear in the list of suppliers.')), 'autoload_rte' => 'rte'), array('type' => 'text', 'label' => $this->l('Phone'), 'name' => 'phone', 'required' => in_array('phone', $required_fields), 'maxlength' => 16, 'col' => 4, 'hint' => $this->l('Phone number for this supplier')), array('type' => 'text', 'label' => $this->l('Mobile phone'), 'name' => 'phone_mobile', 'required' => in_array('phone_mobile', $required_fields), 'maxlength' => 16, 'col' => 4, 'hint' => $this->l('Mobile phone number for this supplier.')), array('type' => 'text', 'label' => $this->l('Address'), 'name' => 'address', 'maxlength' => 128, 'col' => 6, 'required' => true), array('type' => 'text', 'label' => $this->l('Address') . ' (2)', 'name' => 'address2', 'required' => in_array('address2', $required_fields), 'col' => 6, 'maxlength' => 128), array('type' => 'text', 'label' => $this->l('Zip/postal code'), 'name' => 'postcode', 'required' => in_array('postcode', $required_fields), 'maxlength' => 12, 'col' => 2), array('type' => 'text', 'label' => $this->l('City'), 'name' => 'city', 'maxlength' => 32, 'col' => 4, 'required' => true), array('type' => 'select', 'label' => $this->l('Country'), 'name' => 'id_country', 'required' => true, 'col' => 4, 'default_value' => (int) $this->context->country->id, 'options' => array('query' => Country::getCountries($this->context->language->id, false), 'id' => 'id_country', 'name' => 'name')), array('type' => 'select', 'label' => $this->l('State'), 'name' => 'id_state', 'col' => 4, 'options' => array('id' => 'id_state', 'query' => array(), 'name' => 'name')), array('type' => 'file', 'label' => $this->l('Logo'), 'name' => 'logo', 'display_image' => true, 'image' => $image_url ? $image_url : false, 'size' => $image_size, 'hint' => $this->l('Upload a supplier logo from your computer.')), array('type' => 'text', 'label' => $this->l('Meta title'), 'name' => 'meta_title', 'lang' => true, 'col' => 4, 'hint' => $this->l('Forbidden characters:') . ' <>;=#{}'), array('type' => 'text', 'label' => $this->l('Meta description'), 'name' => 'meta_description', 'lang' => true, 'col' => 6, 'hint' => $this->l('Forbidden characters:') . ' <>;=#{}'), array('type' => 'tags', 'label' => $this->l('Meta keywords'), 'name' => 'meta_keywords', 'lang' => true, 'col' => 6, 'hint' => array($this->l('To add "tags" click in the field, write something and then press "Enter".'), $this->l('Forbidden characters:') . ' <>;=#{}')), array('type' => 'switch', 'label' => $this->l('Enable'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))))), 'submit' => array('title' => $this->l('Save'))); // loads current address for this supplier - if possible $address = null; if (isset($obj->id)) { $id_address = Address::getAddressIdBySupplierId($obj->id); if ($id_address > 0) { $address = new Address((int) $id_address); } } // force specific fields values (address) if ($address != null) { $this->fields_value = array('id_address' => $address->id, 'phone' => $address->phone, 'phone_mobile' => $address->phone_mobile, 'address' => $address->address1, 'address2' => $address->address2, 'postcode' => $address->postcode, 'city' => $address->city, 'id_country' => $address->id_country, 'id_state' => $address->id_state); } else { $this->fields_value = array('id_address' => 0, 'id_country' => Configuration::get('PS_COUNTRY_DEFAULT')); } if (Shop::isFeatureActive()) { $this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association'), 'name' => 'checkBoxShopAsso'); } return parent::renderForm(); }
public function getContent() { $output = '<p class="info">' . $this->l('On some versions you could have to disable Cache, save, open your shop home page, than go back and enable it:') . '<br><br>' . sprintf('%s -> %s -> %s', $this->l('Advanced Parameters'), $this->l('Performance'), $this->l('Clear Smarty cache')) . '<br>' . sprintf('%s -> %s -> %s -> %s', $this->l('Preferences'), $this->l('SEO and URLs'), $this->l('Set userfriendly URL off'), $this->l('Save')) . '<br>' . sprintf('%s -> %s -> %s -> %s', $this->l('Preferences'), $this->l('SEO and URLs'), $this->l('Set userfriendly URL on'), $this->l('Save')) . '<br>' . '</p>'; $sql = 'SELECT * FROM `' . _DB_PREFIX_ . 'product_lang` WHERE `link_rewrite` IN (SELECT `link_rewrite` FROM `' . _DB_PREFIX_ . 'product_lang` GROUP BY `link_rewrite`, `id_lang` HAVING count(`link_rewrite`) > 1)'; if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP) { $sql .= ' AND `id_shop` = ' . (int) Shop::getContextShopID(); } if ($res = Db::getInstance()->ExecuteS($sql)) { $err = $this->l('You need to fix duplicate URL entries:') . '<br>'; foreach ($res as $row) { $lang = $this->context->language->getLanguage($row['id_lang']); $err .= $row['name'] . ' (' . $row['id_product'] . ') - ' . $row['link_rewrite'] . '<br>'; $shop = $this->context->shop->getShop($lang['id_shop']); $err .= $this->l('Language: ') . $lang['name'] . '<br>' . $this->l('Shop: ') . $shop['name'] . '<br><br>'; } $output .= $this->displayWarning($err); } else { $output .= $this->displayConfirmation($this->l('Nice. You have no duplicate URL entry.')); } return '<div class="panel">' . $output . '</div>'; }
public function install() { if (Shop::isFeatureActive()) { Shop::setContext(Shop::CONTEXT_ALL); } return parent::install() && $this->registerHook('actionPaymentConfirmation') && $this->registerHook('actionValidateOrder') && Configuration::updateValue('ANDTER_WEBHOOK_URL', 'https://andter.com/i/prestashop/webhook/xxx'); }
public function renderForm() { // loads current warehouse if (!($obj = $this->loadObject(true))) { return; } $this->fields_form = array('legend' => array('title' => $this->l('Suppliers'), 'image' => '../img/admin/suppliers.gif'), 'input' => array(array('type' => 'hidden', 'name' => 'id_address'), array('type' => 'text', 'label' => $this->l('Name'), 'name' => 'name', 'size' => 40, 'required' => true, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}'), array('type' => 'textarea', 'label' => $this->l('Description:'), 'name' => 'description', 'cols' => 60, 'rows' => 10, 'lang' => true, 'hint' => $this->l('Invalid characters:') . ' <>;=#{}', 'desc' => $this->l('Will appear in the supplier list')), array('type' => 'text', 'label' => $this->l('Phone:'), 'name' => 'phone', 'size' => 15, 'maxlength' => 16, 'desc' => $this->l('Phone number for this supplier')), array('type' => 'text', 'label' => $this->l('Address:'), 'name' => 'address', 'size' => 100, 'maxlength' => 128, 'required' => true), array('type' => 'text', 'label' => $this->l('Address:') . ' (2)', 'name' => 'address2', 'size' => 100, 'maxlength' => 128), array('type' => 'text', 'label' => $this->l('Postal Code/Zip Code:'), 'name' => 'postcode', 'size' => 10, 'maxlength' => 12, 'required' => true), array('type' => 'text', 'label' => $this->l('City:'), 'name' => 'city', 'size' => 20, 'maxlength' => 32, 'required' => true), array('type' => 'select', 'label' => $this->l('Country:'), 'name' => 'id_country', 'required' => true, 'default_value' => (int) $this->context->country->id, 'options' => array('query' => Country::getCountries($this->context->language->id, false), 'id' => 'id_country', 'name' => 'name'), 'desc' => $this->l('Country where the state, region or city is located')), array('type' => 'select', 'label' => $this->l('State'), 'name' => 'id_state', 'options' => array('id' => 'id_state', 'query' => array(), 'name' => 'name')), array('type' => 'file', 'label' => $this->l('Logo:'), 'name' => 'logo', 'display_image' => true, 'desc' => $this->l('Upload a supplier logo from your computer')), array('type' => 'text', 'label' => $this->l('Meta title:'), 'name' => 'meta_title', 'lang' => true, 'hint' => $this->l('Forbidden characters:') . ' <>;=#{}'), array('type' => 'text', 'label' => $this->l('Meta description:'), 'name' => 'meta_description', 'lang' => true, 'hint' => $this->l('Forbidden characters:') . ' <>;=#{}'), array('type' => 'tags', 'label' => $this->l('Meta keywords:'), 'name' => 'meta_keywords', 'lang' => true, 'hint' => $this->l('Forbidden characters:') . ' <>;=#{}', 'desc' => $this->l('To add "tags" click in the field, write something and then press "Enter"')), array('type' => 'radio', 'label' => $this->l('Enable:'), 'name' => 'active', 'required' => false, 'class' => 't', 'is_bool' => true, 'values' => array(array('id' => 'active_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'active_off', 'value' => 0, 'label' => $this->l('Disabled'))))), 'submit' => array('title' => $this->l(' Save '), 'class' => 'button')); // loads current address for this supplier - if possible $address = null; if (isset($obj->id)) { $id_address = Address::getAddressIdBySupplierId($obj->id); if ($id_address > 0) { $address = new Address((int) $id_address); } } // force specific fields values (address) if ($address != null) { $this->fields_value = array('id_address' => $address->id, 'phone' => $address->phone, 'address' => $address->address1, 'address2' => $address->address2, 'postcode' => $address->postcode, 'city' => $address->city, 'id_country' => $address->id_country, 'id_state' => $address->id_state); } else { $this->fields_value = array('id_address' => 0, 'id_country' => Configuration::get('PS_COUNTRY_DEFAULT')); } if (Shop::isFeatureActive()) { $this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association:'), 'name' => 'checkBoxShopAsso'); } // set logo image $image = ImageManager::thumbnail(_PS_SUPP_IMG_DIR_ . '/' . $this->object->id . '.jpg', $this->table . '_' . (int) $this->object->id . '.' . $this->imageType, 350, $this->imageType, true); $this->fields_value['image'] = $image ? $image : false; $this->fields_value['size'] = $image ? filesize(_PS_SUPP_IMG_DIR_ . '/' . $this->object->id . '.jpg') / 1000 : false; return parent::renderForm(); }
public function getImageLink($name, $ids, $type = null, $overimage = null) { $not_default = false; $theme = Shop::isFeatureActive() && file_exists(_PS_PROD_IMG_DIR_ . $ids . ($type ? '-' . $type : '') . '-' . (int) Context::getContext()->shop->id_theme . '.jpg') ? '-' . Context::getContext()->shop->id_theme : ''; if (Configuration::get('PS_LEGACY_IMAGES') && file_exists(_PS_PROD_IMG_DIR_ . $ids . ($type ? '-' . $type : '') . $theme . '.jpg') || ($not_default = strpos($ids, 'default') !== false)) { if ($this->allow == 1 && !$not_default) { $uri_path = __PS_BASE_URI__ . $ids . ($type ? '-' . $type : '') . $theme . '/' . $name . '.jpg'; } else { $uri_path = _THEME_PROD_DIR_ . $ids . ($type ? '-' . $type : '') . $theme . '.jpg'; } } else { $split_ids = explode('-', $ids); $id_image = isset($split_ids[1]) ? $split_ids[1] : $split_ids[0]; $theme = Shop::isFeatureActive() && file_exists(_PS_PROD_IMG_DIR_ . Image::getImgFolderStatic($id_image) . $id_image . ($type ? '-' . $type : '') . '-' . (int) Context::getContext()->shop->id_theme . '.jpg') ? '-' . Context::getContext()->shop->id_theme : ''; if (isset($overimage)) { $sql = "SELECT id_image FROM `" . _DB_PREFIX_ . "image` WHERE `id_product` = '{$overimage}' AND position = 2"; $getoverimage = Db::getInstance()->getRow($sql); if ($getoverimage) { $id_image = array_shift($getoverimage); } else { return false; } } if ($this->allow == 1) { $uri_path = __PS_BASE_URI__ . $id_image . ($type ? '-' . $type : '') . $theme . '/' . $name . '.jpg'; } else { $uri_path = _THEME_PROD_DIR_ . Image::getImgFolderStatic($id_image) . $id_image . ($type ? '-' . $type : '') . $theme . '.jpg'; } } return $this->protocol_content . Tools::getMediaServer($uri_path) . $uri_path; }
public function __construct() { $this->name = 'magicredirect'; $this->tab = 'seo'; $this->version = '1.1.4'; $this->author = 'AgenceMalttt'; $this->secure_key = Tools::encrypt($this->name); $this->need_instance = 0; $this->bootstrap = true; $this->module_key = 'a3e63c648fcae16db808f68e1eb18448'; $this->ps_versions_compliancy = array('min' => '1.6.0.0', 'max' => _PS_VERSION_); $this->tabs_form = array('general' => $this->l('General Settings'), 'cache' => $this->l('Cache Settings')); $models = glob(_PS_MODULE_DIR_ . $this->name . '/models/*.php'); if (!empty($models)) { foreach ($models as $file) { if (!strpos($file, 'index.php')) { require_once $file; } } } if (Shop::isFeatureActive()) { Shop::addTableAssociation('redirect', array('type' => 'shop')); } $this->fields_form = array(array('name' => 'MGRT_AUTOCATCH', 'type' => 'radio', 'desc' => $this->l('Catch all 404 Url\'s and log them for future redirections'), 'label' => $this->l('Catch 404 and log them'), 'default' => '1', 'tab' => 'general', 'values' => array(array('id' => 'type_4_0', 'value' => 0, 'label' => $this->l('No')), array('id' => 'type_4_1', 'value' => 1, 'label' => $this->l('Yes')))), array('name' => 'MGRT_AUTOACTIVE', 'type' => 'radio', 'desc' => $this->l('Activate all generated rules by automatic catcher'), 'label' => $this->l('Activate all generated rules'), 'default' => '0', 'tab' => 'general', 'values' => array(array('id' => 'type_5_0', 'value' => 0, 'label' => $this->l('No')), array('id' => 'type_5_1', 'value' => 1, 'label' => $this->l('Yes')))), array('name' => 'MGRT_DELPARENTREDIR', 'type' => 'radio', 'desc' => $this->l('Redirect dead object (product, category, manufacturer, supplier, cms page, cms category) to their natural parent.'), 'label' => $this->l('Redirect to parent if deleted.'), 'default' => '1', 'tab' => 'general', 'values' => array(array('id' => 'type_6_0', 'value' => 0, 'label' => $this->l('No')), array('id' => 'type_6_1', 'value' => 1, 'label' => $this->l('Yes')))), array('name' => 'MGRT_AUTOPARENTREDIR', 'type' => 'radio', 'desc' => $this->l('Redirect disabled object (product, category, cms page, cms category, supplier, manufacturer) to their natural parent.'), 'label' => $this->l('Redirect to parent if disabled'), 'default' => '1', 'tab' => 'general', 'values' => array(array('id' => 'type_707_0', 'value' => 0, 'label' => $this->l('No')), array('id' => 'type_707_1', 'value' => 1, 'label' => $this->l('Yes')))), array('name' => 'MGRT_HOOKDISP', 'type' => 'radio', 'desc' => $this->l('Display an remember on admin dashboard when there is new 404 to take a look.'), 'label' => $this->l('Display new 404 alert on Admin Dashboard'), 'default' => '1', 'tab' => 'general', 'values' => array(array('id' => 'type_d_0', 'value' => 0, 'label' => $this->l('No')), array('id' => 'type_d_1', 'value' => 1, 'label' => $this->l('Yes')))), array('name' => 'MGRT_URLCACHE', 'type' => 'radio', 'desc' => $this->l('Enable cache for URL rules'), 'label' => $this->l('Faster redirects with cache'), 'default' => '1', 'tab' => 'cache', 'values' => array(array('id' => 'type_4_0', 'value' => 0, 'label' => $this->l('No')), array('id' => 'type_4_1', 'value' => 1, 'label' => $this->l('Yes')))), array('name' => 'MGRT_CACHETIME', 'type' => 'text', 'desc' => $this->l('Cache time (in minutes)'), 'label' => $this->l('Cache time (in minutes)'), 'default' => '60', 'validate' => 'isInt', 'tab' => 'cache')); $this->hooks = array('header', 'dashboardZoneOne', 'actionObjectUpdateAfter', 'actionObjectDeleteBefore'); $this->cache_folder = _PS_CACHE_DIR_ . $this->name . '/cache/'; $this->secure_key = Tools::encrypt($this->name); parent::__construct(); $this->displayName = $this->l('Magic Redirect'); $this->description = $this->l('Predictive and easy redirect tools (Multishop/Multilang)'); }
public function __construct() { $this->table = 'smart_blog_comment'; $this->className = 'Blogcomment'; $this->module = 'smartblog'; $this->context = Context::getContext(); $this->bootstrap = true; if (Shop::isFeatureActive()) { Shop::addTableAssociation($this->table, array('type' => 'shop')); } parent::__construct(); $this->fields_list = array('id_smart_blog_comment' => array('title' => $this->l('Id'), 'width' => 50, 'type' => 'text'), 'email' => array('title' => $this->l('Email'), 'width' => 50, 'type' => 'text', 'lang' => true), 'meta_title' => array('title' => $this->l('Post Title'), 'filter_key' => 'smp!meta_title', 'align' => 'center'), 'name' => array('title' => $this->l('Name'), 'width' => 150, 'type' => 'text'), 'content' => array('title' => $this->l('Comment'), 'width' => 200, 'type' => 'text', 'callback' => 'getCommentClean'), 'created' => array('title' => $this->l('Date'), 'width' => 60, 'type' => 'text', 'lang' => true), 'active' => array('title' => $this->l('Status'), 'width' => '70', 'align' => 'center', 'active' => 'status', 'type' => 'bool', 'orderby' => false)); $this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'icon' => 'icon-trash', 'confirm' => $this->l('Delete selected items?'))); $this->_join = ' LEFT JOIN ' . _DB_PREFIX_ . 'smart_blog_comment_shop sbs ON a.id_smart_blog_comment=sbs.id_smart_blog_comment && sbs.id_shop IN(' . implode(',', Shop::getContextListShopID()) . ')'; $this->_join .= ' LEFT JOIN ' . _DB_PREFIX_ . 'smart_blog_post_lang smp ON a.id_post=smp.id_smart_blog_post and smp.id_lang = ' . (int) Context::getContext()->language->id; $this->_select = 'sbs.id_shop'; $this->_defaultOrderBy = 'a.id_smart_blog_comment'; $this->_defaultOrderWay = 'DESC'; $this->_select = 'smp.meta_title'; //$this->_defaultOrderBy = 'a.id_smart_blog_comment'; if (Shop::isFeatureActive() && Shop::getContext() != Shop::CONTEXT_SHOP) { $this->_group = 'GROUP BY a.id_smart_blog_comment'; } parent::__construct(); }
public static function getBlockContent($params, &$smarty) { //use in template as {getBelvgBlockContent id="block_identifier"} if (!Module::isEnabled('belvg_staticblocks')) { return FALSE; } if (isset($params['id'])) { $block_identifier = $params['id']; $sql = ' SELECT `id_belvg_staticblocks` FROM `' . _DB_PREFIX_ . 'belvg_staticblocks` WHERE `block_identifier` = "' . pSQL($block_identifier) . '" AND `status` = "1"'; if (Shop::isFeatureActive()) { $sql .= ' AND `id_belvg_staticblocks` IN ( SELECT sa.`id_belvg_staticblocks` FROM `' . _DB_PREFIX_ . 'belvg_staticblocks_shop` sa WHERE sa.id_shop IN (' . implode(', ', Shop::getContextListShopID()) . ') )'; } $block_id = (int) Db::getInstance()->getValue($sql); if ($block_id) { $id_lang = Context::getContext()->cookie->id_lang; $block = new self($block_id); if (isset($block->content[$id_lang])) { return $block->content[$id_lang]; } } } }
public function getContent() { $output = ''; $output .= '<div style="display:block;" class="hint"> On some versions you have to disable Cache save than open your shop home page than go back and enable it.<br/> Advanced Parameters > Performance > Clear Smarty cache<br /><br/> Go to back office -> Preferences -> SEO and URLs -> Set userfriendly URL off -> Save<br /> Go to back office -> Preferences -> SEO and URLs -> Set userfriendly URL on -> Save<br /> </div><br />'; $sql = 'SELECT * FROM `' . _DB_PREFIX_ . 'product_lang` WHERE `link_rewrite` IN (SELECT `link_rewrite` FROM `' . _DB_PREFIX_ . 'product_lang` GROUP BY `link_rewrite`, `id_lang` HAVING count(`link_rewrite`) > 1)'; if (Shop::isFeatureActive() && Shop::getContext() == Shop::CONTEXT_SHOP) { $sql .= ' AND `id_shop` = ' . (int) Shop::getContextShopID(); } if ($results = Db::getInstance()->ExecuteS($sql)) { $output .= 'You need to fix duplicate URL entries<br/>'; foreach ($results as $row) { $language_info = $this->context->language->getLanguage($row['id_lang']); $output .= $row['name'] . ' (' . $row['id_product'] . ') - ' . $row['link_rewrite'] . '<br/>'; $shop_info = $this->context->shop->getShop($language_info['id_shop']); $output .= 'Language:' . $language_info['name'] . '<br /> Shop:' . $shop_info['name'] . '<br/><br/>'; } } else { $output .= 'Nice you don\'t have any duplicate URL entries.'; } return $output; }
/** * Returns a link to a product image for display * Note: the new image filesystem stores product images in subdirectories of img/p/ * * @param string $name rewrite link of the image * @param string $ids id part of the image filename - can be "id_product-id_image" (legacy support, recommended) or "id_image" (new) * @param string $type */ public function getImageLink($name, $ids, $type = null) { $not_default = false; // Check if module is installed, enabled, customer is logged in and watermark logged option is on /* if (Configuration::get('WATERMARK_LOGGED') && (Module::isInstalled('watermark') && Module::isEnabled('watermark')) && isset(Context::getContext()->customer->id)) { $type .= '-'.Configuration::get('WATERMARK_HASH'); } */ // legacy mode or default image $theme = Shop::isFeatureActive() && file_exists(_MODULE_SMARTBLOG_DIR_ . $ids . ($type ? '-' . $type : '') . '-' . (int) Context::getContext()->shop->id_theme . '.jpg') ? '-' . Context::getContext()->shop->id_theme : ''; if (Configuration::get('PS_LEGACY_IMAGES') && file_exists(_MODULE_SMARTBLOG_DIR_ . $ids . ($type ? '-' . $type : '') . $theme . '.jpg') || ($not_default = strpos($ids, 'default') !== false)) { if ($this->allow == 1 && !$not_default) { $uri_path = __PS_BASE_URI__ . 'blog/' . $ids . ($type ? '-' . $type : '') . $theme . '/' . $name . '.jpg'; } else { $uri_path = _THEME_PROD_DIR_ . $ids . ($type ? '-' . $type : '') . $theme . '.jpg'; } } else { // if ids if of the form id_product-id_image, we want to extract the id_image part $split_ids = explode('-', $ids); $id_image = isset($split_ids[1]) ? $split_ids[1] : $split_ids[0]; $theme = Shop::isFeatureActive() && file_exists(_MODULE_SMARTBLOG_DIR_ . Image::getImgFolderStatic($id_image) . $id_image . ($type ? '-' . $type : '') . '-' . (int) Context::getContext()->shop->id_theme . '.jpg') ? '-' . Context::getContext()->shop->id_theme : ''; if ($this->allow == 1) { $uri_path = __PS_BASE_URI__ . 'blog/' . $id_image . ($type ? '-' . $type : '') . $theme . '/' . $name . '.jpg'; } else { $uri_path = __PS_BASE_URI__ . 'modules/smartblog/images/' . $id_image . ($type ? '-' . $type : '') . $theme . '.jpg'; } } return $this->protocol_content . Tools::getMediaServer($uri_path) . $uri_path; }
public function install() { if (Shop::isFeatureActive()) { Shop::setContext(Shop::CONTEXT_ALL); } return parent::install() && $this->registerHook('displayShoppingCartFooter') && $this->registerHook('header') && $this->registerHook('displayFooterProduct') && Configuration::updateValue('CUSTOMGIFT_PRODUCTID', '0'); }
/** * Render shop list * * @return string */ public function getRenderedShopList() { if (!Shop::isFeatureActive() || Shop::getTotalShops(false, null) < 2) { return ''; } $shop_context = Shop::getContext(); $context = Context::getContext(); $tree = Shop::getTree(); if ($shop_context == Shop::CONTEXT_ALL || $context->controller->multishop_context_group == false && $shop_context == Shop::CONTEXT_GROUP) { $current_shop_value = ''; $current_shop_name = Translate::getAdminTranslation('All shops'); } elseif ($shop_context == Shop::CONTEXT_GROUP) { $current_shop_value = 'g-' . Shop::getContextShopGroupID(); $current_shop_name = sprintf(Translate::getAdminTranslation('%s group'), $tree[Shop::getContextShopGroupID()]['name']); } else { $current_shop_value = 's-' . Shop::getContextShopID(); foreach ($tree as $group_id => $group_data) { foreach ($group_data['shops'] as $shop_id => $shop_data) { if ($shop_id == Shop::getContextShopID()) { $current_shop_name = $shop_data['name']; break; } } } } $tpl = $this->createTemplate('helpers/shops_list/list.tpl'); $tpl->assign(array('tree' => $tree, 'current_shop_name' => $current_shop_name, 'current_shop_value' => $current_shop_value, 'multishop_context' => $context->controller->multishop_context, 'multishop_context_group' => $context->controller->multishop_context_group, 'is_shop_context' => $context->controller->multishop_context & Shop::CONTEXT_SHOP, 'is_group_context' => $context->controller->multishop_context & Shop::CONTEXT_GROUP, 'shop_context' => $shop_context, 'url' => $_SERVER['REQUEST_URI'] . ($_SERVER['QUERY_STRING'] ? '&' : '?') . 'setShopContext=')); return $tpl->fetch(); }
public function install() { if (Shop::isFeatureActive()) { Shop::setContext(Shop::CONTEXT_ALL); } return parent::install() && $this->registerHook('actionValidateOrder') && Configuration::updateValue('NEW_ORDER_WEBHOOK_URL', 'http://www.example.com/new-order-webhook'); }
public function renderForm() { $this->fields_form = array('legend' => array('title' => $this->l('Contacts'), 'image' => '../img/admin/contact.gif'), 'input' => array(array('type' => 'text', 'label' => $this->l('Title:'), 'name' => 'name', 'size' => 33, 'required' => true, 'lang' => true, 'desc' => $this->l('Contact name (e.g. Technical Support)')), array('type' => 'text', 'label' => $this->l('E-mail address'), 'name' => 'email', 'size' => 33, 'required' => false, 'desc' => $this->l('E-mails will be sent to this address')), array('type' => 'radio', 'label' => $this->l('Save messages?'), 'name' => 'customer_service', 'required' => false, 'class' => 't', 'is_bool' => true, 'desc' => $this->l('If enabled, all messages will be saved in the "Customer Service" page under the "Customer" menu'), 'values' => array(array('id' => 'customer_service_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'customer_service_off', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'textarea', 'label' => $this->l('Description'), 'name' => 'description', 'required' => false, 'lang' => true, 'cols' => 36, 'rows' => 5, 'desc' => $this->l('Additional information about this contact'))), 'submit' => array('title' => $this->l(' Save '), 'class' => 'button')); if (Shop::isFeatureActive()) { $this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association:'), 'name' => 'checkBoxShopAsso'); } return parent::renderForm(); }
public function renderForm() { $this->fields_form = array('legend' => array('title' => $this->l('Contacts'), 'icon' => 'icon-envelope-alt'), 'input' => array(array('type' => 'text', 'label' => $this->l('Title'), 'name' => 'name', 'required' => true, 'lang' => true, 'col' => 4, 'hint' => $this->l('Contact name (e.g. Customer Support).')), array('type' => 'text', 'label' => $this->l('Email address'), 'name' => 'email', 'required' => false, 'col' => 4, 'hint' => $this->l('Emails will be sent to this address.')), array('type' => 'switch', 'label' => $this->l('Save messages?'), 'name' => 'customer_service', 'required' => false, 'class' => 't', 'is_bool' => true, 'hint' => $this->l('If enabled, all messages will be saved in the "Customer Service" page under the "Customer" menu.'), 'values' => array(array('id' => 'customer_service_on', 'value' => 1, 'label' => $this->l('Enabled')), array('id' => 'customer_service_off', 'value' => 0, 'label' => $this->l('Disabled')))), array('type' => 'textarea', 'label' => $this->l('Description'), 'name' => 'description', 'required' => false, 'lang' => true, 'col' => 6, 'hint' => $this->l('Further information regarding this contact.'))), 'submit' => array('title' => $this->l('Save'))); if (Shop::isFeatureActive()) { $this->fields_form['input'][] = array('type' => 'shop', 'label' => $this->l('Shop association'), 'name' => 'checkBoxShopAsso'); } return parent::renderForm(); }