Jump to content

ynocquet

Members
  • Posts

    15
  • Joined

  • Last visited

Profile Information

  • Location
    FRANCE
  • Activity
    Other

ynocquet's Achievements

Newbie

Newbie (1/14)

7

Reputation

  1. Hello, The "You come from the future !" issue happens when your server can't reach the Prestashop server to check the available updates. There are three ways to fix this issue both for Prestashop 1.6 and Prestashop 1.7 : Method 1 (not recommanded) : add this command line in your php.ini or replace it if it already exists : allow_url_fopen = Off Be sure that Curl is activated on your server. Method 2 (the proper way) : turn off Fail2ban on your server with the command line /etc/init.d/fail2ban stop or configure it so it fail2ban won't block access to the Prestashop server. Method 3 (last resort method) : if you have no access to your server or if method 1 & 2 are not applicable, then go to /modules/autoupgrade/classes/Tools14.php and replace the function shouldUseFopen public static function shouldUseFopen($url) { return in_array(ini_get('allow_url_fopen'), array('On', 'on', '1')) || !preg_match('/^https?:\/\//', $url); } by the function: public static function shouldUseFopen($url) { return in_array(ini_get('allow_url_fopen'), array('Off', 'off', '0')) || !preg_match('/^https?:\/\//', $url); } Keep in mind that method 3 is an hack and that method 2 is the proper one. Regards,
  2. Hello, Since today (around 9 am), the error "is not a valid module name" is shown when _PS_MODE_DEV = true on version 1.6.1.1 on two different shops I have (with different folders and without any core modification) and prevent any access to the back office. The error is likely to come from Prestashop. How to fix the error ? Thanks, Edit: the error has disappeared at 12 am.
  3. Après plusieurs heures de recherche, j'ai finalement résolu le problème pour Prestashop 1.6.x.x. 1) Vérifiez que curl et allow_url_fopen sont activés sur votre serveur. 2) Vérifiez que les identifiants utilisés sont valides en vous connectant manuellement sur le site de Prestashop addons. 3) La fonction file_get_contents n'utilise pas le curl car une des conditions n'est jamais remplie, ce qui empêche le back-office de se connecter. Dans /classes/tools.php, remplacez la ligne suivante de la fonction file_get_contents : if (in_array(ini_get('allow_url_fopen'), array('On', 'on', '1')) || !preg_match('/^https?:\/\//', $url)) { par la ligne suivante : if (!preg_match('/^https?:\/\//', $url)) { Vous devriez maintenant pouvoir vous connecter à Prestashop addons et profiter des mises à jour des modules.
  4. Après plusieurs heures de recherche, j'ai finalement résolu le problème pour Prestashop 1.6.x.x. 1) Vérifiez que curl et allow_url_fopen sont activés sur votre serveur. 2) Vérifiez que les identifiants utilisés sont valides en vous connectant manuellement sur le site de Prestashop addons. 3) La fonction file_get_contents n'utilise pas le curl car une des conditions n'est jamais remplie, ce qui empêche le back-office de se connecter. Dans /classes/tools.php, remplacez la ligne suivante de la fonction file_get_contents : if (in_array(ini_get('allow_url_fopen'), array('On', 'on', '1')) || !preg_match('/^https?:\/\//', $url)) { par la ligne suivante : if (!preg_match('/^https?:\/\//', $url)) { Vous devriez maintenant pouvoir vous connecter à Prestashop addons et profiter des mises à jour des modules. Edit : autre méthode : Stoppez le service fail2ban ou configurez-le de telle sorte qu'il ne bloque pas l'accès au serveur Prestashop : /etc/init.d/fail2ban stop
  5. After several hours, I have finally found the issue and solved it for 1.6.x.x versions. (You must be sure that curl and allow_url_fopen are activated) In /classes/tools.php, the function file_get_contents never uses curl because one of the conditions is wrong. In the function file_get_contents, you must replace the following line : if (in_array(ini_get('allow_url_fopen'), array('On', 'on', '1')) || !preg_match('/^https?:\/\//', $url)) { by this line : if (!preg_match('/^https?:\/\//', $url)) { You should now be able to connect to prestashop addons.
  6. After several hours, I have finally found the issue and solved it for 1.6.x.x versions. (You must be sure that curl and allow_url_fopen are activated) In /classes/tools.php, the function file_get_contents never uses curl because one of the conditions is wrong. In the function file_get_contents, you must replace the following line : if (in_array(ini_get('allow_url_fopen'), array('On', 'on', '1')) || !preg_match('/^https?:\/\//', $url)) { by this line : if (!preg_match('/^https?:\/\//', $url)) { You should now be able to connect to prestashop addons.
  7. Cela a été dit et redit, il n'y a aucun test réalisé sur les modules mis à jour, trois fois sur quatre il y a des bugs bloquants ... Bienvenue sur Prestashop
  8. Bonjour, Cela fonctionne, merci beaucoup. Pour expliciter votre propos, il suffit d'ajouter les deux lignes ci-dessous à votre thème (adaptez le chemin d'accès selon l'emplacement de votre thème ; dans l'exemple ci-dessous les lignes sont placées dans le fichier .tpl du template du modèle blocklayered) <link rel="stylesheet" type="text/css" href="../../js/jquery/ui/themes/base/jquery.ui.slider.css" /> <link rel="stylesheet" type="text/css" href="../../js/jquery/ui/themes/base/jquery.ui.theme.css" /> Pour éviter l'appel des fichiers dans le template, il est également possible de copier le contenu des deux fichiers dans blocklayered.css, auquel cas il faudra veiller à modifier le chemin d'accès aux images.
  9. Même problème rencontré, sans solution ... La glissière ne fonctionne pas et ce également en local avec une version vierge de PS 1.6.0.11
  10. Ok i was wrong Change the GetbestSaleslight function instead of GetbestSales by this new function. It should work public static function getBestSalesLight($id_lang, $page_number = 0, $nb_products = 10, Context $context = null) { if (!$context) $context = Context::getContext(); if ($page_number < 0) $page_number = 0; if ($nb_products < 1) $nb_products = 10; $sql_groups = ''; if (Group::isFeatureActive()) { $groups = FrontController::getCurrentCustomerGroups(); $sql_groups = 'AND cg.`id_group` '.(count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1'); } //Subquery: get product ids in a separate query to (greatly!) improve performances and RAM usage $products = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT cp.`id_product` FROM `'._DB_PREFIX_.'category_product` cp LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = cp.`id_category`) WHERE cg.`id_group` '.$sql_groups.' AND cp.id_category = '.(int)Tools::getValue('id_category')); $ids = array(); foreach ($products as $product) $ids[$product['id_product']] = 1; $ids = array_keys($ids); sort($ids); $ids = count($ids) > 0 ? implode(',', $ids) : 'NULL'; //Main query $sql = ' SELECT p.id_product, MAX(product_attribute_shop.id_product_attribute) id_product_attribute, pl.`link_rewrite`, pl.`name`, pl.`description_short`, product_shop.`id_category_default`, MAX(image_shop.`id_image`) id_image, il.`legend`, ps.`quantity` AS sales, p.`ean13`, p.`upc`, cl.`link_rewrite` AS category, p.show_price, p.available_for_order, IFNULL(stock.quantity, 0) as quantity, p.customizable, IFNULL(pa.minimal_quantity, p.minimal_quantity) as minimal_quantity, stock.out_of_stock, product_shop.`date_add` > "'.date('Y-m-d', strtotime('-'.(Configuration::get('PS_NB_DAYS_NEW_PRODUCT') ? (int)Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20).' DAY')).'" as new, product_shop.`on_sale` FROM `'._DB_PREFIX_.'product_sale` ps LEFT JOIN `'._DB_PREFIX_.'product` p ON ps.`id_product` = p.`id_product` '.Shop::addSqlAssociation('product', 'p').' LEFT JOIN `'._DB_PREFIX_.'product_attribute` pa ON (p.`id_product` = pa.`id_product`) '.Shop::addSqlAssociation('product_attribute', 'pa', false, 'product_attribute_shop.`default_on` = 1').' '.Product::sqlStock('p', 'product_attribute_shop', false, $context->shop).' LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').' LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`)'. Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').' LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.') LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON cl.`id_category` = product_shop.`id_category_default` AND cl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').' WHERE product_shop.`active` = 1 AND p.`visibility` != \'none\' AND p.`id_product` IN ('.$ids.') GROUP BY product_shop.id_product ORDER BY sales DESC LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products; if (!$result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql)) return false; return Product::getProductsProperties($id_lang, $result); }
  11. Hello, Replace the function getBestSales in classes/productsale.php by this one public static function getBestSales($id_lang, $page_number = 0, $nb_products = 10, $order_by = null, $order_way = null) { if ($page_number < 0) $page_number = 0; if ($nb_products < 1) $nb_products = 10; $final_order_by = $order_by; $order_table = ''; if (is_null($order_by) || $order_by == 'position' || $order_by == 'price') $order_by = 'sales'; if ($order_by == 'date_add' || $order_by == 'date_upd') $order_table = 'product_shop'; if (is_null($order_way) || $order_by == 'sales') $order_way = 'DESC'; $sql_groups = ''; if (Group::isFeatureActive()) { $groups = FrontController::getCurrentCustomerGroups(); $sql_groups = 'WHERE cp.`id_product` IS NOT NULL AND cg.`id_group` '.(count($groups) ? 'IN ('.implode(',', $groups).')' : '= 1'); } $interval = Validate::isUnsignedInt(Configuration::get('PS_NB_DAYS_NEW_PRODUCT')) ? Configuration::get('PS_NB_DAYS_NEW_PRODUCT') : 20; // Subquery: get product ids in a separate query to (greatly!) improve performances and RAM usage $products = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT cp.`id_product` FROM `'._DB_PREFIX_.'category_group` cg INNER JOIN `'._DB_PREFIX_.'category_product` cp ON (cp.`id_category` = cg.`id_category`) '.$sql_groups); $ids = array(); foreach ($products as $product) if (Validate::isUnsignedId($product['id_product'])) $ids[$product['id_product']] = 1; $ids = array_keys($ids); $ids = array_filter($ids); sort($ids); $ids = count($ids) > 0 ? implode(',', $ids) : 'NULL'; //Main query $sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) as quantity, pl.`description`, pl.`description_short`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, m.`name` AS manufacturer_name, p.`id_manufacturer` as id_manufacturer, MAX(image_shop.`id_image`) id_image, il.`legend`, ps.`quantity` AS sales, t.`rate`, pl.`meta_keywords`, pl.`meta_title`, pl.`meta_description`, DATEDIFF(p.`date_add`, DATE_SUB(NOW(), INTERVAL '.$interval.' DAY)) > 0 AS new FROM `'._DB_PREFIX_.'product_sale` ps LEFT JOIN `'._DB_PREFIX_.'product` p ON ps.`id_product` = p.`id_product` '.Shop::addSqlAssociation('product', 'p', false).' LEFT JOIN `'._DB_PREFIX_.'product_lang` pl ON p.`id_product` = pl.`id_product` AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').' LEFT JOIN `'._DB_PREFIX_.'image` i ON (i.`id_product` = p.`id_product`)'. Shop::addSqlAssociation('image', 'i', false, 'image_shop.cover=1').' LEFT JOIN `'._DB_PREFIX_.'image_lang` il ON (i.`id_image` = il.`id_image` AND il.`id_lang` = '.(int)$id_lang.') LEFT JOIN `'._DB_PREFIX_.'manufacturer` m ON (m.`id_manufacturer` = p.`id_manufacturer`) LEFT JOIN `'._DB_PREFIX_.'tax_rule` tr ON (product_shop.`id_tax_rules_group` = tr.`id_tax_rules_group`) AND tr.`id_country` = '.(int)Context::getContext()->country->id.' AND tr.`id_state` = 0 LEFT JOIN `'._DB_PREFIX_.'tax` t ON (t.`id_tax` = tr.`id_tax`) '.Product::sqlStock('p').' WHERE product_shop.`active` = 1 AND p.`visibility` != \'none\' AND p.`id_product` IN ('.$ids.') GROUP BY product_shop.id_product ORDER BY '.(!empty($order_table) ? '`'.pSQL($order_table).'`.' : '').'`'.pSQL($order_by).'` '.pSQL($order_way).' LIMIT '.(int)($page_number * $nb_products).', '.(int)$nb_products; $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql); if ($final_order_by == 'price') Tools::orderbyPrice($result, $order_way); if (!$result) return false; return Product::getProductsProperties($id_lang, $result); } Then, create the hook. There are many subjects that explain how to create a hook.
  12. Hi, For Prestashop 1.6 users, just go to class/productsale.php and replace this part (line 160-164) //Subquery: get product ids in a separate query to (greatly!) improve performances and RAM usage $products = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT cp.`id_product` FROM `'._DB_PREFIX_.'category_product` cp LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = cp.`id_category`) WHERE cg.`id_group` '.$sql_groups); by this new part : //Subquery: get product ids in a separate query to (greatly!) improve performances and RAM usage $products = Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS(' SELECT cp.`id_product` FROM `'._DB_PREFIX_.'category_product` cp LEFT JOIN `'._DB_PREFIX_.'category_group` cg ON (cg.`id_category` = cp.`id_category`) WHERE cg.`id_group` '.$sql_groups.' AND cp.id_category = '.(int)Tools::getValue('id_category')); Then, create a new hook in your category page.
×
×
  • Create New...