Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

99% worked out code


warrenerjm

Recommended Posts

Posted

Hi

 

I have searched & searched & cut & pasted code ALL DAY to try & solve this!

 

I am just about there thanks to a mix of contribs & code snippets, but I am brain dead now, so please could you help me finish it off.=? :D

 

This is my code for catalog/includes/boxes/shopping_cart.php

 

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

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2005 leisuret
 Released under the GNU General Public License  


Changes:
2006-06-11 Modify to 1 line for item count and amount & clean up code


*/
?>
<!-- shopping_cart //-->
	  <tr>
		<td>
<?php

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

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


$cart_contents_string = '';

 if ($cart->count_contents() > 0) {
$cart_contents_string = '<table border="0" width=BOX_WIDTH cellspacing="0" cellpadding="0">';
$products = $cart->get_products();
{

$cart_contents_string .= '<tr><td align="center" valign="middle" class="infoBoxContents">';
$cart_contents_string .= '<b>' . $cart->count_contents() . '</b>';
 if ($cart->count_contents() > 1) { 
 		$cart_contents_string .=' Items  ' . '</td>';

	  } else {

	  $cart_contents_string .=' Item  ' . '</td>';
		}
																}
		$cart_contents_string .= '</table>';
	  } else {
		$cart_contents_string .= BOX_SHOPPING_CART_EMPTY;
	  }


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

 if ($cart->count_contents() > 0) {
$info_box_contents[] = array('align' => 'center',
							 'text' => 'Sub Total: ' . '<b>' . $currencies->format($cart->show_total()) . '</b><br>' .
									   '<u>View Cart</u>');
 }
 new infoBox($info_box_contents);
?>
		</td>
	  </tr>
<!-- shopping_cart_eof //-->

 

This gives me:

screenshot.cart.gif

 

How do I get it to read

 

Item: 1

 

& not

 

1 Item

 

Also how do I add a link to the "View Cart" as all the examples I have are from a FILENAME link?

 

I might align left instead of center, but then that is how I want it ( I hope)

 

Thanks in advance & anticipation!!

 

Julie

Posted
searched & cut & pasted code ALL DAY to try

you probably kidding

 

try:

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

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2005 leisuret
 Released under the GNU General Public License  


Changes:
2006-06-11 Modify to 1 line for item count and amount & clean up code


*/
?>
<!-- shopping_cart //-->
	  <tr>
		<td>
<?php

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

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


$cart_contents_string = '';

 if ($cart->count_contents() > 0) {
$cart_contents_string = '<table border="0" width=BOX_WIDTH cellspacing="0" cellpadding="0">';
$products = $cart->get_products();
{

$cart_contents_string .= '<tr><td align="center" valign="middle" class="infoBoxContents">';
 if ($cart->count_contents() > 1) {
		 $cart_contents_string .=' Items ';

	  } else {

	  $cart_contents_string .=' Item ';
		}
																}
$cart_contents_string .= '<b>' . $cart->count_contents() . '</b></td>';
		$cart_contents_string .= '</table>';
	  } else {
		$cart_contents_string .= BOX_SHOPPING_CART_EMPTY;
	  }


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

 if ($cart->count_contents() > 0) {
$info_box_contents[] = array('align' => 'center',
							 'text' => 'Sub Total: ' . '<b>' . $currencies->format($cart->show_total()) . '</b><br>' .
									   '<u>View Cart</u>');
 }
 new infoBox($info_box_contents);
?>
		</td>
	  </tr>
<!-- shopping_cart_eof //-->

Please read this line: Do you want to find all the answers to your questions? click here. As for contribution database it's located here!

8 people out of 10 don't bother to read installation manuals. I can recommend: if you can't read the installation manual, don't bother to install any contribution yourself.

Before installing contribution or editing/updating/deleting any files, do the full backup, it will save to you & everyone here on the forum time to fix your issues.

Any issues with oscommerce, I am here to help you.

Posted
you probably kidding

 

try:

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

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2005 leisuret
 Released under the GNU General Public License  
Changes:
2006-06-11 Modify to 1 line for item count and amount & clean up code
*/
?>
<!-- shopping_cart //-->
	  <tr>
		<td>
<?php

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

 new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_SHOPPING_CART));
$cart_contents_string = '';

 if ($cart->count_contents() > 0) {
$cart_contents_string = '<table border="0" width=BOX_WIDTH cellspacing="0" cellpadding="0">';
$products = $cart->get_products();
{

$cart_contents_string .= '<tr><td align="center" valign="middle" class="infoBoxContents">';
 if ($cart->count_contents() > 1) {
		 $cart_contents_string .=' Items ';

	  } else {

	  $cart_contents_string .=' Item ';
		}
																}
$cart_contents_string .= '<b>' . $cart->count_contents() . '</b></td>';
		$cart_contents_string .= '</table>';
	  } else {
		$cart_contents_string .= BOX_SHOPPING_CART_EMPTY;
	  }
$info_box_contents = array();
$info_box_contents[] = array('text' => $cart_contents_string);

 if ($cart->count_contents() > 0) {
$info_box_contents[] = array('align' => 'center',
							 'text' => 'Sub Total: ' . '<b>' . $currencies->format($cart->show_total()) . '</b><br>' .
									   '<u>View Cart</u>');
 }
 new infoBox($info_box_contents);
?>
		</td>
	  </tr>
<!-- shopping_cart_eof //-->

I'm not kidding...but that doesn't do anything different? :huh:

Posted
I'm not kidding...but that doesn't do anything different? :huh:

My mistake Alex (i can "see" that the item is fixed ) thanks.

 

I wouldn't have known how to do that :blush:

 

How do I do the link to the shopping_cart.php please as that is still the same? :D

 

Thanks

Julie

Posted

OK I am tierd ... & stupid. ;)

 

I have figured it :lol: Like I said I don't code I just try & find code! I realised that the link needed to be the same as the arrow in the header! DOH

 

This is the code for anyone else looking for it?

 

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

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2005 leisuret
 Released under the GNU General Public License  


Changes:
2006-06-11 Modify to 1 line for item count and amount & clean up code


*/
?>
<!-- shopping_cart //-->
	  <tr>
		<td>
<?php

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

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


$cart_contents_string = '';

 if ($cart->count_contents() > 0) {
$cart_contents_string = '<table border="0" width=BOX_WIDTH cellspacing="0" cellpadding="0">';
$products = $cart->get_products();
{

$cart_contents_string .= '<tr><td align="center" valign="middle" class="infoBoxContents">';
 if ($cart->count_contents() > 1) {
		 $cart_contents_string .=' Items ';

	  } else {

	  $cart_contents_string .=' Item ';
		}
																}
$cart_contents_string .= '<b>' . $cart->count_contents() . '</b></td>';
		$cart_contents_string .= '</table>';
	  } else {
		$cart_contents_string .= BOX_SHOPPING_CART_EMPTY;
	  }


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

 if ($cart->count_contents() > 0) {
$info_box_contents[] = array('align' => 'left',
							 'text' => 'Sub Total: ' . '<b>' . $currencies->format($cart->show_total()) . '</b><br>' .
									   '<a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '">View Basket</a>');
 }
 new infoBox($info_box_contents);
?>
		</td>
	  </tr>
<!-- shopping_cart_eof //-->

 

;) Julie

 

Thanks Alex

Archived

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

×
×
  • Create New...