当前位置: 首页>>代码示例>>PHP>>正文


PHP getProducts函数代码示例

本文整理汇总了PHP中getProducts函数的典型用法代码示例。如果您正苦于以下问题:PHP getProducts函数的具体用法?PHP getProducts怎么用?PHP getProducts使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了getProducts函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getProducts

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);
        }
    }
}
开发者ID:jbm160,项目名称:brs,代码行数:25,代码来源:productlist.php

示例2: settlement

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);
}
开发者ID:q546530715,项目名称:fenzhi-git,代码行数:60,代码来源:game-settlement-backup.php

示例3: controller_products_index

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);
    }
}
开发者ID:PushGit,项目名称:companies,代码行数:26,代码来源:controller.php

示例4: init

 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();
                 }
             }
         }
     }
 }
开发者ID:EliosIT,项目名称:PS_AchatFilet,代码行数:30,代码来源:CartController.php

示例5: compareView

function compareView()
{
    echo '<table id="compareTable">';
    getHeaders();
    getProducts();
    echo '</table>';
}
开发者ID:bwgraves,项目名称:tfpcs,代码行数:7,代码来源:viewFunctions.php

示例6: getProducts

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']);
    }
}
开发者ID:sd-studio,项目名称:pi,代码行数:10,代码来源:mtzpro.php

示例7: writeProductCatalogAsJSON

function writeProductCatalogAsJSON()
{
    $json = Zend_Json::encode(getProducts());
    $dest = JSONExportPath;
    logger("writing: " . $dest);
    logger("json:" . $json);
    $fp = fopen($dest, "w");
    fwrite($fp, $json);
    fclose($fp);
}
开发者ID:vberzsin,项目名称:shop,代码行数:10,代码来源:mygassi-jsonexport.php

示例8: productsLoaded

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";
}
开发者ID:ColdAnkles,项目名称:DC_Test,代码行数:16,代码来源:CommonFunctions.php

示例9: getProducts

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);
        }
    }
}
开发者ID:jbm160,项目名称:wc_cat,代码行数:23,代码来源:productlist.php

示例10: getProducts

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);
        }
    }
}
开发者ID:jbm160,项目名称:drfs,代码行数:24,代码来源:scraper.php

示例11: function

 /**
  *
  * @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
开发者ID:philipwalter,项目名称:OnlineOrdersApp,代码行数:31,代码来源:weborders.controller.php

示例12: main

 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);
 }
开发者ID:b1oki,项目名称:AnotherShopCMS,代码行数:23,代码来源:views.php

示例13: json_decode

$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':
开发者ID:incizon,项目名称:HicreteWebApp,代码行数:31,代码来源:InventoryIndex.php

示例14: switch

<?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) {
开发者ID:morisco,项目名称:uber-classic,代码行数:31,代码来源:get_data.php

示例15: getProducts





$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 {
开发者ID:njassim,项目名称:SOHO_REPRO,代码行数:27,代码来源:products_Sep_19.php


注:本文中的getProducts函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。