Jump to content

Recommended Posts

Bonjour,

 

Je suis en train de modifier mon site sous Prestashop (version 1.6.1.4) pour y ajouter une barre de recherche comportant des images. 

J'ai essayé en utilisant ce topic : https://www.prestashop.com/forums/topic/511805-ajout-des-images-dans-la-barre-de-recherche-prestashop-v-1614/

Mais, le problème est que mon thème (pos_dilima_digital) utilise une extension pour la barre de recherche : possearchcategories

Après avoir réussi à localiser puis modifier les bons fichiers, je n'y arrive toujours pas.

En fait, mon problème est que seul les variables "pname" et "cname" sont transmises. Lorsque j'essai de récupérer l'id de mon produit, j'obtiens la valeur "undefined".

Est-ce que quelqu'un pourrait m'éclairer sur la procédure s'il a une idée ?

 

parse: function(data) {
	var mytab = new Array();
	for (var i = 0; i < data.length; i++){
	mytab[mytab.length] = { data: data[i], value: '<img src="https://monsite.com/' + data[i].id + '-home_default/a.jpg" /><p>' + data[i].pname + '</p>'};
    }
    return mytab;
},

Fichier : possearch-instantsearch.tpl

if ($ajax) {
			    
            $sql = 'SELECT DISTINCT p.id_product iname, pl.name pname, cl.name cname, pl.id_product id,
            
                        cl.link_rewrite crewrite, pl.link_rewrite prewrite '.$score.'
                    FROM '._DB_PREFIX_.'product p
                    
                    INNER JOIN `'._DB_PREFIX_.'product_lang` pl ON (
                    
                        p.`id_product` = pl.`id_product`
                        
                        AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').'
                        
                    )
                    
                    '.Shop::addSqlAssociation('product', 'p').'
                    
                    INNER JOIN `'._DB_PREFIX_.'category_lang` cl ON (
                    
                        product_shop.`id_category_default` = cl.`id_category`
                        
                        AND cl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').'
                        
                    )
                    
                    WHERE p.`id_product` '.$product_pool.'
                    
                    ORDER BY position DESC LIMIT 10';
                    
            return $db->executeS($sql);
            
        }

Fichier : Search.php

 

Merci beaucoup,

Nathan

Edited by tuyote (see edit history)
Link to comment
Share on other sites

  • 1 month later...

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...