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)
-   -   Improved minicart display (https://forum.x-cart.com/showthread.php?t=24999)

instink 09-16-2006 07:53 PM

Improved minicart display
 
Hi guys, I am basically a hack so please excuse the messy code. Anyway I decided my miinicart needed improving and have got it to the point where I'm really in love with it, looks great, simple to use etc. here is a screenshot:

http://www.jctech.com.au/images/minicart.jpg

Improvements are:

Displays products individually
Product links are clickable
"Remove" link for easy product removal
Shipping and total costs displayed

Credit goes to forum user "mac" for his original minicart mod. I just edited it to make it the way I want. Works with 4.0.16 and should work with most other versions.

edit /minicart.php to be as follows:

Code:

<?php


#
# $Id: minicart.php,v 1.1.2.1 2005/01/12 07:41:43 svowl Exp $
#

if ( !defined('XCART_START') ) { header("Location: home.php"); die("Access denied"); }

x_session_register ("cart");

$MINICART["total_cost"] = price_format(0);
$MINICART["total_items"] = 0;

if (!empty($cart)) {

        if (!empty($cart["total_cost"]))
                $MINICART["total_cost"] = $cart["total_cost"];

        $MINICART["total_items"] = ((!empty($cart["products"]) and is_array($cart["products"]))?count($cart["products"]):0) + ((!empty($cart["giftcerts"]) and is_array($cart["giftcerts"]))?count($cart["giftcerts"]):0);
}

$smarty->assign("minicart_total_cost", $MINICART["total_cost"]);
$smarty->assign("minicart_total_items", $MINICART["total_items"]);
$smarty->assign("minicart_contents", $cart["products"]); //added this line
$smarty->assign("minicart_shipping", $cart["display_shipping_cost"]); //added this line
$smarty->assign("minicart_delivery", $cart["delivery"]); //added this line
$smarty->assign("minicart_delete", $cart["delete"]); //added this line

?>


Then edit /skin1/customer/main/minicart.tpl to be as such:

Code:

{* $Id: minicart.tpl,v 1.12 2004/07/06 14:00:12 svowl Exp $ *}

{if $minicart_total_items > 0}

{foreach from=$minicart_contents item=item}
<table width="100%" border="0" cellpadding="1" cellspacing="0">
<tr><TD class="MiniCartTextSmall"><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}">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="ProductDetailsTitle">Shipping Cost</td><td align="right" class="MiniCartTextSmall">{$minicart_shipping}</td>
</tr>
</table>
<table width="100%" border="0" cellpadding="1" cellspacing="0">
<tr>
<TD class="ProductDetailsTitle">{$lng.lbl_total}: </td>
<td align="right" class="MiniCartTextSmall">{include file="currency.tpl" value=$minicart_total_cost}</td>
</tr>
</table>
{else}
{$lng.lbl_cart_is_empty}
{/if}
<hr size="1" noshade class="VertMenuHr">

<A href="cart.php" class="VertMenuItems">{$lng.lbl_view_cart}</A><BR>
<A href="cart.php?mode=checkout" class="VertMenuItems">{$lng.lbl_checkout}</A><BR>


Sorry its so messy, I just cut and pasted bits from all over the place. works a treat though :)

Finally, in skin1/customer/menu_cart.tpl comment out this section:

Code:

{if $cart}
<A href="cart.php" class="VertMenuItems">{$lng.lbl_view_cart}</A><BR>
<A href="cart.php?mode=checkout" class="VertMenuItems">{$lng.lbl_checkout}</A><BR>
{/if}


By doing that last part you are preventing it from showing the "View Cart" and "Checkout" links twice when you are actually in the cart.

Lastly you need to add this to your skin1.css file

Code:

}
.MiniCartTextSmall {
        FONT-SIZE: 11px;
}


I hope this is of some use to someone... and that the code actually works in someone elses system and not just mine!!

gobligoo 09-17-2006 06:55 AM

Re: Improved minicart display
 
Works like a sharm :) Thanks for a good mod!

X-cart 4.019 (unix)

instink 09-17-2006 06:41 PM

Re: Improved minicart display
 
Thanks dude, appreciate it.

If anyone can figure out how to make the "Remove" link return you to the page where you were when you clicked it, rather than straight to the cart (which may be empty after clicking the link) that would be great :)

yages 09-19-2006 05:50 PM

Re: Improved minicart display
 
Great mod just what I wanted

Dongan 09-20-2006 05:40 AM

Re: Improved minicart display
 
was thinking of and got it now.

flyclothing 09-20-2006 01:58 PM

Re: Improved minicart display
 
Quote:

Originally Posted by instink
Thanks dude, appreciate it.

If anyone can figure out how to make the "Remove" link return you to the page where you were when you clicked it, rather than straight to the cart (which may be empty after clicking the link) that would be great :)


I believe you remove this line (minicart.tpl) if you want the "REMOVE"...removed.

{if ($config.Adaptives.platform ne 'MacPPC' || $config.Adaptives.browser ne 'NN')}<a href="{$js_link}">Remove</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}

RichieRich 09-28-2006 03:52 AM

Re: Improved minicart display
 
Quote:

Originally Posted by instink
Thanks dude, appreciate it.

If anyone can figure out how to make the "Remove" link return you to the page where you were when you clicked it, rather than straight to the cart (which may be empty after clicking the link) that would be great :)


Great mod, yes this would be very useful.

lootsale 10-04-2006 04:15 PM

Re: Improved minicart display
 
does that code works on 4.1.3? ive tried it but it doesnt work properly. wt do u say?
and i cant find this file: Finally, in skin1/customer/menu_cart.tpl comment out this section:
Thanks

instink 10-04-2006 04:17 PM

Re: Improved minicart display
 
Hi mate, no idea sorry, I've only ever used 4.0.16 :(

alru111 10-05-2006 04:24 PM

Re: Improved minicart display
 
small fix that will add a dolalr sign to the shipping cost

/skin1/customer/main/minicart.tpl
replace this
<TD class="ProductDetailsTitle">Shipping Cost</td><td align="right" class="MiniCartTextSmall">{$minicart_shipping}</td>



with this

<TD class="ProductDetailsTitle">Shipping Cost</td><td align="right" class="MiniCartTextSmall">{include file="currency.tpl" value=$minicart_shipping}</td>

teddychan 10-06-2006 01:03 PM

Re: Improved minicart display
 
may i know how to show the LAST ADDED item image?
just like the apple store?

it will displayed the last added item small image. (for 4.1.x)

many thinks!

dalmuti 10-06-2006 01:11 PM

Re: Improved minicart display
 
Just to answer lootsale's question, yes this mod does work in 4.1.3.

Thanks for the mod,

Louise

lootsale 10-09-2006 03:53 PM

Re: Improved minicart display
 
hi,
i have implemented the code and it works fine. could you guys tell me that if i click on remove then it takes me to basket (tho it removes the item from the basket). could it be possible that if i click on remove button then it would simply keep me on the same page and removes the item from the mni basket?

I have the same problem while adding a product that it takes me to the main basket. i wana keep it on the same page and the would be added in mini basket. remeber that the mini basket shows up only when you add a product in basket or login.

Your assistance is appreciated?

Skateboards.com 10-10-2006 08:38 AM

Re: Improved minicart display
 
ISSUES WITH SHIPPING TOTALS?

I've installed this mod and the totals aren't adding up correctly:

1 X BAM BAT GRIP T...
$5.95 Remove
1 X CREATION JORDA...
$49.95 Remove
Shipping Cost 7.17
Total: $67.12

After going to checkout while logged in, it looks like the total reflects the sum of everything including the sales tax since my account is from the same state. Anyone know where the code is so that I can output the Tax rate applied in the list with the shipping? Even if it's zero because the customer is from out of state I don't care, I just want to display it in the line items so the math doesn't confuse the customer before checkout time.

www.skateboards.com is the site.

Thanks much.

_Rich_

ShishaPipeUK 10-10-2006 11:07 AM

Re: Improved minicart display
 
1 Attachment(s)
This is the 4.1.3 version for the cart.
You do not need to edit the skin1.css or any language files.

Below is a picture of the cart and the lines in bold are the extra lines added to the original x-cart 4.1.3 tpl file.

At shopcart/skin1/customer/main/minicart.tpl

{* $Id: minicart.tpl,v 1.17 2006/03/28 08:21:07 max Exp $ *}
{if $short_mode eq "short"} {* Crystal_Blue *}
<table cellpadding="0" cellspacing="3">
<tr>
<td>{if $minicart_total_items > 0}<a href="cart.php"><img src="{$ImagesDir}/custom/cart_top_full.gif" width="19" height="16" alt="" /></a>{else}<img src="{$ImagesDir}/custom/cart_top_empty.gif" width="19" height="16" alt="" />{/if}
</td>
<td nowrap="nowrap"><a href="cart.php" class="MainSubtitleLink">{$lng.lbl_view_cart}</a></td>
</tr>
<tr>
<td colspan="2"><img src="{$ImagesDir}/spacer.gif" width="1" height="1" alt="" /></td>
</tr>
<tr>
<td><a href="cart.php?mode=checkout"><img src="{$ImagesDir}/custom/checkout_arr.gif" width="16" height="14" alt="" align="middle" /></a></td>
<td nowrap="nowrap"><a href="cart.php?mode=checkout" class="MainSubtitleLink">{$lng.lbl_checkout}</a></td>
</tr>
</table>
{else} {* Crystal_Blue *}
<table cellpadding="1" cellspacing="0">
{if $minicart_total_items > 0}
<tr>
<td rowspan="3" 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>
{* START - ADDED SHIPPING AMOUNT TO CART *}
<tr>
<td class="VertMenuItems"><b>{$lng.lbl_shipping}: </b></td>
<td class="VertMenuItems">{include file="currency.tpl" value=$minicart_shipping}</td>
</tr>
{* END - ADDED SHIPPING AMOUNT TO CART *}
<tr>
<td class="VertMenuItems"><b>{$lng.lbl_total}: </b></td>
<td class="VertMenuItems">{include file="currency.tpl" value=$minicart_total_cost}</td>
</tr>
{else}
<tr>
<td 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>
{/if}
</table>
<hr class="VertMenuHr" size="1" />
{* START - DISPLAY PRODUCT DESCRIPTION *}
<table cellpadding="1" cellspacing="0">
{if $minicart_total_items > 0}
{foreach from=$minicart_contents item=item}
<tr>
<td class="MainSubtitleLink">{$item.amount} X</td>
<td class="MainSubtitleLink"><a title="{$item.product}">{$item.product|truncate:15 :"...":true}</a></td>
<td align="right" class="MainSubtitleLink">{include file="currency.tpl" value=$item.display_subtotal}</td></tr>
{/foreach}
{else}
<div align="center"><a href="home.php?cat=268" class="MainSubtitleLink">Please Click HERE for SPECIAL OFFERS</a></div>
{/if}
</table>
{* END - DISPLAY PRODUCT DESCRIPTION *}
<hr class="VertMenuHr" size="1" />
{/if} {* Crystal_Blue *}

And of cause the shopcart/minicart.php

Add at the bottom:

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

Skateboards.com 10-10-2006 11:51 AM

Re: Improved minicart display
 
1 Attachment(s)
Will that work for 4.0.18?


Here's the example with my current mini cart image displaying how what the customer sees doesn't add up.

QVS 10-11-2006 06:23 AM

Re: Improved minicart display
 
doesnt work on 4.0.14 any ideas.

just displays the shipping total
and total

plus the view cart and checkout text links.

thanks

dalmuti 10-11-2006 08:23 AM

Re: Improved minicart display
 
Yes, skateboards.com is correct....the total is incorrect. In 4.1.3 on my site it appear that the total is just the product prices added together and does not take into account shipping.

Any ideas of how to include the shipping cost to the equation?

Louise

lootsale 10-12-2006 04:39 PM

Re: Improved minicart display
 
any1 cud help on this qs?

if i click on remove in mini basket then it takes me to basket (tho it removes the item from the basket). could it be possible that if i click on remove button then it would simply keep me on the same page and removes the item from the mni basket?

I have the same problem while adding a product that it takes me to the main basket. i wana keep it on the same page and the product would be added in mini basket. remeber that the mini basket shows up only when you add a product in basket or login.


Your assistance is appreciated?

cmec321 10-13-2006 05:47 AM

Re: Improved minicart display
 
Great work. Now we need to do like Amazon.com, and after user clicks add to cart, it takes them to a "Customers who viewed this product and also viewed:
".

I noticed x-cart is not up with the sign of times. I requested they add upsells to the site after clicking add to cart. anyone agree?

daveb1 10-21-2006 10:31 AM

Re: Improved minicart display
 
Great mod... works fine in 4.0.15.

Would be good to get the remove button to remove it only in the minicart... but I'm not a good enough coder to do that :(

alru111 10-21-2006 11:09 PM

Re: Improved minicart display
 
that is exactly what the remove button does

lootsale 10-22-2006 02:04 PM

Re: Improved minicart display
 
hi guys, u may ans my simpl qs plz?

WHEN I ADD A PRODUCT IN BASKET. FOR SOME REASON IT DZNT SHOW DELIVERY COST BOTH IN MAIN CART AND MINI CART.. DNT KNOW WHY/. BUT IT APPEARS IF YO REFRESH THE PAGE..
ANY IDEA?

teddychan 10-23-2006 01:35 AM

Re: Improved minicart display
 
it will not show until the buyer has choose the shipping method in the checkout cart.
it will be great if it can show all possible shipping method in the drop down list in the mini cart, and let the bueyr to choose from without going to the checkout page.

is it possible?

razorblade 10-27-2006 01:34 PM

Re: Improved minicart display
 
any ideas on how to change the font color of the shipping costs, total costs, quanity, etc in this mod. i have tried several thigns, but no luck yet. thanks

daveb1 10-30-2006 06:27 AM

Re: Improved minicart display
 
alru111

When I click the Remove button, it takes the customer to the checkout page. Thue, the item has been removed, but I'd like it to remove it only from the minicart, without taking the customer to another page. It could be because I have the EZCheckout mod, but I don't understand it enough to confirm that.

laffe 10-31-2006 11:05 AM

Re: Improved minicart display
 
Great mod. I tried this modding thing fr the first time myself using this.
And it worked on my fery first try.
Thanks....

lootsale 11-26-2006 03:46 PM

Re: Improved minicart display
 
http://www.lootsale.co.uk/minibasket.gif
hi guys,

do u know y does the mini basket shows subtotal of only last item. you can test it on lootsale.co.uk. the code i am using is:
<tr>
<TD class="ProductDetailsTitle"><font size="1">{$lng.lbl_subtotal}:</font> </td>
<td align="right" class="MiniCartTextSmall"><font color="#990000">{include file="currency.tpl" value=$item.display_subtotal}</font></td>
</tr>

any help so the mini basket cud show right subtotal?

Regards,

jessej 12-08-2006 03:46 PM

Re: Improved minicart display
 
Anyone figure it out?

whsu716 01-09-2007 12:15 AM

Re: Improved minicart display
 
I am having an issue with getting this installed. I get this error:

Quote:

Fatal error: Smarty error: [in customer/main/minicart.tpl line 17]: syntax error: invalid attribute name: '=' (Smarty_Compiler.class.php, line 1524) in /home/patweb/public_html/Smarty-2.6.9/Smarty.class.php on line 1088

which for me is this line:
Quote:

{if $js_link eq $href}{assign var="js_link" value="javascript: self.location='cart.php?mode=delete&productindex=` $item.cartid`'"}

any suggestions?

jackel 01-09-2007 07:41 AM

Re: Improved minicart display
 
eq? not = ?

whsu716 01-09-2007 08:49 AM

Re: Improved minicart display
 
hmm, don't think that is it, b/c it is trying to declare a variable..

The line of code was taken directly from the first page - not sure why I am having issues with it.

*edit*

Fixed the problem - it was my Dreamweaver acting up. It didn't like the copy&paste, so I just edited through the admin side.

Thanks!

And now, trying to get the 'remove' function to not redirect you to the cart. I'm assuming this will need to be done the same way 'add to cart' is done.

...wish me luck!

newattraction 01-13-2007 03:06 AM

Improved Descriptive Minicart Mod for v4.1.5
 
2 Attachment(s)
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">&nbsp;</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!:D/

Guosheng
www.vonbell.com
P.S. Attached: 2 screenshots (x-cart v4.1.5)

Jay77 01-17-2007 11:49 AM

Re: Improved minicart display
 
Hi, Great mod.
My only problem (as i'm new) is I cant work out the language variables. I have found out that I need to click Labguages > then select English but where do I go from there ? - its working great except for the remove function - assuming its the language variable bit.
Thanks.

newattraction 01-18-2007 05:52 AM

Re: Improved minicart display
 
1 Attachment(s)
Scroll down to the bottom of "Edit languages" section, in "Add new entry" section, type "lbl_remove" in "Variable:" field, and "Remove" in "Default editor" field. Then hit "Add" button.


Please see the attached screen shot.


Good luck!:-)


Guosheng
www.vonbell.com

Jay77 01-18-2007 10:59 AM

Re: Improved minicart display
 
2 Attachment(s)
Hi, Thanks - I tried your suggestion but I still can't get it to work. Please take a look at my screenshots. Maybe does'nt work with my version ?. Hope you can help ?:-)

neaisha 01-25-2007 05:01 AM

Re: Improved minicart display
 
I was having the same problem with the "Remove" link not showing when using the above 4.1.5v code.

you'd find the lines in the above code where the remove link appears and replace it with mac's original code.

Shaun 01-26-2007 07:08 AM

Re: Improved minicart display
 
Thanks, this is a nice mod. I have it working well on 4.0.15, I've just made a few tweaks to the layout thats all.

http://www.streetortrack.com/files/images/minicart.jpg

Code:


{* $Id: minicart.tpl,v 1.12 2004/07/06 14:00:12 svowl Exp $ *}
{if $minicart_total_items > 0}
{foreach from=$minicart_contents item=item}
<table width="100%" border="0" cellpadding="1" cellspacing="0">
<tr><TD class="MiniCartTextSmall"><b>{$item.amount}
x
<a href="product.php?productid={ $item.productid }" title="{$item.product}">{$item.product|truncate:50:"...":true}</a>
</b></tr></td></table>
<table width="100%" border="0" cellpadding="1" cellspacing="0">
<tr>
<td align=left>
{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}">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 align=right>{include file="currency.tpl" value=$item.display_subtotal}
</td></tr>
 
</td>
</table>
<HR size="1" NOSHADE class="VertMenuHr">
{/foreach}
<table width="100%" border="0" cellpadding="1" cellspacing="0">
<tr>
<TD class="ProductDetailsTitle">Shipping Cost:</td><td align="right" class="MiniCartTextSmall">{include file="currency.tpl" value=$minicart_shipping}</td>
</tr>
</table>
<table width="100%" border="0" cellpadding="1" cellspacing="0">
<tr>
<TD class="ProductDetailsTitle">{$lng.lbl_total}: </td>
Displayed when logged in
<p>
<td align="right" class="MiniCartTextSmall">{include file="currency.tpl" value=$minicart_total_cost}</td>
</tr>
</table>
Includes tax for MI residents only
{else}
{$lng.lbl_cart_is_empty}
{/if}
<hr size="1" noshade class="VertMenuHr">


Anybody figure out how to stop the 'Remove' button directing you to the cart? As others have mentioned in this thread it would be great if by clicking 'Remove' it kept you on your current page and just removed the item from the minicart.

just_me 01-26-2007 07:17 AM

Re: Improved minicart display
 
Thanks for the great mod for minicart. After working through a few snags I got it working.

Comments:

I added language variables to keep the minicart multilingual.

I found that /minicart.php needed to be editted directly through my hostings admin panel files administration to work.
Editting through DW made my cart wipe out. In the same vein, /minicart.tpl needed editting through xcart admin panel.

I could not find the exact text in /menu_cart.tpl, to comment out. So I boldly removed the code calling for the repeat view cart and checkout links. Worked.

Here's my modified code with the language variables for anyone with multilingual carts. Works with 4.0.19

{* $Id: minicart.tpl,v 1.12 2004/07/06 14:00:12 svowl Exp $ *}

{if $minicart_total_items > 0}

{foreach from=$minicart_contents item=item}
<table width="100%" border="0" cellpadding="1" cellspacing="0">
<tr><TD class="MiniCartTextSmall"><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.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></table>

<HR size="1" NOSHADE class="VertMenuHr">
{/foreach}

<table width="100%" border="0" cellpadding="1" cellspacing="0">
<tr>
<TD class="ProductDetailsTitle">{$lng.lbl_shipping}</td><td align="right" class="MiniCartTextSmall">{include file="currency.tpl" value=$minicart_shipping}</td>
</tr>
</table>
<table width="100%" border="0" cellpadding="1" cellspacing="0">
<tr>
<TD class="ProductDetailsTitle">{$lng.lbl_total}: </td>
<td align="right" class="MiniCartTextSmall">{include file="currency.tpl" value=$minicart_total_cost}</td>
</tr>
</table>
{else}
{$lng.lbl_cart_is_empty}
{/if}
<hr size="1" noshade class="VertMenuHr">

<A href="cart.php" class="VertMenuItems">{$lng.lbl_view_cart}</A><BR>
<A href="cart.php?mode=checkout" class="VertMenuItems">{$lng.lbl_checkout}</A><BR>


These are the labels I added:

{$lng.lbl_remove}
{$lng.lbl_shipping}

Happy modding!

neaisha 01-26-2007 10:42 PM

Re: Improved minicart display
 
the shipping was calculating incorrectly for me to...it was doubling it.

replace:
Code:

<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>


with
Code:

<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" 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>


i couldnt figure out how to code it right but in general, you don't need the equation per se b/c "minicarttotalcost" already includes shipping


All times are GMT -8. The time now is 11:53 PM.

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