i3l1nd Posted December 14, 2008 Share Posted December 14, 2008 can anyone post an altered includes/boxes/shopping_cart.php that has it so it only shows how many items are in the cart total -minus the descriptions or item names..im kida newb at php coding right now and there are not enough variables for me to mess with the code to getting working right <textarea> <?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="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; } $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())); } new infoBox($info_box_contents); ?> </td> </tr> <!-- shopping_cart_eof //--> </textarea> Link to comment Share on other sites More sharing options...
i3l1nd Posted December 14, 2008 Author Share Posted December 14, 2008 well i guess im gonna start hacking it myself .........I know alot of people have been asking about this so when i fix it Ill post the code , BTW how do I put my code into one of those quote containers? Link to comment Share on other sites More sharing options...
i3l1nd Posted December 14, 2008 Author Share Posted December 14, 2008 took about an hour but I got it if anyone wants the code here it is, this will display only the number of items in the cart + i also coded it to say "item" when 1 items in the cart and "items" when theres more than 1 item in the cart... <?php /* $Id: shopping_cart.php 1739 2007-12-20 00:52:16Z hpdl $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ ?> <!-- shopping_cart //--> <tr> <td> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => $cart_contents_string); 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 style="background:grey;"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 style="background:red;"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 style="font-weight:bold;"class="infoBoxContents">'; // } if ($cart->count_contents() == 1) { $cart_contents_string .= $cart->count_contents() . ' Item</span></a></td></tr>'; } $cart_contents_string .= $cart->count_contents() . ' Items</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; } $s = 'cool'; $info_box_contents = array(); if ($cart->count_contents() == 1) { $info_box_contents[] = array('text' => $cart->count_contents(). ' item' ); } else{ $info_box_contents[] = array('text' => $cart->count_contents(). ' items' ); } new infoBox($info_box_contents); ?> </td> </tr> <!-- shopping_cart_eof //--> Link to comment Share on other sites More sharing options...
i3l1nd Posted December 14, 2008 Author Share Posted December 14, 2008 heres the code...... <?php /* $Id: shopping_cart.php 1739 2007-12-20 00:52:16Z hpdl $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ ?> <!-- shopping_cart //--> <tr> <td> <?php $info_box_contents = array(); $info_box_contents[] = array('text' => $cart_contents_string); 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 style="background:grey;"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 style="background:red;"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 style="font-weight:bold;"class="infoBoxContents">'; // } if ($cart->count_contents() == 1) { $cart_contents_string .= $cart->count_contents() . ' Item</span></a></td></tr>'; } $cart_contents_string .= $cart->count_contents() . ' Items</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; } $s = 'cool'; $info_box_contents = array(); if ($cart->count_contents() == 1) { $info_box_contents[] = array('text' => $cart->count_contents(). ' item' ); } else{ $info_box_contents[] = array('text' => $cart->count_contents(). ' items' ); } new infoBox($info_box_contents); ?> </td> </tr> <!-- shopping_cart_eof //--> Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.