Jump to content


Photo

Help me please with basket cart


  • Please log in to reply
No replies to this topic

#1 fadyz

fadyz
  • New Members
  • Pip
  • Newbie
  • 4 posts

Posted 09 September 2006 - 03:01 AM

I've build a simple web e-commerce and i've stuck in basket cart page. I'm confused how to edit and delete the item that exist in basket cart. I've have this code :
//sc_session.php for hold the session variable
<?php
if(ereg("sc_session.php", $PHP_SELF))
{
header("location: index.php");
die;
}
session_name("sc");
session_start();
if(!session_is_registered("Kode_Produk"))
{
session_register(Kode_Produk, Nama_Produk, Nama_Penulis, Nama_Penerbit, Jumlah_Produk, Harga_Produk, Jumlah_Harga);
$Kode_Produk = array();
$Nama_Produk = array();
$Nama_Penulis = array();
$Nama_Penerbit = array();
$Jumlah_Produk = array();
$Harga_Produk = array();
$Jumlah_Harga = array();
}
?>

//sc_basket for showing the item in the basket cart
<?php
include "sc_session.php";
include "template.php";
include "rupiah.php";

$counter = count($Kode_Produk);
if($counter == 0)
{
$isi .= "<p><div class='bodytext'>Your Basket cart still empty</p>";
}
else
{
$isi = "<div class='bodytext'>";
$isi .= "<b>Basket Cart<p></b>";
$isi .= "Please Look again at your basket cart :<p>";
$isi .= "<table class='bodytext' border='1' align='center' cellspacing='0' cellpadding='2' bordercolorlight='#008000'>";
$isi .= "<tr bgcolor='silver' align='center'><th>No</th><th>Kode Produk</th><th>Nama Produk</th><th>Harga Satuan</th><th>Qty</th><th>Harga</th><th>Edit</th></tr>";
$counter = count($Kode_Produk);
$no = 0;
$totalharga = 0;
for($i=0;$i<$counter;$i++)
{
$index = $i;
$no = $i + 1;
$totalharga = $totalharga + $Jumlah_Harga[$i];
$rp_Harga_Produk = rupiah($Harga_Produk[$i]);
$rp_Jumlah_Harga = rupiah($Jumlah_Harga[$i]);
$isi .= "<tr><td>$no</td><td>$Kode_Produk[$i]</td><td>$Nama_Produk[$i]</td><td align='right'>$rp_Harga_Produk</td><td align='center'>$Jumlah_Produk[$i]</td><td align='right'>$rp_Jumlah_Harga</td>";
}
$rp_totalharga = rupiah($totalharga);
$isi .= "<tr><td colspan='5'>Total Harga</td><td align='right'>$rp_totalharga</td></tr>";
$isi .= "</table></p>";
$isi .= "<p></div>";
}
$isi .= "<p>[<a href='product.php?kid=$kid'><span class='tombol'>Back To Shop</span></a>]";
$isi .= "<p>";

$tpl = new template;
$tpl->define_theme("theme01.html");
$tpl->define_tag("{ISI}",$isi);
$tpl->parse();
$tpl->printproses();
?>

//note that i'm make the web based book shop:
Kode_Produk = product id
Nama_Produk = product name
Nama_Penulis = writer name
Jumlah_Produk = quantity from the product
Harga_Produk = Product cost
Jumlah_Harga = Total Cost

My Question is what should i put(PHP code) in the sc_basket.php so i can edit and delete item that i don't want to in my basket cart. Sorry for my bad english T_T




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users