X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Advanced Cart Mod (https://forum.x-cart.com/showthread.php?t=30809)

vtonya 04-29-2007 12:36 PM

Advanced Cart Mod
 
1 Attachment(s)
:D/ To get the product names to link to the products just replace the body of minicart.tpl with the following code:
Quote:

{* $Id: minicart.tpl,v 1.12 2004/07/06 14:00:12 svowl Exp $ *}
<TABLE border="0" cellpadding="1" cellspacing="0">
<TR>
<TD rowspan="2" width="23">
{if $minicart_total_items > 0}<img border="0" src="{$ImagesDir}/cart_full.gif" width="19" height="16">
{else}<img border="0" src="{$ImagesDir}/cart_empty.gif" width="19" height="16">{/if}
</TD>
<TD class="VertMenuItems">{if $minicart_total_items > 0}{$lng.lbl_items}: </TD>
<TD class="VertMenuItems" color="#0000ff">{$minicart_total_items}{else}<CENT ER>{$lng.lbl_cart_is_empty}</CENTER>{/if}</TD>
</TR>
</TABLE>
{if $minicart_total_items > 0}
<table width="200" border="0" cellpadding="2">
<tr>
<td align="center" width="65%" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-style: solid; border-bottom-width: 1px"><b>Item</b></td>
<td align="center" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-style: solid; border-bottom-width: 1px"><b>Qty</b></td>
<td align="center" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-style: solid; border-bottom-width: 1px"><b>Price</b></td>
<td align="center" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-style: solid; border-bottom-width: 1px"><b>Delete</b></td>
</tr>
<tr>
{foreach from=$minicart_contents item=item}
<td align="left" class="MiniCartTextTiny"><b><a href="product.php?productid={ $item.productid }" title="{$item.product}">{$item.product|truncate:47 :"...":true}</a>
</b></td>

<td align="center">{$item.amount}</td>


<td align="center">{$item.display_subtotal}</td>

<td align="center">
{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}"><img src="/skin1/images/delete.gif" width="22" height="30" alt="Remove product" /></a>
{else}
<A href="cart.php?mode=delete&productindex=`$item.car tid`"{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>{/foreach}
</table>
{/if}
<HR size="1" NOSHADE class="VertMenuHr">
{if $minicart_total_items > 0}
<table width="100%" border="0" cellpadding="1" cellspacing="0">
<tr>
<TD class="MiniCartTextSmall"><a title="{$minicart_delivery}">Shipping Cost:</a></td><td align="right" class="MiniCartTextSmall">
<a title="{$minicart_delivery}">{include file="currency.tpl" value=$minicart_shipping}</a></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="1" cellspacing="0">
<tr>
<TD class="MiniCartTextSmall"><strong>{$lng.lbl_total} </strong>: </td>
<td align="right" class="MiniCartTextSmall"><strong>{include file="currency.tpl" value=$minicart_total_cost}</strong></td>
</tr>
</table>
{else}{/if}
<br>



Make sure you add these lines to minicart.php (thanks Shan!):

Code:

Quote:

$smarty->assign("minicart_contents", $cart["products"]); //added this line
$smarty->assign("minicart_shipping", $cart["shipping_cost"]); //added this line
$smarty->assign("minicart_delivery", $cart["delivery"]); //added this line
$smarty->assign("minicart_delete", $cart["delete"]); //added this line
?>


Make sure you add the class to your .css


Code:

Quote:

.MiniCartTextSmall {
FONT-SIZE: 10px;font-weight:bold
}

I've also added a DELETE button :wink:
All product are linkable!

So, with this mod my shopping cart looks like this:
Attachment 349

vtonya 04-29-2007 12:42 PM

Advanced Cart Mod with thumbs
 
1 Attachment(s)
To see products thumbs in cart replace the body of minicart.tpl :
Quote:

{* $Id: minicart.tpl,v 1.12 2004/07/06 14:00:12 svowl Exp $ *}
<TABLE border="0" cellpadding="1" cellspacing="0">
<TR>
<TD rowspan="2" width="23">
{if $minicart_total_items > 0}<img border="0" src="{$ImagesDir}/cart_full.gif" width="19" height="16">
{else}<img border="0" src="{$ImagesDir}/cart_empty.gif" width="19" height="16">{/if}
</TD>
<TD class="VertMenuItems">{if $minicart_total_items > 0}{$lng.lbl_items}: </TD>
<TD class="VertMenuItems" color="#0000ff">{$minicart_total_items}{else}<CENT ER>{$lng.lbl_cart_is_empty}</CENTER>{/if}</TD>
</TR>
</TABLE>
{if $minicart_total_items > 0}
<table width="200" border="0" cellpadding="2">
<tr>
<td align="center" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-style: solid; border-bottom-width: 1px"><b>Pic</b></td>
<td align="center" width="65%" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-style: solid; border-bottom-width: 1px"><b>Item</b></td>
<td align="center" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-style: solid; border-bottom-width: 1px"><b>Qty</b></td>
<td align="center" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-style: solid; border-bottom-width: 1px"><b>Price</b></td>
<td align="center" style="border-left-width: 1px; border-right-width: 1px; border-top-width: 1px; border-bottom-style: solid; border-bottom-width: 1px"><b>Delete</b></td>
</tr>
<tr>
{foreach from=$minicart_contents item=item}
<td align="center">{include file="product_thumbnail.tpl" productid=$imageid image_x=$config.Appearance.thumbnail_width product=$products[product].product tmbn_url=$products[product].pimage_url type=$products[product].is_pimage}
</td>
<td align="left" class="MiniCartTextTiny"><b><a href="product.php?productid={ $item.productid }" title="{$item.product}">{$item.product|truncate:47 :"...":true}</a>
</b></td>

<td align="center">{$item.amount}
</td>


<td align="center">{$item.display_subtotal}</td>

<td align="center">
{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}"><img src="/skin1/images/delete.gif" width="22" height="30" alt="Remove product" /></a>
{else}
<A href="cart.php?mode=delete&productindex=`$item.car tid`"{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>{/foreach}
</table>
{/if}
<HR size="1" NOSHADE class="VertMenuHr">
{if $minicart_total_items > 0}
<table width="100%" border="0" cellpadding="1" cellspacing="0">
<tr>
<TD class="MiniCartTextSmall"><a title="{$minicart_delivery}">Shipping Cost:</a></td><td align="right" class="MiniCartTextSmall">
<a title="{$minicart_delivery}">{include file="currency.tpl" value=$minicart_shipping}</a></td>
</tr>
</table>
<table width="100%" border="0" cellpadding="1" cellspacing="0">
<tr>
<TD class="MiniCartTextSmall"><strong>{$lng.lbl_total} </strong>: </td>
<td align="right" class="MiniCartTextSmall"><strong>{include file="currency.tpl" value=$minicart_total_cost}</strong></td>
</tr>
</table>
{else}{/if}
<br>



But, there is a problem: it says that products dont have any thumbs, who knows how to fix it???

See the attached image:
Attachment 350

I run XCART 4.1.7

NightFire 04-29-2007 01:09 PM

Re: Advanced Cart Mod
 
Thanks. Looks like a great mod. I will test it soon.
Much appreciated for your contribution.

For the thumbnail issue. Haven't tested it yet, but try this:

Replace:
Code:

{include file="product_thumbnail.tpl" productid=$imageid image_x=$config.Appearance.thumbnail_width product=$products[product].product tmbn_url=$products[product].pimage_url type=$products[product].is_pimage}

with this one:

Code:

{include file="product_thumbnail.tpl" productid=$products[product].productid image_x=150 product=$products[product].product tmbn_url=$products[product].tmbn_url}

vtonya 04-29-2007 01:47 PM

Re: Advanced Cart Mod
 
Thanks, but doesn't work ((

inebriate 04-29-2007 02:13 PM

Re: Advanced Cart Mod
 
you need to watch what variable you are assigning...

replace:
Code:

{include file="product_thumbnail.tpl" productid=$minicart_contents image_x=$config.Appearance.thumbnail_width product=$products[product].product tmbn_url=$products[product].pimage_url type=$products[product].is_pimage}

with:
Code:

{include file="product_thumbnail.tpl" productid=$item.productid image_x=$100 product=$item.product tmbn_url=$item.pimage_url type=$item.is_pimage}

inebriate 04-29-2007 02:15 PM

Re: Advanced Cart Mod
 
you need to watch what variable you are assigning...

replace:
Code:

{include file="product_thumbnail.tpl" productid=$imageid image_x=$config.Appearance.thumbnail_width product=$products[product].product tmbn_url=$products[product].pimage_url type=$products[product].is_pimage}

with:
Code:

{if $item.is_pimage eq 'W' }{assign var="imageid" value=$item.variantid}{else}{assign var="imageid" value=$item.productid}{/if}
{include file="product_thumbnail.tpl" productid=$imageid image_x=100 product=$item.product tmbn_url=$item.pimage_url type=$item.is_pimage}


vtonya 04-29-2007 02:39 PM

Re: Advanced Cart Mod
 
WOW!!!
THAT CODE REALY WORKS!!!! THANK YOU SO MUCH!!!
:D/


Quote:

{include file="product_thumbnail.tpl" productid=$item.productid image_x=$100 product=$item.product tmbn_url=$item.pimage_url type=$item.is_pimage}


vtonya 04-29-2007 02:45 PM

Re: Advanced Cart Mod
 
The only trouble is that when i change image_x=$100 to image_x=$70, for example, it shows image in its real size 150 pixells

inebriate 04-29-2007 03:03 PM

Re: Advanced Cart Mod
 
sorry about that...remove the $ in the image_x portion

vtonya 04-29-2007 03:47 PM

Re: Advanced Cart Mod
 
inebriate, thank you SO MUCH!
Works GREAT!!!


All times are GMT -8. The time now is 05:25 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.