Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

shopping cart box hack?


pixeljuice

Recommended Posts

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.

 

002.jpg

 

003.jpg

 

<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>

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

  • 2 weeks later...

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.

Link to comment
Share on other sites

  • 2 weeks later...

Archived

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

×
×
  • Create New...