Hello Friends
Aqeel Here. I want a shopping cart in php for the submission of my finall assignment . In which we use object oriented approach and no frame work of php.
if anybidy wants to help me then plz mail me.
{REMOVED}
Thanx
Regards
Aqeel Chaudary
PHP Shopping CartShopping Cart
Page 1 of 1
3 Replies - 4815 Views - Last Post: 08 January 2009 - 12:15 AM
Replies To: PHP Shopping Cart
#2
Re: PHP Shopping Cart
Posted 01 January 2009 - 09:12 PM
ch aqeel, on 31 Dec, 2008 - 11:24 PM, said:
if anybidy wants to help me then plz mail me.
You'll have a much better response if you post detailed questions in the PHP topic. Usually someone with less than 10 posts that asks for help on a major project, well... not to many people are looking to do work for someone else for nothing.
Best of luck with your project.
#3
Re: PHP Shopping Cart
Posted 01 January 2009 - 09:20 PM
I'll go ahead and move this to the PHP forum, but be aware you're more than likely not going to get the responses you're looking for
[rules][/rules]
[rules][/rules]
#4
Re: PHP Shopping Cart
Posted 08 January 2009 - 12:15 AM
ch aqeel, on 31 Dec, 2008 - 09:24 PM, said:
Hello Friends
Aqeel Here. I want a shopping cart in php for the submission of my finall assignment . In which we use object oriented approach and no frame work of php.
if anybidy wants to help me then plz mail me.
{REMOVED}
Thanx
Regards
Aqeel Chaudary
Aqeel Here. I want a shopping cart in php for the submission of my finall assignment . In which we use object oriented approach and no frame work of php.
if anybidy wants to help me then plz mail me.
{REMOVED}
Thanx
Regards
Aqeel Chaudary
Create A table in database
CREATE TABLE `cart` (
`sess_id` varchar(255) collate latin1_general_ci NOT NULL,
`product_id` int(10) NOT NULL,
`quantity` int(10) NOT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1 COLLATE=latin1_general_ci;
then
use this php function(modify the query)
////////////////////////////// add or show //////////////////////////////////
function in_stock($product_id, $quantry, $type)
{
$sess_id = session_id();
if($type == "total")
{
$count_product = $quantry;
$return_array[count_product] = $count_product;
}
else if($type == "add")
{
$count_product = select_data("quantity", "cart", "WHERE `sess_id` = '$sess_id' AND `product_id` = $product_id", "single_data") + $quantry;
$return_array[count_product] = $count_product;
}
$stock = select_data("quantity", "product", "WHERE `id` = $product_id", "single_data");
$return_array[stock] = $stock;
if($stock >= $count_product)
{
$return_array[status] = 1;
}
else
{
$return_array[status] = 0;
}
return $return_array;
}
////////////////////////////// CART STATUS //////////////////////////////////
function cart_status()
{
$sess_id = session_id();
$query = "SELECT *
FROM `cart`
WHERE `sess_id` = '$sess_id'";
//echo $query."<br>";
$i=0;
$result = mysql_query($query);
if(mysql_num_rows($result)!=0)
{
while ($data = mysql_fetch_array($result))
{
$product_price = select_data("price", "product", "WHERE `id` = $data[product_id]", "single_data");
$gross_price = $product_price * $data[quantity];
//CART PRICE
$return_array[total] += $gross_price;
//QUANTITY
$return_array[quantity] += $data[quantity];
}
return $return_array;
}
}
////////////////////////////select data\\\\\\\\\\\\\\\\\\\\\\\\\
function select_data($fetch, $table, $where, $process)
{
global $db_database, $tbl_prefix;
$table = $tbl_prefix . $table;
$query = "SELECT $fetch FROM `$table` $where";
$result = mysql_query($query);
//echo $query."<BR>";
switch($process)
{
// SELECT SINGLE DATA OF TABLE [SINGLE VARIABLE]
/*---------------------------------------------------------*/
case "single_data":
{
$data = mysql_fetch_row($result);
if(mysql_num_rows($result)==1)
return $data[0];
else
return 0;
break;
}
}//end of switch
}
Use this function with some necessary modification
This post has been edited by adnan15110: 08 January 2009 - 12:24 AM
Page 1 of 1
|
|

New Topic/Question
Reply



MultiQuote




|