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

Improved minicart display

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #51  
Old 04-07-2007, 01:16 PM
 
icases icases is offline
 

Member
  
Join Date: Mar 2007
Posts: 14
 

Default Re: Improved minicart display

Great mod. Works great in 4.1.6.

Used code from here - http://forum.x-cart.com/showpost.php?p=156065&postcount=33
__________________
Jeff S.
http://www.icases.net
X-Cart V4.1.6

A search engine that pays you! $.25/hour - click here
What is AGLOCO? click here
Reply With Quote
  #52  
Old 04-09-2007, 04:48 PM
 
Pinestream Pinestream is offline
 

Advanced Member
  
Join Date: Jul 2006
Posts: 30
 

Default Re: Improved minicart display

My first X-Cart contribution.....

People have been asking how to return to the same page, not the cart, after removing a product from the min-cart. Simple -- find this code section in cart.php:

# DELETE PRODUCT
if ($mode == "delete" && !empty($productindex)) {
...
...
...
$cart = func_array_merge($cart, func_calculate($cart, $products, $login, $current_area, 0));

--> ADD THIS:
$return_url = $_SERVER['HTTP_REFERER'];
func_header_location($return_url);
}

That's it. Just remember -- it would be wise to add some input validation/filtering on $_SERVER['HTTP_REFERER'].
__________________
Pinestream
X-Cart 4.1.8
Also litecommerce 2.2
Reply With Quote
  #53  
Old 04-29-2007, 02:46 AM
 
RCTOYS RCTOYS is offline
 

Member
  
Join Date: Apr 2007
Posts: 28
 

Default Re: Improved minicart display

Hello,

I thank you very much for this great contribution !

CU
__________________
X-CART GOLD 4.1.7
ADDONS : X-RMA | X-AOM | X-MAGNIFIER
HACKS : MINICART MAGNIFIER
Reply With Quote
  #54  
Old 05-08-2007, 05:27 AM
 
aussieshop aussieshop is offline
 

Member
  
Join Date: Apr 2007
Posts: 11
 

Default Re: Improved minicart display

Thanks very much for this mod it works really well except for Gift certificate module. When I try to add a gift certificate to the minicart. It returns with this error message " Fatal error: Unsupported operand types in /clientdata/clients/a/u/aussiebestprice.com/www/minicart.php on line 53". Attached is my minicart.php can someone assist?

Quote:
$Id: minicart.php,v 1.4 2006/03/14 14:41:30 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"])) {
if (!empty($active_modules["Fast_Lane_Checkout"]))
$MINICART["total_cost"] = $cart["display_subtotal"];
else
$MINICART["total_cost"] = $cart["total_cost"];
}
$MINICART["total_items"] = 0; if (!empty($cart["products"]) and is_array($cart["products"])) {foreach ($cart["products"] as $_tmp) $MINICART["total_items"] += $_tmp["amount"];} if (!empty($cart["giftcerts"]) and is_array($cart["giftcerts"])) $MINICART["total_items"] +=$cart["giftcerts"];
}
$smarty->assign("minicart_total_cost", $MINICART["total_cost"]);
$smarty->assign("minicart_total_items", $MINICART["total_items"]);$smarty->assign("minicart_contents", $cart["products"]); //mycode
$smarty->assign("minicart_shipping", $cart["shipping_cost"]); //mycode
$smarty->assign("minicart_delivery", $cart["delivery"]); //mycode
__________________
X-cart Gold 4.1.6
Reply With Quote
  #55  
Old 05-08-2007, 06:47 AM
  HWT's Avatar 
HWT HWT is offline
 

eXpert
  
Join Date: Jan 2005
Location: Massachusetts, USA
Posts: 392
 

Default Re: Improved minicart display

Line 53 in my minicart.php is this one:

PHP Code:
$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);


maybe you changed it somehow?

I've attached my minicart.php for you. It's the same version as you are working with. I've tested it and the gift certificate works, though it just adds to the totals rather than looking like a product in the minicart.
Attached Files
File Type: php minicart.php (3.4 KB, 137 views)
__________________
x-cart 4.0.13 and 4.1.7 and 4.1.10
Reply With Quote
  #56  
Old 05-08-2007, 07:20 AM
 
aussieshop aussieshop is offline
 

Member
  
Join Date: Apr 2007
Posts: 11
 

Default Re: Improved minicart display

Hi HWT,
Thanks very much for your help, it is now working again.
__________________
X-cart Gold 4.1.6
Reply With Quote
  #57  
Old 05-14-2007, 07:11 AM
  hoosierglass's Avatar 
hoosierglass hoosierglass is offline
 

X-Adept
  
Join Date: Aug 2006
Location: Zionsville, IN
Posts: 974
 

Default Re: Improved minicart display

Quote:
Originally Posted by Pinestream
My first X-Cart contribution.....

People have been asking how to return to the same page, not the cart, after removing a product from the min-cart. Simple -- find this code section in cart.php:

# DELETE PRODUCT
if ($mode == "delete" && !empty($productindex)) {
...
...
...
$cart = func_array_merge($cart, func_calculate($cart, $products, $login, $current_area, 0));

--> ADD THIS:
$return_url = $_SERVER['HTTP_REFERER'];
func_header_location($return_url);
}

That's it. Just remember -- it would be wise to add some input validation/filtering on $_SERVER['HTTP_REFERER'].

I could not get this to work, but noticed this line:
PHP Code:
func_header_location("cart.php"); 

which I changed to:
PHP Code:
func_header_location("home.php"); 

This work great. Again thanks to all who have contributed to this mod.
__________________
X-Cart Gold 4.7.7
Custom Work from www.luminointernet.com
www.indy-pen-dance.com
Reply With Quote
  #58  
Old 05-19-2007, 10:55 AM
  hoosierglass's Avatar 
hoosierglass hoosierglass is offline
 

X-Adept
  
Join Date: Aug 2006
Location: Zionsville, IN
Posts: 974
 

Default Re: Improved minicart display

I have this working in 4.1.7 but have a shipping issue.

If you go into the cart then exit the cart via continue shopping then the shipping amount appears even if you are not logged in. This is great, but it would be nice to have the shipping apear without going into the cart first. It just does not make much sense to me.
__________________
X-Cart Gold 4.7.7
Custom Work from www.luminointernet.com
www.indy-pen-dance.com
Reply With Quote
  #59  
Old 05-19-2007, 06:33 PM
  HWT's Avatar 
HWT HWT is offline
 

eXpert
  
Join Date: Jan 2005
Location: Massachusetts, USA
Posts: 392
 

Default Re: Improved minicart display

Thanks for pointing this out. I thought everything was peachy with this mod until you posted.

A stop gap work around for us is to display "view cart" when the totals meet certain conditions.

What I mean is this. We offer free shipping on orders over $97 and flat rate ground shipping on all orders under $97. So, the shipping was displaying $0.00 on all cart contents regardless of the total until the customer entered the cart. then it displayed correctly (as you stated)

So, I simply added an {if} statement to take care of it that if the $minicart_shipping = 0 and $grantotal < 97 to display "view cart" else do the normal stuff. You may be able to apply the same kind of concept.

Here's the code for mine:

Code:
<td align="right" class="MiniCartTextTiny"> {if $minicart_shipping eq 0 and $grandtotal < 97} <b>View Cart</b> {else} <b><a title="{$minicart_delivery}">{include file="currency.tpl"}{$minicart_shipping}</a></b> {/if} </td>

What worked nicely doing it this way was that after you visit the cart itself, you never have the issue again (for our shipping system). I'm not sure how it will do with real time shipping, as we only offer that for express delivery, and customers usually choose it on checkout, not by what the minicart says anyway.

hope this helps!
__________________
x-cart 4.0.13 and 4.1.7 and 4.1.10
Reply With Quote
  #60  
Old 05-21-2007, 04:32 AM
  hoosierglass's Avatar 
hoosierglass hoosierglass is offline
 

X-Adept
  
Join Date: Aug 2006
Location: Zionsville, IN
Posts: 974
 

Default Re: Improved minicart display

I am having a problem with the minicart displaying the proper totals. (see attach)

The hinge shown in the cart is 46.95 each, but on orders over $125, we discount 20%.
So it is showing the correct discounted price for the item, but the total at the bottom is still showing the price before discount $140.55 (qty 3) and is not adding in the shipping.

I tried looking at the fastlane module cart_subtotal.tpl for some ideas on how to get this to display correct totals but got nowhere fast. Does anyone know where to go with this or am I beating a dead horse?

Here is my minicart.tpl code

Code:
{* $Id: minicart.tpl,v 1.12 2007/05/18 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} &nbsp;&nbsp; <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 Indiana residents only {else} {$lng.lbl_cart_is_empty} {/if} <hr size="1" noshade class="VertMenuHr">
Attached Thumbnails
Click image for larger version

Name:	mini.JPG
Views:	205
Size:	11.5 KB
ID:	397  
__________________
X-Cart Gold 4.7.7
Custom Work from www.luminointernet.com
www.indy-pen-dance.com
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 06:36 PM.

   

 
X-Cart forums © 2001-2020