Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Advanced Cart Mod

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 04-29-2007, 12:36 PM
  vtonya's Avatar 
vtonya vtonya is offline
 

Advanced Member
  
Join Date: Apr 2007
Posts: 61
 

Thumbs up Advanced Cart Mod

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
All product are linkable!

So, with this mod my shopping cart looks like this:
Click image for larger version

Name:	basket.jpg
Views:	1131
Size:	26.7 KB
ID:	349
__________________
X-card Gold 4.1.7
Batch Order Mod/Order Processing
Detailed Order Management Mod
Order Audit/Profit reports
Advanced Product Search
Ajax Username Checker
Direct Product Enquiry Form
FAQ Manager
Social Bookmarking
Tabs Mod v3
MagneticOne.com All-IN-ONE X-Cart Export
Show Referrer Information on Order Details Page
www.medsmarket.net
Reply With Quote

The following user thanks vtonya for this useful post:
am2003 (07-25-2010)
  #2  
Old 04-29-2007, 12:42 PM
  vtonya's Avatar 
vtonya vtonya is offline
 

Advanced Member
  
Join Date: Apr 2007
Posts: 61
 

Exclamation Advanced Cart Mod with thumbs

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:
Click image for larger version

Name:	bask.jpg
Views:	596
Size:	30.5 KB
ID:	350

I run XCART 4.1.7
__________________
X-card Gold 4.1.7
Batch Order Mod/Order Processing
Detailed Order Management Mod
Order Audit/Profit reports
Advanced Product Search
Ajax Username Checker
Direct Product Enquiry Form
FAQ Manager
Social Bookmarking
Tabs Mod v3
MagneticOne.com All-IN-ONE X-Cart Export
Show Referrer Information on Order Details Page
www.medsmarket.net
Reply With Quote

The following user thanks vtonya for this useful post:
am2003 (07-25-2010)
  #3  
Old 04-29-2007, 01:09 PM
  NightFire's Avatar 
NightFire NightFire is offline
 

X-Adept
  
Join Date: Jul 2004
Location: The Netherlands
Posts: 561
 

Default 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}
__________________
Best regards,
Niki Buitenrust Hettema

X-Cart Gold 4.1.8 (Live & Loaded)
Royal Bhaktapur: Handmade products from Nepal - Pashmina's, scarfs, shawls, stola's and more...
Reply With Quote
  #4  
Old 04-29-2007, 01:47 PM
  vtonya's Avatar 
vtonya vtonya is offline
 

Advanced Member
  
Join Date: Apr 2007
Posts: 61
 

Post Re: Advanced Cart Mod

Thanks, but doesn't work ((
__________________
X-card Gold 4.1.7
Batch Order Mod/Order Processing
Detailed Order Management Mod
Order Audit/Profit reports
Advanced Product Search
Ajax Username Checker
Direct Product Enquiry Form
FAQ Manager
Social Bookmarking
Tabs Mod v3
MagneticOne.com All-IN-ONE X-Cart Export
Show Referrer Information on Order Details Page
www.medsmarket.net
Reply With Quote
  #5  
Old 04-29-2007, 02:13 PM
 
inebriate inebriate is offline
 

eXpert
  
Join Date: May 2006
Posts: 301
 

Default 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}
__________________
x-cart pro 4.0.18
linux
www.fabric8d.com (currently undergoing construction)
Reply With Quote
  #6  
Old 04-29-2007, 02:15 PM
 
inebriate inebriate is offline
 

eXpert
  
Join Date: May 2006
Posts: 301
 

Default 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}
__________________
x-cart pro 4.0.18
linux
www.fabric8d.com (currently undergoing construction)
Reply With Quote
  #7  
Old 04-29-2007, 02:39 PM
  vtonya's Avatar 
vtonya vtonya is offline
 

Advanced Member
  
Join Date: Apr 2007
Posts: 61
 

Thumbs up Re: Advanced Cart Mod

WOW!!!
THAT CODE REALY WORKS!!!! THANK YOU SO MUCH!!!



Quote:
{include file="product_thumbnail.tpl" productid=$item.productid image_x=$100 product=$item.product tmbn_url=$item.pimage_url type=$item.is_pimage}
__________________
X-card Gold 4.1.7
Batch Order Mod/Order Processing
Detailed Order Management Mod
Order Audit/Profit reports
Advanced Product Search
Ajax Username Checker
Direct Product Enquiry Form
FAQ Manager
Social Bookmarking
Tabs Mod v3
MagneticOne.com All-IN-ONE X-Cart Export
Show Referrer Information on Order Details Page
www.medsmarket.net
Reply With Quote

The following user thanks vtonya for this useful post:
am2003 (07-25-2010)
  #8  
Old 04-29-2007, 02:45 PM
  vtonya's Avatar 
vtonya vtonya is offline
 

Advanced Member
  
Join Date: Apr 2007
Posts: 61
 

Exclamation 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
__________________
X-card Gold 4.1.7
Batch Order Mod/Order Processing
Detailed Order Management Mod
Order Audit/Profit reports
Advanced Product Search
Ajax Username Checker
Direct Product Enquiry Form
FAQ Manager
Social Bookmarking
Tabs Mod v3
MagneticOne.com All-IN-ONE X-Cart Export
Show Referrer Information on Order Details Page
www.medsmarket.net
Reply With Quote
  #9  
Old 04-29-2007, 03:03 PM
 
inebriate inebriate is offline
 

eXpert
  
Join Date: May 2006
Posts: 301
 

Default Re: Advanced Cart Mod

sorry about that...remove the $ in the image_x portion
__________________
x-cart pro 4.0.18
linux
www.fabric8d.com (currently undergoing construction)
Reply With Quote
  #10  
Old 04-29-2007, 03:47 PM
  vtonya's Avatar 
vtonya vtonya is offline
 

Advanced Member
  
Join Date: Apr 2007
Posts: 61
 

Default Re: Advanced Cart Mod

inebriate, thank you SO MUCH!
Works GREAT!!!
__________________
X-card Gold 4.1.7
Batch Order Mod/Order Processing
Detailed Order Management Mod
Order Audit/Profit reports
Advanced Product Search
Ajax Username Checker
Direct Product Enquiry Form
FAQ Manager
Social Bookmarking
Tabs Mod v3
MagneticOne.com All-IN-ONE X-Cart Export
Show Referrer Information on Order Details Page
www.medsmarket.net
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 05:41 PM.

   

 
X-Cart forums © 2001-2020