本文整理汇总了PHP中Products::getProducts方法的典型用法代码示例。如果您正苦于以下问题:PHP Products::getProducts方法的具体用法?PHP Products::getProducts怎么用?PHP Products::getProducts使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Products
的用法示例。
在下文中一共展示了Products::getProducts方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: createUserInterface
/**
* @see ApplicationView::createUserInterface()
*/
protected function createUserInterface()
{
parent::createUserInterface();
$this->addStyle('/css/home.css');
$resourceBundle = Application::getInstance()->getBundle();
$products = $this->products->getProducts();
if (count($products) == 0) {
$this->contentPanel->addChild(new Heading(2))->addChild(new Text($resourceBundle->getString('NO_PRODUCT')));
} else {
$this->contentPanel->addChild(new ProductList())->setProductList($products);
}
}
示例2: actionIndex
public function actionIndex()
{
$platforms = array();
$platforms = Platform::getPlatformList();
$genres = array();
$genres = Genre::getGenreList();
$productList = array();
$productList = Products::getProducts(6);
require_once ROOT . '/views/site/index.php';
return true;
}
示例3: actionIndex
public function actionIndex($page = 1)
{
self::validateAdmin();
$count = 6;
$productList = array();
$productList = Products::getProducts($count, $page);
$total = Products::getTotalProductInCatalog();
$pagination = new Pagination($total, $page, $count, 'page-');
require_once ROOT . '/views/admin_product/index.php';
return true;
}
示例4: runMiddle
public function runMiddle()
{
$count = Products::getProductsCount();
if (isset($this->params[0]) && $this->params[0] != "") {
$page = $this->params[0];
} else {
$page = 1;
}
$products = Products::getProducts($page - 1, 50);
$max = ceil($count / 50);
include dirname(__FILE__) . "/../views/product_list.php";
}
示例5: actionIndex
public function actionIndex($page = 1)
{
$count = 6;
$platforms = array();
$platforms = Platform::getPlatformList();
$genres = array();
$genres = Genre::getGenreList();
$productList = array();
$productList = Products::getProducts($count, $page);
$total = Products::getTotalProductInCatalog();
$pagination = new Pagination($total, $page, $count, 'page-');
require_once ROOT . '/views/catalog/index.php';
return true;
}
示例6: getBundlingWithDetail
public function getBundlingWithDetail($id)
{
if ($id != '') {
//$bundling = $this->model->fields("*")->join("left join goods as go on pr.goods_id = go.id ")->where("pr.id in($id)")->find();
$bundling = $this->model->fields("*")->where("bd.id in({$id})")->find();
//!empty($bundling)
if ($bundling != NULL) {
if (isset($bundling['products_ids']) && $bundling['products_ids'] != "") {
$product_inst = new Products();
$ret = $product_inst->getProducts($bundling['products_ids']);
if (isset($ret['status']) && $ret['status'] == 1) {
$bundling['Products'] = $ret['data'];
}
}
}
return $bundling;
} else {
return NULL;
}
}
示例7: json_encode
<?php
require_once "../helper.php";
require_once "../classes/Products.class.php";
require_once "../classes/Company.class.php";
$helper = new Helper();
$productObj = new Products();
$companyObj = new Company();
if (($result = $companyObj->checkLoggedIn()) && !isset($result['error'])) {
$result = $productObj->getProducts($result['company_id'], $_POST['id']);
}
echo json_encode($result);
?>
示例8:
<h2>Our Products</h2>
<a class="pages" href="products.php?page=<?php
print $prev;
?>
"><prev</a>
|
<a class="pages" href="products.php?page=<?php
print $next;
?>
">next></a>
<?php
print $message ? " <b>{$message}<br/>" : '';
?>
<ul>
<?php
print $view->displayProducts($page, $linesPerPage, $maxProducts, $products->getProducts());
?>
</ul>
</div><!-- product-list -->
</div><!-- rightnav -->
<br class="clear-all"/>
</div><!-- content -->
</div><!-- maincontent -->
<div id="footer">
<div class="footer">
Copyright © 2012 sweetscomplete.com. All rights reserved. <br/>
示例9: order_act
//.........这里部分代码省略.........
}
$payable_amount += $item['sell_price'] * $item['num'];
// 成交价格
$real_amount += $item['real_price'] * $item['num'];
// 真实成交价格
// $payable_amount += $item['sell_total'];
//$real_amount += $item['amount'];
$weight += $item['weight'] * $item['num'];
$point += $item['point'] * $item['num'];
}
}
}
$order_bundling = null;
$error_bd_list = array();
if (!empty($cart_info[$ship_id]['bundling_list'])) {
//Tiny::log(__FILE__ . __LINE__ . "------cart info---" . var_export($cart_info, true));
$order_bundling =& $cart_info[$ship_id]['bundling_list'];
foreach ($order_bundling as $b_key => $b_val) {
// Tiny::log(__FILE__ . __LINE__ . "-------products item----$key----" . var_export($item, true));
// 判断是否存在
$bundling_total = 0;
foreach ($b_val as $v_key => $v_val) {
$num = $v_val['num'];
// 计算
$payable_amount += $v_val["val"]['price'] * $v_val["num"];
//$real_amount += $v_val["val"]['price']; // 在item里面增加amount 项目
$real_amount += $v_val["val"]['price'] * $v_val["num"];
$bundling_total += $v_val["num"];
$arr_id = explode('-', $v_key);
//$str_ids = join(',', $arr_id);
$product_list = array();
if (!empty($arr_id)) {
$product_inst = new Products();
$ret = $product_inst->getProducts($arr_id);
if (isset($ret['status']) && $ret['status'] == 1) {
$product_list = $ret['data'];
}
}
//SKM-ORDER-STORE todo 判断库存是否足够
foreach ($product_list as $p_k => $p_v) {
if ($p_v['store_nums'] < $num) {
// test OK
$error = 1;
$error_item = array("msg" => '套餐中商品:' . $p_v['name'] . '--库存只有' . $p_v['store_nums'] . '个!');
$error_bd_list[] = $error_item;
}
}
}
}
}
if ($error == 1) {
$this->assign('error_list', $error_list);
$this->assign('error_bd_list', $error_bd_list);
// Req::args('msg', "提交订单失败");
//$this->redirect("/simple/cart", true, Req::args());
$this->redirect("/simple/cart", false);
exit;
}
// 处理整个订单
//计算运费
$fare = new Fare($weight);
$payable_freight = $fare->calculate($address_id);
$real_freight = $payable_freight;
//计算订单优惠
$prom_order = array();
$discount_amount = 0;
示例10: print_picking
public function print_picking()
{
$this->layout = 'blank';
$this->title = '配货单打印';
$this->assign("id", Req::args("id"));
$order_init = new Order();
$order_id = Filter::int(Req::args("id"));
$ret = $order_init->getOrderWithDetail($order_id);
if ($ret['status'] == 1) {
$order_list = $ret['data'];
}
$order_goods_list = $order_list['OrderGoods'];
if ($order_goods_list) {
foreach ($order_goods_list as $key => $item) {
if ($item['prom_type'] == 'bundling') {
$goods_attrs[] = $item['products_ids'];
$products_init = new Products();
$ret = $products_init->getProducts($goods_attrs);
if ($ret['status'] == 1) {
$products_list = $ret['data'];
}
$order_goods_list[$key]["products_list"] = $products_list;
}
}
$this->assign('order_goods_list', $order_goods_list);
}
$this->redirect();
}
示例11: order_detail
public function order_detail()
{
$id = Filter::int(Req::args("id"));
$order = $this->model->table("order as od")->fields("od.*,pa.pay_name")->join("left join payment as pa on od.payment = pa.id")->where("od.id = {$id} and od.user_id=" . $this->user['id'])->find();
if ($order) {
$invoice = $this->model->table("doc_invoice as di")->fields("di.*,ec.code as ec_code,ec.name as ec_name,ec.alias as ec_alias")->join("left join express_company as ec on di.express_company_id = ec.id")->where("di.order_id=" . $id)->find();
$order_goods = $this->model->table("order_goods as og ")->join("left join goods as go on og.goods_id = go.id left join products as pr on og.product_id = pr.id")->where("og.order_id=" . $id)->findAll();
$this->assign("order_goods", $order_goods);
$this->assign("invoice", $invoice);
$this->assign("order", $order);
$order_init = new Order();
$order_id = Filter::int(Req::args("id"));
$ret = $order_init->getOrderWithDetail($order_id);
if ($ret['status'] == 1) {
$order_list = $ret['data'];
}
$order_goods_list = $order_list['OrderGoods'];
if ($order_goods_list) {
foreach ($order_goods_list as $key => $item) {
if ($item['prom_type'] == 'bundling') {
$goods_attrs[] = $item['products_ids'];
$products_init = new Products();
$ret = $products_init->getProducts($goods_attrs);
if ($ret['status'] == 1) {
$products_list = $ret['data'];
}
$order_goods_list[$key]["products_list"] = $products_list;
}
}
$this->assign('order_goods_list', $order_goods_list);
}
$this->redirect();
} else {
Tiny::Msg($this, 404);
}
}
示例12: modifyBundlingNum
public function modifyBundlingNum($bundling, $num = 1)
{
$bundling_id = NULL;
$ship_id = NULL;
$products_ids = NULL;
if (isset($bundling["bundling_id"]) && $bundling["bundling_id"] > 0) {
$bundling_id = $bundling["bundling_id"];
} else {
$ret["msg"] = "修改商品数量失败";
$ret["status"] = false;
return $ret;
}
if (isset($bundling["ship_id"]) && $bundling["ship_id"] > 0) {
$ship_id = $bundling["ship_id"];
} else {
$ret["msg"] = "修改商品数量失败";
$ret["status"] = false;
//Tiny::log(__FILE__.__LINE__."------------carts----------".$ret["msg"]);
return $ret;
}
if (isset($bundling["products_ids"]) && $bundling["products_ids"] > 0) {
$products_ids = $bundling["products_ids"];
} else {
$ret["msg"] = "没有组合商品内容";
$ret["status"] = false;
//Tiny::log(__FILE__.__LINE__."------------carts----------".$ret["msg"]);
return $ret;
}
/*
* $bundling_inst = new Bundling();
if( (isset($bundling["products_ids"]) && $bundling["products_ids"]!= "") && isset($bundling["ship_id"]) && $bundling["ship_id"]>0 ){
$products_ids = $bundling["products_ids"];
$ship_id = $bundling["ship_id"];
}else{
$item = array();
$item = $bundling_inst->getBundling($bundling_id); // 获取购物车 所有的商品
if (!empty($item) && isset($item["goods_id"])){
// $products_ids = $item["goods_id"];
// $goods_id = $item["goods_id"];
//$ship_id = $item["ship_id"]; // 为非空 取 goods_id 的第一个
}else{
$ret["msg"] = "删除商品失败,没有商品ID或ship_id";
$ret["status"] = false;
return $ret;
}
}
*/
$bundling_info = array("ship_id" => $ship_id, "bundling_id" => $bundling_id, "products_ids" => $products_ids);
//Tiny::log(__FILE__.__LINE__."------------carts----------".var_export($bundling_info, true) );
if (!$this->hasBundling($bundling_info)) {
$ret["msg"] = "修改商品数量失败,没有商品";
$ret["status"] = false;
return $ret;
}
//SKM 判断商品是否超过库存量
// todo products.num + bundling.num > store_nums
// 当前 bundling.num > store_nums
//$bundling_inst = new Bundling();
//$bund = $bundling_inst->getBundlingWithDetail($bundling_id);
$max_nums = $num;
$arr_ids = explode('-', $products_ids);
$products_inst = new Products();
$max_store_nums = 100;
// 初始化为100
$ret = $products_inst->getProducts($arr_ids);
if (isset($ret['status']) && $ret['status'] == 1) {
$bundProducts = $ret['data'];
if (isset($bundProducts)) {
foreach ($bundProducts as $p_v) {
$product_num = $this->bundlingInProducts($ship_id, $p_v['id']);
if ($max_store_nums > $p_v['store_nums']) {
$max_store_nums = $p_v['store_nums'];
}
if ($max_nums > $p_v['store_nums'] - $product_num) {
$max_nums = $p_v['store_nums'] - $product_num;
}
}
}
}
if ($num >= $max_nums) {
$this->items[$ship_id]["bundling_list"][$bundling_id][$products_ids]['num'] = $max_nums;
$this->items[$ship_id]["bundling_list"][$bundling_id][$products_ids]['max_nums'] = $max_nums;
} else {
$this->items[$ship_id]["bundling_list"][$bundling_id][$products_ids]['num'] = $num;
$this->items[$ship_id]["bundling_list"][$bundling_id][$products_ids]['max_nums'] = $max_nums;
}
$ret["msg"] = "修改商品数量成功";
$ret["status"] = true;
return $ret;
}
示例13: order_get
public function order_get()
{
$my_order = array();
$order_no = Filter::str(Req::args('order_no'));
$ret = Order::getOrderWithDetailByNo($order_no);
if (isset($ret['status']) && $ret['status'] == 1) {
$order = $ret['data'];
if ($order != NULL) {
$my_order = $order;
$my_order_detail = array();
if (isset($order['OrderGoods'])) {
foreach ($order['OrderGoods'] as $key => $val) {
if ($val['prom_type'] == 'bundling') {
$arr_ids = explode(',', $val['products_ids']);
$product_inst = new Products();
$ret_p = $product_inst->getProducts($arr_ids);
if (isset($ret_p['status']) && $ret_p['status'] == 1) {
$products_list = $ret_p['data'];
foreach ($products_list as $sub_key => $sub_val) {
$product_item = array('goods_id' => $sub_val['goods_id'], 'goods_no' => $sub_val['goods_no'], 'weight' => $sub_val['weight'], 'num' => $val['goods_nums']);
$my_order_detail[] = $product_item;
}
}
} else {
$product_item = array('goods_id' => $sub_val['goods_id'], 'goods_no' => $val['goods_no'], 'weight' => $val['weight'], 'num' => $val['num']);
$my_order_detail[] = $product_item;
}
}
}
$my_order['OrderGoods'] = $my_order_detail;
}
}
echo json_encode($my_order, JSON_UNESCAPED_SLASHES);
}
示例14: catch
return $product->getId();
//endif;
} catch (Exception $e) {
echo $e->getMessage();
Mage::log('product import error' . $e->getMessage());
}
}
/**************** Create Configurable Product ********************************/
function updateProductIdinInterspire($intespireid, $magenotproductid)
{
$prepare = $this->conInterspire->prepare("\n update `isc_products` set `magentoproductid`='" . $magenotproductid . "' where \n `productid`='" . $intespireid . "'\n ");
$prepare->execute();
}
}
$obj = new Products();
$products = $obj->getProducts();
foreach ($products as $product) {
$configurableoptions = $obj->getConfigurableOptions($product['productid']);
if (count($configurableoptions)) {
$productimages = $obj->getProductImages($product['productid']);
try {
$simpleProduct = $this->_createProduct(Mage_Catalog_Model_Product_Type::TYPE_SIMPLE);
// create simple product
$confProduct = $this->_createProduct(Mage_Catalog_Model_Product_Type::TYPE_CONFIGURABLE, false);
// create conf product but do not save
// $productid=$obj->addConfigurableProduct($product,$productimages);
} catch (exception $e) {
echo $e->getMessage();
}
foreach ($configurableoptions as $option) {
echo '<pre>';