From ef74a4e581153259186c3911194a7c224d35285e Mon Sep 17 00:00:00 2001 From: Khalid Sadat Date: Thu, 31 Mar 2022 22:00:05 -0400 Subject: [PATCH] Some minor changes in the link design: #133 --- app/controllers/BabyRegistryController.php | 8 +- app/controllers/ShopController.php | 2 +- app/views/baby_registry/add_products.php | 413 +++++++++++++++++++++ 3 files changed, 420 insertions(+), 3 deletions(-) create mode 100644 app/views/baby_registry/add_products.php diff --git a/app/controllers/BabyRegistryController.php b/app/controllers/BabyRegistryController.php index ce60220..a44909d 100644 --- a/app/controllers/BabyRegistryController.php +++ b/app/controllers/BabyRegistryController.php @@ -15,7 +15,7 @@ private function crypto_rand_secure($min, $max) { return $min + $rnd; } - private function getToken($length=12){ + private function get_token($length=12){ $token = ""; $codeAlphabet = "ABCDEFGHIJKLMNOPQRSTUVWXYZ"; $codeAlphabet.= "0123456789"; @@ -33,7 +33,7 @@ public function generate() { // check the baby registry token; if the baby reg id exists, return the existing token; otherwise, create a new one and return that $baby_reg_token = $this->model('BabyRegistryToken')->findByBabyRegistryId($baby_reg_id); if($baby_reg_token == false) { - $new_token = $this->getToken(37); + $new_token = $this->get_token(37); // make a new baby reg token $baby_reg_token = $this->model('BabyRegistryToken'); @@ -67,6 +67,10 @@ public function add() { $this->view('BASE_STRUCTURES/empty_view'); } + public function add_products($token) { + + } + } \ No newline at end of file diff --git a/app/controllers/ShopController.php b/app/controllers/ShopController.php index 72ec516..167dc99 100644 --- a/app/controllers/ShopController.php +++ b/app/controllers/ShopController.php @@ -6,7 +6,7 @@ class ShopController extends Controller{ private function redirect_to($destination) { if (headers_sent($filename, $line)) { trigger_error("Headers already sent in {$filename} on line {$line}", E_USER_ERROR); - } + } header("Location: {$destination}"); exit; } diff --git a/app/views/baby_registry/add_products.php b/app/views/baby_registry/add_products.php new file mode 100644 index 0000000..c6af28b --- /dev/null +++ b/app/views/baby_registry/add_products.php @@ -0,0 +1,413 @@ +view('include/header'); + + $products = $model['products']; + $products_count = count($products); +?> +Browse Products +
+ +
+
+
+ + + 0 +
$0.00
+
+
+ +
+ + + + + + + + + + + + +
+
+
+
+
+
+ + + +
+
+
+ +
+
+
+
    + category_name; + $category_name_lower = strtolower($category_name); + + // if url_category matches the category in the list, highlight it + if($url_category == $category_name_lower) { + echo " +
  • $category_name
  • + "; + } + else { + echo " +
  • $category_name
  • + "; + } + } + ?> + +
+
+
+
+
+
+
+
+ Branding +
+
+
+
+
    + + brand_name; + $brand_id = $brand->brand_id; + + // if url_category matches the category in the list, highlight it + if($url_brand == $brand_id) { + echo " +
  • $brand_name
  • + "; + } + else { + echo " +
  • $brand_name
  • + "; + } + } + ?> + +
+
+
+
+
+
+ +
+
+
+ Size +
+
+
+
+ + $size + "; + } + else { + echo " +
  • $size
  • + "; + } + } + + ?> + +
    +
    +
    +
    +
    +
    + Colors +
    +
    +
    +
    + + + "; + } + else { + echo " +
  • + "; + } + } + + ?> + + + +
    +
    +
    +
    +
    +
    + Tags +
    +
    +
    +
    + + $keyword + "; + } + else { + echo " + $keyword + "; + } + + } + + ?> + + + +
    +
    +
    +
    +
    +
    + + +
    +
    +
    +
    +
    +
    +
    +
    +

    Showing products

    + + $msg +
    + "; + + unset($_SESSION['login_flag']); + } + + if(isset($_SESSION['wishlist_added'])) { + $msg = 'Product added to wishlist successfully.'; + + echo " +
    + $msg +
    + "; + + unset($_SESSION['wishlist_added']); + } + ?> + +
    +
    + +
    +
    +
    + + 0) { + foreach($products as $product) + { + $product_id = $product->product_id; + $name = $product->name; + $price = $product->price; + + $colors_serialized = unserialize($product->colors); + $colors_array = array_filter($colors_serialized); + + $size_serialized = unserialize($product->size); + $size_array = array_filter($size_serialized); + + $image = $product->images; + $images_name = explode(',', $image); + $image_name = $images_name[0]; + + echo " +
    +
    + "; + ?> +
    + +
      +
    • +
    +
    +
    + +
    +
    $name
    + +
    $$price
    + +
    + "; + $radio_color_counter = 1; + foreach($colors_array as $color) { + echo " + + "; + $radio_color_counter++; + } + echo" +
    + +
    + +
    +
    + "; + + } + } + else { + ?> +
    +
    +

    No product found!


    + +
    + +
    + + +
    +
    + + +
    + + +view('include/footer'); +?> \ No newline at end of file