La formule "Produit(s) ajouté(s) récemment" a l'avantage de s'adapter au singulier comme au pluriel selon la contenance du panier, mais je trouve ce style d'écriture avec les parenthèses particulièrement lourd à lire. Et le bloc panier, c'est l'un des éléments les plus importants à mon sens sur une boutique dans la mesure où le regard va régulièrement s'y poser. Quelques modifications permettent de résoudre ce "problème".
-----------------------------
1. Ouvrir le fichier sidebar.phtml dans template/checkout/cart :
A la ligne 48, remplacer :
| Code : |
<?php if(count($_items)): ?>
<h5>Recently added item(s)</h5>
<ol id="cart-sidebar">
<?php foreach($_items as $_item): ?>
<li>
<div class="product-images">
<a href="<?php echo $_item->getProductUrl() ?>"><img src="<?php echo $this->helper('catalog/image')->init($_item->getThumbnailObject(), 'thumbnail')->resize(50, 50)->setWatermarkSize('30x10'); ?>" alt="<?php echo $_item->getProductName() ?>" width="50" height="50" /></a>
</div>
<div class="product-details">
<a href="<?php echo $this->getRemoveItemUrl($_item) ?>" onclick="return confirm('<?php echo $this->__('Are you sure you would like to remove this item from the shopping cart?') ?>');" class="widget-btn"><img src="<?php echo $this->getSkinUrl('images/list_remove_btn.gif') ?>" alt="<?php echo $this->__('Remove Product') ?>"/></a>
<a href="<?php echo $_item->getProductUrl() ?>"><?php echo $_item->getProductName() ?></a>
<?php echo $_item->getProductDescription() ?>
<br/><strong><?php echo 1*$_item->getQty() ?></strong> x <?php echo Mage::helper('core')->currency($_item->getPrice()) ?>
</div>
</li>
<?php endforeach; ?>
</ol>
<script type="text/javascript">decorateList('cart-sidebar')</script> |
Par :
| Code : |
<?php if(count($_items)==1): ?>
<h5><?php echo $this->__('Recently added product') ?></h5>
<ol id="cart-sidebar">
<?php foreach($_items as $_item): ?>
<li>
<div class="product-images">
<a href="<?php echo $_item->getProductUrl() ?>"><img src="<?php echo $this->helper('catalog/image')->init($_item->getThumbnailObject(), 'thumbnail')->resize(50, 50)->setWatermarkSize('30x10'); ?>" alt="<?php echo $_item->getProductName() ?>" width="50" height="50" /></a>
</div>
<div class="product-details">
<a href="<?php echo $this->getRemoveItemUrl($_item) ?>" onclick="return confirm('<?php echo $this->__('Are you sure you would like to remove this item from the shopping cart?') ?>');" class="widget-btn"><img src="<?php echo $this->getSkinUrl('images/list_remove_btn.gif') ?>" alt="<?php echo $this->__('Remove Product') ?>"/></a>
<a href="<?php echo $_item->getProductUrl() ?>"><?php echo $_item->getProductName() ?></a>
<?php echo $_item->getProductDescription() ?>
<br/><strong><?php echo 1*$_item->getQty() ?></strong> x <?php echo Mage::helper('core')->currency($_item->getPrice()) ?>
</div>
</li>
<?php endforeach; ?>
</ol>
<script type="text/javascript">decorateList('cart-sidebar')</script>
<?php elseif(count($_items)>1): ?>
<h5><?php echo $this->__('Recently added products') ?></h5>
<ol id="cart-sidebar">
<?php foreach($_items as $_item): ?>
<li>
<div class="product-images">
<a href="<?php echo $_item->getProductUrl() ?>"><img src="<?php echo $this->helper('catalog/image')->init($_item->getThumbnailObject(), 'thumbnail')->resize(50, 50)->setWatermarkSize('30x10'); ?>" alt="<?php echo $_item->getProductName() ?>" width="50" height="50" /></a>
</div>
<div class="product-details">
<a href="<?php echo $this->getRemoveItemUrl($_item) ?>" onclick="return confirm('<?php echo $this->__('Are you sure you would like to remove this item from the shopping cart?') ?>');" class="widget-btn"><img src="<?php echo $this->getSkinUrl('images/list_remove_btn.gif') ?>" alt="<?php echo $this->__('Remove Product') ?>"/></a>
<a href="<?php echo $_item->getProductUrl() ?>"><?php echo $_item->getProductName() ?></a>
<?php echo $_item->getProductDescription() ?>
<br/><strong><?php echo 1*$_item->getQty() ?></strong> x <?php echo Mage::helper('core')->currency($_item->getPrice()) ?>
</div>
</li>
<?php endforeach; ?>
</ol>
<script type="text/javascript">decorateList('cart-sidebar')</script> |
2. Ouvrir le fichier Mage_Checkout.csv dans app/locale/fr_FR :
Ajouter ces deux lignes à la fin :
| Code : |
"Recently added products","Produits ajoutés récemment"
"Recently added product","Produit ajouté récemment" |
-----------------------------
Faites le test, ça devrait fonctionner. Si une référence unique est présente dans le panier, le singulier sera utilisé, dans le cas contraire ce sera le pluriel.nn
Message édité par : Otaugames, à : 08 04 2008 16:00:18