Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Shopping Cart Info Box Dilema!!


Philster

Recommended Posts

Posted

Hi,

 

I've designed the look-and-feel for my girlfriend's website (the things you do for love, eh!?!) and I'm in the process of integrating this with osC. Most things have gone pretty well. However, I'm REALLY stuck with the Shopping Cart Info Box.

 

Here's what I want it to look like:

 

basket_sample.gif

 

The table is made up of 3 rows and 3 columns like this:

 

basket_sample1.gif

 

Basically, I want to be able to extract ONLY the text from the shopping cart and insert it into the middle column/row. I don't need the table formatting, as I can hard code this myself. But I'm well-and-truly stumped after spending almost 2 hours playing with the shopping_cart.php file! :cry:

 

I'd REALLY appreciate any help or pointers... Please... :D

Posted

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

*/

?>

<!-- shopping_cart //-->

         <tr>

           <td>corner</td>

           <td>top grpahic</td>

           <td>corner</td>

         </tr>

         <tr>

           <td>side</td>

           <td><?

 $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="infoBoxContents">';



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

     }



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

     }



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

 }



 echo $cart_contents_string;



 if ($cart->count_contents() > 0) {

   echo tep_draw_separator());

   echo $currencies->format($cart->show_total());

 }





?>

           </td>

           <td>side</td>

         </tr>

         <tr>

           <td>corner</td>

           <td>bottom bit</td>

           <td>corner</td>

         <tr>

<!-- shopping_cart_eof //-->

 

That do ya ?

Posted

You, my friend, are a STAR!! :D That worked a treat. Many, MANY thanks!! Must look at what you've done versus what the original, so I can learn me some PHP!!

 

Again, you've made me a VERY happy man...

 

Phil

Posted

Don't suppose you know where I can edit the output of what sits beneath the product listing in the shopping cart when something is in it?

 

For example...

 

My Basket

 

1 x Misc Product

--------------------

?15.00

 

 

I want to be able to edit the line that's underneath this and also how the price total is displayed, but looking in the shopping_cart.php file suggests that controlling these elements is done elsewhere ...

 

    echo tep_draw_separator(); 

   echo $currencies->format($cart->show_total());

 

Any ideas where the draw_separator and show_total files are?

 

Thanks again for the help earlier. I had a look at the code, and even though I'm a relative newbie, it seemed like a fairly logical change you made. So I've learned something today!! Ta for that!! :D

Archived

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

×
×
  • Create New...