[Skip to main content](#vessel-content)

#   Comment afficher un champ dans la vue order/show

##

- **[Michel75](/forum/user/12681-michel75 "View Michel75's Profile")**
- [![Michel75's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/12681-michel75 "View Michel75's Profile") Topic Author
- [ Offline](/forum/user/12681-michel75)

Less More

- Posts: 24
- Thank you received: 0
-
-

13 years 8 months ago [\#89868](#89868) by [Michel75](/forum/user/12681-michel75 "View Michel75's Profile")  *[Comment afficher un champ dans la vue order/show](/forum/5-support-en-francais-french-support-/78329-comment-afficher-un-champ-dans-la-vue-order-show#89868 "Voilà je voudrais modifier la vue order/show pour inclure des clauses d'utilisation. j'ai créé des champs que le client remplit au moment de sa commande. Pour l'instant les champs sont visibles à la fin de la facture. Mais je voudrais les inclure dans un texte. et non pas à la suite. Que dois-je écrire comme code pour avoir uniquement le contenu des champs qui m'intéresse.  Merci")* was created by *[Michel75](/forum/user/12681-michel75 "View Michel75's Profile")*

Voilà je voudrais modifier la vue order/show pour inclure des clauses d'utilisation. j'ai créé des champs que le client remplit au moment de sa commande. Pour l'instant les champs sont visibles à la fin de la facture.
Mais je voudrais les inclure dans un texte. et non pas à la suite. Que dois-je écrire comme code pour avoir uniquement le contenu des champs qui m'intéresse.

Merci

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzUtc3VwcG9ydC1lbi1mcmFuY2Fpcy1mcmVuY2gtc3VwcG9ydC0vNzgzMjktY29tbWVudC1hZmZpY2hlci11bi1jaGFtcC1kYW5zLWxhLXZ1ZS1vcmRlci1zaG93P3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

13 years 8 months ago [\#89961](#89961) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[Comment afficher un champ dans la vue order/show](/forum/5-support-en-francais-french-support-/78329-comment-afficher-un-champ-dans-la-vue-order-show#89961 "Voilà je voudrais modifier la vue order/show pour inclure des clauses d'utilisation. j'ai créé des champs que le client remplit au moment de sa commande. Pour l'instant les champs sont visibles à la fin de la facture. Mais je voudrais les inclure dans un texte. et non pas à la suite. Que dois-je écrire comme code pour avoir uniquement le contenu des champs qui m'intéresse.  Merci")*

Bonjour,

Le code pour afficher les champs de produits est: Code:

if(hikashop_level(2) &amp;&amp; !empty($this-&gt;fields['item'])){ foreach($this-&gt;fields['item'] as $field){ $namekey = $field-&gt;field_namekey; if(!empty($product-&gt;$namekey)){ echo '&lt;p class="hikashop_order_item_'.$namekey.'"&gt;'.$this-&gt;fieldsClass-&gt;getFieldName($field).': '.$this-&gt;fieldsClass-&gt;show($field,$product-&gt;$namekey).'&lt;/p&gt;'; } } }

Et les champs de commande: Code:

&lt;?php foreach($this-&gt;fields['order'] as $fieldName =&gt; $oneExtraField) { if(!@$oneExtraField-&gt;field_frontcomp &#124;&#124; empty($this-&gt;order-&gt;$fieldName)) continue; ?&gt; &lt;tr class="hikashop_order_custom_field_&lt;?php echo $fieldName;?&gt;_line"&gt; &lt;td class="key"&gt; &lt;?php echo $this-&gt;fieldsClass-&gt;getFieldName($oneExtraField);?&gt; &lt;/td&gt; &lt;td&gt; &lt;?php echo $this-&gt;fieldsClass-&gt;show($oneExtraField,$this-&gt;order-&gt;$fieldName); ?&gt; &lt;/td&gt; &lt;/tr&gt; &lt;?php } ?&gt;

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzUtc3VwcG9ydC1lbi1mcmFuY2Fpcy1mcmVuY2gtc3VwcG9ydC0vNzgzMjktY29tbWVudC1hZmZpY2hlci11bi1jaGFtcC1kYW5zLWxhLXZ1ZS1vcmRlci1zaG93P3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

- **[Michel75](/forum/user/12681-michel75 "View Michel75's Profile")**
- [![Michel75's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/12681-michel75 "View Michel75's Profile") Topic Author
- [ Offline](/forum/user/12681-michel75)

Less More

- Posts: 24
- Thank you received: 0
-
-

13 years 8 months ago [\#89975](#89975) by [Michel75](/forum/user/12681-michel75 "View Michel75's Profile")  Replied by *[Michel75](/forum/user/12681-michel75 "View Michel75's Profile")* on topic *[Comment afficher un champ dans la vue order/show](/forum/5-support-en-francais-french-support-/78329-comment-afficher-un-champ-dans-la-vue-order-show#89975 "Voilà je voudrais modifier la vue order/show pour inclure des clauses d'utilisation. j'ai créé des champs que le client remplit au moment de sa commande. Pour l'instant les champs sont visibles à la fin de la facture. Mais je voudrais les inclure dans un texte. et non pas à la suite. Que dois-je écrire comme code pour avoir uniquement le contenu des champs qui m'intéresse.  Merci")*

merci pour votre réponse.

mais le code que vous me communiquez est une boucle pour afficher l'ensemble des champs. je voudrais afficher seulement le contenu d'un champ pour l'insérer dans un texte du style

**votre projet est contenuduchampX**

Uniquement le contenu d'un champ spécifique et nom pas tous les champs.

Merci

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzUtc3VwcG9ydC1lbi1mcmFuY2Fpcy1mcmVuY2gtc3VwcG9ydC0vNzgzMjktY29tbWVudC1hZmZpY2hlci11bi1jaGFtcC1kYW5zLWxhLXZ1ZS1vcmRlci1zaG93P3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

13 years 8 months ago [\#90014](#90014) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[Comment afficher un champ dans la vue order/show](/forum/5-support-en-francais-french-support-/78329-comment-afficher-un-champ-dans-la-vue-order-show#90014 "Voilà je voudrais modifier la vue order/show pour inclure des clauses d'utilisation. j'ai créé des champs que le client remplit au moment de sa commande. Pour l'instant les champs sont visibles à la fin de la facture. Mais je voudrais les inclure dans un texte. et non pas à la suite. Que dois-je écrire comme code pour avoir uniquement le contenu des champs qui m'intéresse.  Merci")*

Code:

foreach($this-&gt;fields['order'] as $fieldName =&gt; $oneExtraField) { if($this-&gt;fieldsClass-&gt;getFieldName($oneExtraField) == 'champX') echo $this-&gt;fieldsClass-&gt;show($oneExtraField,$this-&gt;order-&gt;$fieldName); }

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzUtc3VwcG9ydC1lbi1mcmFuY2Fpcy1mcmVuY2gtc3VwcG9ydC0vNzgzMjktY29tbWVudC1hZmZpY2hlci11bi1jaGFtcC1kYW5zLWxhLXZ1ZS1vcmRlci1zaG93P3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

- **[Michel75](/forum/user/12681-michel75 "View Michel75's Profile")**
- [![Michel75's Avatar](https://www.hikashop.com/media/kunena/core/svg/person.svg)](/forum/user/12681-michel75 "View Michel75's Profile") Topic Author
- [ Offline](/forum/user/12681-michel75)

Less More

- Posts: 24
- Thank you received: 0
-
-

13 years 8 months ago [\#90080](#90080) by [Michel75](/forum/user/12681-michel75 "View Michel75's Profile")  Replied by *[Michel75](/forum/user/12681-michel75 "View Michel75's Profile")* on topic *[Comment afficher un champ dans la vue order/show](/forum/5-support-en-francais-french-support-/78329-comment-afficher-un-champ-dans-la-vue-order-show#90080 "Voilà je voudrais modifier la vue order/show pour inclure des clauses d'utilisation. j'ai créé des champs que le client remplit au moment de sa commande. Pour l'instant les champs sont visibles à la fin de la facture. Mais je voudrais les inclure dans un texte. et non pas à la suite. Que dois-je écrire comme code pour avoir uniquement le contenu des champs qui m'intéresse.  Merci")*

J'ai essayé de copier ce code
Code:

foreach($this-&gt;fields['order'] as $fieldName =&gt; $oneExtraField) { if($this-&gt;fieldsClass-&gt;getFieldName($oneExtraField) == 'monchamp') echo $this-&gt;fieldsClass-&gt;show($oneExtraField,$this-&gt;order-&gt;$fieldName); }

où monchamp est un champ créé pour le test . il est bien visible lors de la commande mais il n'apparait pas dans la facture coté partie publique avec ce code. j'ai bien copié ce code dans la partie du template concerné de la vue order/show.php

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzUtc3VwcG9ydC1lbi1mcmFuY2Fpcy1mcmVuY2gtc3VwcG9ydC0vNzgzMjktY29tbWVudC1hZmZpY2hlci11bi1jaGFtcC1kYW5zLWxhLXZ1ZS1vcmRlci1zaG93P3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

- **[Xavier](/forum/user/4105-xavier "View Xavier's Profile")**
- [![Xavier's Avatar](https://www.hikashop.com/media/kunena/avatars/resized/size144/users/avatar4105.png)](/forum/user/4105-xavier "View Xavier's Profile")
- [ Offline](/forum/user/4105-xavier)

Less More

- Posts: 13201
- Thank you received: 2322
-
-
-
- [](http://www.kidiweb.fr)
-

13 years 8 months ago [\#90136](#90136) by [Xavier](/forum/user/4105-xavier "View Xavier's Profile")  Replied by *[Xavier](/forum/user/4105-xavier "View Xavier's Profile")* on topic *[Comment afficher un champ dans la vue order/show](/forum/5-support-en-francais-french-support-/78329-comment-afficher-un-champ-dans-la-vue-order-show#90136 "Voilà je voudrais modifier la vue order/show pour inclure des clauses d'utilisation. j'ai créé des champs que le client remplit au moment de sa commande. Pour l'instant les champs sont visibles à la fin de la facture. Mais je voudrais les inclure dans un texte. et non pas à la suite. Que dois-je écrire comme code pour avoir uniquement le contenu des champs qui m'intéresse.  Merci")*

Qu'avez vous mis comme valeur pour "monchamp", le label ou le column name ? (dans la config du champ)
Dans cet exemple il faut utiliser la valeur du label. Pour la valeur du column name essayez d'utiliser "if($fieldName = "column_name")..." à la place du if existant.

Please [Log in](/login?return=aHR0cHM6Ly93d3cuaGlrYXNob3AuY29tL2ZvcnVtLzUtc3VwcG9ydC1lbi1mcmFuY2Fpcy1mcmVuY2gtc3VwcG9ydC0vNzgzMjktY29tbWVudC1hZmZpY2hlci11bi1jaGFtcC1kYW5zLWxhLXZ1ZS1vcmRlci1zaG93P3RtcGw9bWFya2Rvd24=) or [Create an account](/register) to join the conversation.

Board Categories HikaShop Install &amp; Update Product &amp; Category Display Content Creation Sales and Orders Orders management Reports &amp; Statistics Customers Checkout Payment Methods Shipping Methods Import &amp; Export (CSV, XLS…) Specific Features Affilation Taxes Wishlist Vote Carousel &amp; Slider Mass Actions Filters &amp; Search Discount &amp; Coupon Feature Request Integrations Showcase General Talk about HikaShop Development HikaShop 3.0 Beta Translation Commercial Jobs HikaShop Components HikaMarket Market: Feature requests Market: How to? Market: Bug Report HikaSerial General talk about HikaSerial Serial: Bug Report Serial: How to? Support en Français de HikaSerial (French Support) HikaSubscription HikaAuction Auction: Feature requests Auction: How to? Auction: Bug report Hikashop around the world Support en Français (French Support) Russian FAQ. Курс выживания с Hikashop. Частые вопросы и о Расширения Hikashop Наши сайты на Hikashop 日本語版サポート(Japanese Support) Thai German Archives Bug Report How to?

[](/forum/topics/feed/mode-topics?format=feed&type=rss)

Time to create page: 0.126 seconds

[Powered by](/forum/credits) [Kunena Forum](https://www.kunena.org)
