Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Weight calculator


Guest

Recommended Posts

Hi,

Is there any way to calculate the toatl weight of all the shopping cart contents and show this to the customer before they progress to checkout.

 

Thanks

Link to comment
Share on other sites

I have the total weight displayed in my shopping_cart.php page. The trick is to see if I can remember how I did it... :)

 

Okay, first I show the individual item weight underneath the item name. I added that with this code:

 

          $products_name .= '<small>Weight: ' . $products[$i]['weight'] . ' grams</small><br>';

 

As you can see, my weight is in grams. You'll want to change that to pounds or ounces, or whatever, as necessary.

 

Then I show the total package weight with this:

 

<b>Package Weight: <?php echo $cart->show_weight(); ?> grams

 

There doesn't appear to be any other reference to weight on my shopping_cart.php page, so that should hopefully cover it.

 

If you're still stuck, let me know.

 

Terry

Terry Kluytmans

 

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

 

Add order total to checkout_shipment

Add order total to checkout_payment

Add radio buttons at checkout_shipping (for backorder options, etc.)

Duplicate Table Rate Shipping Module

Better Product Review Flow

 

* If at first you don't succeed, find out if there's a prize for the loser. *

Link to comment
Share on other sites

I have the total weight displayed in my shopping_cart.php page. The trick is to see if I can remember how I did it... :)

 

Okay, first I show the individual item weight underneath the item name. I added that with this code:

 

          $products_name .= '<small>Weight: ' . $products[$i]['weight'] . ' grams</small><br>';

 

As you can see, my weight is in grams. You'll want to change that to pounds or ounces, or whatever, as necessary.

 

Then I show the total package weight with this:

 

<b>Package Weight: <?php echo $cart->show_weight(); ?> grams

 

There doesn't appear to be any other reference to weight on my shopping_cart.php page, so that should hopefully cover it.

 

If you're still stuck, let me know.

 

Terry

Hi Terry,

Do i just add your code any where on the shopping_cart.php file....or is there a particular place i need to add this code within the shopping_cart.php file.

 

Thanks

Link to comment
Share on other sites

I added mine where I wanted it to display. Test it out in a few places and you'll figure out where you want to place it. You can see it in action on my site by adding a product to your cart, then clicking on the shopping cart page.

 

http://www.kididdles.com/catalog

 

 

HTH,

 

Terry

Terry Kluytmans

 

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

 

Add order total to checkout_shipment

Add order total to checkout_payment

Add radio buttons at checkout_shipping (for backorder options, etc.)

Duplicate Table Rate Shipping Module

Better Product Review Flow

 

* If at first you don't succeed, find out if there's a prize for the loser. *

Link to comment
Share on other sites

I added mine where I wanted it to display. Test it out in a few places and you'll figure out where you want to place it. You can see it in action on my site by adding a product to your cart, then clicking on the shopping cart page.

 

http://www.kididdles.com/catalog

HTH,

 

Terry

Terry,

Thanks a lot for all the info. I went to your website it looks great....I have one more question, on the product description page how did you manage to get the description text of the product at the bottm of the product image.....looks nice.

I really like the layout of your product description page and please let me know whats changes i have to make my product description page look similar to yous..

 

thanks...

Link to comment
Share on other sites

Thanks a lot for all the info. I went to your website it looks great....I have one more question, on the product description page how did you manage to get the description text of the product at the bottm of the product image.....looks nice.

 

I spent many hours creating and/or manipulating table cells to get things displayed the way I wanted them. I also added a number of additional fields, like format, item number, and product availability.

 

For the most part, it was a matter of cutting and pasting code -- sometimes inside table cells, sometimes not -- seeing if I broke the page, then trying again. :)

 

Moving the description to where you want it isn't so difficult... The code to look for is this:

 

          <p><?php echo stripslashes($product_info['products_description']); ?></p>

 

In the original code, it's right below the javascript popup image text. I cut it from there, then placed it below the reviews/add to cart buttons and attributes code. Try looking for this code near the bottom of the /catalog/product_info.php page:

 

      <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td>
<?php
   if ((USE_CACHE == 'true') && empty($SID)) {
     echo tep_cache_also_purchased(3600);
   } else {
     include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
   }
 }
?>

 

and replace with:

 

      <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?>

<p><?php echo stripslashes($product_info['products_description']); ?></p></td>
     </tr>
     <tr>
       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
     </tr>
     <tr>
       <td>
<?php
   if ((USE_CACHE == 'true') && empty($SID)) {
     echo tep_cache_also_purchased(3600);
   } else {
     include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
   }
 }
?>

 

Something along those lines should work, I think... :)

 

HTH,

 

Terry

Terry Kluytmans

 

Contribs Installed: Purchase Without Account (PWA); Big Images, Product Availability, Description in Product Listing, Graphical Infobox, Header Tags Controller, Login Box, Option Type Feature, plus many layout changes & other mods of my own, like:

 

Add order total to checkout_shipment

Add order total to checkout_payment

Add radio buttons at checkout_shipping (for backorder options, etc.)

Duplicate Table Rate Shipping Module

Better Product Review Flow

 

* If at first you don't succeed, find out if there's a prize for the loser. *

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...