From ad76117788aea968b4247e763b9de58db8bbe073 Mon Sep 17 00:00:00 2001 From: Akhnus Date: Fri, 7 Sep 2018 17:50:16 +0500 Subject: [PATCH 1/5] I have created New Php files listed below 1) delete.php 2) edit.php 3) editu.php 4) view_products.php and regex validation of phone number in file insert_product.php --- .idea/vcs.xml | 6 ++ admin/assets/css/custom.css | 4 + admin/index.php | 29 +++++++ admin/insert_product.php | 160 ++++++++++++++++++------------------ 4 files changed, 118 insertions(+), 81 deletions(-) create mode 100644 .idea/vcs.xml diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 0000000..94a25f7 --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/admin/assets/css/custom.css b/admin/assets/css/custom.css index f4a9140..e7e57f6 100644 --- a/admin/assets/css/custom.css +++ b/admin/assets/css/custom.css @@ -90,3 +90,7 @@ a, a:hover, a:focus { color: #fff; background: #6d7fcc; } + +#content { + width: 100%; +} \ No newline at end of file diff --git a/admin/index.php b/admin/index.php index 29e7a82..d575acb 100644 --- a/admin/index.php +++ b/admin/index.php @@ -1,3 +1,6 @@ + @@ -10,6 +13,13 @@ E-commerce Admin Panel + Admin Panel +
@@ -62,6 +72,25 @@
+
+ +
diff --git a/admin/insert_product.php b/admin/insert_product.php index 344fcb6..105d5a5 100644 --- a/admin/insert_product.php +++ b/admin/insert_product.php @@ -1,82 +1,83 @@ - - - - Inserting Product - - - -
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Insert New Product here

Product Title:
Product Category: - -
Product Brand: - -
Product Image:
Product Price:
Product Description:
Product Keywords:
- +
+
+ +
+

Insert New Product

+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+ +
+ +
+
+
+
+ +
+
- - - +
+
\ No newline at end of file From 621241104ff0f72e7757dfc4cd9a17ae2d1ad39b Mon Sep 17 00:00:00 2001 From: Akhnus Date: Fri, 7 Sep 2018 20:27:28 +0500 Subject: [PATCH 2/5] I have created some new php files 1)editcat.php 2)deletecat.php 3)editcatu.php 4)and i have edited view_categories.php Now you can delete and edit in View Categories option --- .idea/ecommerce1.iml | 8 ++++++++ .idea/misc.xml | 6 ++++++ .idea/modules.xml | 8 ++++++++ 3 files changed, 22 insertions(+) create mode 100644 .idea/ecommerce1.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml diff --git a/.idea/ecommerce1.iml b/.idea/ecommerce1.iml new file mode 100644 index 0000000..c956989 --- /dev/null +++ b/.idea/ecommerce1.iml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 0000000..28a804d --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 0000000..0f60086 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file From 6e55219b879bbbdaf6930854f54330b9a894f7d5 Mon Sep 17 00:00:00 2001 From: Akhnus Date: Sat, 8 Sep 2018 12:09:26 +0500 Subject: [PATCH 3/5] Now you can edit delete and update in view_customers Files Altered : 1) view_customers Files Created : 1) deletecust.php 2) editcust.php 3) editcustu.php --- admin/delete.php | 13 ++++ admin/deletecat.php | 13 ++++ admin/deletecust.php | 13 ++++ admin/edit.php | 83 +++++++++++++++++++++++++ admin/editcat.php | 62 +++++++++++++++++++ admin/editcatu.php | 13 ++++ admin/editcust.php | 109 +++++++++++++++++++++++++++++++++ admin/editcustu.php | 19 ++++++ admin/editu.php | 16 +++++ admin/functions/db_connect.php | 4 ++ admin/view_brands.php | 12 ++++ admin/view_categories.php | 23 +++++++ admin/view_customers.php | 53 ++++++++++++++++ admin/view_products.php | 46 ++++++++++++++ 14 files changed, 479 insertions(+) create mode 100644 admin/delete.php create mode 100644 admin/deletecat.php create mode 100644 admin/deletecust.php create mode 100644 admin/edit.php create mode 100644 admin/editcat.php create mode 100644 admin/editcatu.php create mode 100644 admin/editcust.php create mode 100644 admin/editcustu.php create mode 100644 admin/editu.php create mode 100644 admin/functions/db_connect.php create mode 100644 admin/view_brands.php create mode 100644 admin/view_categories.php create mode 100644 admin/view_customers.php create mode 100644 admin/view_products.php diff --git a/admin/delete.php b/admin/delete.php new file mode 100644 index 0000000..6cff131 --- /dev/null +++ b/admin/delete.php @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/admin/deletecat.php b/admin/deletecat.php new file mode 100644 index 0000000..0240ea2 --- /dev/null +++ b/admin/deletecat.php @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/admin/deletecust.php b/admin/deletecust.php new file mode 100644 index 0000000..d51fdc8 --- /dev/null +++ b/admin/deletecust.php @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/admin/edit.php b/admin/edit.php new file mode 100644 index 0000000..0abf53e --- /dev/null +++ b/admin/edit.php @@ -0,0 +1,83 @@ + + + + + + Edit Product + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+

Edit Product

+
+ + + +
+ + + +
+ + + +
+ + + +
+ +
+
+ +
+ + + diff --git a/admin/editcat.php b/admin/editcat.php new file mode 100644 index 0000000..0382eb3 --- /dev/null +++ b/admin/editcat.php @@ -0,0 +1,62 @@ + + + + + + Edit Product + + + + + + + + +
+
+ + + + + + + + + + + + + +
+

Edit Category Name

+
+ + + +
+ +
+
+ +
+ + \ No newline at end of file diff --git a/admin/editcatu.php b/admin/editcatu.php new file mode 100644 index 0000000..2ebfdc1 --- /dev/null +++ b/admin/editcatu.php @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/admin/editcust.php b/admin/editcust.php new file mode 100644 index 0000000..04fc10d --- /dev/null +++ b/admin/editcust.php @@ -0,0 +1,109 @@ + + + + + + Edit Product + + + + + + + + +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+

Edit Customers

+
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ + + +
+ +
+
+ +
+ + \ No newline at end of file diff --git a/admin/editcustu.php b/admin/editcustu.php new file mode 100644 index 0000000..8b1868d --- /dev/null +++ b/admin/editcustu.php @@ -0,0 +1,19 @@ + \ No newline at end of file diff --git a/admin/editu.php b/admin/editu.php new file mode 100644 index 0000000..fdc5d67 --- /dev/null +++ b/admin/editu.php @@ -0,0 +1,16 @@ + \ No newline at end of file diff --git a/admin/functions/db_connect.php b/admin/functions/db_connect.php new file mode 100644 index 0000000..df8ceac --- /dev/null +++ b/admin/functions/db_connect.php @@ -0,0 +1,4 @@ + Brands +
    + $brand_title"; + } + ?> +
\ No newline at end of file diff --git a/admin/view_categories.php b/admin/view_categories.php new file mode 100644 index 0000000..ef1052d --- /dev/null +++ b/admin/view_categories.php @@ -0,0 +1,23 @@ +

Categories

+ diff --git a/admin/view_customers.php b/admin/view_customers.php new file mode 100644 index 0000000..67c81eb --- /dev/null +++ b/admin/view_customers.php @@ -0,0 +1,53 @@ +

Customers

+ +
+
+ + + + + + + + + + + + + + + + + + + + + + + + "; + } + ?> + + +
NameEmailCountryCityContactAddressImageDeleteEdit
$cust_name$cust_email$cust_country$cust_city$cust_contact$cust_address + + + + + + + +
\ No newline at end of file diff --git a/admin/view_products.php b/admin/view_products.php new file mode 100644 index 0000000..88947fc --- /dev/null +++ b/admin/view_products.php @@ -0,0 +1,46 @@ +
+
+
+ +
Product Title
+
Product Price
+
Product Description
+
Product Image
+
Delete Product
+
Edit Product
+ +
+ + + + + + + + + + + + + + + +
+ "; + } + ?> + + +
+ + + From d5893ed6291e1765090ea3175e6524641236f4a2 Mon Sep 17 00:00:00 2001 From: Akhnus Date: Sat, 8 Sep 2018 13:58:30 +0500 Subject: [PATCH 4/5] Now you can : 1) Insert Brand 2) Edit Brand 3) Delete Brand 4) Insert Category 5) Edit Brand 6) Delete Brand 7) Edit Customer Info 8) Delete Customer 9) Edit Products 10) Delete Products Functionalities till now !!! --- admin/deletebrand.php | 13 ++++++++ admin/editbrand.php | 62 +++++++++++++++++++++++++++++++++++++++ admin/editbrandu.php | 13 ++++++++ admin/index.php | 6 ++++ admin/insert_brand.php | 25 ++++++++++++++++ admin/insert_category.php | 25 ++++++++++++++++ admin/insertbrand.php | 9 ++++++ admin/insertcat.php | 9 ++++++ admin/view_brands.php | 10 ++++++- 9 files changed, 171 insertions(+), 1 deletion(-) create mode 100644 admin/deletebrand.php create mode 100644 admin/editbrand.php create mode 100644 admin/editbrandu.php create mode 100644 admin/insert_brand.php create mode 100644 admin/insert_category.php create mode 100644 admin/insertbrand.php create mode 100644 admin/insertcat.php diff --git a/admin/deletebrand.php b/admin/deletebrand.php new file mode 100644 index 0000000..56330a5 --- /dev/null +++ b/admin/deletebrand.php @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/admin/editbrand.php b/admin/editbrand.php new file mode 100644 index 0000000..2890c73 --- /dev/null +++ b/admin/editbrand.php @@ -0,0 +1,62 @@ + + + + + + Edit Product + + + + + + + + +
+
+ + + + + + + + + + + + + +
+

Edit Brand Name

+
+ + + +
+ +
+
+ +
+ + \ No newline at end of file diff --git a/admin/editbrandu.php b/admin/editbrandu.php new file mode 100644 index 0000000..cf52f5d --- /dev/null +++ b/admin/editbrandu.php @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/admin/index.php b/admin/index.php index d575acb..4223a5e 100644 --- a/admin/index.php +++ b/admin/index.php @@ -89,6 +89,12 @@ else if (isset($_GET['insert_product'])) { include('insert_product.php'); } + else if (isset($_GET['insert_category'])) { + include('insert_category.php'); + } + else if (isset($_GET['insert_brand'])) { + include('insert_brand.php'); + } ?> diff --git a/admin/insert_brand.php b/admin/insert_brand.php new file mode 100644 index 0000000..9d70967 --- /dev/null +++ b/admin/insert_brand.php @@ -0,0 +1,25 @@ +
+
+ + + + + + + + + + + + +
+

Add New brand

+
+ + + +
+ +
+
+
\ No newline at end of file diff --git a/admin/insert_category.php b/admin/insert_category.php new file mode 100644 index 0000000..07cc4a0 --- /dev/null +++ b/admin/insert_category.php @@ -0,0 +1,25 @@ +
+
+ + + + + + + + + + + + +
+

Add New Category

+
+ + + +
+ +
+
+
\ No newline at end of file diff --git a/admin/insertbrand.php b/admin/insertbrand.php new file mode 100644 index 0000000..32815e9 --- /dev/null +++ b/admin/insertbrand.php @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/admin/insertcat.php b/admin/insertcat.php new file mode 100644 index 0000000..4e5d224 --- /dev/null +++ b/admin/insertcat.php @@ -0,0 +1,9 @@ + \ No newline at end of file diff --git a/admin/view_brands.php b/admin/view_brands.php index dd3df9c..a719087 100644 --- a/admin/view_brands.php +++ b/admin/view_brands.php @@ -6,7 +6,15 @@ while ($row_brands= mysqli_fetch_array($run_brands)){ $brand_id = $row_brands['brand_id']; $brand_title = $row_brands['brand_title']; - echo "
  • $brand_title
  • "; + echo "
  • $brand_title
  • + + + + + + +
    "; + } ?> \ No newline at end of file From 2c99aac774c348033edfcc4cac38760951be7c8b Mon Sep 17 00:00:00 2001 From: Akhnus Date: Sun, 9 Sep 2018 23:58:28 +0500 Subject: [PATCH 5/5] 1) You can view orders 2) Delete Orders 3) Edit button is not made because admin should not have privilege to change a customer order. --- admin/deleteorder.php | 13 ++++ admin/functions/functions.php | 128 ++++++++++++++++++++++++++++++++++ admin/index.php | 7 ++ admin/insert_product.php | 3 +- admin/view_orders.php | 51 ++++++++++++++ 5 files changed, 201 insertions(+), 1 deletion(-) create mode 100644 admin/deleteorder.php create mode 100644 admin/functions/functions.php create mode 100644 admin/view_orders.php diff --git a/admin/deleteorder.php b/admin/deleteorder.php new file mode 100644 index 0000000..6f99954 --- /dev/null +++ b/admin/deleteorder.php @@ -0,0 +1,13 @@ + \ No newline at end of file diff --git a/admin/functions/functions.php b/admin/functions/functions.php new file mode 100644 index 0000000..c0e15ea --- /dev/null +++ b/admin/functions/functions.php @@ -0,0 +1,128 @@ + $cat_title "; + } +} + +//getting Brands +function getBrands(){ + global $con; + $get_brands = "select * from brands"; + $run_brands = mysqli_query($con, $get_brands); + while ($row_brands= mysqli_fetch_array($run_brands)){ + $brand_id = $row_brands['brand_id']; + $brand_title = $row_brands['brand_title']; + echo "
  • $brand_title
  • "; + } +} + +function getPro($flag = ''){ + global $con; + $get_pro = ""; + if(!isset($_GET['cat']) && !isset($_GET['brand']) && !isset($_GET['search'])) { + if($flag == 'all_products') + $get_pro = "select * from products"; + else + $get_pro = "select * from products order by RAND() limit 0,6"; + } else if(isset($_GET['cat'])){ + $pro_cat_id = $_GET['cat']; + $get_pro = "select * from products where pro_cat = '$pro_cat_id'"; + } else if(isset($_GET['brand'])){ + $pro_brand_id = $_GET['brand']; + $get_pro = "select * from products where pro_brand = '$pro_brand_id'"; + } else if(isset($_GET['search'])){ + $search_query = $_GET['user_query']; + $get_pro = "select * from products where pro_keywords like '%$search_query%'"; + } + $run_pro = mysqli_query($con,$get_pro); + $count_pro = mysqli_num_rows($run_pro); + if($count_pro==0){ + echo "

    No Product found in selected criteria

    "; + } + while($row_pro = mysqli_fetch_array($run_pro)){ + $pro_id = $row_pro['pro_id']; + $pro_cat = $row_pro['pro_cat']; + $pro_brand = $row_pro['pro_brand']; + $pro_title = $row_pro['pro_title']; + $pro_price = $row_pro['pro_price']; + $pro_image = $row_pro['pro_image']; + echo " +
    +

    $pro_title

    + +

    Rs $pro_price/-

    + Details + +
    + "; + } +} +//getting the user IP address +function getIp() { + $ip = $_SERVER['REMOTE_ADDR']; + + if (!empty($_SERVER['HTTP_CLIENT_IP'])) { + $ip = $_SERVER['HTTP_CLIENT_IP']; + } elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) { + $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; + } + return $ip; +} +//creating the shopping cart +function cart(){ + if(isset($_GET['add_cart'])){ + global $con; + $ip = getIp(); + $pro_id = $_GET['add_cart']; + $check_pro = "select * from cart where ip_add = '$ip' AND p_id='$pro_id '"; + $run_check = mysqli_query($con,$check_pro); + if(mysqli_num_rows($run_check)>0){ + echo ""; + } else { + $insert_pro = "insert into cart (p_id, ip_add) VALUES + ('$pro_id','$ip')"; + $run_pro = mysqli_query($con,$insert_pro); + if($run_pro) + header('location:'.$_SERVER['PHP_SELF']); + } + } +} +//getting the total added items. +function total_items(){ + global $con; + $ip = getIp(); + $get_items = "select * from cart where ip_add='$ip'"; + $run_items = mysqli_query($con,$get_items); + $count_items = 0; + while($row = mysqli_fetch_array($run_items)) + $count_items += $row['qty']; + echo $count_items; +} +//getting the total price of the items in the cart +function total_price(){ + global $con; + $ip = getIp(); + $total = 0; + $sel_price = "select * from cart where ip_add = '$ip'"; + $run_price = mysqli_query($con,$sel_price); + while($cart_row = mysqli_fetch_array($run_price)){ + $pro_id = $cart_row['p_id']; + $pro_qty = $cart_row['qty']; + $pro_price = "select * from products where pro_id = '$pro_id'"; + $run_pro_price = mysqli_query($con, $pro_price); + while ($pro_row = mysqli_fetch_array($run_pro_price)){ + $pro_price = $pro_row['pro_price']; + $pro_price_all_items = $pro_price * $pro_qty; + $total += $pro_price_all_items; + } + } + echo 'Rs '.$total.'/-'; +} diff --git a/admin/index.php b/admin/index.php index 4223a5e..94f7bf3 100644 --- a/admin/index.php +++ b/admin/index.php @@ -1,6 +1,9 @@ + @@ -95,6 +98,10 @@ else if (isset($_GET['insert_brand'])) { include('insert_brand.php'); } + else if(isset($_GET['view_orders'])){ + include ('view_orders.php'); + } + ?> diff --git a/admin/insert_product.php b/admin/insert_product.php index 105d5a5..8f54467 100644 --- a/admin/insert_product.php +++ b/admin/insert_product.php @@ -43,7 +43,7 @@ ?> - +l
    @@ -91,6 +91,7 @@ $pro_image = $_FILES['pro_image']['name']; $pro_image_tmp = $_FILES['pro_image']['tmp_name']; move_uploaded_file($pro_image_tmp,"product_images/$pro_image"); + $insert_product = "insert into products (pro_cat, pro_brand,pro_title,pro_price,pro_desc,pro_image,pro_keywords) VALUES ('$pro_cat','$pro_brand','$pro_title','$pro_price','$pro_desc','$pro_image','$pro_keywords');"; $insert_pro = mysqli_query($con, $insert_product); diff --git a/admin/view_orders.php b/admin/view_orders.php new file mode 100644 index 0000000..0197877 --- /dev/null +++ b/admin/view_orders.php @@ -0,0 +1,51 @@ +
    +

    Orders

    + + + + + + + + + + + + + + + + + + + + + + + +
    IpProductQuantitySingle Unit PriceTotal PriceDelete

    + +
    + +
    Sub Total:
    +
    \ No newline at end of file