From 487d1690b6999511aa37bdd049800384c434fa9b Mon Sep 17 00:00:00 2001 From: farasatali1123 Date: Thu, 6 Sep 2018 12:44:00 +0500 Subject: [PATCH 1/3] name --- admin/insert_product.php | 1 + 1 file changed, 1 insertion(+) diff --git a/admin/insert_product.php b/admin/insert_product.php index 07e1bbe..466921a 100644 --- a/admin/insert_product.php +++ b/admin/insert_product.php @@ -6,6 +6,7 @@ Inserting Product +

farast

From c08857a89a0329e1635ff73fc07471f7405e1c86 Mon Sep 17 00:00:00 2001 From: farasatali1123 Date: Thu, 6 Sep 2018 23:34:21 +0500 Subject: [PATCH 2/3] 1# In insert product file styling and colors changes using bootstrap classes. 2# quiz products and images shown in view_product 3# file and search bar and footer also added using bootstrap classes. 4# view categories table made which shows all the available categories. 5# few more changes made. 6# screen of all the changes will be attached in pull request option. Merge remote-tracking branch 'upstream/master' # Conflicts: # admin/insert_product.php --- admin/functions.php | 129 ++++++++++++++++++++++++++++++++++++++ admin/index.php | 18 ++++++ admin/insert_brand.php | 38 +++++++++++ admin/insert_category.php | 38 +++++++++++ admin/insert_product.php | 20 ++++-- admin/view_brands.php | 28 +++++---- admin/view_categories.php | 28 +++++---- admin/view_customers.php | 4 +- admin/view_products.php | 99 +++++++++++++++++++++++++++++ details.php | 2 +- 10 files changed, 373 insertions(+), 31 deletions(-) create mode 100644 admin/functions.php create mode 100644 admin/insert_brand.php create mode 100644 admin/insert_category.php create mode 100644 admin/view_products.php diff --git a/admin/functions.php b/admin/functions.php new file mode 100644 index 0000000..33c0008 --- /dev/null +++ b/admin/functions.php @@ -0,0 +1,129 @@ + $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 282da5b..c3c6504 100644 --- a/admin/index.php +++ b/admin/index.php @@ -80,6 +80,19 @@ else if(isset($_GET['view_brands'])) { include('view_brands.php'); } + else if(isset($_GET['insert_category'])) { + include('insert_category.php'); + } + else if(isset($_GET['insert_brand'])) { + include('insert_brand.php'); + } + else if(isset($_GET['view_products'])) { + include('view_products.php'); + } + else if(isset($_GET['view_orders'])) { + include('view_orders.php'); + } + ?> @@ -95,5 +108,10 @@ }); + + + + + \ No newline at end of file diff --git a/admin/insert_brand.php b/admin/insert_brand.php new file mode 100644 index 0000000..e622184 --- /dev/null +++ b/admin/insert_brand.php @@ -0,0 +1,38 @@ +

    Insert New Brand

    + + + + + +





    +





    +
    +
    +
    +
    + This is footer powered by Farasat Ali Aziz +
    +
    +
    +
    + + + + \ No newline at end of file diff --git a/admin/insert_category.php b/admin/insert_category.php new file mode 100644 index 0000000..413d45e --- /dev/null +++ b/admin/insert_category.php @@ -0,0 +1,38 @@ +

    Insert New Category

    +
    + + + + +





    +





    +
    +
    +
    +
    + This is footer powered by Farasat Ali Aziz +
    +
    +
    +
    + + + \ No newline at end of file diff --git a/admin/insert_product.php b/admin/insert_product.php index d2d6beb..f0d8e1b 100644 --- a/admin/insert_product.php +++ b/admin/insert_product.php @@ -1,8 +1,8 @@ -
    -
    -
    +
    +
    +
    -

    Insert New Product

    +

    Insert New Product

    @@ -77,6 +77,18 @@
    + +

    +
    +
    +
    +
    + This is footer powered by Farasat Ali Aziz +
    +
    +
    +
    + Brands -
      - $brand_title"; - } - ?> -
    \ No newline at end of file +
    +
    +

    Brands

    +
      + $brand_title"; + } + ?> +
    +
    +
    \ No newline at end of file diff --git a/admin/view_categories.php b/admin/view_categories.php index c326a31..af43ced 100644 --- a/admin/view_categories.php +++ b/admin/view_categories.php @@ -1,12 +1,16 @@ -

    Categories

    -
      -$cat_title"; -} -?> -
    +
    +
    +

    Catgories

    +
      + $cat_title"; + } + ?> +
    +
    +
    \ No newline at end of file diff --git a/admin/view_customers.php b/admin/view_customers.php index c96822f..5fd5fbd 100644 --- a/admin/view_customers.php +++ b/admin/view_customers.php @@ -1,5 +1,5 @@ -

    Customers

    -
    +

    Customers

    +
    diff --git a/admin/view_products.php b/admin/view_products.php new file mode 100644 index 0000000..442acb0 --- /dev/null +++ b/admin/view_products.php @@ -0,0 +1,99 @@ + + + + Ecommerce + + + + + +
    +
    + + +
    +
    +
    + + + + +
    +
    +
    +
    + + + + + Shopping Cart - + Total Items: + Total Price: + Go to Cart + + Login"; + } + else{ + echo "Logout"; + } + ?> + +
    +
    + +
    + +
    +
    + + +

    +
    +
    +
    +
    + This is footer powered by Farasat Ali Aziz +
    +
    +
    +
    + + + + + \ No newline at end of file diff --git a/details.php b/details.php index 880bef6..69da832 100644 --- a/details.php +++ b/details.php @@ -69,7 +69,7 @@ echo "

    $pro_title

    - +

    Rs $pro_price/-

    $pro_desc

    Go Back From 8684393fc138e5ddd05a6a0b55dab244b8680ed2 Mon Sep 17 00:00:00 2001 From: farasatali1123 Date: Thu, 13 Sep 2018 12:17:25 +0500 Subject: [PATCH 3/3] updating github project --- admin/index.php | 76 ++++++++++++++------ admin/insert_brand.php | 61 ++++++++-------- admin/insert_category.php | 59 ++++++++------- admin/insert_product.php | 32 ++++----- admin/login.php | 48 +++++++++++-- admin/view_brands.php | 37 ++++++++-- admin/view_categories.php | 37 ++++++++-- admin/view_customers.php | 87 ++++++++++++---------- admin/view_products.php | 148 ++++++++++++++------------------------ details.php | 2 +- 10 files changed, 335 insertions(+), 252 deletions(-) diff --git a/admin/index.php b/admin/index.php index c3c6504..b8ffd2e 100644 --- a/admin/index.php +++ b/admin/index.php @@ -1,5 +1,9 @@ @@ -33,28 +37,39 @@
  • - Insert New Category + + Insert New Category +
  • - View All Categories + + View All Categories +
  • - Insert New Brand + + Insert New Brand +
  • - View All Brands + + View All Brands
  • - View Customers + + View Customers
  • - View Orders + + View Orders
  • - View Payments + + View Payments
  • - Admin logout + + Admin logout
  • @@ -67,31 +82,51 @@
    +

    @@ -108,10 +143,5 @@ }); - - - - - \ No newline at end of file diff --git a/admin/insert_brand.php b/admin/insert_brand.php index e622184..61b3ab2 100644 --- a/admin/insert_brand.php +++ b/admin/insert_brand.php @@ -1,38 +1,37 @@ -

    Insert New Brand

    - - - - - -





    -





    -
    -
    -
    -
    - This is footer powered by Farasat Ali Aziz + +
    +
    +
    +
    +

    Insert New Brand

    -
    +
    + +
    + +
    +
    +
    +
    + +
    +
    +
    -
    - + - \ No newline at end of file +?> \ No newline at end of file diff --git a/admin/insert_category.php b/admin/insert_category.php index 413d45e..50fc5e5 100644 --- a/admin/insert_category.php +++ b/admin/insert_category.php @@ -1,38 +1,37 @@ -

    Insert New Category

    - - - - - -





    -





    -
    -
    -
    -
    - This is footer powered by Farasat Ali Aziz + +
    +
    +
    +
    +

    Insert New Category

    -
    +
    + +
    + +
    +
    +
    +
    + +
    +
    +
    -
    - + - \ No newline at end of file +?> \ No newline at end of file diff --git a/admin/insert_product.php b/admin/insert_product.php index f0d8e1b..5dce0d5 100644 --- a/admin/insert_product.php +++ b/admin/insert_product.php @@ -1,20 +1,26 @@ -
    -
    -
    + +
    +
    +
    -

    Insert New Product

    +

    Insert New Product

    - +
    +
    @@ -77,18 +83,6 @@
    - -

    -
    -
    -
    -
    - This is footer powered by Farasat Ali Aziz -
    -
    -
    -
    - @@ -11,13 +37,25 @@ Admin Login - + +

    +

    Admin Login

    - - - +
    + +
    +
    + + +
    + - \ No newline at end of file + + + + diff --git a/admin/view_brands.php b/admin/view_brands.php index 088da15..b760ebe 100644 --- a/admin/view_brands.php +++ b/admin/view_brands.php @@ -1,16 +1,43 @@ +
    -
    -

    Brands

    -
      +
      +

      Brands

      +
    + + + + + + + + $brand_title"; + ?> + + + + + + - + +
    #NameActions
    + Edit + + + Delete + +
    \ No newline at end of file diff --git a/admin/view_categories.php b/admin/view_categories.php index af43ced..1c8625e 100644 --- a/admin/view_categories.php +++ b/admin/view_categories.php @@ -1,16 +1,43 @@ +
    -
    -

    Catgories

    -
    \ No newline at end of file diff --git a/admin/view_customers.php b/admin/view_customers.php index 5fd5fbd..7287a3c 100644 --- a/admin/view_customers.php +++ b/admin/view_customers.php @@ -1,41 +1,52 @@ -

    Customers

    - -
    -
    + +
    +
    +

    Customers

    +
    + - - - - - - - + + + + + - - - - - - - - - - - "; - } - ?> - + + + No Customer found "; + } + else { + $i = 0; + while ($row_cust = mysqli_fetch_array($run_cust)) { + $cust_id = $row_cust['cust_id']; + $cust_name = $row_cust['cust_name']; + $cust_email = $row_cust['cust_email']; + $cust_image = $row_cust['cust_image']; + ?> + + + + + + + + + +
    NameEmailCountryCityContactAddressImage#NameEmailImageActions
    $cust_name$cust_email$cust_country$cust_city$cust_contact$cust_address
    + Delete + +
    - \ No newline at end of file + \ No newline at end of file diff --git a/admin/view_products.php b/admin/view_products.php index 442acb0..2e57b8c 100644 --- a/admin/view_products.php +++ b/admin/view_products.php @@ -1,99 +1,57 @@ - - - - Ecommerce - - - - - -
    -
    - - -
    -
    -
    - -
    -
    -
    -
    - - - - - Shopping Cart - - Total Items: - Total Price: - Go to Cart - - Login"; - } - else{ - echo "Logout"; - } - ?> - -
    -
    - -
    - -
    -
    - - -

    -
    -
    -
    -
    - This is footer powered by Farasat Ali Aziz -
    -
    -
    -
    - - - - - \ No newline at end of file + \ No newline at end of file diff --git a/details.php b/details.php index 69da832..880bef6 100644 --- a/details.php +++ b/details.php @@ -69,7 +69,7 @@ echo "

    $pro_title

    - +

    Rs $pro_price/-

    $pro_desc

    Go Back