Example #1
0
<?php 
include ROOT_PATH . "inc/navigation.php";
?>

    <div class="container">
        <div class="starter-template">
            <h1>Our Products <?php 
echo $_GET['category'];
?>
</h1>
            <div class="row">

                <?php 
//   $products = get_all_products();
if (isset($_GET['category'])) {
    $products = get_products_by_category($_GET['category']);
} else {
    if (isset($_GET['all']) && $_GET['all'] == 1) {
        $products = get_all_products();
    } else {
        $products = get_latest_products();
    }
}
foreach ($products as $product) {
    ?>
                <div class="col-lg-4">
                    <img class="img-rounded"
                         src="images/<?php 
    echo $product['image'];
    ?>
"
Example #2
0
require '../model/category_db.php';
$action = filter_input(INPUT_POST, 'action');
if ($action == NULL) {
    $action = filter_input(INPUT_GET, 'action');
    if ($action == NULL) {
        $action = 'list_products';
    }
}
if ($action == 'list_products') {
    $category_id = filter_input(INPUT_GET, 'category_id', FILTER_VALIDATE_INT);
    if ($category_id == NULL || $category_id == FALSE) {
        $category_id = 1;
    }
    $categories = get_categories();
    $category_name = get_category_name($category_id);
    $products = get_products_by_category($category_id);
    include 'product_list.php';
} else {
    if ($action == 'view_product') {
        $product_id = filter_input(INPUT_GET, 'product_id', FILTER_VALIDATE_INT);
        if ($product_id == NULL || $product_id == FALSE) {
            $error = 'Missing or incorrect product id.';
            include '../errors/error.php';
        } else {
            $categories = get_categories();
            $product = get_product($product_id);
            // Get product data
            $code = $product['productCode'];
            $name = $product['productName'];
            $list_price = $product['listPrice'];
            // Calculate discounts
Example #3
0
<?php

include 'model.php';
include 'functions.php';
echo embed('tpl/home.tpl.php', array('header' => embed('tpl/header.tpl.php', array()), 'sidebar_first' => embed('tpl/category.tpl.php', array('result' => get_category())), 'body' => embed('tpl/productsbycategory.tpl.php', array('result' => get_products_by_category($_GET['id']))), 'sidebar_second' => embed('tpl/top_last_added.tpl.php', array('result' => last_added()))));