♥akmac Posted July 11, 2005 Share Posted July 11, 2005 Hi all, I'm attempting to get the checkout button to display in the shopping cart box when a customer adds an item to their cart. This code from the "Shopping cart Enhancement" contribution works: $showcheckoutbutton = 1; // set to 1: show checkout button (default); set to 0: never show checkout button if (($showcheckoutbutton==1) && ($cart->count_contents() > 0) && (substr(basename($PHP_SELF), 0, 8) != 'checkout')) { $cart_show_string .= '<tr><td>' . tep_draw_separator('pixel_trans.gif', '100%', '7') . '</td></tr><tr><td align="center"><a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image_button('button_checkout.gif', IMAGE_BUTTON_CHECKOUT) . '</a></td></tr>'; } $cart_show_string .= '</table>'; $info_box_contents[] = array('text' => $cart_show_string); But it causes the rest of my right column boxes to disappear. Probably a misplaced jot or tittle... But I don't speak php and can't see it. Anyone see the error that could be causing this? Here's the whole catalog/includes/boxes/shopping_cart.php: <?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 $showcheckoutbutton = 1; // set to 1: show checkout button (default); set to 0: never show checkout button $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())); } $showcheckoutbutton = 1; // set to 1: show checkout button (default); set to 0: never show checkout button if (($showcheckoutbutton==1) && ($cart->count_contents() > 0) && (substr(basename($PHP_SELF), 0, 8) != 'checkout')) { $cart_show_string .= '<tr><td>' . tep_draw_separator('pixel_trans.gif', '100%', '7') . '</td></tr><tr><td align="center"><a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image_button('button_checkout.gif', IMAGE_BUTTON_CHECKOUT) . '</a></td></tr>'; } $cart_show_string .= '</table>'; $info_box_contents[] = array('text' => $cart_show_string); new infoBox($info_box_contents); ?> </td> </tr> <!-- shopping_cart_eof //--> Note that the only changes are the added lines I mentioned previously. THANKS! Quidquid latine dictum sit, profundum viditur. Link to comment Share on other sites More sharing options...
♥akmac Posted July 11, 2005 Author Share Posted July 11, 2005 Oops-just noticed: It doesn't cause the right column boxes to disappear-it just moves them to the bottom of the right column. Weird... Any ideas? Quidquid latine dictum sit, profundum viditur. Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.