Jump to content

Obodo

Members
  • Posts

    14
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Obodo's Achievements

Member

Member (2/5)

0

Reputation

  1. In my database table, i have a field for price and quantity. Is there a way I could use a select to get 2 values from the database? What I mean is I will create a select field where when I select wholesale it will bring out the price and quantity and if I select retail, it will bring the price and the quantity.
  2. I'm thinking aloud. Is there a way I could use a select to get 2 values from the database? What I mean is I will create a select field where when I select wholesale it will bring out the price per carton and the quantity available and if I select retail, it will bring the price per unit and the quantity available for the item. The values will be from the database of course I'm thinking jquery will be able to do such.
  3. WOAH! I'm lost here! Will need to read and reread. Thanks
  4. Exactly! Inventory is the main headache
  5. WOAH! I'm lost here! Will need to read and reread. Thanks
  6. What I have in mind is to convert all the cartons to pieces. But I envisage a problem of conflict somewhere. I have not been able to put the problem to perspective though. I want to do the thinking and computation first before I start codifying it.
  7. My thoughts are almost like yours.
  8. pls i am looking for the best way to get this done: i want to be able to deal with both retail and wholesales from one spot. in my frontend store, a customer can decide to chose buying just an item or the whole pack. e.g i want to buy noodles, when i type noodles, it will give me an option to buy either 1 or 2 or the whole carton or also i can buy a carton and some pieces. meanwhile any item bought from the front end should be deducted from the quantity in stock (e.g a cartoon of noodle contains 15 pieces and i have 30 cartons of noodle in stock. if a carton and 2 pieces are bought, it should deduct the item i.e 30 cartons minus 1 carton and 2 pieces = 28 cartons and 13 pieces as the remain stock on noodles) thanks
  9. ok sir. how can that be done with the above mentioned?
  10. thanks all. i got it up and running now. but Mr Barand, is there a way i could have stored the items into the database without the use of form? meanwhile like i tried explaining, the values are derived from session so the page i had problem is the checkout page. thanks again
  11. I really want to update the record. I mean to subtract the quantity of items bought to that in stock. that is if a customer buys 12 coke and 15 milk, they will be deducted from the total in stock. hope you get it. thanks
  12. Sorry but i don't quite get you. the files are read only cos user is not expected to do any form of input on the page. the values are from another page which is the front end. this page is the checkout page.
  13. Hahahahahahaha. Users don't get to input their own price. this page is actually to send the order to the database and print. meanwhile its for online, I'm developing it for my wife to use in her shop. so everything is ran on localhost.
  14. hello all i am building a shopping system, but i am stuck. i want to update items in the database but it is affecting only the last row. thanks for the help <input type="hidden" class="form-control" name="prod_id" value="'.$values["product_ids"].'" /> <td><input type="text" class="form-control" readonly name="prod_name" value="'.$values["product_name"].'" /></td> <td><input type="text" class="form-control" readonly name="prod_type" value="'.$values["product_type"].'" /></td> <td><input type="text" class="form-control" readonly name="prod_size" value="'.$values["product_size"].'" /></td> <td><input type="text" class="form-control" readonly name="prod_qty" value="'.$values["product_quantity"].'" /></td> <td><input type="text" class="form-control" readonly name="prod_price" value="'.$values["product_price"].'" /></td> <td><input type="text" class="form-control" readonly name="total_price" value="'.number_format($values["product_quantity"] * $values["product_price"], 2).'" /></td> if(isset($_POST['enter'])) { require_once 'database_connection.php'; $prod_name = $_POST['prod_name']; $prod_id = $_POST['prod_id']; $prod_type = $_POST['prod_type']; $prod_size = $_POST['prod_size']; $prod_qty = $_POST['prod_qty']; $prod_price = $_POST['prod_price']; $total_price = $_POST['total_price']; $trans_ref = mt_rand(10000, 99999); $sql = "INSERT INTO test_sales ( trans_ref, prod_id, prod_name, prod_type, prod_size, prod_qty, prod_price, total_price, trans_date ) VALUES ( :trans_ref, :prod_id, :prod_name, :prod_type, :prod_size, :prod_qty, :prod_price, :total_price, NOW() )"; $stmt = $connect->prepare($sql); $stmt->execute(array( ':trans_ref' => $trans_ref, ':prod_id' => $prod_id, ':prod_name' => $prod_name, ':prod_type' => $prod_type, ':prod_size' => $prod_size, ':prod_qty' => $prod_qty, ':prod_price' => $prod_price, ':total_price' => $total_price )); $num_rows = $stmt->rowCount(); if($num_rows){ $sql = " UPDATE products SET qty = qty - '$prod_qty' WHERE prod_name = '$prod_name' AND prod_id = '$prod_id' "; $stmt = $connect->prepare($sql); //$stmt->bindValue(':qty', $prod_qty, PDO::PARAM_STR); $stmt->bindValue(':prod_name', $prod_name, PDO::PARAM_STR); $stmt->bindValue(':prod_id', $prod_id, PDO::PARAM_STR); $stmt->execute(); echo '<div class="alert bg-success text-center">ITEMS ADDED</div>'; unset($_SESSION["shopping_cart"]); }else{ echo '<div class="alert bg-danger text-center">A PROBLEM OCCURRED</div>'; } }
×
×
  • 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.