Denys06 Posted February 27, 2015 Share Posted February 27, 2015 (edited) Bonjour,J'effectue des précommande sur ma boutique comme vous pouvez le voir sur cette page : http://www.slotcar-union.com/fr/digital-132/1934-carrera-digital-132-30679-chevrolet-corvette-c6r-gt-open-2013-no8-4007486306790.htmlJ'ai correctement configuré les dates dans les différentes langues de ma boutique dans la rubrique Localisation, mais je souhaiterais maintenant modifier mon Template pour que la date de disponibilité (actuellement indiqué en 01/05/2015) n'affiche plus que le format : mois/année soit : 05/2015.Comment modifier ma boutique pour que ce paramettre soit pris en compte svp ? Voici un bout de code présent dans mon Template product.tpl : <!-- availability --> {if ($product->quantity > 0) OR !$product->available_for_order OR $PS_CATALOG_MODE OR !isset($product->available_date) OR $product->available_date < $smarty.now|date_format:'%Y-%m-%d'}<p id="availability_statut"> <span id="availability_label">{l s='Availability:'}</span> <span id="availability_value"{if $product->quantity <= 0}{if $allow_oosp} class="warning_inline2" title="{l s='On Backorder Explanation'}" style="cursor:help;"{else} class="warning_inline"{/if}{/if}>{if $product->quantity <= 0}{if $allow_oosp}{l s='On Backorder Availability'}{else}{l s='This product is no longer in stock'}{/if}{else}{l s='Available'}{/if}</span> </p>{/if} <p id="availability_date"{if ($product->quantity > 0) OR !$product->available_for_order OR $PS_CATALOG_MODE OR !isset($product->available_date) OR $product->available_date < $smarty.now|date_format:'%Y-%m-%d'} style="display: none;"{/if}> <span id="availability_date_label">{l s='Availability:'}</span> <span id="availability_date_value" class="warning_inline4" title="{l s='On Pre-order Explanation'}" style="cursor:help;">{l s='Pre-order until'} {dateFormat date=$product->available_date full=false})</span> </p> <!-- number of item in stock --> {if ($display_qties == 1 && !$PS_CATALOG_MODE && $product->available_for_order)} <p id="pQuantityAvailable"{if $product->quantity <= 0} style="display: none;"{/if}> <span id="quantityAvailable">{$product->quantity|intval}</span> <span {if $product->quantity > 1} style="display: none;"{/if} id="quantityAvailableTxt">{l s='Item in stock'}</span> <span {if $product->quantity == 1} style="display: none;"{/if} id="quantityAvailableTxtMultiple">{l s='Items in stock'}</span> </p> {/if} Merci d'avance pour votre précieuse aide Edited February 28, 2015 by Denys06 (see edit history) Link to comment Share on other sites More sharing options...
EISEAL Posted February 28, 2015 Share Posted February 28, 2015 (edited) Salut, regarde ça : http://www.smarty.net/docsv2/fr/language.modifier.date.format.tpl Du coup faudrait modifier : {dateFormat date=$product->available_date full=false} par un truc du genre : {$product->available_date|date_format:"%m - %Y"} Je n'ai pas moyen de tester actuellement mais inspire toi du lien ci dessus EDIT : je viens de tester et apparement c'est bien ça Personnellement je mettrais : {$product->available_date|date_format:"%B %Y"} Edited February 28, 2015 by anteverce (see edit history) Link to comment Share on other sites More sharing options...
Denys06 Posted February 28, 2015 Author Share Posted February 28, 2015 Bonjour anteverce, Ta modification fonctionne très bien, j'ai enfin réussit à réaliser le résultat que j'espéré. Un grand merci à toi, car sur le forum c'est très rare que j'obtienne une réponse, d'autant plus rare une réponse qui résout mon problème. De ce fait je m'incline face à toi et ne peut que t'acclamer "avé, avé". Merci et à très bientôt 1 Link to comment Share on other sites More sharing options...
EISEAL Posted February 28, 2015 Share Posted February 28, 2015 Pas de quoi. Le principal étant que tu comprennes "un peu" comment ça fonctionne Pense a marquer ton sujet en [ résolu ] Link to comment Share on other sites More sharing options...
Denys06 Posted March 12, 2015 Author Share Posted March 12, 2015 Bonjour à tous,Je viens de me rendre compte quand utilisant le code du talentueux anteverce : {$product->available_date|date_format:"%B %Y"} le mois affiché ne l'est qu'en Français. Il n'est pas traduit dans les autres langues de ma boutique. Comment cela ce fait-il et comment traduire convenablement les mois de Janvier à Décembre dans mes différentes langues s'il vous plait ? Link to comment Share on other sites More sharing options...
EISEAL Posted March 13, 2015 Share Posted March 13, 2015 (edited) Salut, Ca vient du fait que date_format:"%B %Y" prends la langue de ton serveur... Mais voilà une solution, peut etre un peu "lourde", qui fonctionne : Remplace : {$product->available_date|date_format:"%B %Y"} Par : {assign var=month_trad value=$product->available_date|date_format:"%m"} {if $month_trad == 01} {l s='January'} {/if} {if $month_trad == 02} {l s='February'} {/if} {if $month_trad == 03} {l s='March'} {/if} {if $month_trad == 04} {l s='April'} {/if} {if $month_trad == 05} {l s='May'} {/if} {if $month_trad == 06} {l s='June'} {/if} {if $month_trad == 07} {l s='July'} {/if} {if $month_trad == 08} {l s='August'} {/if} {if $month_trad == 09} {l s='September'} {/if} {if $month_trad == 10} {l s='October'} {/if} {if $month_trad == 11} {l s='November'} {/if} {if $month_trad == 12} {l s='December'} {/if} {$product->available_date|date_format:"%Y"} Et il te reste à aller dans Localisation > Traductions pour traduire les mois dans les langues que tu as sur ton site Edited March 13, 2015 by anteverce (see edit history) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now