Jump to content

Help me please with basket cart


fadyz

Recommended Posts

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
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.