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

display the total weight on the view cart page

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #11  
Old 03-05-2010, 08:53 AM
 
just wondering just wondering is offline
 

X-Adept
  
Join Date: Oct 2006
Location: UK
Posts: 471
 

Default Re: display the total weight on the view cart page

Quote:
Originally Posted by lookformeb
----------------------------------------------------------------------------------
In /shipping/shipping.php, add:
Code:
$smarty->assign("total_weight_shipping",$total_weight_shipping);
after:
Code:
$total_weight_shipping = func_weight_shipping_products($products);
----------------------------------------------------------------------------------

Then, to call this simply edit /skin1/customer/main/cart_totals.tpl and place this wherever you want to show it:
Code:
{$total_weight_shipping}
This is slightly different on 4.3.1:

In /shipping/shipping.php, add:
Code:
$smarty->assign("total_weight_shipping_valid", $total_weight_shipping_valid);
after:
Code:
$total_weight_shipping_valid = func_weight_shipping_products($cart['products'], true, $all_products_free_shipping, false);
----------------------------------------------------------------------------------

Then, to call this simply edit /skin1/customer/main/cart_totals.tpl and place this wherever you want to show it:
Code:
{$total_weight_shipping_valid}
Reply With Quote
  #12  
Old 03-05-2010, 06:00 PM
 
vixnfox vixnfox is offline
 

Advanced Member
  
Join Date: Feb 2006
Location: Adelaide, South Australia
Posts: 82
 

Default Re: display the total weight on the view cart page

Nice one. For anyone intrested in layout I added this to skin1/main.css

Code:
.totals .total-wt { white-space: nowrap; color: #cccccc; font-weight: bold; text-align: left; }

and used it this way in cart_totals.tpl (around line 191)

Code:
<div class="right-box"> <table cellspacing="0" class="totals" summary="{$lng.lbl_total|escape}"> <tr> <td class="total-wt">{$lng.lbl_totalwt}</td> <td class="total-name">{$total_weight_shipping_valid}g</td> </tr> <tr> <td class="total-name">{$lng.lbl_subtotal}:</td> <td class="total-value">{include file="currency.tpl" value=$cart.display_subtotal}</td> <td class="total-alt-value">{include file="customer/main/alter_currency_value.tpl" alter_currency_value=$cart.display_subtotal}</td> </tr>

the"g" is for grams BTW since I was too lazy to edit languages and put in a nice label, although I did for lbl_totalwt which you can do or just type in the text you want.


Vixnfox
__________________
V 4.3.1 Live:

Developing on
PHP 5.3.0
MySQL server 5.0.75-community-log
MySQL client 5.1.36
Web server Apache/2.2.11 (Unix) mod_ssl/2.2.11
Windows 7 64bit on a Toshiba Satellite P500

ADELAIDE, SOUTH AUSTRALIA
Reply With Quote
  #13  
Old 03-08-2010, 08:03 AM
 
just wondering just wondering is offline
 

X-Adept
  
Join Date: Oct 2006
Location: UK
Posts: 471
 

Default Re: display the total weight on the view cart page

Hey vixnfox,

I didn't even add anything to the CSS layout. I just added this:
Code:
<tr> <td class="total-name">{$lng.lbl_total_weight}:</td> <td class="total-value">{$total_weight_shipping_valid} KG</td> </tr>
& made the "lbl_total_weight" Label and it worked a treat.
Reply With Quote
  #14  
Old 07-11-2011, 01:44 AM
  chamberinternet's Avatar 
chamberinternet chamberinternet is offline
 

X-Wizard
  
Join Date: Sep 2005
Location: Lancashire, UK
Posts: 1,470
 

Default Re: display the total weight on the view cart page

Any idea on how this can be achieved using XC v4.4.x?

Many Thanks
__________________
Developing in 4.7.x now (Dipping into v5 - Slowly!)
Have used 4.1.x, 4.2.x, 4.4.x, 4.5.x, 4.6.x & 4.7.x
Multiple Instances of X-Cart
MySQL 5.6.37
CentOS 7.4


Chamber Internet
- Lancashire, United Kingdom
http://www.chamberelancs.co.uk
Reply With Quote
  #15  
Old 11-17-2011, 02:30 AM
  pauldodman's Avatar 
pauldodman pauldodman is offline
 

X-Guru
  
Join Date: Jul 2003
Location: Spain / UK
Posts: 3,052
 

Default Re: display the total weight on the view cart page

Quote:
Originally Posted by chamberinternet
Any idea on how this can be achieved using XC v4.4.x?

To do this in 4.4.x - follow the previous instructions for 4.3.x, but instead of:
shipping/shipping.php
you need to be in:
include/func/func.shipping.php
__________________
Paul Dodman
e-business & m-commerce consultant
w: www.luminointernet.com
e: xcart@luminointernet.com

Professional X-Cart help, advice, support and services, specialists in Mobile X-Cart.
Reply With Quote
  #16  
Old 12-18-2012, 09:30 AM
  drheath's Avatar 
drheath drheath is offline
 

Advanced Member
  
Join Date: Nov 2010
Location: Wisconsin
Posts: 53
 

Default Re: display the total weight on the view cart page

Thanks to everyone who contributed to the solution. I made a couple slight changes to accomplish this in 4.5.x using One Page Checkout.

In /shipping/shipping.php add
Code:
$smarty->assign("total_weight_shipping_valid", $total_weight_shipping_valid);
after
Code:
$total_weight_shipping_valid = func_weight_shipping_products($cart['products'], true, $all_products_free_shipping, false);

I called it on /skin/common_files/modules/One_Page_Checkout/Summary/cart_totals.tpl by just inserting a row where I wanted it to display.
Code:
<tr> <td class="total-name">{$lng.lbl_weight}:</td> <td class="total-value">{$total_weight_shipping_valid} lbs</td> </tr>
__________________
Business Edition 5.2.10
Gold Plus 4.6.1
Reply With Quote

The following user thanks drheath for this useful post:
tartaglia (12-18-2012)
  #17  
Old 02-25-2013, 09:12 AM
 
dmpinder dmpinder is offline
 

Advanced Member
  
Join Date: Jun 2009
Posts: 86
 

Default Re: display the total weight on the view cart page

I'm struggling to get this to work on version 4.5.1. The file which includes the PHP code to amend is actually include/func/func.shipping.php, and I have done the following:

PHP Code:
$total_weight_shipping_valid func_weight_shipping_products($cart['products'], true$all_products_free_shippingfalse);
    
$smarty->assign('total_weight_shipping_valid'$total_weight_shipping_valid); 

And on the cart.tpl I have included this:

HTML Code:
{$total_weight_shipping_valid}

However nothing shows up. Any thoughts?
__________________
Darren

X-Cart Gold 4.3.1
Reply With Quote
  #18  
Old 02-25-2013, 09:51 AM
  drheath's Avatar 
drheath drheath is offline
 

Advanced Member
  
Join Date: Nov 2010
Location: Wisconsin
Posts: 53
 

Default Re: display the total weight on the view cart page

Are you wrapping your call in anything? If I take it out of the table, it does not display.
__________________
Business Edition 5.2.10
Gold Plus 4.6.1
Reply With Quote
  #19  
Old 02-25-2013, 10:01 AM
 
dmpinder dmpinder is offline
 

Advanced Member
  
Join Date: Jun 2009
Posts: 86
 

Default Re: display the total weight on the view cart page

Quote:
Originally Posted by drheath
Are you wrapping your call in anything? If I take it out of the table, it does not display.

Do you mean the smarty code? I'm including it in the Cart template near the "Checkout" button at the moment, but my final intention is to do an if statement see if total weight is over 12, if not, then include a disabled Checkout button (since weight must be over 12 to proceed).
__________________
Darren

X-Cart Gold 4.3.1
Reply With Quote
  #20  
Old 02-25-2013, 10:28 AM
  drheath's Avatar 
drheath drheath is offline
 

Advanced Member
  
Join Date: Nov 2010
Location: Wisconsin
Posts: 53
 

Default Re: display the total weight on the view cart page

My bad, I thought you wanted to display information. I did something a while back that disabled specific shipping options based on extra field values of cart contents, but I really don't remember the details. I'm sure I found the instructions on the forum, it may help point you in the right direction.

If your only requirement is order total must be over 12 lbs, you could just set the minimum value on shipping options at 12 lbs and change the error label to read something like "Your order must be at least ..." The customer would not be able to check proceed without selecting a shipping method. If you did that, you may want to include the weight in the cart display.
__________________
Business Edition 5.2.10
Gold Plus 4.6.1
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 03:36 AM.

   

 
X-Cart forums © 2001-2020