Esempio n. 1
0
function getProducts($u, $cat)
{
    global $o;
    $d = new simple_html_dom();
    $d->load(scraperwiki::scrape($u));
    //echo "Loaded URL: " . $u . "\n";
    $items = $d->find('li.grid-item');
    if (count($items) > 0) {
        foreach ($items as $p) {
            $prod = $p->find('p.product-name > a', 0);
            $prodname = trim($prod->innertext);
            $prodURL = $prod->href;
            if (!is_null($p->find('p.minimal-price', 0))) {
                $prodtype = 1;
            } else {
                $prodtype = 0;
            }
            fputcsv($o, array($prodname, $prodtype, $cat, $prodURL));
            echo $prodname . "\n";
        }
        if (!is_null($d->find('p.next', 0))) {
            getProducts($d->find('p.next', 0)->href, $cat);
        }
    }
}
function settlement()
{
    global $gPrices;
    $products = getProducts();
    $deals = getDeals();
    $mysqli = getMysqli();
    $mysqli->autocommit(false);
    // 开始事务
    // 插入操作
    foreach ($deals as $value) {
        $productId = $value['productId'];
        //$deal->getProductId();
        $product = $products[$productId];
        $contract = $product->getContract();
        // 合同名
        $breakeven = $product->getBreakeven();
        // 产品盈亏金额
        $weight = $product->getWeight();
        // 产品重量
        $price = $product->getPrice();
        // 产品价格
        $orderId = $value['orderId'];
        // 交易编号
        $wid = $value['wid'];
        // 微信号	$deal->getWid();
        $deposit = $value['rmoney'];
        // 保证金	$deal->getDeposit();
        $buy = $value['buyprice'];
        // 进仓价   $deal->getBuy();
        $sell = $value['sellprice'];
        // 平仓价 	$deal->getSell();
        $amount = $value['sl'];
        // 数量		$deal->getAmount();
        $type = $value['type'];
        // 买卖类型 1:跌,2:涨	$deal->getType();
        $profit = $value['zhuanqu'];
        // 收益		$deal->getProfit();
        $time = $value['addtime'];
        // 买入时间	$deal->getDate();
        if ($sell == 0) {
            $sell = $gPrices[$contract];
            // 按产品名取报价,设为平仓价
            if ($type == 1) {
                // 买跌:(进仓价-平仓价或11点的价格)* 手数 * 盈亏金额
                $profit = ($buy - $sell) * $amount * $breakeven;
            } else {
                // 买涨:(平仓价或11点的价格-进仓价)* 手数 * 盈亏金额
                $profit = ($sell - $buy) * $amount * $breakeven;
            }
        }
        $sql = "INSERT INTO settlement (orderId, wid, deposit, buyprice, sellprice, profit, type, amount, addtime, pId, pBreakeven, pWeight, pPrice, pContract) \r\n\t\t\tVALUES('{$orderId}', '{$wid}', '{$deposit}', '{$buy}', '{$sell}', '{$profit}', '{$type}', '{$amount}', '{$time}', '{$productId}', '{$breakeven}', '{$weight}', '{$price}', '{$contract}')";
        $mysqli->query($sql);
    }
    if (!$mysqli->errno) {
        $mysqli->commit();
    } else {
        $mysqli->rollback();
    }
    mysqli_close($mysqli);
}
Esempio n. 3
0
function controller_products_index()
{
    $id = @$_GET["id"];
    switch (@$_GET["action"]) {
        case "delete":
            $strSQL = "DELETE FROM products WHERE id={$id}";
            mysqli_query(connect(), $strSQL);
            header("Location:http://localhost/companies/index.php?page=products");
            close_bd();
            break;
        case "edit":
            setcookie("editProduct", 1, time() + 3600 * 24 * 30 * 12, "/");
            header("Location:http://localhost/companies/index.php?page=products&id={$id}");
            break;
        case "insert":
            setcookie("insertProduct", 1, time() + 3600 * 24 * 30 * 12, "/");
            break;
    }
    $data = getProducts();
    ////////////////////////
    if ($_COOKIE["otherCompanyID"] == 0) {
        view_products($data);
    } else {
        view_my_products($data);
    }
}
Esempio n. 4
0
 public function init()
 {
     parent::init();
     if (Module::isEnabled('aimultidimensions')) {
         if (Tools::getIsset('add') && $this->context->cart->id) {
             require_once _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'aimultidimensions' . DIRECTORY_SEPARATOR . 'aimultidimensions.php';
             require_once _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'aimultidimensions' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'config.php';
             require_once _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . 'modules' . DIRECTORY_SEPARATOR . 'aimultidimensions' . DIRECTORY_SEPARATOR . 'includes' . DIRECTORY_SEPARATOR . 'functions' . $GLOBALS['aimd_config_suffix'] . '.php';
             $add = 1;
             $idProduct = (int) Tools::getValue('id_product', NULL);
             if (checkLink($idProduct)) {
                 $idProductAttribute = (int) Tools::getValue('id_product_attribute', Tools::getValue('ipa'));
                 $customizationId = (int) Tools::getValue('id_customization', 0);
                 $qty = (int) abs(Tools::getValue('qty', 1));
                 if ($add && $qty >= 0 && getProducts($idProduct)) {
                     $quantity = (int) Db::getInstance()->getValue('SELECT quantity FROM ' . _DB_PREFIX_ . 'cart_product WHERE id_cart = ' . $this->context->cart->id . ' AND id_product = ' . $idProduct . ' AND ' . 'id_product_attribute = ' . $idProductAttribute);
                     if (Tools::getValue('op', 'up') == 'up') {
                         $quantity += (int) $qty;
                     } else {
                         $quantity -= (int) $qty;
                     }
                     $cookie = $this->context->cookie;
                     $cart = $this->context->cart;
                     include_once 'modules/aimultidimensions/includes/cart.php';
                     Product::flushPriceCache();
                 }
             }
         }
     }
 }
Esempio n. 5
0
function compareView()
{
    echo '<table id="compareTable">';
    getHeaders();
    getProducts();
    echo '</table>';
}
Esempio n. 6
0
function getProducts(&$categories)
{
    foreach ($categories as &$cat) {
        $cat['products'] = ocshop::products($cat['id'], false);
        foreach ($cat['products'] as &$product) {
            $product['active'] = $product['product_id'] == ocshop::$pid;
        }
        getProducts($cat['children']);
    }
}
Esempio n. 7
0
function writeProductCatalogAsJSON()
{
    $json = Zend_Json::encode(getProducts());
    $dest = JSONExportPath;
    logger("writing: " . $dest);
    logger("json:" . $json);
    $fp = fopen($dest, "w");
    fwrite($fp, $json);
    fclose($fp);
}
Esempio n. 8
0
function productsLoaded()
{
    $redo = filter_input(INPUT_POST, "instr");
    if (isset($_SESSION['p_init'])) {
        if ($_SESSION['p_init'] === false || !isset($GLOBALS['cat_array'])) {
            getProducts();
            return;
        }
    } elseif ($redo === "redo" || !isset($GLOBALS['csv_loc'])) {
        getProducts();
        return;
    } else {
        parseProducts();
    }
    echo "Import Complete";
}
Esempio n. 9
0
function getProducts($u)
{
    global $baseurl, $o, $local;
    $path = "";
    $d = new simple_html_dom();
    $d->load(scraperwiki::scrape($u));
    //echo "Loaded URL: " . $u . "\n";
    $S2Prod = $d->find('span[class=S2Product]');
    if (count($S2Prod) > 0) {
        foreach ($S2Prod as $p) {
            $sku = trim($p->find('div[class=S2ProductSku]', 0)->innertext, "# ");
            $prodname = trim($p->find('div[class=S2ProductName]', 0)->first_child()->innertext);
            $prodthumb = $p->find('img[class=S2ProductImg]', 0)->src;
            $prodURL = $p->find('div[class=S2ProductName]', 0)->first_child()->href;
            fputcsv($o, array($sku, $prodname, $prodthumb, $prodURL));
            echo $prodname . "\n";
        }
        if ($d->find('div[class=S2itemsPPText]', 0)->last_child()->style == "display: inline") {
            $newURL = $baseurl . $d->find('div[class=S2itemsPPText]', 0)->last_child()->href;
            getProducts($newURL);
        }
    }
}
Esempio n. 10
0
function getProducts($url, $path)
{
    global $p, $c, $baseurl;
    $c->load(scraperwiki::scrape($baseurl . $url));
    echo "Looking for products in " . $path . "\n";
    $prods = $c->find('div.product2014item');
    if (count($prods) == 0) {
        echo "No products found at " . $url . "\n";
    } else {
        foreach ($prods as $prod) {
            if (strpos($prod->class, "product2014cattab") === FALSE) {
                if (!is_null($prod->find('a', 0))) {
                    $prodname = $prod->find('a.product_link > div', 0)->innertext;
                    $produrl = $prod->find('a', 0)->href;
                    fputcsv($p, array($prodname, $path, $produrl));
                    echo "Saved product: " . $prodname . "\n";
                }
            }
        }
        if (!is_null($c->find('div.pagnbtn', 0))) {
            getProducts($c->find('div.pagnbtn > a', 0)->href, $path);
        }
    }
}
 /**
  *
  * @AJAX Action - Returns JSON encoded string of all ACodes in a certain category
  *
  **/
 $app->get('/products/:catID', function ($catID) use($app) {
     $ACodes = getACodesByCategory($catID);
     echo json_encode($ACodes);
 });
 /**
  *
  * @AJAX Action - Returns JSON encoded string of all products under a certain ACode
  *
  **/
 $app->get('/products/:catID/:ACode', function ($catID, $ACode) use($app) {
     $products = getProducts($ACode);
     echo json_encode($products);
 });
 $app->post('/upload/', function () use($app) {
     $fileName = $_FILES["file1"]["name"];
     // The file name
     $fileTmpLoc = $_FILES["file1"]["tmp_name"];
     // File in the PHP tmp folder
     $fileType = $_FILES["file1"]["type"];
     // The type of file it is
     $fileSize = $_FILES["file1"]["size"];
     // File size in bytes
     $fileErrorMsg = $_FILES["file1"]["error"];
     // 0 for false... and 1 for true
     if (!$fileTmpLoc) {
         // if file not chosen
Esempio n. 12
0
 public function main()
 {
     $category_title = 'Каталог';
     $category_id = Catalog::getIdByPath($_REQUEST['category_path']);
     // парсим id каталога
     if ($category_id != 0) {
         $this->data['category'] = getCategory($category_id);
     } else {
         $this->data['category'] = false;
     }
     if (isset($this->data['category']['parent']) and $this->data['category']['parent']) {
         $this->data['category_parent'] = getCategory($this->data['category']['parent']);
     }
     $this->data['category-no-image'] = 'http://placehold.it/150x100';
     // картинка-заглушка
     $this->data['categories'] = getCategories($category_id);
     // берем все подразделы с текущим родителем
     // TODO: 1 для корня отображаем все корневые каталоги и, если есть, товары
     // TODO: 2 а можно слева корневые каталоги, а на страничке топ товаров
     $this->data['products'] = getProducts($category_id);
     // берем все товары с текущим родителем
     $this->render('templates/catalog-main.phtml', $category_title);
 }
Esempio n. 13
0
$mData = json_decode($_GET["data"]);
$opt = array(PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION, PDO::ATTR_DEFAULT_FETCH_MODE => PDO::FETCH_ASSOC);
switch ($mData->module) {
    case 'inward':
        # code...
        inwardOperations($mData->operation, $mData);
        break;
    case 'outward':
        # code...
        outwardOperations($mData->operation, $mData);
        break;
    case 'inventorySearch':
        getInventory($mData->searchBy, $mData->searchKeyword);
        break;
    case 'getProducts':
        getProducts();
        break;
    case 'getProductsForOutward':
        getProductsForOutward();
        break;
    case 'getProductsForInward':
        getProductsForInward();
        break;
    case 'getSuppliers':
        getSuppliers();
        break;
    case 'getCriticalStock':
        $result = InventoryUtils::getCriticalStock();
        echo getReturnStatus("Successful", $result);
        break;
    case 'getHistory':
Esempio n. 14
0
<?php

if (isset($_REQUEST['action'])) {
    $user_longitude = $_REQUEST['user_longitude'];
    $user_latitude = $_REQUEST['user_latitude'];
    $destination_longitude = $_REQUEST['destination_longitude'];
    $destination_latitude = $_REQUEST['destination_latitude'];
    $product_id = $_REQUEST['product_id'];
    $search_term = $_REQUEST['query'];
    $venue_id = $_REQUEST['venue_id'];
    $radius = $_REQUEST['radius'];
    $max_price = $_REQUEST['max_price'];
    switch ($_REQUEST['action']) {
        case 'get_products':
            if ($user_longitude && $user_latitude) {
                getProducts($user_longitude, $user_latitude);
            }
            break;
        case 'get_prices':
            // echo 'start_long' . $user_longitude .'<br/>';
            // echo 'start_lat' . $user_latitude .'<br/>';
            // echo 'dest_long' . $destination_longitude . '<br/>';
            // echo 'dest_lat' . $destination_latitude . '<br/>';
            $price_to_venue = getPrices($user_longitude, $user_latitude, $destination_longitude, $destination_latitude);
            print_r(json_encode($price_to_venue));
            break;
        case 'get_times':
            getTimes($user_longitude, $user_latitude, $product_id);
            break;
        case 'search_foursquare':
            if ($venue_id) {
Esempio n. 15
0



$page=1;//Default page
$limit=20;//Records per page
$start=0;//starts displaying records from 0
if(isset($_GET['page']) && $_GET['page']!=''){
	$page=$_GET['page'];
}
	$start=($page-1)*$limit;
if($_GET['limite']){
    $limit = $_GET['limite'];
} 

$Products = getProducts($_REQUEST['sort'],$start,$limit);
$rows= count(ProductsCount());
$super_category  = getSuperCat();
$active_category = getCategoryActive();
$categoryLoad = CategoryLoad($_GET['superc_id']);
$subcategoryLoad = SubCategoryLoad($_GET['superc_id'],$_GET['cat_id']);
//print_r($subcategoryLoad);
if ($_GET['delete_id']) {

    $delete_id = $_GET['delete_id'];
    $sql = "DELETE FROM sohorepro_products WHERE id = " . $delete_id . " ";

    $sql_result = mysql_query($sql);
    if ($sql_result) {
        $result = "success";
    } else {
Esempio n. 16
0
<a href="index.php?controller=product&action=new">
    Thêm sản phẩm mới
</a>

<table class="my-table">
<tr><th>STT</th><th>Minh họa</th><th>Tên</th><th>Giá</th>
<th>Lượt xem</th>
<th>Người tạo</th>
<th>Xem </th>
<th>Chỉnh sửa</th>
<th>Xóa</th>
</tr>

<?php 
$products = getProducts();
while ($p = mysql_fetch_array($products)) {
    echo "<tr><td>{$p['id']}</td>";
    echo "<td><img src='{$p['img']}' width=50 height = 50 /></td>";
    echo "<td class ='align-left'>{$p['name']}</td>";
    echo "<td>{$p['price']}</td>";
    echo "<td>{$p['view']}</td>";
    $u = getUserById($p['user_id']);
    echo "<td>{$u['fullname']}</td>";
    echo "<td><a href='index.php?controller=product" . "&action=view&id={$p['id']}'>Xem</a></td>";
    echo "<td><a href='index.php?controller=product" . "&action=edit&id={$p['id']}'>Sửa</a></td>";
    echo "<td><a href='index.php?controller=product" . "&action=delete&id={$p['id']}'>Xóa</a></td></tr>";
}
?>
</table>
<?php 
Esempio n. 17
0
<?php

require_once 'functions.php';
session_start();
checkSession();
$action = isset($_GET['action']) != null ? $_GET['action'] : "home";
switch ($action) {
    case "home":
        $pageTitle = "AlgimStore - Home Page";
        require_once 'header.php';
        // Home needs list of items
        $keyword = isset($_GET['keyword']) != null ? $_GET['keyword'] : "";
        $brand = isset($_GET['brand']) != null && $_GET['brand'] != -1 ? $_GET['brand'] : null;
        $make = isset($_GET['make']) != null && $_GET['make'] != -1 ? $_GET['make'] : null;
        //$keyword="",$brand=null,$make=null
        $items = getProducts($keyword, $brand, $make);
        require_once 'home.php';
        require_once 'footer.php';
        break;
    case "login":
        $pageTitle = "AlgimStore - Login";
        if (isset($_POST['Email'])) {
            $mysqli = new mysqli("localhost", "root", "killian", "store");
            if ($mysqli->connect_errno) {
                echo "Failed to connect to MySQL: (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
            }
            $query = mysqli_query($mysqli, "SELECT ID FROM User WHERE Email='" . $_POST['Email'] . "' AND Password='******'Password'] . "' ");
            if (mysqli_num_rows($query) > 0) {
                $_SESSION["user"] = mysqli_fetch_assoc($query)['ID'];
                $query = mysqli_query($mysqli, "SELECT ID FROM Sessions WHERE UserID=" . $_SESSION["user"]);
                $_SESSION["sessionID"] = mysqli_fetch_assoc($query)['ID'];
Esempio n. 18
0
<section class="site_body">
<?php 
$products = getProducts($data_product);
$token_needed = "";
if ($products) {
    foreach ($products as $product) {
        $auctiontime = strtotime($product['dateend']) - time();
        $token_needed = $product["bids"];
        include 'models/token_function.php';
        ?>
			<script>
			var poll<?php 
        echo $product['product_id'];
        ?>
 = function () {
				$.ajax({
					type: 'POST',
					url: "controller/timer.php",
					data : {
						id : <?php 
        echo $product['product_id'];
        ?>
					}
				}).done(function (data) {
					$("#bid_timer_<?php 
        echo $product['product_id'];
        ?>
").text(data);
					setTimeout(poll<?php 
        echo $product['product_id'];
        ?>
Esempio n. 19
0
 /**
  * \brief	Get the informations of the linked products tab
  * \retval 	string : HTML to display
  */
 private function _getProductsTabHtml()
 {
     global $cookie;
     //	Get the linked products
     $products = getProducts();
     if (count($products)) {
         $return = '<div style="padding-top:2px;">' . '<div style="float: left; font-weight: bold; text-align: center; width: 25%;">' . $this->l('Product') . '</div>' . '<div style="float: left; font-weight: bold; text-align: center; width: 10%;">' . $this->l('Type') . '</div>' . '<div style="float: left; font-weight: bold; text-align: center; width: 20%;">' . $this->l('Attributes used') . '</div>' . '<div style="float: left; font-weight: bold; text-align: center; width: 15%;">' . $this->l('Global surface reduction') . '</div>' . '<div style="float: left; font-weight: bold; text-align: center; width: 12%;">' . $this->l('Minimum charged surface') . '</div>' . '<div style="float: left; font-weight: bold; text-align: center; width: 8%;">' . $this->l('Delivery') . '</div>' . '<div style="float: left; font-weight: bold; text-align: center; width: 10%;">' . $this->l('Delete link') . '</div>';
         //	For each product
         $active = '';
         $active_name = '';
         foreach ($products as $product) {
             if ($active != $product['id_product']) {
                 if ($active != '') {
                     $return .= '<div style="float: left; margin-top: 5px; width: 100%;">' . '<div style="float: left; text-align: left; width: 25%;"><img title="' . $this->l('Edit') . '" class="product_update" id="product_update_' . $active . '" style="cursor: pointer;" ' . 'src="../modules/aimultidimensions/img/edit.png" alt="' . $this->l('Edit') . '" /> ' . $active_name . '</div>' . '<div style="float: left; text-align: center; width: 10%;">' . $GLOBALS['config_format'][$product['aimd_format']]['format'] . '</div>' . '<div style="float: left; text-align: center; width: 20%;">' . implode(', ', $product_attributes) . ' ' . $grid . '</div>';
                     //	Global surface reduction
                     $gsr = Db::getInstance()->ExecuteS('SELECT aimd_gsr FROM ' . _DB_PREFIX_ . 'product WHERE id_product = ' . $active);
                     if (intval($gsr[0]['aimd_gsr'])) {
                         $return .= '<div style="float: left; text-align: center; width: 15%;">' . $this->l('Yes') . '</div>';
                     } else {
                         $return .= '<div style="float: left; text-align: center; width: 15%;">' . $this->l('No') . '</div>';
                     }
                     //	Minimum charged surface
                     $minimum_surface = Db::getInstance()->getValue('SELECT aimd_msc FROM ' . _DB_PREFIX_ . 'product WHERE id_product = ' . $active);
                     $return .= '<div style="float: left; text-align: center; width: 12%;">' . $minimum_surface . '</div>';
                     //	Get delivery datas
                     $delivery = (int) Db::getInstance()->getValue('SELECT ad_delivery FROM ' . _DB_PREFIX_ . 'aimultidimensions_delivery WHERE ad_product = ' . $active);
                     $return .= '<div style="float: left; text-align: center; width: 8%;">' . $delivery . ' ' . $this->l('Day(s)') . '</div>';
                     $return .= '<div style="float: left; text-align: center; width: 10%;">' . '<input type="checkbox" name="aimd_delete[' . $active . ']" value="1" />' . '</div>' . '</div>';
                 }
                 //	Next product
                 $product_attributes = array();
                 $active = $product['id_product'];
                 $active_name = $product['name'];
                 //	Get grid
                 $grid = $this->_getGrid($active);
             }
             $product_attributes[] = $product['group_name'];
         }
         //	Last product
         $return .= '<div style="float: left; margin-top: 5px; width: 100%;">' . '<div style="float: left; text-align: left; width: 25%;"><img title="' . $this->l('Edit') . '" class="product_update" id="product_update_' . $active . '" style="cursor: pointer;" ' . 'src="../modules/aimultidimensions/img/edit.png" alt="' . $this->l('Edit') . '" /> ' . $active_name . '</div>' . '<div style="float: left; text-align: center; width: 10%;">' . $GLOBALS['config_format'][$product['aimd_format']]['format'] . '</div>' . '<div style="float: left; text-align: center; width: 20%;">' . implode(', ', $product_attributes) . ' ' . $grid . '</div>';
         //	Global surface reduction
         $gsr = Db::getInstance()->ExecuteS('SELECT aimd_gsr FROM ' . _DB_PREFIX_ . 'product WHERE id_product = ' . $active);
         if (intval($gsr[0]['aimd_gsr'])) {
             $return .= '<div style="float: left; text-align: center; width: 15%;">' . $this->l('Yes') . '</div>';
         } else {
             $return .= '<div style="float: left; text-align: center; width: 15%;">' . $this->l('No') . '</div>';
         }
         //	Minimum charged surface
         $minimum_surface = Db::getInstance()->getValue('SELECT aimd_msc FROM ' . _DB_PREFIX_ . 'product WHERE id_product = ' . $active);
         $return .= '<div style="float: left; text-align: center; width: 12%;">' . $minimum_surface . '</div>';
         //	Get delivery datas
         $delivery = (int) Db::getInstance()->getValue('SELECT ad_delivery FROM ' . _DB_PREFIX_ . 'aimultidimensions_delivery WHERE ad_product = ' . $active);
         $return .= '<div style="float: left; text-align: center; width: 8%;">' . $delivery . ' ' . $this->l('Day(s)') . '</div>';
         $return .= '<div style="float: left; text-align: center; width: 10%;">' . '<input type="checkbox" name="aimd_delete[' . $active . ']" value="1" />' . '</div>' . '</div>' . '</div>';
         //	Script to update products
         $return .= '<script type="text/javascript">' . '$(document).ready( function() {' . '$(\'img.product_update\').click( function() {' . 'var id = $(this).attr(\'id\').replace(\'product_update_\', \'\');' . '$(\'input#update_product_id\').val(id);' . '$(\'form#aimd_form\').submit();' . '});' . '});' . '</script>';
         //	Delete button
         $return .= '<div class="clear">&nbsp;</div>' . '<p style="text-align: center;"><input class="button" type="submit" name="submitDeleteProduct" value="' . $this->l('Delete the selected links') . '" /></p>';
     } else {
         $return = '<div style="margin-top: 20px; text-align: center; width: 100%;">' . $this->l('No links defined') . '</div>';
     }
     return $return;
 }
Esempio n. 20
0
function printProducts()
{
    setlocale(LC_MONETARY, 'id-ID');
    $products = getProducts();
    $result = '<table class="table table-hover">
							<tr>
								<th>No.</th>
								<th>&nbsp;</th>
								<th>Nama Produk</th>
								<th>Kategori</th>
								<th>Harga Satuan</th>
								<th>Stok Tersedia</th>
								<th colspan="2">&nbsp;</th>
							</tr>';
    $itemindex = 1;
    if (count($products) > 0) {
        foreach ($products as $product) {
            $result .= '<tr>';
            $result .= '<td>' . $itemindex . '</td>';
            $result .= '<td><img src="../../' . $product->imageurl . '" style="max-width: 100px;"/></td>';
            $result .= '<td>' . $product->title . '</td>';
            $result .= '<td>' . $product->category . '</td>';
            $result .= '<td>' . str_replace('+', '', money_format('%i', $product->price)) . '</td>';
            $result .= '<td>' . $product->stock . '</td>';
            $result .= "<td><button onclick=\"detailProduct(" . $product->id . ")\" class=\"btn\">Ubah/Detail</btn></td>";
            $result .= "<td><button onclick=\"removeProduct(" . $product->id . ",'" . $product->title . "')\" class=\"btn btn-danger removeprod\">X</btn></td>";
            $result .= '</tr>';
            $itemindex++;
        }
    } else {
        $result .= '<tr><td colspan="5"><p class="alert alert-warning">Tidak ada data produk</p></td></tr>';
    }
    $result .= '</table>';
    return $result;
}
Esempio n. 21
0
include_once "Brain/ShoppingCart.php";
regGet('prodName', 'priceMin', 'priceMax', 'catNo');
$cart = new SCart();
if ($prodName == "") {
    $prodName = null;
}
if ($priceMin == "") {
    $priceMin = null;
}
if ($priceMax == "") {
    $priceMax = null;
}
if ($catNo == "") {
    $catNo = null;
}
$prods = getProducts($prodName, $priceMin, $priceMax, null, null, $catNo, null);
//$prods = getAllProducts();
?>

	<div class="row prod_C">
		<?php 
if ($prods == null) {
    echo '<div class="noProducts"> No products found. </div>';
}
foreach ($prods as $p) {
    $s = getSupplier($p[suppNo]);
    $prodName = $p[prodName];
    $outOfStock = $p[stockQty] <= 0;
    if (strlen($prodName) > 23) {
        $prodName = substr($prodName, 0, 20) . '...';
    }
Esempio n. 22
0
    <a class="btn btn-primary" role="button" data-toggle="modal" data-target="#newProduct">Novo Produto</a>
    <h1>Seus produtos</h1>
    <table class="table table-bordered">
        <thead>
            <tr>
                <th>Descrição</th>
                <th>Data de Produção</th>
                <th>Data de Vencimento</th>
                <th>Preço</th>
                <th>Estoque</th>
                <th>Editar</th>
            </tr>
        </thead>
        <tbody>
            <?php 
getProducts($_SESSION['id']);
?>
        </tbody>
    </table>
</div>
<div id="newProduct" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="modalUpdate" aria-hidden="true">
    <div class="modal-dialog">
        <div class="modal-content">
            <div class="modal-header">
                <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;  </button>
                <h4 class="modal-title" id="modalUpdate">Cadastrar Produto</h4>
            </div>
            <form id="formAjax" action="../../controllers/newProduct.php" method="post">
                <div class="modal-body">
                    <input type="hidden" name="comp_id" value="<?php 
echo $_SESSION['id'];
Esempio n. 23
0
function showOrderUpload($v846b3ce5d769, $ve09ec8cebef9, $v3e3e6b0e5c1c)
{
    global $cookie;
    $v2fe98fd2790c = '';
    $vbe7e10eee5f6 = '<script type="text/javascript">' . 'var orderId = ' . (int) Tools::getValue('id_order') . ';' . 'var modulesDir = \'' . _PS_BASE_URL_ . _MODULE_DIR_ . $v846b3ce5d769->name . '/\';' . 'var dir = \'' . _PS_BASE_URL_ . __PS_BASE_URI__ . str_replace('\\', '/', Configuration::get('AIMD_UPLOAD_DIR')) . $v846b3ce5d769->name . '/\';' . 'var uploadFailed = \'' . addslashes($v846b3ce5d769->l('Failed', 'functions')) . '\';' . 'var uploadButton = \'' . addslashes($v846b3ce5d769->l('Upload a file', 'functions')) . '\';' . 'var uploadCancel = \'' . addslashes($v846b3ce5d769->l('Cancel', 'functions')) . '\';' . 'var dropHere = \'' . addslashes($v846b3ce5d769->l('Drop files here to upload', 'functions')) . '\';' . '</script>';
    $vbe7e10eee5f6 .= '<div class="aimd_tabs_container">' . '<div class="tabs">';
    $v934f0b0fc139 = '';
    $v408604424864 = '';
    $vcd72ac047746 = 1;
    foreach ($ve09ec8cebef9 as $va92811717d11) {
        $v17e937b52c19 = false;
        $v444fad254a49 = getProducts((int) $va92811717d11['product_id']);
        if (count($v444fad254a49)) {
            $v17e937b52c19 = true;
        }
        if ($v17e937b52c19) {
            $va5735fe0d4b5 = '';
            $v86d0a1914022 = $va92811717d11['product_name'];
            if (strlen($v86d0a1914022) > 15) {
                $v86d0a1914022 = substr($v86d0a1914022, 0, 12) . '...';
            }
            $v0ddf62a16cde = (int) Tools::getValue('id_order') . '_' . (int) $va92811717d11['product_id'] . '_' . (int) $va92811717d11['product_attribute_id'];
            $vbe7e10eee5f6 .= '<div class="tab_tab" id="tab_' . $v0ddf62a16cde . '" title="' . addslashes($va92811717d11['product_name']) . '">' . addslashes($v86d0a1914022) . '</div>';
            $v934f0b0fc139 .= '<div class="tab_content" id="content_' . $v0ddf62a16cde . '">';
            if ((int) Configuration::get('AIMD_FILE_NUMBER') && !$v3e3e6b0e5c1c) {
                $v934f0b0fc139 .= '<div class="files_limit">' . $v846b3ce5d769->l('You can upload up to', 'functions') . ' ' . Configuration::get('AIMD_FILE_NUMBER') . ' ' . $v846b3ce5d769->l('files', 'functions') . ' (' . (int) Configuration::get('AIMD_FILE_SIZE') . $v846b3ce5d769->l('Mb', 'functions') . ' ' . $v846b3ce5d769->l('maximum', 'functions') . '), ' . $v846b3ce5d769->l('allowed files are', 'functions') . ' : ' . str_replace(',', ', ', Configuration::get('AIMD_FILE_FORMAT')) . '</div>';
            }
            $v0ce3778dfd6c = (int) $va92811717d11['id_order'] . '_' . (int) $va92811717d11['product_id'];
            $v74695833092b = (int) $va92811717d11['product_attribute_id'];
            $v0ce3778dfd6c .= '_' . $v74695833092b;
            $veaf839388994 = _PS_ROOT_DIR_ . DIRECTORY_SEPARATOR . Configuration::get('AIMD_UPLOAD_DIR') . $v846b3ce5d769->name . DIRECTORY_SEPARATOR . $v0ce3778dfd6c;
            $vf03aab0a7259 = 0;
            $vbaf01000f27c = time();
            if (!file_exists($veaf839388994)) {
                mkdir($veaf839388994, 0777);
                copy('index.php', $veaf839388994 . '/index.php');
            }
            if (file_exists($veaf839388994)) {
                $vd8eb58323a7b = opendir($veaf839388994);
                while (($v846ce60614cf = readdir($vd8eb58323a7b)) !== false) {
                    $v846ce60614cf = strtolower($v846ce60614cf);
                    if ($v846ce60614cf != '.' && $v846ce60614cf != '..' && $v846ce60614cf != 'index.php') {
                        $v52f0be65c0fe = $veaf839388994 . DIRECTORY_SEPARATOR . $v846ce60614cf;
                        $v0ec2d0b8c4b4 = str_replace(DIRECTORY_SEPARATOR, '/', Configuration::get('AIMD_UPLOAD_DIR')) . $v846b3ce5d769->name . '/' . $v0ce3778dfd6c . '/' . $v846ce60614cf;
                        if (substr($v0ec2d0b8c4b4, 0, 1) != '/') {
                            $v0ec2d0b8c4b4 = '/' . $v0ec2d0b8c4b4;
                        }
                        $vc616783d5b67 = @filesize($v52f0be65c0fe);
                        if ($vc616783d5b67 > 1024 * 1024) {
                            $vc616783d5b67 = sprintf("%01.2f", $vc616783d5b67 / (1024 * 1024)) . $v846b3ce5d769->l('Mb', 'functions');
                        } else {
                            $vc616783d5b67 = sprintf("%01.2f", $vc616783d5b67 / 1024) . $v846b3ce5d769->l('Kb', 'functions');
                        }
                        $vc61480530622 = @filemtime($v52f0be65c0fe);
                        if ($vbaf01000f27c > $vc61480530622) {
                            $vbaf01000f27c = $vc61480530622;
                        }
                        $v06367ffabacd = '';
                        $v32912f2f4136 = '';
                        $vb3c1836d42ad = (int) Tools::getValue('id_order') . '_' . (int) $va92811717d11['product_id'] . '_' . (int) $va92811717d11['product_attribute_id'] . '-' . $v846ce60614cf;
                        $va5735fe0d4b5 .= '<div class="upload_file">' . '<span>' . $v846ce60614cf . '</span>' . '<span>' . $vc616783d5b67 . '</span>';
                        if ($v3e3e6b0e5c1c) {
                            $va5735fe0d4b5 .= '<span>' . '<img src="' . _MODULE_DIR_ . $v846b3ce5d769->name . '/img/delete.png" title="' . $v846b3ce5d769->l('Delete this file', 'functions') . '" class="file_delete" />' . '<a href="' . _MODULE_DIR_ . $v846b3ce5d769->name . '/includes/ajax.php?action=downloadFile&file=' . $v0ec2d0b8c4b4 . '" target="_blank">' . '<img src="' . _MODULE_DIR_ . $v846b3ce5d769->name . '/img/download.png" title="' . $v846b3ce5d769->l('Download this file', 'functions') . '" class="file_download" />' . '</a>' . '<input type="hidden" class="file_url" value="' . $v0ec2d0b8c4b4 . '" />' . '</span>';
                        }
                        $va5735fe0d4b5 .= '</div>';
                        $vf03aab0a7259++;
                    }
                }
                closedir($vd8eb58323a7b);
            }
        }
        $v885f9154767a = (int) Configuration::get('AIMD_FILE_NUMBER');
        $v934f0b0fc139 .= '<div id="aimultidimensions_information" style="display: none;">' . $v846b3ce5d769->l('You will be able to upload your file(s) when your payment will be granted by the administrator of the shop.', 'functions') . '</div>' . $va5735fe0d4b5 . '<input type="hidden" class="product_id" value="' . (int) $va92811717d11['product_id'] . '" />' . '<input type="hidden" class="combination_id" value="' . (int) $va92811717d11['product_attribute_id'] . '" />' . '</div>';
        $vcd72ac047746++;
    }
    if ($v934f0b0fc139) {
        $v2fe98fd2790c = $vbe7e10eee5f6 . '</div>' . $v934f0b0fc139 . '<div class="clear">&nbsp;</div>' . '</div>';
        if (!$v3e3e6b0e5c1c) {
            $v2fe98fd2790c .= '<form id="miniUpload" method="post" action="' . _PS_BASE_URL_ . _MODULE_DIR_ . $v846b3ce5d769->name . '/upload/upload.php" enctype="multipart/form-data">' . '<div id="miniUpload-drop" class="cibleDragnDrop text-center dz-clickable" >' . '<div class="drop_title">' . $v846b3ce5d769->l('Drag & Drop your', 'functions') . ' <span>' . $v846b3ce5d769->l('files here... or click on', 'functions') . '</span> <img id="fake_button" src="' . _PS_BASE_URL_ . _MODULE_DIR_ . $v846b3ce5d769->name . '/img/upload_button.png"" title="' . $v846b3ce5d769->l('click to add files', 'functions') . '" alt="" /></div>' . '<div class="upload_button">' . '<input type="file" name="upl" id="miniUpload-file" multiple />' . '</div>' . '</div>' . '<ul>' . '<!-- The file uploads will be shown here -->' . '</ul>' . '<input type="hidden" id="order_id" value="' . (int) Tools::getValue('id_order') . '" />' . '</form>' . '<script type="text/javascript">' . '$(document).ready( function () {' . '$(\'#fake_button\').click( function () {' . '$(\'#miniUpload-file\').click();' . '});' . 'bindTabChange();' . '$(\'.aimd_tabs_container .tab_tab:first-child\').click();' . '});' . '</script>' . '<script type="text/javascript" src="' . __PS_BASE_URI__ . 'modules/' . $v846b3ce5d769->name . '/includes/mini-uploader/assets/js/script.js"></script>';
        } else {
            $v2fe98fd2790c .= '<script type="text/javascript">' . '$(document).ready( function () {' . '$(\'#tabOrder\').before($(\'.aimd_tabs_container\'));' . 'bindTabChange();' . 'bindFileDelete();' . 'bindFileDownload();' . '$(\'.aimd_tabs_container .tab_tab:first-child\').click();' . '});' . '</script>';
        }
    }
    return $v2fe98fd2790c;
}
Esempio n. 24
0
function testGetProducts()
{
    $json = getProducts("json");
    //$xml = getProducts("xml");
    //echo htmlentities($xml->asXML());
    //echo htmlentities($xml->asXML());
    echo "GET products in JSON format: example of looping through the product list" . "<br />";
    //print_r( $duap_options);
    //print_r($json);
    foreach ($json->Items as $k => $product) {
        echo $k . "------------------<pre>";
        print_r($product);
        echo "</pre>";
    }
}
Esempio n. 25
0
        echo $row[4];
        ?>
 remaining.</span><br>
        <span class="added">Date added: <?php 
        echo $row[6];
        ?>
</span><br>
        <button class="add-item-button">Add to kart...</button>
    </div>
    <div class="clear"></div>   
<?php 
    }
    mysql_free_result($result);
    return true;
}
?>
<div id="product-list">
    <?php 
$result = getProducts();
?>
    <div class="clear"></div>
</div>
<?php 
printContainerBottom();
?>

<?php 
printHtmlBottom();
?>

Esempio n. 26
0
		<?php 
if (isset($_GET['category'])) {
    $cat_id = $_GET['category'];
    getProducts("SELECT * FROM products WHERE pro_category like {$cat_id}");
} else {
    if (isset($_GET['brand'], $_GET['cat'])) {
        $bra_id = $_GET['brand'];
        $cat_id = $_GET['cat'];
        getProducts("SELECT * FROM products JOIN brands ON products.pro_brand = brands.brand_id WHERE products.pro_category = {$cat_id} AND brands.brand_name = '{$bra_id}'");
    } else {
        if (isset($_GET['all'])) {
            getProducts("SELECT * FROM products");
        } else {
            if (isset($_GET['key'])) {
                $keywords = $_GET['key'];
                getProducts('SELECT * FROM products WHERE pro_keywords LIKE "%' . $keywords . '%"');
            } else {
                var_dump($_GET);
                var_dump($_POST);
                echo '<h1>You are not supposed to be here. A skillful monkey is working on fixing this "feature", so that this could not happen again. And go away now! Quickly</h1>';
            }
        }
    }
}
?>
	</div>

</div></div>

	<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
Esempio n. 27
0
?>
">Toggle UI</a></li>-->
            </ul>
            <form class="navbar-form navbar-right" role="search">
                <div class="form-group">
                    <input type="text" id="filter-search" class="form-control" placeholder="Search">
                </div>
            </form>
        </div>
      </div>
    </nav>
    <div id="main" class="container">
	<br>

<?php 
$product = getProducts($DOM, $exact_gpu);
$i = 0;
if ($product !== false) {
    foreach ($product as $gpu) {
        ?>
<div class="gpu-listing col-lg-4 col-md-6 col-sm-6 col-xs-12"> <div class="panel panel-mat"><div class="panel-heading"> <h3 class="panel-title"><?php 
        echo $gpu['title'];
        ?>
</h3> <span class="paragraph-end"></span> </div> <div class="panel-body"> <div class="row"> <div class="gpu-img-container col-xs-5"> <img src="http://www.evga.com<?php 
        echo $gpu['img'];
        ?>
" class="gpu-img" /> </div> <div class="gpu-info-container col-xs-7"> <?php 
        echo $gpu['part'];
        ?>
 <?php 
        echo $gpu['desc'];
Esempio n. 28
0
                        'name' => "produto[]",
                        'class'=> "chosen-select produto",
                        'select_options' => getProducts()),
                    array(                 
                        'type' => "text",
                        'name' => "qtd[]",
                        'class'=> "qtd",
                        'post_content' => 'CXS')
                ),
                'actions' => array(
                    'details' => 'Detalhes',
                    'edit' => 'Editar',
                    'delete' => 'Excluir'
                ),
                'extraFooterRow' => array(
                    array(
                        'content' => '< button >Adicionar Linha< /button >',
                        'params'  => 'colspan="7" align="center"'
                        )
                )
            )                    
        );
        </pre>
        <?php 
$inputbuilder->createDataTable(array('extra_param' => 'border="1"', 'labels' => array('Produto', 'Quantidade', 'Valor<br>Unitário<br>(R$)', 'Valor<br>Total<br>(R$)', 'Detalhes', 'Editar', 'Excluir'), 'hasPrice' => true, 'extraHeaderRow' => array(array('content' => 'Teste', 'params' => 'colspan="7" align="center"')), 'inputs' => array(array('type' => "select", 'name' => "produto[]", 'class' => "chosen-select produto", 'select_options' => getProducts()), array('type' => "text", 'name' => "qtd[]", 'class' => "qtd", 'post_content' => 'CXS')), 'actions' => array('details' => 'Detalhes', 'edit' => 'Editar', 'delete' => 'Excluir'), 'extraFooterRow' => array(array('content' => '<button>Adicionar Linha</button>', 'params' => 'colspan="7" align="center"'))));
/***** FIM ESBOÇO */
?>
        </fieldset>
    </body>
</html>
        <li><a href="home.php">Home</a></li>
        <li><a href="About.php">About</a></li>
        <li><a href="Contact.php">Contact</a></li>
        <li><a href="Products.php">Products</a></li>
        <li><a href="shoppingCart.php">Shopping Cart</a></li>
        <li><a href="F.A.Q..php">F.A.Q.</a></li>
        <li><a href="login.php">Login</a></li>
        <li class="copyright"> © New York Apartments</li>
    </ul>
</div>
<h1>Shopping Cart</h1>

<div>
    <div class="productContent">
        <form method="post" action="Checkout.php">
            <input type="submit" name="Checkout" value="CHECKOUT"/>
        </form>
        <div class="productTable">
            <table border="1px">
    <?php 
getProducts($dbh);
?>

                </table>

         </div>
    </div>
</div>

</body>
Esempio n. 30
0
function duap_update_price()
{
    try {
        //script goes here
        global $duap_options, $wpdb;
        $totUpdate = 0;
        $totalUP = 0;
        //first get all product on unleashed
        $json = getProducts("json");
        $jsonStr = "";
        $productUpdated = array();
        $productUpdatedJson = array();
        $matchTotal = 0;
        $matchProducts = array();
        //now lets add the $sql
        if (isset($json->Items)) {
            $totalUP = count($json->Items);
        }
        if ($totalUP) {
            foreach ($json->Items as $k => $product) {
                //print_r($product);
                $result = $wpdb->get_results('SELECT * FROM ' . $wpdb->prefix . 'posts WHERE post_type = "product" AND post_title = "' . esc_sql($product->ProductDescription) . '" LIMIT 1', ARRAY_A);
                //echo $wpdb->num_rows;
                if ($wpdb->num_rows) {
                    $matchTotal++;
                    $matchProducts[] = $product->ProductDescription;
                    $prodId = 0;
                    foreach ($result as $k => $v) {
                        $prodId = $v['ID'];
                    }
                    if ($prodId) {
                        $updatePriceJson = '{"individual": "' . $product->SellPriceTier2->Value . '", "wholesale": "' . $product->SellPriceTier3->Value . '", "tender": "' . $product->SellPriceTier1->Value . '"}';
                        $isUpdate = 0;
                        $isUpdate = $wpdb->replace($wpdb->prefix . 'postmeta', array('meta_value' => $updatePriceJson), array('post_id' => $prodId, 'meta_key' => 'festiUserRolePrices'));
                        //--- if updated successfully
                        if ($isUpdate) {
                            $productUpdated[] = "(" . $prodId . ")  <u>" . $product->ProductDescription . "</u>";
                            $productUpdatedJson[] = "{<strong>individual:</strong> " . $product->SellPriceTier2->Value . ", \n\t\t\t\t\t\t\t\t\t<strong>wholesale:</strong> " . $product->SellPriceTier3->Value . ", \n\t\t\t\t\t\t\t\t\t<strong>tender:</strong> " . $product->SellPriceTier1->Value . "}";
                            $totUpdate++;
                            //--- else add new
                        } else {
                            $wpdb->get_results('SELECT * FROM ' . $wpdb->prefix . 'postmeta WHERE post_id = ' . $prodId . ' AND meta_key = "festiUserRolePrices" LIMIT 1', ARRAY_A);
                            //now lets insert the data
                            if (!$wpdb->num_rows) {
                                $isInsert = $wpdb->insert($wpdb->prefix . 'postmeta', array('post_id' => $prodId, 'meta_key' => 'festiUserRolePrices', 'meta_value' => $updatePriceJson), array('%d', '%s', '%s'));
                                //--- if added
                                if ($isInsert) {
                                    $productUpdated[] = "(" . $prodId . ") <u>" . $product->ProductDescription . "</u>";
                                    $productUpdatedJson[] = "{<strong>individual:</strong> " . $product->SellPriceTier2->Value . ", \n\t\t\t\t\t\t\t\t\t\t<strong>wholesale:</strong> " . $product->SellPriceTier3->Value . ", \n\t\t\t\t\t\t\t\t\t\t<strong>tender:</strong> " . $product->SellPriceTier1->Value . "}";
                                    $totUpdate++;
                                }
                            }
                        }
                    }
                }
                //creating json data
                $jsonStr .= '{"name":"' . esc_sql($product->ProductDescription) . '", "individual": "' . $product->SellPriceTier2->Value . '", "wholesale": "' . $product->SellPriceTier3->Value . '", "tender": "' . $product->SellPriceTier1->Value . '"}';
                if ($totalUP > $k + 1) {
                    $jsonStr .= ",";
                }
            }
        }
        $newJson = "[" . $jsonStr . "]";
        //now lets insert the data
        $wpdb->insert($wpdb->prefix . 'djay_unleashed', array('duap_time' => current_time('mysql'), 'duap_json' => $newJson, 'duap_type' => 'price', 'duap_user' => get_current_user_id()), array('%s', '%s', '%d'));
        $newJson = json_decode($newJson, true);
        echo "<div class='duap-ajax-result-section'>";
        echo "<p><b>Total no. of matched product(s): </b><span class='counter'>" . $matchTotal . "</span><p>";
        echo "<p><b>Total no. of <font color='green'>updated</font> product(s): </b><span class='counter'>" . $totUpdate . "</span><p>";
        echo "<p><b>Product List</b></p><ul>";
        if ($totUpdate) {
            foreach ($productUpdated as $k => $prod) {
                echo "<li>" . $prod . " - " . $productUpdatedJson[$k] . "</li>";
            }
        } else {
            echo "<p class='empty'>No product has been updated! Please click again...</p>";
        }
        echo "</ul>";
        echo "<hr>";
        echo "<p><b>Matched Product List</b></p><ul>";
        if ($matchTotal) {
            foreach ($matchProducts as $prod) {
                echo "<li>" . $prod . "</li>";
            }
        } else {
            echo "<p class='empty'>No product matches! Please click again...</p>";
        }
        echo "</ul></div>";
        die;
    } catch (Exception $e) {
        echo $e->getMessage();
        die;
    }
}