Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Shopping Cart - Contents


maestro584

Recommended Posts

Hi all,

 

I've got this problem with the shopping cart. I've changed the default box to cater for a new look, basically i've added a header, background and a footer so that the image will come out nice. The problem I have is when I add products to the cart, the items came out at the box and sorta messed up my image part i.e. the image is now not in line. My php looks like this:

<?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 © 2003 osCommerce

 

Released under the GNU General Public License

*/

?>

<!-- shopping_cart //-->

<tr>

<td>

<table width="255" border="0" cellspacing="0" cellpadding="0" class="infoboxborder">

<tr>

<td> <table width=100% border=0 cellpadding=0 cellspacing=0 class="infoBoxContents">

<tr>

<td colspan=3 width="100%"> <img src="images/boxes/header_goodies.jpg"></td>

</tr>

<tr>

<td>

<?php

$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="center" 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' => 'center',

'text' => $currencies->format($cart->show_total()));

}

 

new ShoppingCartBox($info_box_contents);

?>

<tr>

<td width=100% border=0 cellpadding=0 cellspacing=0><img src="images/boxes/footer_goodies.jpg"></td>

</tr>

</td>

</tr>

</table>

</td>

</tr>

</table>

</td>

</tr>

<!-- shopping_cart_eof //-->

 

I've tried messing around with the box width, and cell padding but still I cant get it to come out nicely.

 

Hope that someone can help me on this.

Link to comment
Share on other sites

hi multimixer,

 

here's the url: www.kreateez.com

 

Unfortunately you need to register before you can see what is wrong with the cart system. As you can see in the "my goodies" section, the image is ok. As soon as you add content, the alignment goes haywire. Here's my css:

 

.ShoppingCartBoxContents {

font-family: Calibri, "Century Gothic", Tahoma;

font-size: 12px;

text-align: center;

background-image: url('images/boxes/bg_goodies.jpg');

background-repeat:repeat-x;

}

SPAN.newItemInCart {

font-family: Calibri, "Century Gothic", Tahoma;

font-size: 12px;

color: #ff0000;

}

 

You can have a look at the image over here: goodiest.th.png

 

Rgds

Link to comment
Share on other sites

From a first sight:

 

1)Your images header_, footer_ goodies.jpg have a fixed with only bg_ is repeat

2) Your cart table with is set to 100%

 

There are several ways to go around this:

 

The most simple: Make the cart table to have a fixed with too, if your page has in total a fixed with, then it can be the remaining after the info box column. If your page in total doesn't have this, then you will have a problem with longer item descriptions in the future

 

The most elegant: Make the edges (left - right) on all 3 pictures a fixed image. Make the center of the images, to be a repeatable background. So you can leave the table with as it is and the with will expand doesn't matter how long descriptions are.

 

Like you have it now, I guess problems are also when somebody add 10 items to the cart not? I don't know how to solve this, because of the lines in the image. Maybe with detailed photoshop work?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...