formattage adresse commande

  • Posts: 2639
  • Thank you received: 66
  • Hikashop Business
12 years 7 months ago #50989

dans l'email de notification de commande

$shipping = $template;
            foreach($data->order_addresses_fields as $field){
              $fieldname = $field->field_namekey;
              $address =& $data->order_addresses[$data->cart->shipping_address->address_id];
              $shipping=str_replace('{'.$fieldname.'}',$fieldsClass->show($field,$address->$fieldname),$shipping);
            }
            echo str_replace(array("\r\n","\r","\n"),'<br/>',preg_replace('#{(?:(?!}).)*}#i','',$shipping)).'<br/></td></tr>';

ce qui donne des sauts de lignes comme 3 br de suite si le champ est vide comme state par exemple
du genre :

M. jean valjean


1 rue du the
012345paris

France

Téléphone 0123456700


avec le code postal colle a la ville


comment eviter d'ajouter a l'adresse les champs vides ? eet comment decoller le code postal de la ville

merci

Last edit: 12 years 7 months ago by erickb.

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

  • Posts: 83025
  • Thank you received: 13405
  • MODERATOR
12 years 7 months ago #51106

Changez:
echo str_replace(array("\r\n","\r","\n"),'<br/>',preg_replace('#{(?:(?!}).)*}#i','',$shipping)).'<br/></td></tr>';
en:
echo str_replace(array("\r\n","\r","\n"),'<br/>',str_replace(array("\r\n\r\n","\r\r","\n\n"),array("\r\n","\r","\n"),preg_replace('#{(?:(?!}).)*}#i','',$shipping))).'<br/></td></tr>';

Pour l'espace, il suffit d'ajouter un espace entre le tag du code postal et celui de la ville dans les fichiers address_template, comme c'est le cas par défaut...

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

  • Posts: 2639
  • Thank you received: 66
  • Hikashop Business
12 years 7 months ago #51170

merci

j'avais fait un vcard dans le address_template.php j'ai cree unaddress_template_mail.php

Last edit: 12 years 7 months ago by erickb.

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

Time to create page: 0.060 seconds
Powered by Kunena Forum