Improved Descriptive Minicart Mod for v4.1.5
1. Total price now calculated correctly (including shipping cost)
2. Move mouse pointer over a product link in minicart √ and the product title will appear
3. Original loaded and empty cart images/icons preserved
4. Modified and tested to work in v4.1.5
Step 1. Add the following css style code to the bottom of file \skin1\skin1.css:
Code:
/* Custom Descriptive Minicart Mod START - mycode */
.MiniCartTextTiny {
FONT-SIZE: 9px;
}
/* Custom Descriptive Minicart Mod END - mycode */
Step 2. Replace \skin1\customer\main\minicart.tpl with the following code (based on original x-cart v4.1.5 tpl file):
Code:
{* $Id: minicart.tpl,v 1.17 2006/03/28 08:21:07 max Exp $ *}
{if $minicart_total_items > 0}
<table width="100%" border="0" cellpadding="1" cellspacing="0">
<tr>
<td rowspan="2" width="23"><a href="cart.php"><img src="{$ImagesDir}/cart_full.gif" width="19" height="16" alt="" /></a></td>
<td class="VertMenuItems"><b>{$lng.lbl_cart_items}: </b></td>
<td class="VertMenuItems">{$minicart_total_items}</td>
</tr>
</table>
<hr size="1" NOSHADE class="VertMenuHr">
{foreach from=$minicart_contents item=item}
<table width="100%" border="0" cellpadding="1" cellspacing="0">
<tr>
<td class="MiniCartTextTiny"><b>{$item.amount} X
<a href="product.php?productid={ $item.productid }" title="{$item.product}">{$item.product|truncate:17:"...":true}</a>
</b>
</tr>
</td>
</table>
<table width="100%" border="0" cellpadding="1" cellspacing="0">
<tr>
<td>{include file="currency.tpl" value=$item.display_subtotal}</td>
<td align=right>
{if $config.Adaptives.platform eq 'MacPPC' && $config.Adaptives.browser eq 'NN'}
{assign var="js_to_href" value="Y"}
{/if}
{if $type eq 'input'}
{assign var="img_type" value='input type="image" class="blank"'}
{else}
{assign var="img_type" value='IMG'}
{/if}
{assign var="js_link" value=$href|regex_replace:"/^\s*javascript\s*:/Si":""}
{if $js_link eq $href}
{assign var="js_link" value="javascript: self.location='cart.php?mode=delete&productindex=`$item.cartid`'"}
{else}
{assign var="js_link" value=$href}
{if $js_to_href ne 'Y'}
{assign var="onclick" value=$href}
{assign var="href" value="javascript: void(0);"}
{/if}
{/if}
{if ($config.Adaptives.platform ne 'MacPPC' || $config.Adaptives.browser ne 'NN')}<a href="{$js_link}">{$lng.lbl_remove}</a>
{else}
<A href="cart.php?mode=delete&productindex=`$item.cartid`"{if $onclick ne ''} onclick="{$onclick}"{/if}{if $title ne ''} title="{$title}"{/if}{if $target ne ''} target="{$target}"{/if}><FONT class="FormButton">{$button_title} </FONT></A>
{/if}
</td>
</tr>
</table>
<hr size="1" noshade class="VertMenuHr">
{/foreach}
<table width="100%" border="0" cellpadding="1" cellspacing="0">
<tr>
<td class="MiniCartTextTiny"><a title="{$minicart_delivery}">{$lng.lbl_shipping_cost}</a></td><td align="right" class="MiniCartTextTiny"><a title="{$minicart_delivery}">{$minicart_shipping}</a></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="1" cellspacing="0">
<tr>
<td class="ProductPriceSmall">{$lng.lbl_total}: </td>
{* calculate grand total including shipping cost*}
{math assign="grandtotal" equation="minicarttotalcost+minicartshipping" minicarttotalcost=$minicart_total_cost minicartshipping=$minicart_shipping}
{* end of grand total calculation *}
<td align="right" class="ProductPriceSmall">{include file="currency.tpl" value=$grandtotal}</td>
</tr>
</table>
{else}
<table width="100%" border="0" cellpadding="1" cellspacing="0">
<tr>
<td rowspan="2" width="23"><img src="{$ImagesDir}/cart_empty.gif" width="19" height="16" alt="" /></td>
<td class="VertMenuItems" align="center"><b>{$lng.lbl_cart_is_empty}</b></td>
</tr>
<tr>
<td class="VertMenuItems"> </td>
</tr>
</table>
{/if}
<hr size="1" noshade class="VertMenuHr">
Please add a language variable $lng.lbl_remove = Remove from Admin backend.
Step 3. In file minicart.php, after:
Quote:
$smarty->assign("minicart_total_items", $MINICART["total_items"]);
|
Add:
Quote:
$smarty->assign("minicart_contents", $cart["products"]); //mycode
$smarty->assign("minicart_shipping", $cart["shipping_cost"]); //mycode
$smarty->assign("minicart_delivery", $cart["delivery"]); //mycode
|
Done!
Feel free to test drive at my website
www.vonbell.com - add few items to cart and see how they will show up in mini cart.
Good luck!
Guosheng
www.vonbell.com
P.S. Attached: 2 screenshots (x-cart v4.1.5)