Jump to content

maziagha

Members
  • Posts

    20
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

maziagha's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. Hi! I'm working on a webshop and everything works fine. Now there is only one thing left and i can't get it working. In the code below i'm Updating the products the customer is buying into the Quantity table(works good) but at the same time i want to remove the quantity of the product from the stock list that contains sizes of the products. Here is the part that I updatethe products in quantity table: [code] for ($i = 0; $i < $numItem; $i++) { $sql = "UPDATE tbl_product SET pd_qty = pd_qty - {$cartContent[$i]['ct_qty']} WHERE pd_id = {$cartContent[$i]['pd_id']}"; $result = dbQuery($sql);[/code] Here is the code to remove the specific sizes from the stock: [code] $query = "UPDATE productquantity SET Quantity = Quantity - {$cartContent[$i]['ct_qty']} WHERE QProdID = {$cartContent[$i]['pd_id']} AND QSizeID = {$cartContent[$i]['ct_size_n']}";[/code] So it should look like this: [code] for ($i = 0; $i < $numItem; $i++) { $sql = "UPDATE tbl_product SET pd_qty = pd_qty - {$cartContent[$i]['ct_qty']} WHERE pd_id = {$cartContent[$i]['pd_id']}"; $query = "UPDATE productquantity SET Quantity = Quantity - {$cartContent[$i]['ct_qty']} WHERE QProdID = {$cartContent[$i]['pd_id']} AND QSizeID = {$cartContent[$i]['ct_size_n']}"; $result = dbQuery($sql,$query);[/code] But this wont work. Can anyone pls help me???
  2. Helo! I use this script to get a dropdown from my mysql. this works fine. what the problem is that i want to have multiple dropdowns and all the selected values should be stored in the same table, but each value as a new row [code]<?php $sql="select * from tbl_sizes"; $result=mysql_query($sql); echo "<select name=\"select\">\n"; while($zeile = mysql_fetch_array($result)){ ?> <option value="<?php echo $zeile['SizeChartID']; ?>"><?php echo $zeile['Size']; ?></option> <?php } ?>[/code] How can i do that?
  3. That could work, but the process to add products would be to complicated.
  4. ok! looks pretty good So if i want a product that i only have in S and M only what do i do then? Yeah also i want it to be a List drop down menu to choose the sizes.
  5. Hello all! I have this webshop today that i'm using. everything works fine until i decided that want my customers to be able to chose size and colors of the products. Now the problem is every products can have diferent sizes and colors compared to others. My question is how can i make a MYSQL table and what can i do to solve this problem. Today i'm using a newby variable thing that i don't even wanna show because it sux. If any of you have good solutin for this please let me know. Thank you
  6. OK it work almost fine now except the main category gets wrong ID when choosen. no mather what main category i choose it is the same cat-id all the time. Work fine with child categories. someone can tell why? looks like this now: [code]/* Generate combo box options containing the categories we have. if $catId is set then that category is selected */ function buildCategoryOptions($catId = 0) { $sql = "SELECT cat_id, cat_parent_id, cat_name FROM tbl_category ORDER BY cat_id"; $result = dbQuery($sql) or die('Cannot get Product. ' . mysql_error()); $categories = array(); while($row = dbFetchArray($result)) { list($id, $parentId, $name) = $row; if ($parentId == 0) { // we create a new array for each top level categories $categories[$id] = array('name' => $name, 'children' => array()); } else { // the child categories are put int the parent category's array $categories[$parentId]['children'][] = array('id' => $id, 'name' => $name); } } // build combo box options $list = ''; foreach ($categories as $key => $value) { $name     = $value['name']; $children = $value['children']; $list .= "<option value=\"$parentId\"> $name"; foreach ($children as $child) { $list .= "<option value=\"{$child['id']}\""; if ($child['id'] == $catId) { $list.= " selected"; } $list .= ">{$child['name']}</option>\r\n"; } $list .= "</optgroup>"; } return $list; }[/code]
  7. i tryed that but it messes the thing up. Note that have removed this part [code]//$name    = $value['name'];[/code] if i out that back it really mess thing up. I can get it work then but i use the same  list menu and if i want to add products to my database they all get recorded in wrong category.
  8. Hello all! I'm using php mysql databse to creat a list/menu drop down. In my category database i also have child categories. with my script i can pull the categories and child categories. the problem i have is that the child categories are placed in the list as they wish and not directly under the main category. Can anyone help me? here is the part of that script. [code]/* Generate combo box options containing the categories we have. if $catId is set then that category is selected */ function buildCategoryOptions($catId = 0) { $sql = "SELECT cat_id, cat_parent_id, cat_name FROM tbl_category ORDER BY cat_id"; $result = dbQuery($sql) or die('Cannot get Product. ' . mysql_error()); $categories = array(); while($row = dbFetchArray($result)) { list($id, $parentId, $name) = $row; if ($parentId = 0) { // we create a new array for each top level categories $categories[$id] = array('name' => $name, 'children' => array()); } else { // the child categories are put int the parent category's array $categories[$parentId]['children'][] = array('id' => $id, 'name' => $name); } } // build combo box options $list = ''; foreach ($categories as $key => $value) { //$name    = $value['name']; $children = $value['children']; $list .="<option value=\"$parentId\"> $name"; foreach ($children as $child) { $list .= "<option value=\"{$child['id']}\""; if ($child['id'] == $catId) { $list.= " selected"; } $list .= ">{$child['name']}</option>\r\n"; } $list .= "</optgroup>"; } return $list; } [/code]
  9. nah never mind guys i solved the problem after sleeping on it and dreaming about it.  ;D The problem was that the add to cart URL was taken from an include file and that caused the problem. solved it buy making the page to a big script page. Thank you all for trying to help.
  10. Well, since i don't get any posting of the form i cant even write it to database. I tryied but failed that also. Can you run the cart sript and check where it is bugging? Please please pretty please
  11. form method="post"> <select name="sizer">   <option value="Small">Small</option>   <option value="Medium">Medium</option>   <option value="Large">Large</option> </select> This is what i added to the productdetail.php next to the descriptions part. But i can't get it posted so i can $_request it later on.
  12. Please someone run the cart and help me!
  13. Can anyone take a look at the codes and tell me what is wrong? The size part i have added my self so its not in the original code.
×
×
  • 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.