[PHP-DB] Shopping Cart Discount System

2012-12-31 Thread Karl DeSaulniers

Hello Everyone,
Hope all are well. Quick and hopefully painless question.
Is there any examples on how to build a discount system
into your shopping cart out there that anyone knows of?
I am using MySQL and PHP. I have built one of my own so far,
but am having trouble making sense of what goes where.

For example. If a product has miscellaneous charges,
lets say.. glitter is extra on your shirt.
How is discounts applied? I mean, as far as discounts go,
lets say its 20% a shirt and this shirt has glitter.
Is it best practice to apply the discount to just the shirt
or the shirt and glitter as a combo discount.
I know this is somewhat dependent on the owners choice
of what he/she wants to give the discount on,
but my question is of the programing of it.
Do I build conditions for the shirt to get a discount applied
then the miscellaneous charges, or combine the totals of the two,
then apply the discount to the sum?

Then lets say there is a cart discount also being applied.
Is it best practice to apply this to the total of items then
add the shipping, rush charges and tax, or to the total of the whole  
cart
including shipping, rush charges then add the tax after applying the  
discount?


Sorry for the run-on question, hope this makes sense enough to merit  
help.


HNY,

Best,

Karl DeSaulniers
Design Drumm
http://designdrumm.com

PS: Because this question could be answered by either database or  
general, is the only reason for the double post.

Wont be making a habit of it.. :)

Re: [PHP-DB] Shopping cart application question

2010-04-04 Thread Ron Piggott

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 
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 ) {



> $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

2010-04-03 Thread chris smith
> 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 ) {



> $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 application question

2010-04-03 Thread Nilesh Govindarajan



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



[PHP-DB] Shopping cart application question

2010-04-03 Thread Ron Piggott

I am writing a shopping cart application.  I am expanding the application
to have a store membership component.

Right now I am saving the customers selections in one of two ways:
- In the session variable "$_SESSION['order']" if they aren't logged in
- For those who have logged into their account I am saving their
selections in the table "membership_shopping_carts"

I have ran into trouble trying to output their choices under the "cart
contents" heading.  I want to invoke one of two loops --- A 'while' loop
for the session variable and a mySQL query for the logged in users.

The " } else { " confuses PHP.  I am not sure what I should be doing.

$_SESSION['user_reference'] stores the value of the logged in user.  This
is how I tell if s/he is logged in or not --- and which loop I want to
invoke.

Suggestions?

Ron

if ( $_SESSION['user_reference'] > 0 ) {

$user_reference = $_SESSION['user_reference'];
$query = "SELECT `store_product_profile`.`reference` FROM
`membership_shopping_carts` INNER JOIN `store_product_profile` on
`store_product_profile`.`reference` =
`membership_shopping_carts`.`store_product_profile_reference` WHERE
`membership_shopping_carts`.`member_reference` = $user_reference ORDER BY
`store_product_profile`.`product_name` ASC";
$shopping_cart_content_result=mysql_query($query);
$cart_records_found=mysql_numrows($shopping_cart_content_result);

$i=0;
while ( $i < $cart_records_found ) {

} else {

foreach ($_SESSION['order'] AS $key => $value ) {

}


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Shopping cart

2009-05-16 Thread danaketh

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


basket.php
 include("mysql.class.php");

 include ("header.php");
 include ("mysql_connect.php");
  include ("functions.php");
 ?>
 
Rum Basket

 

  Rum on Offer
   
 $sql= 'SELECT * FROM spirits BY id';

  $result = $con->query($sql);
 $output[]= '';
 while ($row = $result->fetch()) {
 $output[] = ''.$row['name'].': £'.$row['price'].'Add to Cart';
}
$output[] = '';
  echo join ('', $output);
   ?>
  





cart.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;

?>



Rum Basket







Please Check Quantities...



Back to Rum List








functions.php

There is no alcohol in your Rum Basket';
 } else {
  // Parse the cart session variable
  $items = explode(',',$cart);
  $s = (count($items) > 1) ? 's':'';
  return 'There are'.count($items).' item'.$s.' in your rum 
basket';
 }
}
  
 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[] = '';
  $output[] = '';
  foreach ($contents as $id=>$qty) {
   $sql = 'SELECT * FROM spirits WHERE id = '.$id;
   $result = $con->query($sql);
   $row = $result->fetch();
   extract($row);
   $output[] = '';
   $output[] = 'Remove';
   $output[] = ''.$name.'';
   $output[] = '£'.$price.'';
   $output[] = '';
   $output[] = '£'.($price * $qty).'';
   $total += $price * $qty;
   $output[] = '';
  }
  $output[] = '';
  $output[] = 'Grand total: £'.$total.'';
  $output[] = 'Update cart';
  $output[] = '';
 } else {
  $output[] = 'You shopping cart is empty.';
 }
 return join('',$output);
}

?>




Many Thanks

Vee
  


--

S pozdravem

Daniel Tlach
Freelance webdeveloper

Email: m...@danaketh.com
ICQ: 160914875
MSN: danak...@hotmail.com
Jabber: danak...@jabbim.cz



Re: [PHP-DB] Shopping cart

2009-05-16 Thread Max E.K
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
>  $con = mysql_connect("localhost","root","");
> if (!$con)
>   {
>   die('Could not connect: ' . mysql_error());
>   }
> mysql_select_db("rum", $con);
> ?>
> 
> basket.php
>   include("mysql.class.php");
>  include ("header.php");
>  include ("mysql_connect.php");
>   include ("functions.php");
>  ?>
>  
> Rum Basket
>  echo writeCart();
> ?>
>  
> 
>   Rum on Offer
> 
>  $sql= 'SELECT * FROM spirits BY id';
>   $result = $con->query($sql);
>  $output[]= '';
>  while ($row = $result->fetch()) {
>  $output[] = ''.$row['name'].': £'.$row['price'].' href="cart.php?action=add&id=
>   '.$row['id'].'">Add to Cart';
> }
> $output[] = '';
>   echo join ('', $output);
>?>
>   
> 
> 
>   include("footer.html");
> 
> ?>
> 
> 
> cart.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;
> 
> ?>
> 
> 
> 
> Rum Basket
> 
>  echo writeCart();
> ?>
> 
> 
> 
> 
> 
> Please Check Quantities...
> 
>  echo showCart();
> ?>
> 
> Back to Rum List
> 
> 
> 
> 
> 
> 
>   include("footer.html");
> 
> ?>
> 
> functions.php
> 
>  function writeCart() {
>  $cart = $_SESSION['cart'];
>  if (!$cart) {
>   return 'There is no alcohol in your Rum Basket';
>  } else {
>   // Parse the cart session variable
>   $items = explode(',',$cart);
>   $s = (count($items) > 1) ? 's':'';
>   return 'There are'.count($items).' item'.$s.' in your 
> rum basket';
>  }
> }
>   
>  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[] = ' id="cart">';
>   $output[] = '';
>   foreach ($contents as $id=>$qty) {
>$sql = 'SELECT * FROM spirits WHERE id = '.$id;
>$result = $con->query($sql);
>$row = $result->fetch();
>extract($row);
>$output[] = '';
>$output[] = ' class="r">Remove';
>$output[] = ''.$name.'';
>$output[] = '£'.$price.'';
>$output[] = ' size="3" maxlength="3" >';
>$output[] = '£'.($price * $qty).'';
>$total += $price * $qty;
>$output[] = '';
>   }
>   $output[] = '';
>   $output[] = 'Grand total: £'.$total.'';
>   $output[] = 'Update cart';
>   $output[] = '';
>  } else {
>   $output[] = 'You shopping cart is empty.';
>  }
>  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



[PHP-DB] Shopping cart

2009-05-16 Thread Vernon St Croix
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


basket.php

 
Rum Basket

 

  Rum on Offer
  query($sql);
 $output[]= '';
 while ($row = $result->fetch()) {
 $output[] = ''.$row['name'].': £'.$row['price'].'Add to Cart';
}
$output[] = '';
  echo join ('', $output);
   ?>
  





cart.php

$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;

?>



Rum Basket







Please Check Quantities...



Back to Rum List








functions.php

There is no alcohol in your Rum Basket';
 } else {
  // Parse the cart session variable
  $items = explode(',',$cart);
  $s = (count($items) > 1) ? 's':'';
  return 'There are'.count($items).' item'.$s.' in your 
rum basket';
 }
}
  
 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[] = '';
  $output[] = '';
  foreach ($contents as $id=>$qty) {
   $sql = 'SELECT * FROM spirits WHERE id = '.$id;
   $result = $con->query($sql);
   $row = $result->fetch();
   extract($row);
   $output[] = '';
   $output[] = 'Remove';
   $output[] = ''.$name.'';
   $output[] = '£'.$price.'';
   $output[] = '';
   $output[] = '£'.($price * $qty).'';
   $total += $price * $qty;
   $output[] = '';
  }
  $output[] = '';
  $output[] = 'Grand total: £'.$total.'';
  $output[] = 'Update cart';
  $output[] = '';
 } else {
  $output[] = 'You shopping cart is empty.';
 }
 return join('',$output);
}

?>




Many Thanks

Vee

[PHP-DB] Shopping cart shipping logic

2008-05-14 Thread Ron Piggott
I need help writing a mySQL query and syntax that will determine the
shipping packing selected and will then determine the cost to ship.  I
have assigned dollar values to various packaging.  I have a designed the
following table which contains various packaging, the maximum size (in
centimeters) that packaging may contain and the cost to ship within
Canada, US or international:

shopping_cart_packaging_options:

reference int(2)
packaging_name varchar(50)
packaging_image_filename varchar(40)
package_length decimal(3,1)
package_width decimal(3,1)
package_height decimal(3,1)
packaging_cost_to_ship_canada decimal(3,2)
packaging_cost_to_ship_us decimal(3,2)
packaging_cost_to_ship_international decimal(3,2)

When I input a product I have been recording it's dimensions into this
table:

shopping_cart_product:

reference int(5)
category_reference int(3)
product_name varchar(50)
product_description longtext
product_length decimal(3,1)
product_width decimal(3,1)
product_height decimal(3,1)
supplier_reference int(3)
sku varchar(12)
reorder_alert int(5)
discontinued int(1)

The following code is from my check out script.  It displays the
products being purchased at check out, quantity ordered and pricing.  It
also creates the order record in the shopping_cart_orders table.  I am
hoping some code could be added in here to figure out shipping costs
based on product dimensions and the dimensions of the available
packaging.  I haven't been able to figure out how to compare the total
dimensions of the products with the available packaging.  There are (2)
types of packaging:  Tubes for posters (The poster category has a
category_reference of 2) and envelopes / boxes for everything else.
Perhaps a split shipment needs to take place if someone orders a poster
and something else that needs to ship in an envelope.  I want the logic
behind this to optimize packaging shipping and handling costs and for
the order created to indicate to me which type of packaging I should use
that will hold all items ordered.

Thanks for helping me.  Ron


mysql_connect('localhost',$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
$query="SELECT * FROM ( shopping_cart_category INNER JOIN
shopping_cart_product ON shopping_cart_category.reference =
shopping_cart_product.category_reference ) INNER JOIN
shopping_cart_product_image ON
shopping_cart_product_image.product_reference =
shopping_cart_product.reference INNER JOIN shopping_cart_inventory ON
shopping_cart_inventory.product_reference =
shopping_cart_product.reference WHERE
shopping_cart_product_image.primary_image =1 ORDER BY product_name ASC";
$product_result=mysql_query($query);
$number_of_products=mysql_numrows($product_result);
mysql_close();

echo "Today's Order Is For:\r\n";
echo "\r\n";

echo "\r\n";

echo "Product Name\r\n";
echo "Unit
Price\r\n";
echo "Quantity Ordered\r\n";
echo "Total\r\n";

$product_cost_total = 0;
$i=0;
while ($i < $number_of_products) {

$product_reference = mysql_result($product_result,
$i,"shopping_cart_product.reference");
$product_name = mysql_result($product_result,
$i,"shopping_cart_product.product_name");
$quantity = $_SESSION['selection'][$product_reference];
$cost_of_product = mysql_result($product_result,
$i,"shopping_cart_inventory.selling_price");

if ( $_SESSION['selection'][$product_reference] > 0 ) {

echo "" .
stripslashes($product_name) . "\r\n";
echo "$" .
$cost_of_product . "\r\n";
echo "" .
$quantity . "\r\n";
echo "$" .
number_format(($quantity * $cost_of_product), 2, '.', '') .
"\r\n";

$product_cost_total = number_format(($product_cost_total +
($cost_of_product*$quantity)), 2, '.', '');

#record product(s) being sold to the shopping_cart_products_sold table

$shipping_order_reference = $_SESSION['shipping_order_reference'];

mysql_connect('localhost',$username,$password);
@mysql_select_db($database) or die( "Unable to select database");
mysql_query("INSERT INTO `shopping_cart_products_sold` ( `reference` ,
`orders_reference` , `product_reference` , `quantity` ) VALUES ( NULL ,
'$shipping_order_reference', '$product_reference', '$quantity' );");
$saved_product_order_reference = mysql_insert_id();
mysql_close();

}

++$i;
}

echo "\r\n";



-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



RES: [PHP-DB] Shopping cart session handling

2008-05-05 Thread Thiago Pojda
Forwarding to the correct mailing list. You should get flames...*cough* I
mean, answers here :)

Regards,
Thiago

-Mensagem original-
De: Ron Piggott [mailto:[EMAIL PROTECTED] 
Enviada em: domingo, 4 de maio de 2008 19:35
Para: PHP DB
Assunto: [PHP-DB] Shopping cart session handling

I am writing a shopping cart.  I wanted some input on session handling
for a shopping cart that is secure.  

At this time I am not programming for credit card processing.  I am
going to forward onto PayPal for payment initially.  But I want to do a
good job with security.

Ron


-- 
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



[PHP-DB] Shopping cart session handling

2008-05-04 Thread Ron Piggott
I am writing a shopping cart.  I wanted some input on session handling
for a shopping cart that is secure.  

At this time I am not programming for credit card processing.  I am
going to forward onto PayPal for payment initially.  But I want to do a
good job with security.

Ron


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] Shopping Cart

2005-03-08 Thread mohamed naazir
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

2005-03-07 Thread Martin Norland
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

2005-03-07 Thread Wendell Frohwein
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

Re: [PHP-DB] Shopping Cart

2005-03-07 Thread Martin Norland
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 re

[PHP-DB] Shopping Cart

2005-03-05 Thread Wendell Frohwein
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.
 
 
-Wendell Frohwein
 
 
 


[PHP-DB] Shopping Cart Updating Quantities Question.

2003-06-04 Thread Boa Constructor
Greetings all, Ok, I've made some progress with my shopping cart.  I can now
update the quantity of one item only.  When I try to update the quantities
of 2 products it only lists the first product with its previous quantity.  I
also need to press the "update quantity" button twice for the quantity to be
changed.

How can I update quantities of more than one product and why do I have to
press the "update quantity" button twice?

Here's the product catalogue:

http://www.hostmaster-x.co.uk/DisplayProducts.php?TypesOfInterests=11


The values are passed to the URL and the code I'm using to update quantities
is as follows:

foreach($shoppingcart['products'] as $buy => $quantity)

{

if ($_GET['buy'] == $buy)

{


$shoppingcart['products'][$buy] = $_GET['quantity'];


}



Any ideas ppl?

Cheers,

Graeme :)


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP-DB] - Shopping cart software

2003-05-30 Thread Ruprecht Helms
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 software

2003-05-30 Thread David Shugarts
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

2003-05-30 Thread Becoming Digital
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



[PHP-DB] - Shopping cart software

2003-05-30 Thread 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).

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



Re: [PHP-DB] Shopping Cart Sessions - Think this is a simple prolem- hopefully

2002-11-14 Thread Boa Constructor
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 "Buy";
> >
> > 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

2002-11-14 Thread Peter Beckman
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 "Buy";
>
> 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




[PHP-DB] Shopping Cart Sessions - Think this is a simple prolem - hopefully

2002-11-13 Thread Boa Constructor
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:

Cart contains:  items";

*/

//exit();

}

// Loads more code here ( code that works )


Of course I need a link so that I can buy a product, so I've got the following in a 
loop:  
echo "Buy";

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 :)



Public Sub House()

On Error Resume drink

 If Pint.empty = True Then
 Pint.refill
   Else
 Pint.drink
 End if

stomach.add Pint

MsgBox " I've had  " & stomach.count & " Pints"
MsgBox "VERY DRUNK"

End Sub




Re: [PHP-DB] Shopping Cart ?

2002-02-24 Thread Andrey Hristov

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




[PHP-DB] Shopping Cart ?

2002-02-24 Thread Dave Carrera

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-DB] Shopping Cart Category help

2001-12-10 Thread Chris Payne

Hey there everyone,

Hope you are all doing good :-)

I have a problem, I have a shopping cart system but I need to add sub-categories, how 
- using PHP with MySQL do I get the system to display sub-categories if they are 
found?  I have category 1 as the main one which displays all products, but my clients 
needs require that some areas will have sub-categories (I guess ID 2)  - how do I get 
it to display ID 2  if it is found?

I know I sound mumbled, it's my age :-)

Thank you everyone.

Chris



[PHP-DB] shopping cart classes

2001-02-16 Thread Randall Perry

I've checked out the shopping cart packages available for PHP and am not
thrilled by any of them. Was wondering if there are a set of classes
available that could be used to support a shopping cart. I'm interested in
the 'back end' -- working with the actual data, rather than the front end --
the user interface. Want to build it with php + mySQL or PostgreSQL.

I want complete freedom to build the interface but don't want to reinvent
the wheel for credit card validation, online credit card processing,
shipping calculation, etc.


I've built a simple shopping cart for a site currently under construction.
This uses a combination of javascript and php, and doesn't use database
(less than 1 dozen items).

You can see an example (excuse the mess) by going to:

http://www.bhagavati.com/trial/mainframe.htm

and clicking the 'order' link in the navbar frame at the top. HINT: close
movie window as soon as it opens.



Randy Perry
sysTame

Mac Consulting/Sales


-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]