Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

editing the shopping cart box to only show items and total


lindsayanng

Recommended Posts

Is there a contribution or "the best way" to get the shopping cart to only show something like this:

 

2 items

_______

total :$25.00

 

instead of listing the individual items that the person adds to the cart.. This shop is selling tshirts, and its pretty unlikely that peoeple will need to keep track of which ones that added, and its also pretty unlike that they will buy more than 2.. but if they were to add a bunch of tshirts to their cart, it would push the box way down and screw up my layout massively.

 

So is there a way to just total the value and show the # of items instead of each individual item???

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

If you remove this code from boxes/shopping_cart.php it will remove the products from the box and show the $ total.

 

	  $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');
  }

 

It won't show the number of products in the cart.

 

PS I always buy multiple shirts, especially tee shirts.

Link to comment
Share on other sites

well see.. then if you always buy multiples, then i DEFIINITELY Need to have the item counter in there.. this way you know how many and how much.. it snot like they need to know 1 of this style, and 2 of that style.. and oh yea, a belt..

 

it just seems like overkill to me in general. Removing the product name, etc was the easy part.. Counting them and showing the count is harder.. I will play around but any suggestions are GREATLY appreciated.

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

In the boxes file you will find this

 

 $cart_contents_string .= $products[$i]['quantity']

 

If you change it to

 

	  $cart_contents_string .= $cart->count_contents()

 

you will get the total number of products in the cart instead of how many of each product.

Link to comment
Share on other sites

The easy way is to remove the shopping cart box from your left or right column and put it in your header. You can add something like this any where.

<?php echo '<a href ="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' . HEADER_TITLE_CART_CONTENTS .'</a><br>Items: ' . $cart->count_contents() . ' Total: ' . $currencies->format($cart->show_total());?>

Link to comment
Share on other sites

I already removed it from the column and added it to the header, i just need to figure out how to adjust the contents in a way that it doesnt show each product

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

Am I misunderstanding you? The above code will only show the total number of items and the total cost. Is that not what you want?

Link to comment
Share on other sites

ohh oops@@ i only read half of your response

A great place for newbies to start

Road Map to oscommerce File Structure

DO NOT PM ME FOR HELP. My time is valuable, unless i ask you to PM me, please dont. You will get better help if you post publicly. I am not as good at this as you think anyways!

 

HOWEVER, you can visit my blog (go to my profile to see it) and post a question there, i will find time to get back and answer you

 

Proud Memeber of the CODE BREAKERS CLUB!!

Link to comment
Share on other sites

ohh oops@@ i only read half of your response

:lol: :lol: I do the same thing too. That why I asked if I wasn't getting the problem.

Link to comment
Share on other sites

  • 3 months later...
  • 3 months later...

The easy way is to remove the shopping cart box from your left or right column and put it in your header. You can add something like this any where.

<?php echo '<a href ="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' . HEADER_TITLE_CART_CONTENTS .'</a><br>Items: ' . $cart->count_contents() . ' Total: ' . $currencies->format($cart->show_total());?>

 

 

thank you for that!

 

is there a way to not show "items & total" when the cart is empty?

 

:)

Link to comment
Share on other sites

thank you for that!

 

is there a way to not show "items & total" when the cart is empty?

 

smile.gif

 

 

<?php echo '<a href ="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' . HEADER_TITLE_CART_CONTENTS .'</a>' . ($cart->count_contents()  ? '<br>Items: ' . $cart->count_contents() . ' Total: ' . $currencies->format($cart->show_total()) : ''); ?>

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

<?php echo '<a href ="' . tep_href_link(FILENAME_SHOPPING_CART) . '">' . HEADER_TITLE_CART_CONTENTS .'</a>' . ($cart->count_contents()  ? '<br>Items: ' . $cart->count_contents() . ' Total: ' . $currencies->format($cart->show_total()) : ''); ?>

 

 

thank you! but get a "PHP Parse error: syntax error, unexpected T_STRING" when I use it,

will check again if it just me, it usually is :lol:

Link to comment
Share on other sites

thank you! but get a "PHP Parse error: syntax error, unexpected T_STRING" when I use it,

will check again if it just me, it usually is :lol:

 

 

SOLVED:

 

there was one too many spaces in . ($cart->count_contents() ? '<br>Items: '" between () and ?

 

thank again, works perfect! :)

Link to comment
Share on other sites

  • 4 months later...

If you remove this code from boxes/shopping_cart.php it will remove the products from the box and show the $ total.

 

	  $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');
  }

 

It won't show the number of products in the cart.

 

PS I always buy multiple shirts, especially tee shirts.

Link to comment
Share on other sites

Is there some way to edit this code so that it shows the model instead of the product name?

In catalog/includes/boxes/shopping_cart.php find

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

Change to

     //$cart_contents_string .= $products[$i]['name'] . '</span></a></td></tr>';
     $cart_contents_string .= ($products[$i]['model'] ? $products[$i]['model'] : $products[$i]['name']) . '</span></a></td></tr>';

That will display the products model#. If there is no model# the products name will display.

Link to comment
Share on other sites

In catalog/includes/boxes/shopping_cart.php find

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

Change to

     //$cart_contents_string .= $products[$i]['name'] . '</span></a></td></tr>';
     $cart_contents_string .= ($products[$i]['model'] ? $products[$i]['model'] : $products[$i]['name']) . '</span></a></td></tr>';

That will display the products model#. If there is no model# the products name will display.

 

Nice Thanx!

 

Kurt

Link to comment
Share on other sites

  • 2 months later...

hi there

 

i'm not sure it's the right topic to ask my question

but i guess it's not really different.

 

is there a way to count the number of products instead of the number of total quantity?

(with the code to show total quantity in header)

 

for example i have

10x AAAA

5x BBBB

3x CCCC

 

so in the header i have

18 items

 

but i want to show

3 items

 

Thanks

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...