Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Total - its urgent

New Here ,
Sep 05, 2006 Sep 05, 2006

Copy link to clipboard

Copied

I am unable to multiply the price of each item with quantity stored and display it on the cart page......please help with this its urgent. Thanks in advance.
TOPICS
Server side applications

Views

340
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 05, 2006 Sep 05, 2006

Copy link to clipboard

Copied

In most languages, the operator used to multiply variables is *. eg

LineTotal=Price*Quantity

--
Jules
http://www.charon.co.uk/charoncart
Charon Cart 3
Shopping Cart Extension for Dreamweaver MX/MX 2004



Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 05, 2006 Sep 05, 2006

Copy link to clipboard

Copied

I know the operator but i need the syntax or code in php for doing it......

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Sep 05, 2006 Sep 05, 2006

Copy link to clipboard

Copied

>I know the operator but i need the syntax or code in php for doing it......

What does your current PHP code look like?

--
Regards

John Waller


Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Sep 05, 2006 Sep 05, 2006

Copy link to clipboard

Copied

LATEST
show cart code is as follows


<?php require_once('Connections/prashi.php'); ?>
<?php
$maxRows_cart = 10;
$pageNum_cart = 0;
if (isset($_GET['pageNum_cart'])) {
$pageNum_cart = $_GET['pageNum_cart'];
}
$startRow_cart = $pageNum_cart * $maxRows_cart;

$colname_cart = "-1";
if (isset($_GET['userid'])) {
$colname_cart = (get_magic_quotes_gpc()) ? $_GET['userid'] : addslashes($_GET['userid']);
}
mysql_select_db($database_prashi, $prashi);
$query_cart = sprintf("SELECT * FROM cart WHERE user_id = %s", $colname_cart);
$query_limit_cart = sprintf("%s LIMIT %d, %d", $query_cart, $startRow_cart, $maxRows_cart);
$cart = mysql_query($query_limit_cart, $prashi) or die(mysql_error());
$row_cart = mysql_fetch_assoc($cart);

if (isset($_GET['totalRows_cart'])) {
$totalRows_cart = $_GET['totalRows_cart'];
} else {
$all_cart = mysql_query($query_cart);
$totalRows_cart = mysql_num_rows($all_cart);
}
$totalPages_cart = ceil($totalRows_cart/$maxRows_cart)-1;
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" " http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns=" http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
</head>

<body>
<table border="1" cellpadding="2" cellspacing="5">
<tr>
<td>cartId</td>
<td>cookieId</td>
<td>pro_id</td>
<td>qty</td>
<td>user_id</td>
</tr>
<?php do { ?>
<tr>
<td><?php echo $row_cart['cartId']; ?></td>
<td><?php echo $row_cart['cookieId']; ?></td>
<td><?php echo $row_cart['pro_id']; ?></td>
<td><?php echo $row_cart['qty']; ?></td>
<td><?php echo $row_cart['user_id']; ?></td>
</tr>
<?php } while ($row_cart = mysql_fetch_assoc($cart)); ?>
</table>
</body>
</html>
<?php
mysql_free_result($cart);
?>



this code as ability to store the product id but when the user adds the same product twice the quantity is not upadated instead a new row of same product id is created with increment in cart_id and i have no idea how to add a total, subtotal into it......please help with this

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines