patulong po. eto nalang po talaga yung hindi ko gaanong magets eh.
yung scenario po is kelangan may quantity selector yung cart page.
hindi ko maimplement due to limited time na binigay samin ng prof namin
refer to the screenshots below
eto po yung page:
eto po yung code na nagmamanage sa add item
[CODE lang="php" title="index.php"]<?php
session_start();
require_once ('php/CreateDb.php');
require_once ('php/component.php');
// create instance of Createdb class
$database = new CreateDb("Productdb", "Producttb");
// var
$quantity = 0;
if (isset($_POST['add'])){
if(isset($_SESSION['cart'])){
$item_array_id = array_column($_SESSION['cart'], "product_id");
if(in_array($_POST['product_id'], $item_array_id)){
} else {
$count = count($_SESSION['cart']);
$item_array = array(
'product_id' => $_POST['product_id']
);
$_SESSION['cart'][$count] = $item_array;
}
}else{
$item_array = array(
'product_id' => $_POST['product_id']
);
$_SESSION['cart'][0] = $item_array;
}
}
?>[/CODE]
paano po kaya malalagyan ng proper quantity field yan ?
eto po yung ginamit kong base: You do not have permission to view the full content of this post. Log in or register now.
yung scenario po is kelangan may quantity selector yung cart page.
hindi ko maimplement due to limited time na binigay samin ng prof namin
refer to the screenshots below
eto po yung page:
eto po yung code na nagmamanage sa add item
[CODE lang="php" title="index.php"]<?php
session_start();
require_once ('php/CreateDb.php');
require_once ('php/component.php');
// create instance of Createdb class
$database = new CreateDb("Productdb", "Producttb");
// var
$quantity = 0;
if (isset($_POST['add'])){
if(isset($_SESSION['cart'])){
$item_array_id = array_column($_SESSION['cart'], "product_id");
if(in_array($_POST['product_id'], $item_array_id)){
} else {
$count = count($_SESSION['cart']);
$item_array = array(
'product_id' => $_POST['product_id']
);
$_SESSION['cart'][$count] = $item_array;
}
}else{
$item_array = array(
'product_id' => $_POST['product_id']
);
$_SESSION['cart'][0] = $item_array;
}
}
?>[/CODE]
paano po kaya malalagyan ng proper quantity field yan ?
eto po yung ginamit kong base: You do not have permission to view the full content of this post. Log in or register now.
Attachments
-
You do not have permission to view the full content of this post. Log in or register now.