Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Really Want Photos


phoenixx

Recommended Posts

I'm posting here because people who typically are looking in the contributions section need help with a specific contribution, but I'm not sure one exists for this.

 

I'm looking for a fix to add a product thumbnail to the shopping_cart.php infobox. I'm running Simple Template System, but don't have a specific template configured. I've figured it all out except calling the specific product images name *.jpg/.gif in the image path.

 

Here's the code I have already done, and you can see a snapshot at http://www.swjs.net/nomad/catalog/

 

The portion labeled KAM Contribution is the one I'm trying to write. If I can get it fixed I will of course give credit when I post it. It will be my first contribution.

 

<?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>
<?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 = '';
 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="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">';
     }
// PICTURE CODE
     $cart_contents_string .= '<a href="' . tep_href_link(DIR_WS_IMAGES . $products['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $products['products_image'], $products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . $products[$i]['quantity'] . ' x ' . $products[$i]['name'] . '</a></td></tr>';
// END PICTURE CODE
// ORIGINAL CODE
//      $cart_contents_string .= $products[$i]['name'] . '</span></a></td></tr>';
// END ORIGINAL CODE
     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' => 'right',
                                'text' => $currencies->format($cart->show_total()));
 }

// KAM CONTRIBUTION - COMMENT OUT IF YOU DON'T WANT THE CHECKOUT BUTTON TO SHOW
if ($cart->count_contents() > 0) {
if (preg_match("/checkout/", $PHP_SELF)) {
$info_box_contents[] = array('align' => 'left','text' => '<a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '"><u>View Cart</u></a>');
} else {
$info_box_contents[] = array('align' => 'left','text' => '<a href="' . tep_href_link(FILENAME_SHOPPING_CART) . '"><u>View Cart</u> | <a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '"><u>Checkout</u></a>');
}
}
// END KAM CONTRIBUTION

 new infoBox($info_box_contents);
?>
           </td>
         </tr>
<!-- shopping_cart_eof //-->

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...