Jump to content

LENTEUR extrême back office !


Recommended Posts

Bonjour,

 

Je suis sur Prestashop 1.5.3.1

 

Je suis confronté à petit problème très génant.

 

Mon site est terminé et fonctionne très bien en front office.

 

Cependant en back office tout fonctionne sauf pour le menu "catalogue" -> "produits" où là c'est hyper hyper lent avant d'afficher les 20 produits de la première page.

 

J'ai essayé de regarder mais en vain je n'y suis pas arrivé.

 

J'ai peut-être ciblé la requête sql qui étati lente.

 

Cette requête ce situe dans le fichier "category.php" qui se situe dans le répertoire /classes situé à la racine du site.

 

Dans ce fichier il y a une requête qui d'après moi fait tout ralentir car quand je la désactive , c'est hyper rapide mais par contre les "associations" aux catégories ne fonctionne pas.

 

Voici la requête que vous pourez aussi voir dans le fichier category.php :

 

 

 

public static function getChildrenWithNbSelectedSubCat($id_parent, $selected_cat, $id_lang, Shop $shop = null, $use_shop_context = true)
{
if (!$shop)
$shop = Context::getContext()->shop;
 
/*id_shop = $shop->id ? $shop->id : Configuration::get('PS_SHOP_DEFAULT');*/
$id_shop = 1;
$selected_cat = explode(',', str_replace(' ', '', $selected_cat));
$sql = 'SELECT c.`id_category`, c.`level_depth`, cl.`name`, IF((
SELECT COUNT(*)
FROM `'._DB_PREFIX_.'category` c2
WHERE c2.`id_parent` = c.`id_category`
) > 0, 1, 0) AS has_children, '.($selected_cat ? '(
SELECT count(c3.`id_category`)
FROM `'._DB_PREFIX_.'category` c3
WHERE c3.`nleft` > c.`nleft`
AND c3.`nright` < c.`nright`
AND c3.`id_category`  IN ('.implode(',', array_map('intval', $selected_cat)).')
)' : '0').' AS nbSelectedSubCat
FROM `'._DB_PREFIX_.'category` c
LEFT JOIN `'._DB_PREFIX_.'category_lang` cl ON (c.`id_category` = cl.`id_category` '.Shop::addSqlRestrictionOnLang('cl', $id_shop).')';
$sql .= ' LEFT JOIN `'._DB_PREFIX_.'category_shop` cs ON (c.`id_category` = cs.`id_category` AND cs.`id_shop` = '.(int)$id_shop.')';
$sql .= ' WHERE `id_lang` = '.(int)$id_lang;
if (Shop::getContext() == Shop::CONTEXT_SHOP && $use_shop_context)
$sql .= ' AND cs.`id_shop` = '.(int)$shop->id;
$sql .= ' AND c.`id_parent` = '.(int)$id_parent;
if (!Shop::isFeatureActive() || Shop::getContext() == Shop::CONTEXT_SHOP && $use_shop_context)
$sql .= ' ORDER BY cs.`position` ASC';
 
return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($sql);
}
 
 
J'ai l'impression donc que cela viendrait d'un problème des catégories et sous catégories ? mais je n'en suis pas sur...
 
ou alors peut être l'AJAX ?
 
 
Si quelqu'un peut m'aider et me donner des pistes ce serait vraiment super car je suis bien embêter avec ce problème
 
MERCI à tous
 
JMA
 
 
 
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...