Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Modifying the ShoppingCart Box.


sroblesruiz

Recommended Posts

Posted

Hi,

 

I alreday did a serch in the forum for this with no luck...

 

Is there any way of showing only the Total and number of items for the Shopping Cart box ?...

 

tnx,

 

Sergio

Posted

/catalog/includes/boxes/shopping_cart.php

 

The things I have added are in RED

 

<?php
/*
 $Id: shopping_cart.php,v 1.18 2003/02/10 22:31:06 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url]

 Copyright © 2003 osCommerce

 Released under the GNU General Public License
*/
?>
<!-- shopping_cart //-->
         <tr>
           <td>
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => BOX_HEADING_SHOPPING_CART);

 new infoBoxHeading($info_box_contents, false, true, tep_href_link(FILENAME_SHOPPING_CART));

 $cart_contents_string = '';
 if ($cart->count_contents() > 0) {

[color="#FF0000"][b]    $cart_contents_string .= '<tr><td align="center">';
   $cart_contents_string .= $cart->count_contents() . ' products';
   $cart_contents_string .= '</td></tr>';

/*[/b][/color]
   $cart_contents_string = '<table border="0" width="100%" cellspacing="0" cellpadding="0">';
   $products = $cart->get_products();
   for ($i=0, $n=sizeof($products); $i<$n; $i++) {
     $cart_contents_string .= '<tr><td align="right" valign="top" class="infoBoxContents">';

     if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {
       $cart_contents_string .= '<span class="newItemInCart">';
     } else {
       $cart_contents_string .= '<span class="infoBoxContents">';
     }

     $cart_contents_string .= $products[$i]['quantity'] . ' x </span></td><td valign="top" class="infoBoxContents"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products[$i]['id']) . '">';

     if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {
       $cart_contents_string .= '<span class="newItemInCart">';
     } else {
       $cart_contents_string .= '<span class="infoBoxContents">';
     }

     $cart_contents_string .= $products[$i]['name'] . '</span></a></td></tr>';

     if ((tep_session_is_registered('new_products_id_in_cart')) && ($new_products_id_in_cart == $products[$i]['id'])) {
       tep_session_unregister('new_products_id_in_cart');
     }
   }
   $cart_contents_string .= '</table>';
[color="#FF0000"][b]*/[/b][/color]

 } else {
   $cart_contents_string .= BOX_SHOPPING_CART_EMPTY;
 }

 $info_box_contents = array();
 $info_box_contents[] = array('text' => $cart_contents_string);

[color="#FF0000"][b]/*[/b][/color]
 if ($cart->count_contents() > 0) {
   $info_box_contents[] = array('text' => tep_draw_separator());
   $info_box_contents[] = array('align' => 'right',
                                'text' => $currencies->format($cart->show_total()));
 }
[color="#FF0000"][b]*/[/b][/color]
 new infoBox($info_box_contents);
?>
           </td>
         </tr>
<!-- shopping_cart_eof //-->

BACKUP THE ONE YOU HAVE BEFORE MAKING ANY EDITS.

 

You break it - You buy it.

 

If your store is multilingual you'll want to change this line:

 

	$cart_contents_string .= $cart->count_contents() . ' product(s)';

To something like:

 

	$cart_contents_string .= $cart->count_contents() . PRODUCTS;

Then in each of your language files make an entry like:

 

define('PRODUCTS', ' product(s)');

Again, backup any file before making any edits.

 

I'm not going to fix it if you break it.

:blush:

 

I tried this code and it works for me.

;)

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Archived

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

×
×
  • Create New...