I'm trying to get my minicart to display an estimated ship time similar to the one on apple's store. The minicart should display the number of days that it should take for my company to ship based on the item in the cart with the longest ship time.
So far I have:
1) Added a new INT() field to the xcart_products table called "ship_time".
2) Modified skin1/admin/product_details.tpl
Where:
Code:
<tr>
{if $geid ne ''}<td width="15" class="TableSubHead"><input type="checkbox" value="Y" name="fields[shipping_freight]" /></td>{/if}
<td class="FormButton" nowrap="nowrap">{$lng.lbl_shipping_freight} ({$config.General.currency_symbol})</td>
<td class="ProductDetails">
<input type="text" name="shipping_freight" size="18" value="{$product.shipping_freight|formatprice|default:$zero}" />
</td>
</tr>
After add:
Code:
<tr>
{if $geid ne ''}<td width="15" class="TableSubHead"><input type="checkbox" value="Y" name="fields[ship_time]" /></td>{/if}
<td class="FormButton" nowrap="nowrap">Ship time:</td>
<td class="ProductDetails">
<input type="text" name="ship_time" size="18" value="{if $product.productid eq ""}{$product.ship_time|default:1000}{else}{$product.ship_time}{/if}" />
</td>
</tr>
3)Modified skin1/customer/main/minicart.tpl
Where:
Code:
{if $minicart_total_items > 0}
After add:
Code:
{assign var=ship value=0}
{section name=product loop=$products}
{if $products[product].ship_time gt $ship}
{assign var=ship value=$products[product].ship_time}
{/if}
{/section}
<tr>
<td class="VertMenuItems"><b>Estimated Ship: </b></td>
<td class="VertMenuItems">{$ship} Days(s)</td>
</tr>
My problem:
The code only works when viewing cart.php. All other pages show the default 0.
I think that this problem is due to the fact that I am using the
$products variable. I should be using some sort of variable passed from minicart.php.
i.e. : $smarty->assign("minicart_products", $cart["products"]);
(I've tried this and it doesn't pass the new ship_time database field like the $products variable does in cart.php)
I know that this mod would be useful for others.
Any help would be greatly appreciated.
Thanks,
Scott