twistedindustries.com Posted November 3, 2007 Posted November 3, 2007 I have my shopping cart infobox set up so that it only shows five items, however its the first five items added and not the last five how do i fix it? here is /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 [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url] Copyright © 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++) { if ($i <= 4){ $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 //-->
♥geoffreywalton Posted November 3, 2007 Posted November 3, 2007 Not sure this can be done without a db change Customer basket does not appear to have an sequence within cart no or date/time added only date. Bit difficult without that data. Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile Virus Threat Scanner My Contributions Basic install answers. Click here for Contributions / Add Ons. UK your site. Site Move. Basic design info. For links mentioned in old answers that are no longer here follow this link Useful Threads. If this post was useful, click the Like This button over there ======>>>>>.
twistedindustries.com Posted November 3, 2007 Author Posted November 3, 2007 so do i need to do a another column or possibly modify the date column to add time to so that i can have it sort by that column?
♥geoffreywalton Posted November 3, 2007 Posted November 3, 2007 You are getting there, add a time. Then you will need an "order by" in the sql that gets the data to display. Let people know where you updated the sql command and if you are feeling particularly nice post the line here. Jobs a good un. Need help installing add ons/contributions, cleaning a hacked site or a bespoke development, check my profile Virus Threat Scanner My Contributions Basic install answers. Click here for Contributions / Add Ons. UK your site. Site Move. Basic design info. For links mentioned in old answers that are no longer here follow this link Useful Threads. If this post was useful, click the Like This button over there ======>>>>>.
twistedindustries.com Posted November 4, 2007 Author Posted November 4, 2007 could you give me a clue as to where it calls the sql for that info so that i can add the order
twistedindustries.com Posted November 5, 2007 Author Posted November 5, 2007 actually i found that it is ordered by customers_basket_id
twistedindustries.com Posted November 5, 2007 Author Posted November 5, 2007 so would anyone happen to know where i can add sort to the db query for the shopping cart infobox?
twistedindustries.com Posted November 7, 2007 Author Posted November 7, 2007 can anyone tell me where the shopping cart infobox refers to the table so that i can make it order the right way??
twistedindustries.com Posted November 8, 2007 Author Posted November 8, 2007 really not a single person can give me this information... i can't seem to find it please if anyone can help let me know
twistedindustries.com Posted November 14, 2007 Author Posted November 14, 2007 well i finally figured it out thanks for the help to the guy that had a little input but we were way off here it is for the latest five products added after for ($i=0, $n=sizeof($products); $i<$n; $i++) { add if ($i >= $n - 5){ if ($i <= $n){
Recommended Posts
Archived
This topic is now archived and is closed to further replies.