[résolu]codification champ personnalisé

  • Posts: 117
  • Thank you received: 1
9 years 6 months ago #176792

-- HikaShop version -- : 2.3.3
-- Joomla version -- : 3.3.6
-- PHP version -- : 2.5.6

Bonjour;

J'ai ajouté un champ personnalisé dans la définition de produits : la certification.
Il s'agit d'une liste à choix multiple.
Certains codes (importé depuis une autre application) ont 3 caractères et d'autres en ont 4.

Exemple :

BDL : BETDIN LYON
BDLO : BETDIN LONDRES

Dans le module du filtre si je saisis dans le code de certification le mot lyon on me propose BETDIN LYON.
Mais l'affichage contient tous les produits ayant la référence BDL et la référence BDLO (BETDIN LONDRES).

Comme je ne peux pas gérer les codes de certification (donnés par une application extérieure) comme puis je faire pour n'avoir que le code demandé.

Par avance merci pour vos conseilss

Meilleures salutations

Michel ROTTENBERG

Last edit: 9 years 5 months ago by rottenberg.

Please Log in or Create an account to join the conversation.

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
9 years 6 months ago #176812

Bonjour,

Il n'y a pas d'option pour changer cela.

Changez la ligne:

$fieldsList[] = 'b.'.$filter->filter_options['custom_field'].' LIKE \'%'.hikashop_getEscaped($field,true).'%\'';
en:
$fieldsList[] = 'b.'.$filter->filter_options['custom_field'].' =  '.$database->Quote($field);
									$fieldsList[] = 'b.'.$filter->filter_options['custom_field'].' LIKE \''.hikashop_getEscaped($field,true).',%\'';
									$fieldsList[] = 'b.'.$filter->filter_options['custom_field'].' LIKE \'%,'.hikashop_getEscaped($field,true).'\'';
									$fieldsList[] = 'b.'.$filter->filter_options['custom_field'].' LIKE \'%,'.hikashop_getEscaped($field,true).',%\'';
dans le fichier administrator/components/com_hikashop/classes/filter.php et cela devrait permettre de gérer cela.

Last edit: 9 years 5 months ago by nicolas.

Please Log in or Create an account to join the conversation.

  • Posts: 117
  • Thank you received: 1
9 years 5 months ago #176891

j'ai fait la modification mais j'obtiens une erreur sql :

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OR b.certification LIKE 'BDL,%' OR b.certification LIKE '%,BDL' OR b.certificati' at line 1 SQL=SELECT DISTINCT b.* FROM hfn_hikashop_product_category AS a LEFT JOIN hfn_hikashop_product AS b ON a.product_id=b.product_id WHERE b.product_published=1 AND b.product_type = 'main' AND a.category_id IN (2) AND b.product_quantity!=0 AND (b.product_access = 'all' OR b.product_access LIKE '%,9,%') AND (b.certification = 'BDL' OR OR b.certification LIKE 'BDL,%' OR b.certification LIKE '%,BDL' OR b.certification LIKE '%,BDL,%') ORDER BY a.ordering ASC LIMIT 0, 21


Par ailleurs je n'ai pas trouvé le fichier dans la liste des sources personnalisables, j'ai fait la modification directement dans le repertoire.

Je joins le fichier filter.php aprè modification

File Attachment:

File Name: filter_php.zip
File Size:14 KB



par avance merci pour vos conseils

meilleures salutations

Michel ROTTENBERG

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
9 years 5 months ago #176907

Bonjour,

J'ai fais une erreur dans le code de mon précédent message. J'ai corrigé. Veuillez réappliquer avec le nouveau code et cela devrait éviter le problème.

Please Log in or Create an account to join the conversation.

  • Posts: 117
  • Thank you received: 1
9 years 5 months ago #176932

Pouvez vous me donner le nouveau code.


Par ailleurs je ne trouve pas le source dans la fonction de personnalisation des sources dan HIKA SHOP. J'ai modifié le source directement par FTP. Que se passera-t-il lors d'un upgrade de HIKA SHOP

Meilleures salutations

Michel ROTTENBERG

Please Log in or Create an account to join the conversation.

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
9 years 5 months ago #176952

Le nouveau code est dans mon premier message:
www.hikashop.com/forum/product-category-...onnalise.html#176812
Comme expliqué dans mon précédent message, j'ai corrigé le code de mon premier message directement dans le message.
C'est en effet pas FTP qu'il faut faire la modification.
Si la modification est concluante, merci de nous faire un retour et nous l'inclueront dans la prochaine version d'HikaShop.
Ainsi, pas de soucis pour les prochaines mises à jour.

Please Log in or Create an account to join the conversation.

  • Posts: 117
  • Thank you received: 1
9 years 5 months ago #176989

Je n'ai plus d'erreur mais je n'ai pas le résultat attendu

quand je choisis 'BDL' (BETDIN LYON) je ne récupère aucun produit.
Quand je choisis 'BDLO' (BETDIN LONDRES) je récupère bien les produits correspondants.

meilleures salutations

Michel

Please Log in or Create an account to join the conversation.

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
9 years 5 months ago #177056

J'ai testé sur votre site mais j'ai bien des résultats quand je cherche BDL:
take.ms/QZFtG
Donc je ne vois pas ?
Peut-être avz vous des espaces avant ou après le texte ou quelque chose du genre ?

Please Log in or Create an account to join the conversation.

  • Posts: 117
  • Thank you received: 1
9 years 5 months ago #177088

le champ de filtre nest pas le type de produit.

il faut prendre le second : certification.

tapez Lyon vous obtiendrez le libelle de la certification : BETH DIN DE LYON. Les produits selectionnes seront ceux du BETH DIN DE LONDRES ( code certification correspondant : BDLO) et ceux du BETH DIN de LYON ( code correspondant : BDL).

SI vous tapez Londres dans le critère de choix certification, vous n obtiendrez que ceu du BETH DIN DE LONDRES.


meilleures salutations

Michel ROTTENBERG

Please Log in or Create an account to join the conversation.

  • Posts: 81539
  • Thank you received: 13069
  • MODERATOR
9 years 5 months ago #177105

Pourriez vous fournir un accès au backend du site pour que nous puissions regarder les options de votre site ?

Please Log in or Create an account to join the conversation.

  • Posts: 117
  • Thank you received: 1
9 years 5 months ago #177571

bonsoir,

je viens de télécharger la version 2.3.4.
Le filtre sur un champ de selection ne fonctionne pas. il génère l'erreur suivante :

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'OR b.certification LIKE 'BDLO,%' OR b.certification LIKE '%,BDLO' OR b.certifica' at line 1 SQL=SELECT DISTINCT b.* FROM hfn_hikashop_product_category AS a LEFT JOIN hfn_hikashop_product AS b ON a.product_id=b.product_id WHERE b.product_published=1 AND b.product_type = 'main' AND a.category_id IN (2) AND b.product_quantity!=0 AND (b.product_access = 'all' OR b.product_access LIKE '%,9,%') AND (b.certification = 'BDLO' OR OR b.certification LIKE 'BDLO,%' OR b.certification LIKE '%,BDLO' OR b.certification LIKE '%,BDLO,%') ORDER BY a.ordering ASC LIMIT 0, 21




J'ai remplacé la modification faite dans filter.php par celle donnée ci desssus :

$fieldsList[] = 'b.'.$filter->filter_options.' = '.$database->Quote($field);
$fieldsList[] = 'b.'.$filter->filter_options.' LIKE \''.hikashop_getEscaped($field,true).',%\'';
$fieldsList[] = 'b.'.$filter->filter_options.' LIKE \'%,'.hikashop_getEscaped($field,true).'\'';
$fieldsList[] = 'b.'.$filter->filter_options.' LIKE \'%,'.hikashop_getEscaped($field,true).',%\'';



J'ai fait un essai. Maintenant cela fonctionne. Je n'ai plus aucun problème entre les codes 'BDL' et 'BDLO'.
Meilleures salutations

Michel ROTTENBERG

Last edit: 9 years 5 months ago by rottenberg. Reason: problème résolu

Please Log in or Create an account to join the conversation.

  • Posts: 26004
  • Thank you received: 4004
  • MODERATOR
9 years 5 months ago #177572

Bonjour,

Merci d'éditer le fichier "administrator/components/com_hikashop/classes/filter.php" et de remplacer

$fieldsList[] = 'b.'.$filter->filter_options['custom_field'].' =  '.$database->Quote($field).' OR ';
Pär
$fieldsList[] = 'b.'.$filter->filter_options['custom_field'].' =  '.$database->Quote($field);
Cordialement,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.
The following user(s) said Thank You: rottenberg

Please Log in or Create an account to join the conversation.

Time to create page: 0.077 seconds
Powered by Kunena Forum