ImJustBrndn Posted August 20, 2006 Share Posted August 20, 2006 I need help making the output of my cart be sent via email or something that will allow me to know what the people ordered. I'm having problems doing this bc only one of the items show up, none of the others do. Any help would be really appreciated. Link to comment https://forums.phpfreaks.com/topic/18084-homemade-shopping-cart-question/ Share on other sites More sharing options...
tomfmason Posted August 20, 2006 Share Posted August 20, 2006 How do you set the items in the cart? Session or ?Please post your code so that I may look over it. Use the []code Tags Link to comment https://forums.phpfreaks.com/topic/18084-homemade-shopping-cart-question/#findComment-77492 Share on other sites More sharing options...
ImJustBrndn Posted August 20, 2006 Author Share Posted August 20, 2006 It's set via session. This is the heart of the cart code minus the site its built around. Thanks again.[code]<?include "functions_cart.php";$totalvalue = 0;session_start();// If no sessions has been started $_SESSION["cart"] equals null, thus showing the message no items.if (!isset($_SESSION["cart"])) { $_SESSION["cart"] = NULL;}if (validate() == TRUE && $_SESSION["cart"] != NULL) { foreach ($_SESSION["cart"] as $key => $session_data) { list($ses_id, $ses_quan) = $session_data; // call database connect function db_connect(); $sel_products = mysql_query("SELECT * FROM $mysql_tablename WHERE id=".$ses_id.""); $item = mysql_fetch_array($sel_products); $totalvalue = $totalvalue + $shipping + ($item["price"]*$ses_quan); $subtotal = ($item["price"]*$ses_quan); $shipping = (3.00*ses_quan); ?> <tr> <td class="style11"><div align="center"><a href="<? echo "phpCart_manage.php?act=del&pid=".$ses_id; ?>"><img src="remove_button.gif" width="60" height="21" border="0"></a></div></td> <td class="style11"><input name="newquan[]" type="text" id="newquan[]3" value="<? echo $ses_quan; ?>" size="5" maxlength="4"> <input name="eid[]" type="hidden" id="eid[]" value="<? echo $ses_id; ?>"></td> <td class="style11"><? echo $item["product"]; ?></td> <td class="style11"><? echo $cur_symbol."".number_format($item["price"], 2, '.', ''); ?></td> <td class="style11"><? echo $cur_symbol."".number_format($subtotal, 2, '.', ''); ?></td> </tr> <? } // end foreach loop } elseif ($_SESSION["cart"] == NULL) { echo "<td colspan=\"5\"><center><p>Your basket is currently empty.</p></center></td>"; } else { echo "<td colspan=\"5\"><center><p>Unknown Error.</p></center></td>";} ?> <tr> <td class="style11"> </td> <td class="style11"> </td> <td class="style11"> </td> <td class="style11"><strong>Shipping</strong></td> <td class="style11"><? echo $cur_symbol."".number_format($totalvalue, 2, '.', ''); ?> </td> </tr> <tr> <td class="style11"> </td> <td class="style11"><? if ($_SESSION["cart"] != NULL) { echo "<input name=\"UpdateChg\" type=\"submit\" id=\"UpdateChg\" value=\"Update\">"; } ?></td> <td class="style11"><a href="index.php">Continue Shopping</a></td> <td class="style11"><strong>Total</strong></td> <td class="style11"><? echo $cur_symbol."".number_format($totalvalue, 2, '.', ''); ?></td> </tr> <tr> <td class="style11"> </td> <td class="style11"> </td> <td class="style11"> </td> <td class="style11"> </td> <td class="style11"> </td> </tr> <tr> <td colspan="5" class="style11"> </td> </tr> </table> </form>[/code] Link to comment https://forums.phpfreaks.com/topic/18084-homemade-shopping-cart-question/#findComment-77657 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.