pixeljuice Posted August 18, 2005 Posted August 18, 2005 I'd llike to change the shopping cart box so that all info about number of items and price are on one line with no line. I've commented out the lines that return item name and rule (underline). I've played and played, but cannot seem to make it happen. I think I need a php guru to chime in on what I need to look for or change. Any help is greatly appreciated. Here's the code I'm currently using: <table border="0" cellspacing="0" cellpadding="0"> <tr><td><!-- shopping_cart //--><?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 = '<img src="https://host350.ipowerweb.com/~putitonc/store/catalog/images/icons/shoppingcart.gif" alt="" height="11" width="13" border="0"> '; if ($cart->count_contents() > 0) { $cart_contents_string .= '<table border="0" width="100%" cellspacing="0" cellpadding="0">'; $cart_contents_string = '<table border="0" width="100%" cellspacing="0" cellpadding="0">'; $products = $cart->get_products(); { $cart_contents_string .= '<img src="https://host350.ipowerweb.com/~putitonc/store/catalog/images/icons/shoppingcart.gif" alt="" height="11" width="13" border="0"> '; $cart_contents_string .= '' . $cart->count_contents() . ''; if ($cart->count_contents() > 1) { $cart_contents_string .= ' Items </span>'; } else { $cart_contents_string .=' Item </span>'; } } $cart_contents_string .= '</td></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' => '' . $currencies->format($cart->show_total()) . ''); } new infoBox($info_box_contents); ?><!-- shopping_cart_eof //--></td> </tr> </table> Thanks, -TS
Guest Posted August 18, 2005 Posted August 18, 2005 If I understand correctly you need to place your info in the same table cell. So your $info_box_contents[] should be used once. I see your using it separately for the price. The price should go with the $cart_contents_string.
pixeljuice Posted August 18, 2005 Author Posted August 18, 2005 If I understand correctly you need to place your info in the same table cell.So your $info_box_contents[] should be used once. I see your using it separately for the price. The price should go with the $cart_contents_string. <{POST_SNAPBACK}> Ok. Don't know how this will sound. While I understand what you've suggested, I don't know how to implement it. Should I move array('align' => 'left', 'text' => '' . $currencies->format($cart->show_total()) . ''); up to line 31 so that it reads $cart_contents_string .= array('align' => 'left', 'text' => '' . $currencies->format($cart->show_total()) . '');. ??? -TS
Guest Posted August 18, 2005 Posted August 18, 2005 Ok so I would change these lines you have $info_box_contents = array(); $info_box_contents[] = array('text' => $cart_contents_string); to something like this: $info_box_contents = array(); $cart_contents_string . = ' ' . $currencies->format($cart->show_total(); $info_box_contents[] = array('text' => $cart_contents_string); and remove the last $info_box_contents[] statement. Then when new infoBox($info_box_contents); is executed is should created the contents with a single cell.
pixeljuice Posted August 18, 2005 Author Posted August 18, 2005 nope. that defintely isn't right... well, I do have a direction to go in now. thanks! I'll post here again when I get it figured out. -TS
pixeljuice Posted August 18, 2005 Author Posted August 18, 2005 I'm so close now to getting the shopping cart box to look the way I want it to. One small problem still. When the number of items in the cart is 0, the price shows on the same line as I'd wanted. However, when an item is placed in the cart, the price again returns under the number of items instead of on the same line. If anyone out there sees the glitch I'd appreciate being educated. Here's the current (o-so-close) code being used in shoppingcart.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) 2003 osCommerce Released under the GNU General Public License */ ?> <table border="0" cellspacing="0" cellpadding="0"> <tr><td><!-- shopping_cart //--><?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 = '<img src="https://host350.ipowerweb.com/~putitonc/store/catalog/images/icons/shoppingcart.gif" alt="" height="11" width="13" border="0"> '; if ($cart->count_contents() > 0) { $cart_contents_string .= '<table border="0" width="100%" cellspacing="0" cellpadding="0">'; $cart_contents_string = '<table border="0" width="100%" cellspacing="0" cellpadding="0">'; $products = $cart->get_products(); { $cart_contents_string .= '<img src="https://host350.ipowerweb.com/~putitonc/store/catalog/images/icons/shoppingcart.gif" alt="" height="11" width="13" border="0"> '; $cart_contents_string .= '' . $cart->count_contents() . ''; if ($cart->count_contents() > 1) { $cart_contents_string .= ' Items </span>'; } else { $cart_contents_string .=' Item </span>'; } } $cart_contents_string .= '</td></table>'; } else { $cart_contents_string .= BOX_SHOPPING_CART_EMPTY; } $info_box_contents = array(); $cart_contents_string .= ' | '. $currencies->format($cart->show_total()) . ''; $info_box_contents[] = array('text' => $cart_contents_string); //if ($cart->count_contents() > 0) new infoBox($info_box_contents); ?><!-- shopping_cart_eof //--></td> </tr> </table>
pixeljuice Posted August 19, 2005 Author Posted August 19, 2005 Got it. Here's the code in case others are interested. FYI, I'm using Simple Template System (STS) by Brian Gallagher to move the shopping cart box to the top of the page. Then, I've altered the code on the shopping cart box to the following: <?php $cart_contents_string = '<img src="https://host350.ipowerweb.com/~putitonc/store/catalog/images/icons/shoppingcart.gif" alt="" height="11" width="13" border="0"> '; if ($cart->count_contents() > 0) { $products = $cart->get_products(); { $cart_contents_string .= '' . $cart->count_contents() . ''; if ($cart->count_contents() > 1) { $cart_contents_string .= '<span class="infoBoxContents"> Items </span>'; } else { $cart_contents_string .='<span class="infoBoxContents"> Item </span>'; } } $cart_contents_string .= ''; } else { $cart_contents_string .= BOX_SHOPPING_CART_EMPTY; } $info_box_contents = array(); $cart_contents_string .= ' | ' .$currencies->format($cart->show_total()) . ''; $info_box_contents[] = array('text' => $cart_contents_string); { } new infoBox($info_box_contents); ?> Seems to work just fine. Just need to remove the rule from around the shopping cart box, which I believe is a stylesheet.css item.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.