pixeljuice Posted August 19, 2005 Posted August 19, 2005 Got a good start from a forum member earlier, but still need some help hacking the shopping cart box to look like I want it to. Currently, the shopping cart looks like I want it to when there are no products in it. When I add a product, however, the dollar amount ($ 0.00) returns ine row beneath where I want it to. I just haven't had luck with trial and error. Any ideas please. Can it be done by simply rearranging the existing code? That's the assumption I've been working under. Screenshots and current code below. Thanks for having a look. <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) { //$info_box_contents[] = array('align' => 'left','text' => '' . $currencies->format($cart->show_total()) . ''); } 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.
Guest Posted August 30, 2005 Posted August 30, 2005 Hello, I am just wondering if you had tried adding more than one item to your cart? If so, does it display "2 Item" or "2 Items" . If you need help with that, I designed a contribution with the code to make the "Item" plural. It can be found below. Hope this helps. Cleaner Shopping Cart hack.
pixeljuice Posted September 8, 2005 Author Posted September 8, 2005 Yep. I adjusted the lines generating "Item" and "Items" manually so that they work as intended. The Contribution sounds helpful to others though. Thanks.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.