Example #1
0
 public function postProcess()
 {
     if (!Module::isInstalled('aplazame') || !Module::isEnabled('aplazame')) {
         $this->error('Aplazame is not enabled');
     }
     $cartId = $mid = Tools::getValue('checkout_token');
     $secureKey = Tools::getValue('key', false);
     if (!$mid || !$secureKey) {
         $this->error('Missing required fields');
     }
     $cart = new Cart((int) $mid);
     if (!Validate::isLoadedObject($cart)) {
         $this->error('Cart does not exists or does not have an order');
     }
     $response = $this->module->callToRest('POST', '/orders/' . $mid . '/authorize');
     if ($response['is_error']) {
         $message = 'Aplazame Error #' . $response['code'];
         if (isset($response['payload']['error']['message'])) {
             $message .= ' ' . $response['payload']['error']['message'];
         }
         $this->module->validateOrder($cartId, Configuration::get('PS_OS_ERROR'), $cart->getOrderTotal(true), $this->module->displayName, $message, null, null, false, $secureKey);
         $this->error('Authorization error');
     }
     $cartAmount = AplazameSerializers::formatDecimals($cart->getOrderTotal(true));
     if ($response['payload']['amount'] !== $cartAmount) {
         $this->error('Invalid');
     }
     $aplazameAmount = AplazameSerializers::decodeDecimals($response['payload']['amount']);
     if (!$this->module->validateOrder($cartId, Configuration::get('PS_OS_PAYMENT'), $aplazameAmount, $this->module->displayName, null, null, null, false, $secureKey)) {
         $this->error('Cannot validate order');
     }
     exit('success');
 }
Example #2
0
 public function getImageLink($name, $ids, $type = null)
 {
     $context = Context::getContext();
     // check if WebP support is enabled.
     if ($context->cookie->exists() && $context->cookie->WebPSupport) {
         $extension = '.webp';
     } else {
         $extension = '.jpg';
     }
     $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(_PS_PROD_IMG_DIR_ . $ids . ($type ? '-' . $type : '') . '-' . (int) Context::getContext()->shop->id_theme . $extension) ? '-' . Context::getContext()->shop->id_theme : '';
     if (Configuration::get('PS_LEGACY_IMAGES') && file_exists(_PS_PROD_IMG_DIR_ . $ids . ($type ? '-' . $type : '') . $theme . $extension) || ($not_default = strpos($ids, 'default') !== false)) {
         if ($this->allow == 1 && !$not_default) {
             $uri_path = __PS_BASE_URI__ . $ids . ($type ? '-' . $type : '') . $theme . '/' . $name . $extension;
         } else {
             $uri_path = _THEME_PROD_DIR_ . $ids . ($type ? '-' . $type : '') . $theme . $extension;
         }
     } 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(_PS_PROD_IMG_DIR_ . Image::getImgFolderStatic($id_image) . $id_image . ($type ? '-' . $type : '') . '-' . (int) Context::getContext()->shop->id_theme . $extension) ? '-' . Context::getContext()->shop->id_theme : '';
         if ($this->allow == 1) {
             $uri_path = __PS_BASE_URI__ . $id_image . ($type ? '-' . $type : '') . $theme . '/' . $name . $extension;
         } else {
             $uri_path = _THEME_PROD_DIR_ . Image::getImgFolderStatic($id_image) . $id_image . ($type ? '-' . $type : '') . $theme . $extension;
         }
     }
     return $this->protocol_content . Tools::getMediaServer($uri_path) . $uri_path;
 }
 public function hookLeftColumn($params)
 {
     if (Module::isInstalled('smartblog') != 1) {
         $this->smarty->assign(array('smartmodname' => $this->name));
         return $this->display(__FILE__, 'views/templates/front/install_required.tpl');
     } else {
         if (!$this->isCached('smartblogrecentposts.tpl', $this->getCacheId())) {
             global $smarty;
             $id_lang = $this->context->language->id;
             $posts = SmartBlogPost::getRecentPosts($id_lang);
             $i = 0;
             foreach ($posts as $post) {
                 if (file_exists(_PS_MODULE_DIR_ . 'smartblog/images/' . $post['id_smart_blog_post'] . '.jpg')) {
                     $image = $post['id_smart_blog_post'];
                     $posts[$i]['post_img'] = $image;
                 } else {
                     $posts[$i]['post_img'] = 'no';
                 }
                 $i++;
             }
             $smarty->assign(array('posts' => $posts));
         }
         return $this->display(__FILE__, 'views/templates/front/smartblogrecentposts.tpl', $this->getCacheId());
     }
 }
Example #4
0
    private function _postProcess()
    {
        // Get var 'action'
        $action = Tools::getValue('action');
        if (Tools::getValue('submitExport') && $action) {
            if ($action == 'customers') {
                $result = $this->_getCustomers();
            } else {
                if (!Module::isInstalled('blocknewsletter')) {
                    $this->_html .= $this->displayError('The module "blocknewsletter" is required for this feature');
                } else {
                    $result = $this->_getBlockNewsletter();
                }
            }
            if ($fd = @fopen(dirname(__FILE__) . '/' . strval(preg_replace('#\\.{2,}#', '.', $action)) . '_' . $this->_file, 'w')) {
                foreach ($result as $tab) {
                    $this->_my_fputcsv($fd, $tab);
                }
                fclose($fd);
                $nb = count($result) > 1 ? count($result) - 1 : 0;
                $this->_html .= $this->displayConfirmation($this->l('The .CSV file has been successfully exported.') . ' (' . $nb . ' ' . $this->l('customers found') . ')<br />
				<a href="../modules/newsletter/' . Tools::safeOutput(strval($action)) . '_' . $this->_file . '"><b>' . $this->l('Download the file') . ' ' . $this->_file . '</b></a>
				<br />
				<ol style="margin-top: 10px;">
					<li style="color: red;">' . $this->l('WARNING: If opening this .csv file with Excel, remember to choose UTF-8 encoding or you may see strange characters.') . '</li>
				</ol>');
            } else {
                $this->_html .= $this->displayError($this->l('Error: cannot write') . ' ' . dirname(__FILE__) . '/' . strval($action) . '_' . $this->_file . ' !');
            }
        }
    }
 private function listAllowed()
 {
     global $smarty;
     if (Module::isInstalled('agilemultipleseller')) {
         include_once _PS_ROOT_DIR_ . "/modules/agilemultipleseller/agilemultipleseller.php";
         include_once _PS_ROOT_DIR_ . "/modules/agilemultipleseller/SellerInfo.php";
         $id_owner = AgileSellerManager::getObjectOwnerID('product', Tools::getValue('id_product'));
         $smarty->assign(array('id_seller' => $id_owner));
         if ($id_owner > 0) {
             if (intval(Configuration::get('AGILE_MS_PRODUCT_APPROVAL')) == 1) {
                 $approved = AgileMultipleSeller::is_list_approved(Tools::getValue('id_product'));
                 if ($approved != 1) {
                     return false;
                 }
             }
             if (Module::isInstalled('agilesellerlistoptions')) {
                 include_once _PS_ROOT_DIR_ . "/modules/agilesellerlistoptions/agilesellerlistoptions.php";
                 $listoption = AgileSellerListOptions::get_product_list_option(Tools::getValue('id_product'), AgileSellerListOptions::ASLO_OPTION_LIST);
                 $liststatus = intval($listoption['status']);
                 $aslo_list_prod_id = intval(Configuration::get('ASLO_PROD_FOR_OPTION' . AgileSellerListOptions::ASLO_OPTION_LIST));
                 if ($liststatus != AgileSellerListOptions::ASLO_STATUS_IN_EFFECT && $aslo_list_prod_id != AgileSellerListOptions::ASLO_ALWAYS_FREE) {
                     return false;
                 }
             }
         }
     }
     return true;
 }
 public function initOptions()
 {
     $this->optionTitle = $this->l('Settings');
     $blogCategories = SimpleBlogCategory::getCategories($this->context->language->id);
     $simpleBlogCategories = array();
     $simpleBlogCategories[0] = $this->l('All categories');
     $simpleBlogCategories[9999] = $this->l('Featured only');
     foreach ($blogCategories as $key => $category) {
         $simpleBlogCategories[$category['id']] = $category['name'];
     }
     $recentPosts = array();
     if (Module::isInstalled('ph_recentposts')) {
         $recentPosts = array('recent_posts' => array('submit' => array('title' => $this->l('Update'), 'class' => 'button'), 'title' => $this->l('Recent Posts widget settings'), 'image' => '../img/t/AdminOrderPreferences.gif', 'fields' => array('PH_RECENTPOSTS_LAYOUT' => array('title' => $this->l('Recent Posts layout:'), 'show' => true, 'required' => true, 'type' => 'radio', 'choices' => array('full' => $this->l('Full width with large images'), 'grid' => $this->l('Grid'))), 'PH_RECENTPOSTS_GRID_COLUMNS' => array('title' => $this->l('Grid columns:'), 'cast' => 'intval', 'desc' => $this->l('Working only with "Recent Posts layout:" setup to "Grid"'), 'show' => true, 'required' => true, 'type' => 'radio', 'choices' => array('2' => $this->l('2 columns'), '3' => $this->l('3 columns'), '4' => $this->l('4 columns'))), 'PH_RECENTPOSTS_NB' => array('title' => $this->l('Number of displayed Recent Posts'), 'cast' => 'intval', 'desc' => $this->l('Default: 4'), 'type' => 'text', 'required' => true, 'validation' => 'isUnsignedId'), 'PH_RECENTPOSTS_CAT' => array('title' => $this->l('Category:'), 'cast' => 'intval', 'desc' => $this->l('If you not select any category then Recent Posts will displayed posts from all categories'), 'show' => true, 'required' => true, 'type' => 'radio', 'choices' => $simpleBlogCategories))));
     }
     $relatedPosts = array();
     if (Module::isInstalled('ph_relatedposts')) {
         $relatedPosts = array('related_posts' => array('submit' => array('title' => $this->l('Update'), 'class' => 'button'), 'title' => $this->l('Related Posts widget settings'), 'image' => '../img/t/AdminOrderPreferences.gif', 'fields' => array('PH_RELATEDPOSTS_GRID_COLUMNS' => array('title' => $this->l('Grid columns:'), 'cast' => 'intval', 'desc' => $this->l('Working only with "Recent Posts layout:" setup to "Grid"'), 'show' => true, 'required' => true, 'type' => 'radio', 'choices' => array('2' => $this->l('2 columns'), '3' => $this->l('3 columns'), '4' => $this->l('4 columns'))))));
     }
     $alert_class = $this->is_16 === true ? 'alert alert-info' : 'info';
     $standard_options = array('general' => array('title' => $this->l('PrestaHome SimpleBlog Settings'), 'image' => '../img/t/AdminOrderPreferences.gif', 'info' => '<a class="button btn btn-default" href="index.php?controller=AdminSimpleBlogSettings&token=' . Tools::getValue('token') . '&regenerateThumbnails=1" class="bold"><i class="process-icon-cogs"></i>' . $this->l('Regenerate thumbnails') . '</a><br /><br />', 'fields' => array('PH_BLOG_POSTS_PER_PAGE' => array('title' => $this->l('Posts per page:'), 'cast' => 'intval', 'desc' => $this->l('Number of blog posts displayed per page. Default is 10.'), 'type' => 'text', 'required' => true, 'validation' => 'isUnsignedId'), 'PH_BLOG_SLUG' => array('title' => $this->l('Blog main URL (by default: blog)'), 'validation' => 'isGenericName', 'required' => true, 'type' => 'text', 'size' => 40), 'PH_BLOG_MAIN_TITLE' => array('title' => $this->l('Blog title:'), 'validation' => 'isGenericName', 'type' => 'textLang', 'size' => 40), 'PH_BLOG_DATEFORMAT' => array('title' => $this->l('Blog default date format:'), 'desc' => $this->l('More details: http://php.net/manual/pl/function.date.php'), 'validation' => 'isGenericName', 'type' => 'text', 'size' => 40), 'PH_CATEGORY_SORTBY' => array('title' => $this->l('Sort categories by:'), 'desc' => $this->l('Select which method use to sort categories in SimpleBlog Categories Block'), 'show' => true, 'required' => true, 'type' => 'radio', 'choices' => array('position' => $this->l('Position (1-9)'), 'name' => $this->l('Name (A-Z)'), 'id' => $this->l('ID (1-9)'))), 'PH_BLOG_FB_INIT' => array('title' => $this->l('Init Facebook?'), 'validation' => 'isBool', 'cast' => 'intval', 'desc' => $this->l('If you already use some Facebook widgets in your theme please select option to "No". If you select "Yes" then SimpleBlog will add facebook connect script on single post page.'), 'required' => true, 'type' => 'bool')), 'submit' => array('title' => $this->l('Update'), 'class' => 'button')), 'layout' => array('submit' => array('title' => $this->l('Update'), 'class' => 'button'), 'title' => $this->l('Appearance Settings - General'), 'image' => '../img/t/AdminOrderPreferences.gif', 'fields' => array('PH_BLOG_LAYOUT' => array('title' => $this->l('Main layout:'), 'show' => true, 'required' => true, 'type' => 'radio', 'choices' => array('default' => $this->l('3 columns, enabled left column and right column'), 'left_sidebar' => $this->l('2 columns, enabled left column'), 'right_sidebar' => $this->l('2 columns, enabled right column'), 'full_width' => $this->l('Full width - Left and right column will be removed'))), 'PH_BLOG_DISPLAY_BREADCRUMBS' => array('title' => $this->l('Display breadcrumbs in center-column?'), 'validation' => 'isBool', 'cast' => 'intval', 'desc' => $this->l('Sometimes you want to remove breadcrumbs from center-column'), 'required' => true, 'type' => 'bool'), 'PH_BLOG_LIST_LAYOUT' => array('title' => $this->l('Posts list layout:'), 'show' => true, 'required' => true, 'type' => 'radio', 'choices' => array('full' => $this->l('Full width with large images'), 'grid' => $this->l('Grid'))), 'PH_BLOG_GRID_COLUMNS' => array('title' => $this->l('Grid columns:'), 'cast' => 'intval', 'desc' => $this->l('Working only with "Posts list layout" setup to "Grid"'), 'show' => true, 'required' => true, 'type' => 'radio', 'choices' => array('2' => $this->l('2 columns'), '3' => $this->l('3 columns'), '4' => $this->l('4 columns'))), 'PH_BLOG_CSS' => array('title' => $this->l('Custom CSS'), 'show' => true, 'required' => false, 'type' => 'textarea', 'cols' => '70', 'rows' => '10'))), 'single_post' => array('submit' => array('title' => $this->l('Update'), 'class' => 'button'), 'title' => $this->l('Appearance Settings - Single post'), 'image' => '../img/t/AdminOrderPreferences.gif', 'fields' => array('PH_BLOG_DISPLAY_LIKES' => array('title' => $this->l('Display "likes"?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool'), 'PH_BLOG_FB_COMMENTS' => array('title' => $this->l('Use FB comments on single post page?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool'), 'PH_BLOG_DISPLAY_SHARER' => array('title' => $this->l('Use share icons on single post page?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool'), 'PH_BLOG_DISPLAY_AUTHOR' => array('title' => $this->l('Display post author?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool', 'desc' => $this->l('This option also applies to the list of posts from the category')), 'PH_BLOG_DISPLAY_DATE' => array('title' => $this->l('Display post creation date?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool', 'desc' => $this->l('This option also applies to the list of posts from the category')), 'PH_BLOG_DISPLAY_FEATURED' => array('title' => $this->l('Display post featured image?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool'), 'PH_BLOG_DISPLAY_CATEGORY' => array('title' => $this->l('Display post category?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool', 'desc' => $this->l('This option also applies to the list of posts from the category')), 'PH_BLOG_DISPLAY_TAGS' => array('title' => $this->l('Display post tags?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool', 'desc' => $this->l('This option also applies to the list of posts from the category')))), 'category_page' => array('submit' => array('title' => $this->l('Update'), 'class' => 'button'), 'title' => $this->l('Appearance Settings - Post lists'), 'image' => '../img/t/AdminOrderPreferences.gif', 'fields' => array('PH_BLOG_DISPLAY_THUMBNAIL' => array('title' => $this->l('Display post thumbnails?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool'), 'PH_BLOG_DISPLAY_DESCRIPTION' => array('title' => $this->l('Display post short description?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool'), 'PH_BLOG_DISPLAY_CAT_DESC' => array('title' => $this->l('Display category description on category page?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool'), 'PH_BLOG_DISPLAY_CATEGORY_IMAGE' => array('title' => $this->l('Display category image?'), 'validation' => 'isBool', 'cast' => 'intval', 'required' => true, 'type' => 'bool'), 'PH_CATEGORY_IMAGE_X' => array('title' => $this->l('Default category image width (px)'), 'cast' => 'intval', 'desc' => $this->l('Default: 535 (For PrestaShop 1.5), 870 (For PrestaShop 1.6)'), 'type' => 'text', 'required' => true, 'validation' => 'isUnsignedId'), 'PH_CATEGORY_IMAGE_Y' => array('title' => $this->l('Default category image height (px)'), 'cast' => 'intval', 'desc' => $this->l('Default: 150'), 'type' => 'text', 'required' => true, 'validation' => 'isUnsignedId'))), 'thumbnails' => array('submit' => array('title' => $this->l('Update'), 'class' => 'button'), 'title' => $this->l('Thumbnails Settings'), 'image' => '../img/t/AdminOrderPreferences.gif', 'info' => '<div class="' . $alert_class . '">' . $this->l('Remember to regenerate thumbnails after doing changes here') . '</div>', 'fields' => array('PH_BLOG_THUMB_METHOD' => array('title' => $this->l('Resize method:'), 'cast' => 'intval', 'desc' => $this->l('Select wich method use to resize thumbnail. Adaptive resize: What it does is resize the image to get as close as possible to the desired dimensions, then crops the image down to the proper size from the center.'), 'show' => true, 'required' => true, 'type' => 'radio', 'choices' => array('1' => $this->l('Adaptive resize (recommended)'), '2' => $this->l('Crop from center'))), 'PH_BLOG_THUMB_X' => array('title' => $this->l('Default thumbnail width (px)'), 'cast' => 'intval', 'desc' => $this->l('Default: 255 (For PrestaShop 1.5), 420 (For PrestaShop 1.6)'), 'type' => 'text', 'required' => true, 'validation' => 'isUnsignedId'), 'PH_BLOG_THUMB_Y' => array('title' => $this->l('Default thumbnail height (px)'), 'cast' => 'intval', 'desc' => $this->l('Default: 200 (For PrestaShop 1.5 and 1.6)'), 'type' => 'text', 'required' => true, 'validation' => 'isUnsignedId'), 'PH_BLOG_THUMB_X_WIDE' => array('title' => $this->l('Default thumbnail width (wide version) (px)'), 'cast' => 'intval', 'desc' => $this->l('Default: 535 (For PrestaShop 1.5), 870 (For PrestaShop 1.6)'), 'type' => 'text', 'required' => true, 'validation' => 'isUnsignedId'), 'PH_BLOG_THUMB_Y_WIDE' => array('title' => $this->l('Default thumbnail height (wide version) (px)'), 'cast' => 'intval', 'desc' => $this->l('Default: 350 (For PrestaShop 1.5 and 1.6)'), 'type' => 'text', 'required' => true, 'validation' => 'isUnsignedId'))));
     $widgets_options = array();
     $widgets_options = array_merge($recentPosts, $relatedPosts);
     //$this->hide_multishop_checkbox = true;
     $this->fields_options = array_merge($standard_options, $widgets_options);
     return parent::renderOptions();
 }
Example #7
0
 public function getSliders()
 {
     if (Module::isInstalled('homesliderpro')) {
         $SlidersEverywhere = new homesliderpro();
         $hooks = $SlidersEverywhere->getConfig('HOMESLIDERPRO_HOOKS', (int) $this->getShopId());
         if (empty($hooks)) {
             $hooks = $SlidersEverywhere->getConfig('HOMESLIDERPRO_HOOKS');
         }
         $cmsPage = Tools::getValue('id_cms');
         $html = '<option value="0">' . $this->l('None') . '</option>';
         if (!empty($hooks)) {
             if ($cmsPage != '') {
                 foreach ($hooks as $hook) {
                     if ($sel = Db::getInstance()->getRow('SELECT * FROM `' . _DB_PREFIX_ . 'cms` WHERE proslider = "' . $hook . '" AND id_cms=' . $cmsPage)) {
                         $selected = 'selected="selected"';
                     } else {
                         $selected = '';
                     }
                     $html .= '<option ' . $selected . ' value="' . $hook . '">' . $hook . '</option>';
                 }
             } else {
                 foreach ($hooks as $hook) {
                     $selected = '';
                     $html .= '<option ' . $selected . ' value="' . $hook . '">' . $hook . '</option>';
                 }
             }
         }
         return $html;
     }
     return false;
 }
 public function initToolbar()
 {
     if (Module::isInstalled('agilemultipleseller') and $this->is_seller) {
         return;
     }
     parent::initToolbar();
 }
 public function getList($id_lang, $order_by = null, $order_way = null, $start = 0, $limit = null, $id_lang_shop = false)
 {
     if (Module::isInstalled('agilemultipleseller')) {
         $this->agilemultipleseller_list_override();
     }
     parent::getList($id_lang, $order_by, $order_way, $start, $limit, $id_lang_shop);
 }
Example #10
0
 public static function addSqlAssociation($table, $alias, $inner_join = true, $on = null, $force_not_default = false)
 {
     $sql = parent::addSqlAssociation($table, $alias, $inner_join, $on, $force_not_default);
     if (!Module::isInstalled('agilemultipleshop')) {
         return $sql;
     }
     $eaccess = AgileSellerManager::get_entity_access($table);
     if ($eaccess['owner_table_type'] == AgileSellerManager::OWNER_TABLE_UNKNOWN) {
         return $sql;
     }
     $xr_table = $eaccess['owner_xr_table'];
     $include_shared = '';
     if (!$eaccess['is_exclusive']) {
         $include_shared = ',0';
     }
     if (Shop::$id_shop_owner > 0) {
         $join = $inner_join ? 'INNER JOIN ' : 'LEFT JOIN ';
         if ($table == 'feature') {
             $join = 'LEFT JOIN ';
         }
         if ($eaccess['owner_table_type'] == AgileSellerManager::OWNER_TABLE_DEFINED) {
             $sql .= $join . _DB_PREFIX_ . $table . '_owner ' . $table . '_owner ON (' . $alias . '.id_' . $table . '=' . $table . '_owner.id_' . $table . ' AND IFNULL(' . $table . '_owner.id_owner,0) IN (' . Shop::$id_shop_owner . $include_shared . '))';
         } else {
             $sql .= $join . _DB_PREFIX_ . 'object_owner ' . $table . '_object_owner ON (' . $table . '_object_owner.entity=\'' . $table . '\' AND ' . $alias . '.id_' . $table . '= ' . $table . '_object_owner.id_object AND IFNULL(' . $table . '_object_owner.id_owner,0) IN (' . Shop::$id_shop_owner . $include_shared . '))';
         }
     }
     return $sql;
 }
Example #11
0
 public function hookLeftColumn($params)
 {
     if (Module::isInstalled('smartblog') != 1) {
         $this->smarty->assign(array('smartmodname' => $this->name));
         return $this->display(__FILE__, 'views/templates/front/install_required.tpl');
     } else {
         if (!$this->isCached('smartblogtag.tpl', $this->getCacheId())) {
             $view_data = array();
             $id_lang = $this->context->language->id;
             if (Configuration::get('smartshowposttag') != '' && Configuration::get('smartshowposttag') != null) {
                 $limit = Configuration::get('smartshowposttag');
             } else {
                 $limit = 10;
             }
             $id_lang_default = configuration::get('PS_LANG_DEFAULT');
             $sqllangdefault = 'SELECT * FROM ' . _DB_PREFIX_ . 'smart_blog_post_tag p INNER JOIN 
             ' . _DB_PREFIX_ . 'smart_blog_post_shop s ON p.id_post=s.id_smart_blog_post AND s.id_shop = ' . (int) Context::getContext()->shop->id . ' INNER JOIN 
             ' . _DB_PREFIX_ . 'smart_blog_tag t ON p.id_tag= t.id_tag where t.id_lang = ' . (int) $id_lang_default . ' LIMIT ' . $limit;
             $sql = 'SELECT * FROM ' . _DB_PREFIX_ . 'smart_blog_post_tag p INNER JOIN 
             ' . _DB_PREFIX_ . 'smart_blog_post_shop s ON p.id_post=s.id_smart_blog_post AND s.id_shop = ' . (int) Context::getContext()->shop->id . ' INNER JOIN 
             ' . _DB_PREFIX_ . 'smart_blog_tag t ON p.id_tag= t.id_tag where t.id_lang = ' . (int) $id_lang . ' LIMIT ' . $limit;
             $tags = Db::getInstance()->ExecuteS($sql);
             if (empty($tags)) {
                 $tags = Db::getInstance()->ExecuteS($sqllangdefault);
             }
             $this->smarty->assign(array('tags' => $tags));
         }
         return $this->display(__FILE__, 'views/templates/front/smartblogtag.tpl', $this->getCacheId());
     }
 }
 private function _postProcess()
 {
     if (isset($_POST['submitExport']) and isset($_POST['action'])) {
         if ($_POST['action'] == 'customers') {
             $result = $this->_getCustomers();
         } else {
             if (!Module::isInstalled('blocknewsletter')) {
                 $this->_html .= $this->displayError('The module "blocknewsletter" is required for this feature');
             } else {
                 $result = $this->_getBlockNewsletter();
             }
         }
         if (!($nb = intval(Db::getInstance()->NumRows()))) {
             $this->_html .= $this->displayError($this->l('No customers were found with these filters !'));
         } elseif ($fd = @fopen(dirname(__FILE__) . '/' . strval(preg_replace('#\\.{2,}#', '.', $_POST['action'])) . '_' . $this->_file, 'w')) {
             foreach ($result as $tab) {
                 $this->_my_fputcsv($fd, $tab);
             }
             fclose($fd);
             $this->_html .= $this->displayConfirmation($this->l('The .CSV file has been successfully exported') . ' (' . $nb . ' ' . $this->l('customers found') . ')<br />> <a href="../modules/newsletter/' . strval($_POST['action']) . '_' . $this->_file . '"><b>' . $this->l('Download the file') . '</b></a>');
         } else {
             $this->_html .= $this->displayError($this->l('Error: cannot write to') . ' ' . dirname(__FILE__) . '/' . strval($_POST['action']) . '_' . $this->_file . ' !');
         }
     }
 }
Example #13
0
 public function displayFormSettings()
 {
     $veykuwqwjkus = "currency";
     ${"GLOBALS"}["tthknplj"] = "currencies";
     $lfapjegsknsa = "currency_list";
     $this->context->controller->addCSS($this->_path . "css/agilepaypal.css", "all");
     ${${"GLOBALS"}["teujyh"]} = array();
     array_push(${$lfapjegsknsa}, array("id" => 0, "name" => $this->l('Please choose')));
     $tfcoqgvrd = "helper";
     ${${"GLOBALS"}["sajaoqav"]} = Currency::getCurrencies(false, false);
     foreach (${${"GLOBALS"}["tthknplj"]} as ${$veykuwqwjkus}) {
         $unlqgrxvnkrh = "currency";
         array_push(${${"GLOBALS"}["teujyh"]}, array("id" => ${${"GLOBALS"}["duxtnwtj"]}["id_currency"], "name" => ${$unlqgrxvnkrh}["name"]));
     }
     ${${"GLOBALS"}["ogzmjfmjkidg"]} = array("form" => array("legend" => array("title" => $this->l('Settings'), "image" => $this->_path . "logo.gif"), "input" => array(array("type" => "text", "label" => $this->l('PayPal business e-mail'), "class" => "width10", "name" => "business", "size" => 33), array("type" => "select", "label" => $this->l('Paypal Account Currency'), "name" => "paypal_currency", "options" => array("query" => ${${"GLOBALS"}["teujyh"]}, "id" => "id", "name" => "name"), "desc" => $this->l('Please select the your Paypal Account Currency.')), array("type" => "radio", "label" => $this->l('Sandbox mode (Test)'), "name" => "sandbox", "values" => array(array("id" => "sandbox_yes", "value" => 1, "label" => $this->l('Yes')), array("id" => "sandbox_no", "value" => 0, "label" => $this->l('No')))), array("type" => "radio", "label" => $this->l('Mutiple Sellers Mode'), "name" => "support_sellers", "hint" => $this->l('If you have installed the Agile Multiple Seller module'), "form_group_class" => Module::isInstalled("agilemultipleseller") ? "" : "hidden", "values" => array(array("id" => "support_sellers_yes", "value" => 1, "label" => $this->l('Yes')), array("id" => "support_sellers_no", "value" => 0, "label" => $this->l('No'))), "desc" => array($this->l('All settings are the same for all sellers, except the Paypal account information which is managed in the Agile Multiple Seller module'))), array("type" => "htmlhr", "name" => "section1", "values" => array()), array("type" => "text", "label" => $this->l('Banner image URL'), "class" => "width10", "name" => "header", "size" => 82, "desc" => $this->l('The image should be hosted on a secured server in order to avoid security warnings. Size should be limited to 750x90px.')), array("type" => "htmlhr", "name" => "section2", "values" => array()), array("type" => "agile_radio_checkbox", "label" => $this->l('Express Checkout Enabled'), "name" => "express_enabled", "values" => array(array("id" => "express_enabled_yes", "value" => 1, "label" => $this->l('Yes'), "onclick" => "showitem('.express_enabled_yes')", "checkbox_list" => array("class" => "express_enabled_yes agile-radio-checkbox", "query" => array(array("id" => "hidecountry", "val" => 1, "name" => $this->l('Hide Countries') . "<font color=red>&nbsp;--&nbsp;" . $this->l('If your store ships to one country only.') . "</font>"), array("id" => "hidecarrier", "val" => 1, "name" => $this->l('Hide Carriers') . "<font color=red>&nbsp;--&nbsp;" . $this->l('If your store has one carrier, or no carrier') . "</font>"), array("id" => "hideterms", "val" => 1, "name" => $this->l('Hide Terms and Conditions') . "&nbsp;&nbsp;" . $this->l('Hide Terms and Conditions') . "&nbsp;--&nbsp;" . $this->l('If your want to hide the "Terms & Conditions" agreement checkbox at the express checkout screen'))), "id" => "id", "name" => "name")), array("id" => "express_enabled_no", "value" => 0, "label" => $this->l('No'), "onclick" => "hideitem('.express_enabled_yes')"))), array("type" => "htmlhr", "name" => "section3", "values" => array()), array("type" => "radio", "label" => $this->l('Force "Checkout" goes though summary page'), "name" => "force_summary", "values" => array(array("id" => "force_summary_yes", "value" => 1, "label" => $this->l('Yes')), array("id" => "force_summary_no", "value" => 0, "label" => $this->l('No'))), "desc" => $this->l('There are two buttons (Cart and Checkout) in the cart block. The "Checkout" button will bypass the order summary page, so the user will not be able to choose Express Checkout. Selecting "Yes" will force Checkout to go though the order summary page')), array("type" => "htmlhr", "name" => "section4", "values" => array()), array("type" => "agile_radio_checkbox", "label" => $this->l('Enable Recurring Payment'), "name" => "recurringpayment", "hint" => $this->l('Determine whether allow customers to subcribe for automatic, periodic payments, such as membership payments, etc.'), "values" => array(array("id" => "recurringpayment_yes", "value" => 1, "label" => $this->l('Yes'), "p" => $this->l('This will allow customers to subcribe for automatic, periodic payments, such as membership payments, etc.'), "onclick" => "showitem('.recurringpayment_yes')", "checkbox_list" => array("class" => "recurringpayment_yes agile-radio-checkbox", "query" => array(array("id" => "recurringdaily", "val" => 1, "name" => $this->l('Daily')), array("id" => "recurringweekly", "val" => 1, "name" => $this->l('Weekly')), array("id" => "recurringmonthly", "val" => 1, "name" => $this->l('Mobthly')), array("id" => "recurringyearly", "val" => 1, "name" => $this->l('Yearly'))), "id" => "id", "name" => "name")), array("id" => "recurringpayment_no", "value" => 0, "label" => $this->l('No'), "onclick" => "hideitem('.recurringpayment_yes')"))), array("type" => "htmlhr", "name" => "section5", "values" => array()), array("type" => "agile_text_addon", "label" => $this->l('Paypal Micropayment Account(Optional)'), "class" => "width10", "name" => "business2", "hint" => $this->l('Please leave this field empty if you are not using it'), "size" => 33, "addon_text" => $this->l('Max Amount:'), "addon_name" => "micro_amount", "addon_id" => "micro_amount", "size_addon" => 10, "desc" => array($this->l('What is Paypal Micropayment Account?'), $this->l('PayPal offers support for Micropayments to merchants for US to US, GB to GB, AU to AU, and EU to EU transactions for Business and Premier accounts. This feature is offered at a special rate of 5% + $0.05 per transaction. ') . "<a href=\"https://www.paypalobjects.com/IntegrationCenter/ic_micropayments.html\" target=\"_blank\" style=\"color:Blue\">" . $this->l('See here for detail') . "</a>")), array("type" => "agile_radio_checkbox", "label" => $this->l('Membership Integrattion'), "name" => "am_integrated", "hint" => $this->l(' Integrated with membership module'), "form_group_class" => Module::isInstalled("agilemembership") ? "" : "hidden", "values" => array(array("id" => "am_integrated_yes", "value" => 1, "label" => $this->l('Yes'), "onclick" => "showitem('.am_integrated_yes')", "checkbox_list" => array("class" => "am_integrated_yes agile-radio-checkbox", "query" => array(array("id" => "am_show_choice", "val" => 1, "name" => $this->l('Allow customer to choose repeating times')), array("id" => "am_mix_product", "val" => 1, "name" => $this->l('Prevent Membership and other product mix in the shopping cart')), array("id" => "subscribe_only", "val" => 1, "name" => $this->l('Make this module for membership payment only'))), "id" => "id", "name" => "name")), array("id" => "am_integrated_no", "value" => 0, "label" => $this->l('No'), "onclick" => "hideitem('.am_integrated_yes')")))), "submit" => array("title" => $this->l('Update settings'))));
     $fjxhbnyyanl = "lang";
     ${$tfcoqgvrd} = new HelperForm();
     $helper->show_toolbar = false;
     $helper->table = $this->name;
     ${$fjxhbnyyanl} = new Language((int) Configuration::get("PS_LANG_DEFAULT"));
     $helper->default_form_language = $lang->id;
     $helper->module = $this;
     $helper->allow_employee_form_lang = Configuration::get("PS_BO_ALLOW_EMPLOYEE_FORM_LANG") ? Configuration::get("PS_BO_ALLOW_EMPLOYEE_FORM_LANG") : 0;
     $helper->identifier = $this->identifier;
     $helper->submit_action = "submitPaypal";
     $helper->currentIndex = $this->context->link->getAdminLink("AdminModules", false) . "&configure=" . $this->name . "&tab_module=" . $this->tab . "&module_name=" . $this->name;
     $helper->token = Tools::getAdminTokenLite("AdminModules");
     $helper->tpl_vars = array("fields_value" => $this->getConfigFieldsValues(), "languages" => $this->context->controller->getLanguages(), "id_language" => $this->context->language->id);
     $this->_html .= $helper->generateForm(array(${${"GLOBALS"}["ogzmjfmjkidg"]}));
     $this->context->controller->addCSS($this->_path . "css/agilepaypal.css", "all");
     $this->context->controller->addJS($this->_path . "js/agilepaypal.js");
 }
 public function viewAccess($disable = false)
 {
     if (Module::isInstalled('agilemultipleshop')) {
         return true;
     }
     return parent::viewAccess($disable);
 }
 protected function setRequestUri()
 {
     parent::setRequestUri();
     if (Module::isInstalled('yamodule') && strpos($this->request_uri, 'module/yamodule/')) {
         $this->request_uri = iconv('windows-1251', 'UTF-8', $this->request_uri);
     }
 }
 public function __construct()
 {
     parent::__construct();
     if (Module::isInstalled('agilemultipleseller') or Module::isInstalled('agilemultipleshop')) {
         unset($this->fields_options['general']['fields']['PS_MULTISHOP_FEATURE_ACTIVE']);
     }
 }
Example #17
0
 /**
  * Checks if the module has new upgrade scripts and applies them.
  * These scripts located in the modules `upgrade` directory, with versions above the current installed version.
  *
  * @param Module $module the module to check and apply the updates for.
  */
 public function checkForUpdates($module)
 {
     if (!Module::isInstalled($module->name)) {
         return;
     }
     // Prestashop 1.4 does not have any auto-update mechanism.
     // Prestashop < 1.5.4.0 has a bug that causes the auto-update mechanism fail.
     if (version_compare(_PS_VERSION_, '1.5.4.0', '<')) {
         // If the module is already updated to the latest version, don't continue.
         $installed_version = (string) Nosto::helper('nosto_tagging/config')->getInstalledVersion();
         if (version_compare($installed_version, $module->version, '=')) {
             return;
         }
         foreach ($this->findUpgradeScripts($module) as $script) {
             if (file_exists($script['file']) && is_readable($script['file'])) {
                 // Run the script and update the currently installed module version so future updates can work.
                 include_once $script['file'];
                 call_user_func($script['upgrade_function'], $module);
             }
         }
         // Always update the installed version so that we can check it during the next requests in order
         // to avoid reading the file system for upgrade script all the time.
         Nosto::helper('nosto_tagging/config')->saveInstalledVersion($module->version);
     }
     // Prestashop >= 1.5.4.0 handles the auto-update mechanism.
 }
Example #18
0
    private function _postProcess()
    {
        if (isset($_POST['submitExport']) and isset($_POST['action'])) {
            if ($_POST['action'] == 'customers') {
                $result = $this->_getCustomers();
            } else {
                if (!Module::isInstalled('blocknewsletter')) {
                    $this->_html .= $this->displayError('The module "blocknewsletter" is required for this feature');
                } else {
                    $result = $this->_getBlockNewsletter();
                }
            }
            if (!($nb = (int) Db::getInstance(_PS_USE_SQL_SLAVE_)->NumRows())) {
                $this->_html .= $this->displayError($this->l('No customers found with these filters!'));
            } elseif ($fd = @fopen(dirname(__FILE__) . '/' . strval(preg_replace('#\\.{2,}#', '.', $_POST['action'])) . '_' . $this->_file, 'w')) {
                foreach ($result as $tab) {
                    $this->_my_fputcsv($fd, $tab);
                }
                fclose($fd);
                $this->_html .= $this->displayConfirmation(sprintf($this->l('The .CSV file has been successfully exported. (%d customers found)'), $nb) . '<br />
				<a href="../modules/newsletter/' . Tools::safeOutput(strval($_POST['action'])) . '_' . $this->_file . '"><b>' . $this->l('Download the file') . ' ' . $this->_file . '</b></a>
				<br />
				<ol style="margin-top: 10px;">
					<li style="color: red;">' . $this->l('WARNING: If opening this .csv file with Excel, remember to choose UTF-8 encoding or you may see strange characters.') . '</li>
				</ol>');
            } else {
                $this->_html .= $this->displayError($this->l('Error: cannot write') . ' ' . dirname(__FILE__) . '/' . strval($_POST['action']) . '_' . $this->_file . ' !');
            }
        }
    }
Example #19
0
 public static function find($id_lang, $expr, $page_number = 1, $page_size = 1, $order_by = 'position', $order_way = 'desc', $ajax = false, $use_cookie = true, Context $context = null)
 {
     // Call parent method
     $find = parent::find($id_lang, $expr, $page_number, $page_size, $order_by, $order_way, $ajax, $use_cookie, $context);
     if (isset($find['result']) && !empty($find['result']) && Module::isInstalled('mymodcomments')) {
         // List id product
         $products = $find['result'];
         $id_product_list = array();
         foreach ($products as $p) {
             $id_product_list[] = (int) $p['id_product'];
         }
         // Get grade average and nb comments for products in list
         require_once dirname(__FILE__) . '/../../modules/mymodcomments/classes/MyModComment.php';
         $grades_comments = MyModComment::getInfosOnProductsList($id_product_list);
         // Associate grade and nb comments with product
         foreach ($products as $kp => $p) {
             foreach ($grades_comments as $gc) {
                 if ($gc['id_product'] == $p['id_product']) {
                     $products[$kp]['mymodcomments']['grade_avg'] = round($gc['grade_avg']);
                     $products[$kp]['mymodcomments']['nb_comments'] = $gc['nb_comments'];
                 }
             }
         }
         $find['result'] = $products;
     }
     // Return products
     return $find;
 }
    public function hookAdminStatsModules($params)
    {
        if (Module::isInstalled('blocknewsletter')) {
            $totals = $this->getTotals();
            if (Tools::getValue('export')) {
                $this->csvExport(array('type' => 'line', 'layers' => 3));
            }
            $this->_html = '
			<div class="panel-heading">
				' . $this->displayName . '
			</div>
			<div class="row row-margin-bottom">
				<div class="col-lg-12">
					<div class="col-lg-8">
						' . $this->engine(array('type' => 'line', 'layers' => 3)) . '
					</div>
					<div class="col-lg-4">
						<ul class="list-unstyled">
							<li>' . $this->l('Customer registrations:') . ' ' . (int) $totals['customers'] . '</li>
							<li>' . $this->l('Visitor registrations: ') . ' ' . (int) $totals['visitors'] . '</li>
							<li>' . $this->l('Both:') . ' ' . (int) $totals['both'] . '</li>
						</ul>
						<hr/>
						<a class="btn btn-default export-csv" href="' . Tools::safeOutput($_SERVER['REQUEST_URI'] . '&export=1') . '">
							<i class="icon-cloud-upload"></i> ' . $this->l('CSV Export') . '
						</a>
					</div>
				</div>
			</div>';
        } else {
            $this->_html = '<p>' . $this->l('The "Newsletter block" module must be installed.') . '</p>';
        }
        return $this->_html;
    }
 public function __construct()
 {
     $this->name = 'nqgatewayneteven';
     $tab_name = 'Tools';
     if (constant('_PS_VERSION_') >= 1.4) {
         $tab_name = 'market_place';
     }
     $this->tab = $tab_name;
     $this->version = '2.8';
     $this->author = 'NetEven';
     parent::__construct();
     $this->displayName = $this->l('NetEven');
     $this->description = $this->l('Vendez sur toutes les marketplaces depuis votre PrestaShop');
     $this->ps_versions_compliancy = array('min' => '1.4', 'max' => _PS_VERSION_);
     $this->feature_url = '/script/set-neteven-categories.php?token=' . Tools::encrypt(Configuration::get('PS_SHOP_NAME'));
     $this->order_url = '/script/import-order.php?token=' . Tools::encrypt(Configuration::get('PS_SHOP_NAME')) . '&active=1';
     $this->product_url = '/script/update-product.php?token=' . Tools::encrypt(Configuration::get('PS_SHOP_NAME')) . '&active=1';
     if (!$this->getSOAP()) {
         $this->warning = $this->l('SOAP should be installed for this module');
     }
     if (version_compare(_PS_VERSION_, '1.5', '<')) {
         require _PS_MODULE_DIR_ . $this->name . '/backward_compatibility/backward.php';
     }
     if (Module::isInstalled($this->name)) {
         $this->unInstallHookByVersion();
         $this->installHookByVersion();
         $this->installCarrier();
     }
 }
Example #22
0
 protected function truncateTables($case)
 {
     if (!Module::isInstalled('agilemultipleseller')) {
         return truncateTables($case);
     }
     $controller = Context::getContext()->controller;
     if (!$controller->is_seller) {
         return truncateTables($case);
     }
     switch ((int) $case) {
         case $this->entities[$this->l('Products')]:
             $subquery = 'SELECT id_product FROM ' . _DB_PREFIX_ . 'product_owner WHERE id_owner=' . (int) $controller->context->cookie->id_employee;
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'product` WHERE id_product IN (' . $subquery . ')');
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'product_shop` WHERE id_product IN (' . $subquery . ')');
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'feature_product` WHERE id_product IN (' . $subquery . ')');
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'product_lang` WHERE id_product IN (' . $subquery . ')');
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'category_product` WHERE id_product IN (' . $subquery . ')');
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'product_tag` WHERE id_product IN (' . $subquery . ')');
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'specific_price` WHERE id_product IN (' . $subquery . ')');
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'specific_price_priority` WHERE id_product IN (' . $subquery . ')');
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'product_carrier` WHERE id_product IN (' . $subquery . ')');
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'cart_product` WHERE id_product IN (' . $subquery . ')');
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'compare_product` WHERE id_product IN (' . $subquery . ')');
             if (count(Db::getInstance()->executeS('SHOW TABLES LIKE \'' . _DB_PREFIX_ . 'favorite_product\' '))) {
                 Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'favorite_product` WHERE id_product IN (' . $subquery . ')');
             }
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'product_attachment` WHERE id_product IN (' . $subquery . ')');
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'product_country_tax` WHERE id_product IN (' . $subquery . ')');
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'product_download` WHERE id_product IN (' . $subquery . ')');
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'product_group_reduction_cache` WHERE id_product IN (' . $subquery . ')');
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'product_sale` WHERE id_product IN (' . $subquery . ')');
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'product_supplier` WHERE id_product IN (' . $subquery . ')');
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'scene_products` WHERE id_product IN (' . $subquery . ')');
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'warehouse_product_location` WHERE id_product IN (' . $subquery . ')');
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'customization` WHERE id_product IN (' . $subquery . ')');
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'customization_field` WHERE id_product IN (' . $subquery . ')');
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'supply_order_detail` WHERE id_product IN (' . $subquery . ')');
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'attribute_impact` WHERE id_product IN (' . $subquery . ')');
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'product_attribute` WHERE id_product IN (' . $subquery . ')');
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'product_attribute_shop` WHERE id_product IN (' . $subquery . ')');
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'product_attribute_combination` WHERE id_product IN (' . $subquery . ')');
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'product_attribute_image` WHERE id_product IN (' . $subquery . ')');
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'pack` WHERE id_product_pack IN (' . $subquery . ') OR  WHERE id_product_item IN (' . $subquery . ')');
             $stockquery = 'SELECT id_stock FROM `' . _DB_PREFIX_ . 'stock` WHERE id_product IN (' . $subquery . ')';
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'stock` WHERE id_product IN (' . $stockquery . ')');
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'stock_available` WHERE id_product IN (' . $stockquery . ')');
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'stock_mvt` WHERE id_stock IN (' . $stockquery . ')');
             $imagequery = 'SELECT id_image FROM `' . _DB_PREFIX_ . 'image` WHERE id_product IN (' . $subquery . ')';
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'image` WHERE id_iamge IN (' . $imagequery . ')');
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'image_lang` WHERE id_iamge IN (' . $imagequery . ')');
             Db::getInstance()->execute('DELETE FROM `' . _DB_PREFIX_ . 'image_shop` WHERE id_iamge IN (' . $imagequery . ')');
             if (!file_exists(_PS_PROD_IMG_DIR_)) {
                 mkdir(_PS_PROD_IMG_DIR_);
             }
             break;
     }
     Image::clearTmpDir();
     return true;
 }
Example #23
0
 public function process()
 {
     parent::process();
     if (Module::isInstalled('agilesellershipping')) {
         include_once _PS_ROOT_DIR_ . "/modules/agilesellershipping/agilesellershipping.php";
         AgileSellerShipping::override_carriers();
     }
 }
 protected function afterUpdate($object)
 {
     $res = parent::afterUpdate($object);
     if ($res && Module::isInstalled('agilemultipleseller') && Tools::getValue('id_employee') && Tools::getValue('passwd')) {
         AgileSellerManager::syncSellerCredentials('b2f', Tools::getValue('id_employee'));
     }
     return $res;
 }
 public function renderForm()
 {
     $scripts_4_hide = '';
     if (Module::isInstalled('agilemultipleshop')) {
         $scripts_4_hide = $this->hide_shop_defaultsetting();
     }
     return parent::renderForm() . $scripts_4_hide;
 }
 /**
  * Constructor
  *
  * @param Request $request
  * @return ModulesAdminController
  */
 function __construct($request)
 {
     parent::__construct($request);
     $this->wireframe->addBreadCrumb(lang('Modules'), assemble_url('admin_modules'));
     $module_name = $this->request->get('module_name');
     if ($module_name) {
         $this->active_module = Modules::findById($module_name);
         if (!instance_of($this->active_module, 'Module')) {
             $module_class = Inflector::camelize($module_name) . 'Module';
             $module_class_file = APPLICATION_PATH . "/modules/{$module_name}/{$module_class}.class.php";
             if (is_file($module_class_file)) {
                 require_once $module_class_file;
                 $this->active_module = new $module_class();
             }
             // if
         }
         // if
         if (instance_of($this->active_module, 'Module')) {
             $this->wireframe->addBreadCrumb($this->active_module->getDisplayName(), $this->active_module->getViewUrl());
             if ($this->active_module->isInstalled()) {
                 if ($this->active_module->canBeUninstalled()) {
                     $uninstall_message = lang('Your are about to uninstall :name module', array('name' => $this->active_module->getDisplayName())) . '. ';
                     if ($this->active_module->getUninstallMessage()) {
                         $uninstall_message .= $this->active_module->getUninstallMessage() . '. ';
                     }
                     // if
                     $uninstall_message .= lang('There is NO UNDO. Continue?');
                     $this->wireframe->addPageAction(lang('Uninstall'), $this->active_module->getUninstallUrl(), null, array('method' => 'post', 'confirm' => $uninstall_message));
                 }
                 // if
             } else {
                 $this->wireframe->addPageMessage(lang(':name module is not installed yet. Click on the Install button above this message to install this module', array('name' => $this->active_module->getDisplayName())));
                 $this->wireframe->addPageAction(lang('Install'), $this->active_module->getInstallUrl());
             }
             // if
         } else {
             $this->httpError(HTTP_ERR_NOT_FOUND);
         }
         // if
     } else {
         $this->active_module = new Module();
     }
     // if
     $this->smarty->assign(array('active_module' => $this->active_module));
 }
Example #27
0
 public function getDeliveryOption($default_country = null, $dontAutoSelectOptions = false, $use_cache = true)
 {
     @session_start();
     if (Module::isInstalled('agilepaypal') && isset($_SESSION['agile_paypal_validating_order']) && $_SESSION['agile_paypal_validating_order'] == 1 && isset($this->delivery_option) && $this->delivery_option != '') {
         $_SESSION['agile_paypal_validating_order'] = 0;
         return Tools::unSerialize($this->delivery_option);
     }
     return parent::getDeliveryOption($default_country, $dontAutoSelectOptions, $use_cache);
 }
Example #28
0
 public function update($nullValues = false)
 {
     if (Module::isInstalled('agilemultipleshop')) {
         if (isset($_SESSION[$this->_name])) {
             $_COOKIE[$this->_name] = $_SESSION[$this->_name];
         }
     }
     parent::update($nullValues);
 }
 public function processUpdate()
 {
     $ret = parent::processUpdate();
     if (!Module::isInstalled('agilemultipleseller')) {
         return $ret;
     }
     ObjectModel::cleear_unnecessary_lang_data();
     return $ret;
 }
Example #30
0
 public function init()
 {
     if (Module::isInstalled('magicredirect') && Module::isEnabled('magicredirect')) {
         require_once _PS_MODULE_DIR_ . 'magicredirect/magicredirect.php';
         $mod = new MagicRedirect();
         $mod->catchUrls();
     }
     return parent::init();
 }