Re: [PHP-DB] Shopping cart application question
I have done something like you have said below Chris. I put the code which is common to be loops in it's own file and I did an INCLUDE Ron -Original Message- From: chris smith dmag...@gmail.com To: ron.pigg...@actsministries.org Cc: php-db@lists.php.net Subject: Re: [PHP-DB] Shopping cart application question Date: Sun, 4 Apr 2010 13:36:05 +1000 The } else { confuses PHP. I am not sure what I should be doing. You're missing at least one brace. If the code you supplied is a copy of what you have, you're missing a } for the end of the while loop and one for the end of the else condition. So it's treating } else { as part of the while construct (and while() doesn't have anything like an else condition). if ( $_SESSION['user_reference'] 0 ) { snip $i=0; while ( $i $cart_records_found ) { } // end while } else { foreach ($_SESSION['order'] AS $key = $value ) { } } // end else condition
Re: [PHP-DB] Shopping cart application question
Quote snip I didn't understand your problem. Explain clearly. -- Nilesh Govindarajan Site Server Administrator www.itech7.com मेरा भारत महान ! मम भारत: महत्तम भवतु ! -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Shopping cart application question
The } else { confuses PHP. I am not sure what I should be doing. You're missing at least one brace. If the code you supplied is a copy of what you have, you're missing a } for the end of the while loop and one for the end of the else condition. So it's treating } else { as part of the while construct (and while() doesn't have anything like an else condition). if ( $_SESSION['user_reference'] 0 ) { snip $i=0; while ( $i $cart_records_found ) { } // end while } else { foreach ($_SESSION['order'] AS $key = $value ) { } } // end else condition -- Postgresql php tutorials http://www.designmagick.com/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Shopping cart
On Sat, 2009-05-16 at 10:54 +0100, Vernon St Croix wrote: Hi, I am pretty new to PHP and I am trying to create a shopping cart. I keep on getting the below error when trying to show the shopping list. Any guidance that can be provided will be very much appreciated Fatal error: Call to a member function query() on a non-object in C:\wamp\www\draft\basket.php on line 36 mysql_connect.php ?php $con = mysql_connect(localhost,root,); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db(rum, $con); ? basket.php ?php include(mysql.class.php); include (header.php); include (mysql_connect.php); include (functions.php); ? div id=shopping h2Rum Basket/h2 ?php echo writeCart(); ? /div div id=rumlist h2Rum on Offer/h2 ?php $sql= 'SELECT * FROM spirits BY id'; $result = $con-query($sql); $output[]= 'ul'; while ($row = $result-fetch()) { $output[] = 'li'.$row['name'].': pound;'.$row['price'].'br/a href=cart.php?action=addid= '.$row['id'].'Add to Cart/a/li'; } $output[] = '/ul'; echo join ('', $output); ? /div /div ?php include(footer.html); ? cart.php ?php include (header.php); include (mysql_connect.php); include (functions.php); $cart = $_SESSION['cart']; if(isset($_GET[action])) { $action = $_GET[action]; } else { $action = ; } switch ($action) { case 'add': if ($cart) { $cart .= ','.$_GET['id']; } else { $cart = $_GET['id']; } break; case 'delete': if ($cart) { $items = explode(',',$cart); $newcart = ''; foreach ($items as $item) { if ($_GET['id'] != $item) { if ($newcart != '') { $newcart .= ','.$item; } else { $newcart = $item; } } } $cart = $newcart; } break; case 'update': if ($cart) { $newcart = ''; foreach ($_POST as $key=$value) { if (stristr($key,'qty')) { $id = str_replace('qty','',$key); $items = ($newcart != '') ? explode(',',$newcart) : explode(',',$cart); $newcart = ''; foreach ($items as $item) { if ($id != $item) { if ($newcart != '') { $newcart .= ','.$item; } else { $newcart = $item; } } } for ($i=1;$i=$value;$i++) { if ($newcart != '') { $newcart .= ','.$id; } else { $newcart = $id; } } } } } $cart = $newcart; break; } $_SESSION['cart'] = $cart; ? div id=shopping h2Rum Basket/h2 ?php echo writeCart(); ? /div div id=contents h2Please Check Quantities.../h2 ?php echo showCart(); ? pa href=basket.phpBack to Rum List/a/p /div /div ?php include(footer.html); ? functions.php ?php function writeCart() { $cart = $_SESSION['cart']; if (!$cart) { return 'pThere is no alcohol in your Rum Basket/p'; } else { // Parse the cart session variable $items = explode(',',$cart); $s = (count($items) 1) ? 's':''; return 'pThere area href=cart.php'.count($items).' item'.$s.' in your rum basket/a/p'; } } function showCart() { $cart = $_SESSION['cart']; if ($cart) { $items = explode(',',$cart); $contents = array(); foreach ($items as $item) { $contents[$item] = (isset($contents[$item])) ? $contents[$item] + 1 : 1; } $output[] = 'form action=cart.php?action=update method=post id=cart'; $output[] = 'table'; foreach ($contents as $id=$qty) { $sql = 'SELECT * FROM spirits WHERE id = '.$id; $result = $con-query($sql); $row = $result-fetch(); extract($row); $output[] = 'tr'; $output[] = 'tda href=cart.php?action=deleteid='.$id.' class=rRemove/a/td'; $output[] = 'td'.$name.'/td'; $output[] = 'tdpound;'.$price.'/td'; $output[] = 'tdinput type=text name=qty'.$id.' value='.$qty.' size=3 maxlength=3 /td'; $output[] = 'tdpound;'.($price * $qty).'/td'; $total += $price * $qty; $output[] = '/tr'; } $output[] = '/table'; $output[] = 'pGrand total: pound;'.$total.'/p'; $output[] = 'divbutton type=submitUpdate cart/button/div'; $output[] = '/form'; } else { $output[] = 'pYou shopping cart is empty./p'; } return join('',$output); } ? Many Thanks Vee Hi, if i look at the code of basket.php its only 33 lines long, hence it must be counting the includes as well. Send me zip file of you project, i can help debug. regards, Max. Max E. Kimambo Franz-Stenzer-Str, 51 12679 Berlin Office: +493053080013 Mobile: +4917649520175 Fortune message of the moment You will triumph over your enemy. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Shopping cart
Hi Vee, You have it all in that error :) You're calling function on non-object. Look into the basket.php. On the lines where you call the MySQL query you have $con-query($sql) but there is no decalaration of $con object anywhere before. I think you have an MySQL layer included (mysql.class.php) but you haven't it declared. You just made a new relation in $con. Instead of calling $con-query() you have to call mysql_query(). You also have some mistakes in query ;) $sql = 'SELECT * FROM spirits ORDER BY id'; $query = mysql_query($sql); ... Look at the PHP documentation how to work with mysql_ functions. Or provide us with link to the MySQL layer you're using - that mysql.class.php - so we can help you with using that. I think there will be something like $con = new MySQL('host', 'user', 'pass', 'db'); Then your syntax will work. However without knowing what layer it is, I can't tell you the right syntax for it ;) Vernon St Croix napsal(a): Hi, I am pretty new to PHP and I am trying to create a shopping cart. I keep on getting the below error when trying to show the shopping list. Any guidance that can be provided will be very much appreciated Fatal error: Call to a member function query() on a non-object in C:\wamp\www\draft\basket.php on line 36 mysql_connect.php ?php $con = mysql_connect(localhost,root,); if (!$con) { die('Could not connect: ' . mysql_error()); } mysql_select_db(rum, $con); ? basket.php ?php include(mysql.class.php); include (header.php); include (mysql_connect.php); include (functions.php); ? div id=shopping h2Rum Basket/h2 ?php echo writeCart(); ? /div div id=rumlist h2Rum on Offer/h2 ?php $sql= 'SELECT * FROM spirits BY id'; $result = $con-query($sql); $output[]= 'ul'; while ($row = $result-fetch()) { $output[] = 'li'.$row['name'].': pound;'.$row['price'].'br/a href=cart.php?action=addid= '.$row['id'].'Add to Cart/a/li'; } $output[] = '/ul'; echo join ('', $output); ? /div /div ?php include(footer.html); ? cart.php ?php include (header.php); include (mysql_connect.php); include (functions.php); $cart = $_SESSION['cart']; if(isset($_GET[action])) { $action = $_GET[action]; } else { $action = ; } switch ($action) { case 'add': if ($cart) { $cart .= ','.$_GET['id']; } else { $cart = $_GET['id']; } break; case 'delete': if ($cart) { $items = explode(',',$cart); $newcart = ''; foreach ($items as $item) { if ($_GET['id'] != $item) { if ($newcart != '') { $newcart .= ','.$item; } else { $newcart = $item; } } } $cart = $newcart; } break; case 'update': if ($cart) { $newcart = ''; foreach ($_POST as $key=$value) { if (stristr($key,'qty')) { $id = str_replace('qty','',$key); $items = ($newcart != '') ? explode(',',$newcart) : explode(',',$cart); $newcart = ''; foreach ($items as $item) { if ($id != $item) { if ($newcart != '') { $newcart .= ','.$item; } else { $newcart = $item; } } } for ($i=1;$i=$value;$i++) { if ($newcart != '') { $newcart .= ','.$id; } else { $newcart = $id; } } } } } $cart = $newcart; break; } $_SESSION['cart'] = $cart; ? div id=shopping h2Rum Basket/h2 ?php echo writeCart(); ? /div div id=contents h2Please Check Quantities.../h2 ?php echo showCart(); ? pa href=basket.phpBack to Rum List/a/p /div /div ?php include(footer.html); ? functions.php ?php function writeCart() { $cart = $_SESSION['cart']; if (!$cart) { return 'pThere is no alcohol in your Rum Basket/p'; } else { // Parse the cart session variable $items = explode(',',$cart); $s = (count($items) 1) ? 's':''; return 'pThere area href=cart.php'.count($items).' item'.$s.' in your rum basket/a/p'; } } function showCart() { $cart = $_SESSION['cart']; if ($cart) { $items = explode(',',$cart); $contents = array(); foreach ($items as $item) { $contents[$item] = (isset($contents[$item])) ? $contents[$item] + 1 : 1; } $output[] = 'form action=cart.php?action=update method=post id=cart'; $output[] = 'table'; foreach ($contents as $id=$qty) { $sql = 'SELECT * FROM spirits WHERE id = '.$id; $result = $con-query($sql); $row = $result-fetch(); extract($row); $output[] = 'tr'; $output[] = 'tda href=cart.php?action=deleteid='.$id.' class=rRemove/a/td'; $output[] = 'td'.$name.'/td'; $output[] = 'tdpound;'.$price.'/td'; $output[] = 'tdinput type=text name=qty'.$id.' value='.$qty.' size=3 maxlength=3 /td'; $output[] = 'tdpound;'.($price * $qty).'/td'; $total += $price * $qty; $output[] = '/tr'; } $output[] = '/table'; $output[] = 'pGrand total: pound;'.$total.'/p'; $output[] = 'divbutton type=submitUpdate cart/button/div'; $output[] = '/form'; } else { $output[] = 'pYou shopping cart is empty./p'; } return
Re: [PHP-DB] Shopping Cart
SIR SORRY FOR LATE . I AM NAAZIR FROM SRI LANKA..I AM DOING WEBDEVALOBMENT USING PHP AND MY SQL, I WAS BORN IN A MIDDLE CLASS FAMILLY. MY FATHER IS A BUSSINES MAN MOTHER IS HOUSE WIFE. I HAVE 5 SIISTER. MY FATHER BUSSINUS BADLY AFFECTED MY TSUNNMI . WE LOST OUR FATHER BUSSINES . AND FATHER SAY RO ME I CAN'T PAY MONEY TO STUDY ME I DON'T HAVE MIONEY NOW .AND HAVE TO SPEND SISITERS STUDIES NAD WEDDING . SIR I ASK FROM YOU IF CAN PLEASE HELP TO STUDY OR ATLEAST SEND SOME GOOD NOTES OR PAERNT BOOK OF PHP $ MyAQL TO MY MAIL THNAK SIR naazir On Mon, 07 Mar 2005 13:16:31 -0600, Martin Norland [EMAIL PROTECTED] wrote: Wendell Frohwein wrote: Hi martin, thanks for the email. I'm sorting it out slowly but surely. I was just a little over worked the night I wrote that novel of an email. I don't know if you saw my latest email titled Mysql Result. That's the last step I am at. I used a select statement across multiple tables to get all the values that I wanted. I forgot because I was so tired that, once I had those values in there that I could sort by anything I wanted to. If you have a solution for my Mysql Result problem, that would help me out alot. Most people are saying that I have to do a sub query, so I am not really sure. Thanks though. -Wendell Frohwein [snipped from another email] I wanted to know if it would be possible for it to output it like so: +--+---+-+--+ | makename | modelname | versionname |years | +--+---+-+--+ | Acura| Integra | RS | 92,93| | Acura| Integra | GSR | 94,95,96,97,98,99,01 | +--+---+-+--+ [snip] As penance for suggesting the quick way out in another posting, I've answered your question! (I would've answered anyway - I'm a softie. I got distracted this morning with the whole 'work' thing - sorry for the delay.) I remembered doing this before - and sure enough: GROUP_CONCAT: http://dev.mysql.com/doc/mysql/en/group-by-functions.html The relevant bits: GROUP_CONCAT([DISTINCT] expr [,expr ...] [ORDER BY {unsigned_integer | col_name | expr} [ASC | DESC] [,col_name ...]] [SEPARATOR str_val]) mysql SELECT student_name, - GROUP_CONCAT(test_score) - FROM student - GROUP BY student_name; Or: mysql SELECT student_name, - GROUP_CONCAT(DISTINCT test_score - ORDER BY test_score DESC SEPARATOR ' ') - FROM student - GROUP BY student_name; The default separator is the comma. Just toss in a 'GROUP_CONCAT(year) AS year' and appropriate 'GROUP BY' clause and have at it. Cheers, -- - Martin Norland, Sys Admin / Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Shopping Cart
Wendell Frohwein wrote: Hello everyone. Just want to thank you for all the help you have provided me in the past. I have a new task that I am trying to tackle, but have come into a snag. I am building a customized shopping cart for auto accessories. I have gotten about 90% of the cart worked out except for the search feature. It is not a textual search. It is a vehicle specific search. When products are added to the cart, all the standard information is there along with the vehicle make, model, and year. Example: Honda Civic Si 1999. So this sounds like a peace of cake, as I would think. But in the customized car industry, some products fit on multiple cars. Example: DC Sport 4-1 Header AHS6607s fits all 92-93 Acura Integra's, but also fits 94-99 Acura Integra's GSR Only. When adding a product. I have this option that says, Select Vehicle Make, Model, and Year. Option for newly created product says, Not Selected. So they click to add and a window opens that allows you to pick these choices from drop down menus. So for the above examples, you would choose: Make Drop Down: Acura Model Drop Down: Integra Year Text Field: 92-93 Then you click add vehicle to this product. That window stays open and allows you to put another entry for the current product. Make Drop Down: Acura Model Drop Down: Integra Year Text Field: 94-99 Once again, click add vehicle to this product. So all this goes into a table that I called cart_search. Here is the table layout for the cart_search table: CREATE TABLE `cart_search` ( `id` INT( 20 ) NOT NULL AUTO_INCREMENT , `pid` INT( 20 ) NOT NULL , `make` INT( 20 ) NOT NULL , `model` INT( 20 ) NOT NULL , `year` INT( 4 ) NOT NULL , PRIMARY KEY ( `id` ) ); For the above examples, the following rows would be added: (forgive my crappy hand coded mysql output) |id|pid|make|model|year| 11234 1 1 1992 21234 1 1 1993 31234 1 1 1994 41234 1 1 1995 51234 1 1 1996 61234 1 1 1997 71234 1 1 1998 81234 1 1 1999 in the cart_makes table the id that corresponds with Acura would be 1 in the cart_models table the id that corresponds with Integra would be 1 This is the reason for the 1's in the above simulated mysql output. When that is all done, the window is closed and you are back at the add product page. Click Add Product button at the bottom. A new row is inserted to cart_products and the id row is retrieved with mysql_insert_id(). Then all the cart_search rows that have 1243 as the pid would be set to the respective product id that was retrieved by mysql_insert_id() So now you are a potential customer on the website wishing to search for some products for your 93 acura integra. You go to the search page and select Acura from drop down 1, page refresh's and the model dropdown is populated with all Acura models, you select Integra as the model, Page refreshes again populating the Year drop down with a list of years, You choose 1993. Hit the search button and mysql does a query to the db as so: $query=mysql_query(SELECT * FROM cart_search WHERE make='{$_POST[make]}' AND model='{$_POST[model]}' AND year='{$_POST[year]}'); If the database was only populated with the entry's from above, It would then return 1 result with a product id for that dc sports header we added. So after all this, I supposed it works. But not like it should, Cause I have no idea how to sort it, and to top it off, this just seems like a really long process just to search a database for some products that match specified make, model and years. Incase you are wondering the search page would return about 3 columns. Product Description, Catalog Number, and Price. It would be pulling all this information out of the cart_products table by its product id number that was returned by the mysql_query above. So I am sorry if this seems like a novel to anyone. I just really believe that there is an easier method to doing all of this. Any help that someone can provide me would be greatly appreciated. I was looking at a lot of websites on the net that sale car accessories and no one really has a search that is this detailed. Most of them are static html pages created by hand. This business has way to many products to make hundreds of static pages like that. So thank you in advanced, and I hope someone could lend a hand. [snip] You're right, you're 90% done. The only remaining 10% is basically confidence. Sounds to me like you have the right code, the right interface, and a fine implementation working already. If you're wondering how to sort the products that are returned from
RE: [PHP-DB] Shopping Cart
Hi martin, thanks for the email. I'm sorting it out slowly but surely. I was just a little over worked the night I wrote that novel of an email. I don't know if you saw my latest email titled Mysql Result. That's the last step I am at. I used a select statement across multiple tables to get all the values that I wanted. I forgot because I was so tired that, once I had those values in there that I could sort by anything I wanted to. If you have a solution for my Mysql Result problem, that would help me out alot. Most people are saying that I have to do a sub query, so I am not really sure. Thanks though. -Wendell Frohwein -Original Message- From: Martin Norland [mailto:[EMAIL PROTECTED] Sent: Monday, March 07, 2005 7:08 AM To: php-db@lists.php.net Subject: Re: [PHP-DB] Shopping Cart Wendell Frohwein wrote: Hello everyone. Just want to thank you for all the help you have provided me in the past. I have a new task that I am trying to tackle, but have come into a snag. I am building a customized shopping cart for auto accessories. I have gotten about 90% of the cart worked out except for the search feature. It is not a textual search. It is a vehicle specific search. When products are added to the cart, all the standard information is there along with the vehicle make, model, and year. Example: Honda Civic Si 1999. So this sounds like a peace of cake, as I would think. But in the customized car industry, some products fit on multiple cars. Example: DC Sport 4-1 Header AHS6607s fits all 92-93 Acura Integra's, but also fits 94-99 Acura Integra's GSR Only. When adding a product. I have this option that says, Select Vehicle Make, Model, and Year. Option for newly created product says, Not Selected. So they click to add and a window opens that allows you to pick these choices from drop down menus. So for the above examples, you would choose: Make Drop Down: Acura Model Drop Down: Integra Year Text Field: 92-93 Then you click add vehicle to this product. That window stays open and allows you to put another entry for the current product. Make Drop Down: Acura Model Drop Down: Integra Year Text Field: 94-99 Once again, click add vehicle to this product. So all this goes into a table that I called cart_search. Here is the table layout for the cart_search table: CREATE TABLE `cart_search` ( `id` INT( 20 ) NOT NULL AUTO_INCREMENT , `pid` INT( 20 ) NOT NULL , `make` INT( 20 ) NOT NULL , `model` INT( 20 ) NOT NULL , `year` INT( 4 ) NOT NULL , PRIMARY KEY ( `id` ) ); For the above examples, the following rows would be added: (forgive my crappy hand coded mysql output) |id|pid|make|model|year| 11234 1 1 1992 21234 1 1 1993 31234 1 1 1994 41234 1 1 1995 51234 1 1 1996 61234 1 1 1997 71234 1 1 1998 81234 1 1 1999 in the cart_makes table the id that corresponds with Acura would be 1 in the cart_models table the id that corresponds with Integra would be 1 This is the reason for the 1's in the above simulated mysql output. When that is all done, the window is closed and you are back at the add product page. Click Add Product button at the bottom. A new row is inserted to cart_products and the id row is retrieved with mysql_insert_id(). Then all the cart_search rows that have 1243 as the pid would be set to the respective product id that was retrieved by mysql_insert_id() So now you are a potential customer on the website wishing to search for some products for your 93 acura integra. You go to the search page and select Acura from drop down 1, page refresh's and the model dropdown is populated with all Acura models, you select Integra as the model, Page refreshes again populating the Year drop down with a list of years, You choose 1993. Hit the search button and mysql does a query to the db as so: $query=mysql_query(SELECT * FROM cart_search WHERE make='{$_POST[make]}' AND model='{$_POST[model]}' AND year='{$_POST[year]}'); If the database was only populated with the entry's from above, It would then return 1 result with a product id for that dc sports header we added. So after all this, I supposed it works. But not like it should, Cause I have no idea how to sort it, and to top it off, this just seems like a really long process just to search a database for some products that match specified make, model and years. Incase you are wondering the search page would return about 3 columns. Product Description, Catalog Number, and Price. It would be pulling all
Re: [PHP-DB] Shopping Cart
Wendell Frohwein wrote: Hi martin, thanks for the email. I'm sorting it out slowly but surely. I was just a little over worked the night I wrote that novel of an email. I don't know if you saw my latest email titled Mysql Result. That's the last step I am at. I used a select statement across multiple tables to get all the values that I wanted. I forgot because I was so tired that, once I had those values in there that I could sort by anything I wanted to. If you have a solution for my Mysql Result problem, that would help me out alot. Most people are saying that I have to do a sub query, so I am not really sure. Thanks though. -Wendell Frohwein [snipped from another email] I wanted to know if it would be possible for it to output it like so: +--+---+-+--+ | makename | modelname | versionname |years | +--+---+-+--+ | Acura| Integra | RS | 92,93| | Acura| Integra | GSR | 94,95,96,97,98,99,01 | +--+---+-+--+ [snip] As penance for suggesting the quick way out in another posting, I've answered your question! (I would've answered anyway - I'm a softie. I got distracted this morning with the whole 'work' thing - sorry for the delay.) I remembered doing this before - and sure enough: GROUP_CONCAT: http://dev.mysql.com/doc/mysql/en/group-by-functions.html The relevant bits: GROUP_CONCAT([DISTINCT] expr [,expr ...] [ORDER BY {unsigned_integer | col_name | expr} [ASC | DESC] [,col_name ...]] [SEPARATOR str_val]) mysql SELECT student_name, - GROUP_CONCAT(test_score) - FROM student - GROUP BY student_name; Or: mysql SELECT student_name, - GROUP_CONCAT(DISTINCT test_score - ORDER BY test_score DESC SEPARATOR ' ') - FROM student - GROUP BY student_name; The default separator is the comma. Just toss in a 'GROUP_CONCAT(year) AS year' and appropriate 'GROUP BY' clause and have at it. Cheers, -- - Martin Norland, Sys Admin / Database / Web Developer, International Outreach x3257 The opinion(s) contained within this email do not necessarily represent those of St. Jude Children's Research Hospital. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] - Shopping cart software
osCommerce http://www.oscommerce.com Edward Dudlik Becoming Digital www.becomingdigital.com - Original Message - From: Mignon Hunter [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, 29 May, 2003 16:47 Subject: [PHP-DB] - Shopping cart software Can anyone recommend shopping cart software; does not have to be open source. I need to set up pretty fast and be able to calculate the different sales tax for anywhere, USA. (International should be ok). Already have cc processor lined up. Any suggestions would be appreciated. Thx -- M Hunter -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] - Shopping cart software
A lot of hosted servers are already set up for Miva Merchant. The basic store/shopping cart is very quick to set up. --Dave Shugarts Can anyone recommend shopping cart software; does not have to be open source. I need to set up pretty fast and be able to calculate the different sales tax for anywhere, USA. (International should be ok). Already have cc processor lined up. Any suggestions would be appreciated. Thx -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] - Shopping cart software
Hi Mignon Hunter, Can anyone recommend shopping cart software; does not have to be open source. I need to set up pretty fast and be able to calculate the different sales tax for anywhere, USA. (International should be ok). have a look on http://www.phpshop.org. Regards, Ruprecht -- Ruprecht Helms IT-Service und Softwareentwicklung Tel./Fax +49[0]7621 16 99 16 email: [EMAIL PROTECTED] Homep.http://www.rheyn.de -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Shopping Cart Sessions - Think this is a simple prolem- hopefully
1. Are you 100% sure register_globals is turned on? 2. You session_register your variable before you change it. Replace $ShoppingCart with $_SESSION[ShoppingCart] every time you use it. This way you are modifying the session variable actually in the session, not just the one time. session_register() copies the named variable into the session space, but adding or removing items from that variable does NOT change it in the session if you use _register. If you modify $_SESSION[shoppingcart] every time, then you are actually reading/writing to the real session variable and don't have to worry about it. Peter On Thu, 14 Nov 2002, Boa Constructor wrote: Evening all, I'm pretty stumped with this basic shopping cart I'm trying to integrate into my site, if u wanna see what I'm on about visit http://www.hostmaster-x.co.uk/Products.php. On my products script I've got the following: [...] Of course I need a link so that I can buy a product, so I've got the following in a loop: echo a href=$PHP_SELF?buy=$iBuy/aBR; The link works fine for each product, the problem is that the ID of the product doesn't seem to be stored in the session and I get a whole pile of mysql errors which don't appear in the same page when products are displayed. The errors highlight the following code: while($ProductDetails = mysql_fetch_array($Q)) { $ProductID = $ProductDetails[ID]; $ProductName = $ProductDetails[ProductName]; $SellingPrice = $ProductDetails[SellingPrice]; $ProductPicture = $ProductDetails[PictureOfProduct]; $AmountInStock = $ProductDetails[AmountInStock]; $Description = $ProductDetails[ProductDescription]; $PictureOfProduct = $ProductDetails[PictureOfProduct]; } if(mysql_num_rows($Q) 0) Anyone got any ideas? I'm a bit lost as to why this doesn't work. G :) --- Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ --- -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Shopping Cart Sessions - Think this is a simple prolem- hopefully
Peter, thanks for your reply. I'm 100% unsure that register_globals is turned on. I've not tried any of your points as for some reason my code works and my errors have somehow disappeared. It simply doesn't make any sense. Although I did email my web host to see if register_globals were turned on and they may have done this, but I'm thinking its not that as nobody has got back to me. I printed out the contents of the $buy variable and it contained exactly what I expected it to so it seems to be behaving as it should, I'm just unsure as to why its working now - bizarre! Even when I passed the Catagory/Interests ID along with the product ID in the URL, that still produced errors but I wasn't going to stay up any later to try and solve it. All I know is last night is didn't work and now it does ! Thanks again for your reply. Graeme :) - Original Message - From: Peter Beckman [EMAIL PROTECTED] To: Boa Constructor [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, November 14, 2002 3:41 PM Subject: Re: [PHP-DB] Shopping Cart Sessions - Think this is a simple prolem- hopefully 1. Are you 100% sure register_globals is turned on? 2. You session_register your variable before you change it. Replace $ShoppingCart with $_SESSION[ShoppingCart] every time you use it. This way you are modifying the session variable actually in the session, not just the one time. session_register() copies the named variable into the session space, but adding or removing items from that variable does NOT change it in the session if you use _register. If you modify $_SESSION[shoppingcart] every time, then you are actually reading/writing to the real session variable and don't have to worry about it. Peter On Thu, 14 Nov 2002, Boa Constructor wrote: Evening all, I'm pretty stumped with this basic shopping cart I'm trying to integrate into my site, if u wanna see what I'm on about visit http://www.hostmaster-x.co.uk/Products.php. On my products script I've got the following: [...] Of course I need a link so that I can buy a product, so I've got the following in a loop: echo a href=$PHP_SELF?buy=$iBuy/aBR; The link works fine for each product, the problem is that the ID of the product doesn't seem to be stored in the session and I get a whole pile of mysql errors which don't appear in the same page when products are displayed. The errors highlight the following code: while($ProductDetails = mysql_fetch_array($Q)) { $ProductID = $ProductDetails[ID]; $ProductName = $ProductDetails[ProductName]; $SellingPrice = $ProductDetails[SellingPrice]; $ProductPicture = $ProductDetails[PictureOfProduct]; $AmountInStock = $ProductDetails[AmountInStock]; $Description = $ProductDetails[ProductDescription]; $PictureOfProduct = $ProductDetails[PictureOfProduct]; } if(mysql_num_rows($Q) 0) Anyone got any ideas? I'm a bit lost as to why this doesn't work. G :) -- - Peter BeckmanSystems Engineer, Fairfax Cable Access Corporation [EMAIL PROTECTED] http://www.purplecow.com/ -- - -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] Shopping Cart ?
Hi There are functions for the Verisign API. For those servers with no compiled module for Verisign try to use the Verisign package from PEAR repository. You can get it from the CVS - cvs.php.net l:cvsread, p:phpfi Look at the docs what command to issue to get the pear package(write pear instead of php4). Best regards, Andrey Hristov IcyGEN Corporation http://www.icygen.com BALANCED SOLUTIONS - Original Message - From: Dave Carrera [EMAIL PROTECTED] To: php List [EMAIL PROTECTED] Sent: Monday, February 25, 2002 9:50 AM Subject: [PHP-DB] Shopping Cart ? Hi All, I am developing a shopping cart for a customer. No Prob there. Is there any info around, or can someone supply, on how to Link the buy button to a ccp. I think what I mean is the customer has no credit card processor at the moment So I want to be flexible with the buy button links ( I think...). Is there some kind of code example for this. As Always thank you in advance for any snippets of wisdom. Dave Carrera Php / MySql Development Web Design Site Marketing http://www.davecarrera.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php