Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Cant get it to look right


matrix2223

Recommended Posts

Posted

Thanks for anyone who looks at this. Here is a link to My Webpage

 

I got the shopping cart info box in the header, which is what I want. However what I dont want is the box that goes with it. I gave the box a new class="ShoppingCartBox" and added it to the stylesheet.

 

What Im hoping to get is just the text to display in the same fashion as it would as if it was in a box on the right side of the header. If I make sense.

 

I did try every contrib that I could find to do this but nothing gave me what I wanted.

 

Could someone please pretty please point me in the right direction?

 

Thank you in advance,

 

Eric

Posted

Try posting the code for the class and the pertinent part of the header here and see if someone can find what you need.

Posted

Thank you for your reply,

 

in my stylesheet I added

 

.ShoppingCartBox {
 background: #000000;
}
TD.ShoppingCartBoxHeading {
 font-family: Verdana, Arial, sans-serif;
 font-size: 10px;
 font-weight: bold;
 background: #000000;
 color: #ffffff;
}
.ShoppingCartBoxContents {
 background: #ffffff;
 font-family: Verdana, Arial, sans-serif;
 font-size: 10px;
}

 

In the Header.php file I add this

?>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<table align="right" class="header" width="25%" border="0" cellspacing="1" cellpadding="1">
  <table align="right" valign="top" class="header" width="120" border="0" cellspacing="1" cellpadding="1">
<!-- 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) {
//$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="ShoppingCartBoxContents">';

  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="ShoppingCartBoxContents">';
  }

  $cart_contents_string .= $products[$i]['quantity'] . ' x </span></td><td valign="top" class="ShoppingCartBoxContents"><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="ShoppingCartBoxContents">';
  }

  $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>';
 } 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('text' => tep_draw_separator());
$info_box_contents[] = array('align' => 'right',
							 'text' => $currencies->format($cart->show_total()));
 }

 new infoBox($info_box_contents);
?>
		</td>
	  </tr>
<!-- shopping_cart_eof //-->
<table border="0" width="75%" cellspacing="0" cellpadding="0">
 <tr class="header">
<td valign="middle" align="middle"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'candle_banner.gif', 'Mountain View Candles') . '</a>'; ?></td>
</tr>
</table>

 

Also in includes/classes/boxes.php I added this

 

//New ShoppingCartBox Class
 class ShoppingCartBox extends tableBox {
function ShoppingCartBox($contents) {
  $info_box_contents = array();
  $info_box_contents[] = array('text' => $this->ShoppingCartBoxContents($contents));
  $this->table_cellpadding = '1';
  $this->table_parameters = 'class="ShoppingCartBox"';
  $this->tableBox($info_box_contents, true);
}

function ShoppingCartBoxContents($contents) {
  $this->table_cellpadding = '3';
  $this->table_parameters = 'class="ShoppingCartBoxContents"';
  $info_box_contents = array();
  $info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1')));
  for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
	$info_box_contents[] = array(array('align' => $contents[$i]['align'],
									   'form' => $contents[$i]['form'],
									   'params' => 'class="ShoppingCartBoxContents"',
									   'text' => $contents[$i]['text']));
  }
  $info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1')));
  return $this->tableBox($info_box_contents);
}
 }

 class ShoppingCartBoxHeading extends tableBox {
function ShoppingCartBoxHeading($contents, $left_corner = true, $right_corner = true, $right_arrow = false) {
  $this->table_cellpadding = '0';

  if ($left_corner == true) {
	$left_corner = tep_image(DIR_WS_IMAGES . 'ShoppingCartBox/corner_left.gif');
  } else {
	$left_corner = tep_image(DIR_WS_IMAGES . 'ShoppingCartBox/corner_right_left.gif');
  }
  if ($right_arrow == true) {
	$right_arrow = '<a href="' . $right_arrow . '">' . tep_image(DIR_WS_IMAGES . 'ShoppingCartBox/arrow_right.gif', ICON_ARROW_RIGHT) . '</a>';
  } else {
	$right_arrow = '';
  }
  if ($right_corner == true) {
	$right_corner = $right_arrow . tep_image(DIR_WS_IMAGES . 'ShoppingCartBox/corner_right.gif');
  } else {
	$right_corner = $right_arrow . tep_draw_separator('pixel_trans.gif', '11', '14');
  }

  $info_box_contents = array();
  $info_box_contents[] = array(array('params' => 'height="14" class="ShoppingCartBoxHeading"',
									 'text' => $left_corner),
							   array('params' => 'width="100%" height="14" class="ShoppingCartBoxHeading"',
									 'text' => $contents[0]['text']),
							   array('params' => 'height="14" class="ShoppingCartBoxHeading" nowrap',
									 'text' => $right_corner));

  $this->tableBox($info_box_contents, true);
}
 }

 

Thank you for your response and help,

 

Eric

Posted

Hmmm, not enough coffee yet this morning....try: Leave the structure and content, but don't call it an infobox.

Posted

LOL Ive tried for the past 6 hours I just cant seem to figure it out. Been up all night Im tryin to get this done been the end of the weekend. Maybe I should get some ZZZZzzzzz

 

Would you happen to know which part to cut/change

 

Thank you for your help

Posted

Just a stab:

near the bottom of your added header stuff you are still asking for an infobox here:

$info_box_contents = array();

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

 

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()));

}

 

new infoBox($info_box_contents);

now, how to keep the data but drop the infobox formatting. I've never done that.

Posted

Hey thanks man You have really honestly been a big help.

 

First is some ZZZzzzz then Ill try playin around with it some more Once I figure it out Im going to post in the contrib section this is crazy codin for a rookie.

 

Thanks,

 

Eric

Posted

You may wake up and find the answer is here for you! Good luck!

Posted

Good Morning, Eric! I love a good puzzle; which is how I view these things. I mocked up your header in my dev store and found the answer! You only need to change one line to make it work! (unless I missed something). In header.php where you have:

 

  new infoBox($info_box_contents);

 

change it to:

 

  new ShoppingCartBox($info_box_contents);

 

Works in my dev store. That's a nice look, by the way. trouble is, it falls behind the rest of the contents of the page as it fills up. You may want to consider just displaying the total number of items and the cost, so it doesn't use up so much space and break the layout. For that, you must remove most of the guts that call for "$cart_contents_string" and replace them with something that aggregates the total number of products ordered so far. Newegg's cart looks like that. I'm sure it's just a bit of code and you could re-post once you're closer.

Posted

Hi Dan,

 

Thanks for the reply again there is a contrib that I downloaded that used the total items and price but I couldnt get it to go the way I wanted it to

 

heres the code for it

<table align="right" class="header" width="25%" border="0" cellspacing="1" cellpadding="1">
  <table align="right" valign="top" class="header" width="120" border="0" cellspacing="1" cellpadding="1">
<tr>
	<td class="accountCategory1" align="right" valign="top">
		Items:
	</td>
	<td class="accountCategory1" align="left" valign="top">
		<?php echo $cart->
		count_contents(); ?>  <br>
	</td>
	<td class="accountCategory1" align="right" valign="center">
		Total:
	</td>
	<td class="accountCategory1" align="left" valign="center">
		<?php echo $currencies->
		format($cart->show_total()); ?><br>
	</td>
	 </td>
</tr>
</table>
</table>
<!-- shopping_cart_eof //-->

 

The what that this displays is

Item:1 Total: $39.99

 

I tried and tried to figure out how to get it to look like this;

Item/s: 1

Total: $39.99

 

LOL I will figure this out if it kills me The whole idea behind this is to get rid of every box so that the content looks supper clean

 

Thanks for the input,

 

Eric

Posted

Hey Dan I think we are on to something This is looks good because I am getting rid of the whole top bar ie breadcrumbs and links to my account and so on so the info that the cart displays shouldnt be a problem.

 

The only thing I have to figure out now is how to get rid of the darn border should be a simple stylesheet change. Ill post back with any progress that I have.

 

Thanks a million,

 

Eric

Posted

For those of you have been reading this thread I finally figured it out How to do this and to get it to work the way I wanted it to.

 

Here is how to do it The code can be modified to your likings;

 

In the stylesheet.css add a new class (Add at the very bottom so its easy to find)

.ShoppingCartBox {
 background: #000000;
}
TD.ShoppingCartBoxHeading {
 font-family: Verdana, Arial, sans-serif;
 font-size: 10px;
 font-weight: bold;
 //background: #000000;
 color: #ffffff;
 background-image: img src="/images/pixel_trans.gif";
 background-repeat: repeat;
 background-position: center;
}
.ShoppingCartBoxContents {
 background: #ffffff;
 font-family: Verdana, Arial, sans-serif;
 font-size: 10px;
}

 

In includes/classes/boxes.php change the shopping Cart box class to this;

//New ShoppingCartBox Class
 class ShoppingCartBox extends tableBox {
function ShoppingCartBox($contents) {
  $info_box_contents = array();
  $info_box_contents[] = array('text' => $this->ShoppingCartBoxContents($contents));
  $this->table_cellpadding = '0';//was 1
  $this->table_parameters = 'class="ShoppingCartBox"';
  $this->tableBox($info_box_contents, true);
}

function ShoppingCartBoxContents($contents) {
  $this->table_cellpadding = '0';//was 3
  $this->table_parameters = 'class="ShoppingCartBoxContents"';
  $info_box_contents = array();
  $info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1')));
  for ($i=0, $n=sizeof($contents); $i<$n; $i++) {
	$info_box_contents[] = array(array('align' => $contents[$i]['align'],
									   'form' => $contents[$i]['form'],
									   'params' => 'class="ShoppingCartBoxContents"',
									   'text' => $contents[$i]['text']));
  }
  $info_box_contents[] = array(array('text' => tep_draw_separator('pixel_trans.gif', '100%', '1')));
  return $this->tableBox($info_box_contents);
}
 }

 class ShoppingCartBoxHeading extends tableBox {
function ShoppingCartBoxHeading($contents, $left_corner = true, $right_corner = true, $right_arrow = false) {
  $this->table_cellpadding = '0';

  if ($left_corner == true) {
	$left_corner = tep_image(DIR_WS_IMAGES . 'ShoppingCartBox/corner_left.gif');
  } else {
	$left_corner = tep_image(DIR_WS_IMAGES . 'ShoppingCartBox/corner_right_left.gif');
  }
  if ($right_arrow == true) {
	$right_arrow = '<a href="' . $right_arrow . '">' . tep_image(DIR_WS_IMAGES . 'ShoppingCartBox/arrow_right.gif', ICON_ARROW_RIGHT) . '</a>';
  } else {
	$right_arrow = '';
  }
  if ($right_corner == true) {
	$right_corner = $right_arrow . tep_image(DIR_WS_IMAGES . 'ShoppingCartBox/corner_right.gif');
  } else {
	$right_corner = $right_arrow . tep_draw_separator('pixel_trans.gif', '11', '14');
  }

  $info_box_contents = array();
  $info_box_contents[] = array(array('params' => 'height="14" class="ShoppingCartBoxHeading"',
									 'text' => $left_corner),
							   array('params' => 'width="100%" height="14" class="ShoppingCartBoxHeading"',
									 'text' => $contents[0]['text']),
							   array('params' => 'height="14" class="ShoppingCartBoxHeading" nowrap',
									 'text' => $right_corner));

  $this->tableBox($info_box_contents, true);
}
 }

 

In includes/lang./english.php look for this;

define('IMAGE_BUTTON_CHECKOUT', 'More');[code]

Change to this;

define('IMAGE_BUTTON_CHECKOUT', 'Checkout');

In the includes/header.php add this just above the code where you add your logo.gif
So that it looks like this;
[code]?>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<table align="right" class="header" width="25%" border="0" cellspacing="1" cellpadding="1">
  <table align="right" valign="top" class="header" width="120" border="0" cellspacing="1" cellpadding="1">
<!-- shopping_cart //-->
	  <tr>
		<td>
<?php
 $ShoppingCart_Box_Contents = array();
 $ShoppingCart_Box_Contents[] = array('text' => BOX_HEADING_SHOPPING_CART);

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

 $cart_contents_string = '';
 if ($cart->count_contents() > 0) {
//$cart_contents_string = '<table border="-1" 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="ShoppingCartBoxContents">';

  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="ShoppingCartBoxContents">';
  }

  $cart_contents_string .= $products[$i]['quantity'] . ' x </span></td><td valign="top" class="ShoppingCartBoxContents"><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="ShoppingCartBoxContents">';
  }

  $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>';
 } 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('text' => tep_draw_separator());
$info_box_contents[] = array('align' => 'right',
							 'text' => $currencies->format($cart->show_total()));
 }

 new ShoppingCartBox($info_box_contents);
?>
		</td>
	  </tr>
<!-- shopping_cart_eof //-->
<table border="0" width="75%" cellspacing="0" cellpadding="0">
 <tr class="header">
<td valign="middle" align="middle"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image(DIR_WS_IMAGES . 'candle_banner.gif', 'Mountain View Candles') . '</a>'; ?></td>
</tr>
</table>
<?php

 

If anyone whould like to see what this looks like Click Here

 

Any questions feel free to ask and remember that I am going to remove the whole top nav bar so if you plan on keeping this plan to do some midifing of the code

 

Hope this helps some folks,

 

Eric

Posted

Eric,

 

I just had a peek, but all I see are the red x's so I can't really tell what the overall look is for that area.

 

Also, I just took a peek at your contact us and links pages - you have a parse error going on with the right_column. If you don't already know about this, take a look-see.

 

Can't wait to see your finished site!

Posted

Yead sorry about the column right I just remove all of it's contents

 

What browser are you using Im using firefox and it looks good to me

 

Thanks,

 

Eric

Archived

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

×
×
  • Create New...