Пример #1
0
<?php

// Includng configuration file
include 'config/config.php';
//Check user is already login or not
checkAuthentication();
$id = $_SESSION['adminid'];
$product = new product();
$order = new order();
$cashmemo = new cashmemo();
if (isset($_GET['action']) && $_GET['action'] == 'suggestprod') {
    $keyword = $_GET['keyword'];
    $elementid = $_GET['id'];
    $string = '';
    $autosuggpro = $product->getSearchProducts($keyword);
    if (is_array($autosuggpro)) {
        $string .= '<ul>';
        foreach ($autosuggpro as $val) {
            $string .= '<li onClick="fillname(\'' . addslashes($val['name']) . '\',\'' . $elementid . '\');fillcode(\'' . addslashes($val['sku']) . '\',\'' . $elementid . '\');fillprice(\'' . addslashes($val['price']) . '\',\'' . $elementid . '\');" >' . $val['name'] . '</li>';
        }
        $string .= '</ul>';
    } else {
        $string .= '<li>No Record found</li></ul>';
    }
    echo $string;
    exit;
} elseif (isset($_GET['action']) && $_GET['action'] == 'suggestchalan') {
    $keyword = $_GET['chalan_no'];
    $string = '';
    $autosuggpro = $order->getChalanOrders($keyword);
    if (is_array($autosuggpro)) {
Пример #2
0
    }
    if ($product->updateProduct($data)) {
        $_SESSION['message'] = 'Product has been updated successfully.';
        header('Location: ' . FRONTEND . 'inventory.php');
        exit;
    }
} elseif (isset($_GET['action']) && $_GET['action'] == 'delete') {
    $id = $_GET['id'];
    if ($product->deleteProduct($id)) {
        $_SESSION['message'] = 'Product has been deleted successfully.';
        header('Location: ' . FRONTEND . 'inventory.php');
        exit;
    }
} elseif (isset($_GET['action']) && $_GET['action'] == 'search') {
    $keyword = $_POST['keywords'];
    $products = $product->getSearchProducts($keyword);
    $smarty->assign('productcount', count($products));
    $smarty->assign('products', $products);
    $smarty->assign('content', $smarty->fetch('product.tpl'));
} else {
    $page = 1;
    if (isset($_GET['page'])) {
        $page = $_GET['page'];
    }
    $products = $product->getProducts($page, $offset = 10);
    $smarty->assign('productcount', $product->getProductsCount());
    $smarty->assign('page', $page);
    $smarty->assign('products', $products);
    $smarty->assign('pagecount', ceil($product->getProductsCount() / 10));
    $smarty->assign('content', $smarty->fetch('product.tpl'));
}