本文整理汇总了PHP中Product::getProducts方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::getProducts方法的具体用法?PHP Product::getProducts怎么用?PHP Product::getProducts使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Product
的用法示例。
在下文中一共展示了Product::getProducts方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: displayMain
public function displayMain()
{
global $smarty;
$products = Product::getProducts();
$smarty->assign(array('products' => $products['entitys']));
return $smarty->fetch('shop.tpl');
}
示例2: __construct
public function __construct()
{
// Set variables
$this->table = 'mymod_comment';
$this->className = 'MyModComment';
$this->fields_list = array('id_mymod_comment' => array('title' => $this->l('ID'), 'align' => 'center', 'width' => 25), 'shop_name' => array('title' => $this->l('Shop'), 'width' => 120, 'filter_key' => 's!name'), 'firstname' => array('title' => $this->l('Firstname'), 'width' => 120), 'lastname' => array('title' => $this->l('Lastname'), 'width' => 140), 'email' => array('title' => $this->l('E-mail'), 'width' => 150), 'product_name' => array('title' => $this->l('Product'), 'width' => 100, 'filter_key' => 'pl!name'), 'grade_display' => array('title' => $this->l('Grade'), 'align' => 'right', 'width' => 80, 'filter_key' => 'a!grade'), 'comment' => array('title' => $this->l('Comment'), 'search' => false), 'date_add' => array('title' => $this->l('Date add'), 'type' => 'date'));
// Set fields form for form view
$this->context = Context::getContext();
$this->context->controller = $this;
$this->fields_form = array('legend' => array('title' => $this->l('Add / Edit Comment'), 'image' => '../img/admin/contact.gif'), 'input' => array(array('type' => 'text', 'label' => $this->l('Firstname'), 'name' => 'firstname', 'size' => 30, 'required' => true), array('type' => 'text', 'label' => $this->l('Lastname'), 'name' => 'lastname', 'size' => 30, 'required' => true), array('type' => 'text', 'label' => $this->l('E-mail'), 'name' => 'email', 'size' => 30, 'required' => true), array('type' => 'select', 'label' => $this->l('Product'), 'name' => 'id_product', 'required' => true, 'default_value' => 1, 'options' => array('query' => Product::getProducts($this->context->cookie->id_lang, 1, 1000, 'name', 'ASC'), 'id' => 'id_product', 'name' => 'name')), array('type' => 'text', 'label' => $this->l('Grade'), 'name' => 'grade', 'size' => 30, 'required' => true, 'desc' => $this->l('Grade must be between 1 and 5')), array('type' => 'textarea', 'label' => $this->l('Comment'), 'name' => 'comment', 'cols' => 50, 'rows' => 5, 'required' => false)), 'submit' => array('title' => $this->l('Save')));
// Enable bootstrap
$this->bootstrap = true;
// Call of the parent constructor method
parent::__construct();
// Update the SQL request of the HelperList
$this->_select = "s.`name` as shop_name, pl.`name` as product_name, CONCAT(a.`grade`, '/5') as grade_display";
$this->_join = 'LEFT JOIN `' . _DB_PREFIX_ . 'product_lang` pl ON (pl.`id_product` = a.`id_product` AND pl.`id_lang` = ' . (int) $this->context->language->id . ' AND pl.`id_shop` = a.`id_shop`)
LEFT JOIN `' . _DB_PREFIX_ . 'shop` s ON (s.`id_shop` = a.`id_shop`)';
// Add actions
$this->addRowAction('view');
$this->addRowAction('delete');
$this->addRowAction('edit');
// Add bulk actions
$this->bulk_actions = array('delete' => array('text' => $this->l('Delete selected'), 'confirm' => $this->l('Would you like to delete the selected items?')), 'myaction' => array('text' => $this->l('My Action'), 'confirm' => $this->l('Are you sure?')));
// Define meta and toolbar title
$this->meta_title = $this->l('Comments on Product');
if (Tools::getIsset('viewmymod_comment')) {
$this->meta_title = $this->l('View comment') . ' #' . Tools::getValue('id_mymod_comment');
}
$this->toolbar_title[] = $this->meta_title;
}
示例3: actionProducts
/**
* Отображения списка товаров
*/
public function actionProducts($mark, $model, $modification)
{
if (Yii::app()->request->isAjaxRequest) {
$data = Product::getProducts($mark, $model, $modification);
$this->renderPartial('products', array('data' => $data));
Yii::app()->end();
}
}
示例4: renderForm
public function renderForm()
{
if (!($obj = $this->loadObject(true))) {
return;
}
$products = Product::getProducts((int) $this->context->language->id, 0, 0, 'id_product', 'ASC');
foreach ($products as $product) {
$productList[] = array('key' => $product['id_product'], 'name' => '(' . $product['id_product'] . ') ' . $product['name']);
}
$categories = Category::getSimpleCategories((int) $this->context->language->id);
foreach ($categories as $category) {
$categoryList[] = array('key' => $category['id_category'], 'name' => '(' . $category['id_category'] . ') ' . $category['name']);
}
$cmss = CMS::listCms();
foreach ($cmss as $cms) {
$cmsList[] = array('key' => $cms['id_cms'], 'name' => '(' . $cms['id_cms'] . ') ' . $cms['meta_title']);
}
$this->fields_form = array('tinymce' => true, 'legend' => array('title' => $this->l('Slideshow'), 'image' => '../img/admin/cog.gif'), 'input' => array(array('type' => 'text', 'lang' => true, 'label' => $this->l('Name:'), 'name' => 'name', 'size' => 40), array('type' => 'text', 'label' => $this->l('Width:'), 'name' => 'width', 'size' => 10, 'desc' => $this->l('If you change the width of the it will be necessary to upload images again')), array('type' => 'text', 'label' => $this->l('Height:'), 'name' => 'height', 'size' => 10, 'desc' => $this->l('If you change the height of the it will be necessary to upload images again')), array('type' => 'select', 'label' => $this->l('Effect:'), 'name' => 'effect', 'cast' => 'strval', 'identifier' => 'mode', 'options' => array('query' => array(array('key' => 0, 'name' => $this->l('random')), array('key' => 1, 'name' => $this->l('swirl')), array('key' => 2, 'name' => $this->l('rain')), array('key' => 3, 'name' => $this->l('straight'))), 'name' => 'name', 'id' => 'key')), array('type' => 'text', 'label' => $this->l('Squares per width:'), 'name' => 'spw', 'size' => 10, 'desc' => $this->l('large number can cause transitions problems, Example: 7')), array('type' => 'text', 'label' => $this->l('Squares per height:'), 'name' => 'sph', 'size' => 10, 'desc' => $this->l('large number can cause transitions problems, Example: 5')), array('type' => 'text', 'label' => $this->l('Delay:'), 'name' => 'delay', 'size' => 10, 'desc' => $this->l('delay between images in ms, Example: 3000')), array('type' => 'text', 'label' => $this->l('Square delay:'), 'name' => 'sDelay', 'size' => 10, 'desc' => $this->l('delay beetwen squares in ms. Example: 30')), array('type' => 'text', 'label' => $this->l('Opacity:'), 'name' => 'opacity', 'size' => 10, 'desc' => $this->l('opacity of title and navigation. Example: 0.7')), array('type' => 'text', 'label' => $this->l('Title speed:'), 'name' => 'titleSpeed', 'size' => 10, 'desc' => $this->l('speed of title appereance in ms. Example: 500')), array('type' => 'select', 'label' => $this->l('Navigation:'), 'name' => 'navigation', 'cast' => 'strval', 'identifier' => 'mode', 'options' => array('query' => array(array('key' => 0, 'name' => $this->l('no')), array('key' => 1, 'name' => $this->l('yes'))), 'name' => 'name', 'id' => 'key')), array('type' => 'select', 'label' => $this->l('Links:'), 'name' => 'links', 'desc' => $this->l('Enable links.'), 'cast' => 'strval', 'identifier' => 'mode', 'options' => array('query' => array(array('key' => 0, 'name' => $this->l('no')), array('key' => 1, 'name' => $this->l('yes'))), 'name' => 'name', 'id' => 'key')), array('type' => 'select', 'label' => $this->l('Hover pause:'), 'name' => 'hoverpause', 'desc' => $this->l('pause on hover.'), 'cast' => 'strval', 'identifier' => 'mode', 'options' => array('query' => array(array('key' => 0, 'name' => $this->l('no')), array('key' => 1, 'name' => $this->l('yes'))), 'name' => 'name', 'id' => 'key')), array('type' => 'select', 'label' => $this->l('Show on home:'), 'name' => 'home', 'cast' => 'strval', 'identifier' => 'mode', 'options' => array('query' => array(array('key' => 0, 'name' => $this->l('no')), array('key' => 1, 'name' => $this->l('yes'))), 'name' => 'name', 'id' => 'key')), array('type' => 'select', 'label' => $this->l('Show on all category:'), 'name' => 'showOnCat', 'cast' => 'strval', 'identifier' => 'mode', 'options' => array('query' => array(array('key' => 0, 'name' => $this->l('no')), array('key' => 1, 'name' => $this->l('yes'))), 'name' => 'name', 'id' => 'key')), array('type' => 'select', 'label' => $this->l('Categories:'), 'name' => 'categories[]', 'id' => 'categories', 'options' => array('query' => $categoryList, 'name' => 'name', 'id' => 'key'), 'multiple' => true, 'desc' => $this->l('Choose one or several category s page where the slideshow will be displayed.')), array('type' => 'select', 'label' => $this->l('Show on all product:'), 'name' => 'showOnProd', 'cast' => 'strval', 'identifier' => 'mode', 'options' => array('query' => array(array('key' => 0, 'name' => $this->l('no')), array('key' => 1, 'name' => $this->l('yes'))), 'name' => 'name', 'id' => 'key')), array('type' => 'select', 'label' => $this->l('Products:'), 'name' => 'products[]', 'id' => 'products', 'options' => array('query' => $productList, 'name' => 'name', 'id' => 'key'), 'multiple' => true, 'desc' => $this->l('Choose one or several product s page where the slideshow will be displayed.')), array('type' => 'select', 'label' => $this->l('Show on all cms page:'), 'name' => 'showOnCms', 'cast' => 'strval', 'identifier' => 'mode', 'options' => array('query' => array(array('key' => 0, 'name' => $this->l('no')), array('key' => 1, 'name' => $this->l('yes'))), 'name' => 'name', 'id' => 'key')), array('type' => 'select', 'label' => $this->l('Cms:'), 'name' => 'cms[]', 'id' => 'cms', 'options' => array('query' => $cmsList, 'name' => 'name', 'id' => 'key'), 'multiple' => true, 'desc' => $this->l('Choose one or several cms s page where the slideshow will be displayed.')), array('type' => 'select', 'label' => $this->l('Hook:'), 'name' => 'hook', 'cast' => 'strval', 'identifier' => 'mode', 'options' => array('query' => array(array('name' => 'displayTop'), array('name' => 'displayHome'), array('name' => 'displayLeftColumn'), array('name' => 'displayRightColumn'), array('name' => 'displayOpartSlideshowHook')), 'name' => 'name', 'id' => 'name'), 'desc' => $this->l('You must hook the module for display your slideshow on each position. Go to modules/positions menu for setup this')), array('type' => 'select', 'label' => $this->l('Statut:'), 'name' => 'active', 'cast' => 'strval', 'identifier' => 'mode', 'options' => array('query' => array(array('key' => 0, 'name' => $this->l('disable')), array('key' => 1, 'name' => $this->l('enable'))), 'name' => 'name', 'id' => 'key'))), 'submit' => array('title' => $this->l('Save'), 'class' => 'button'));
if (is_numeric($obj->id)) {
//products value
$sql = 'SELECT id_product FROM ' . _DB_PREFIX_ . 'opartslideshow_slideshow_product WHERE id_opartslideshow_slideshow = ' . $obj->id;
$array = Db::getInstance()->executeS($sql);
if (count($array)) {
foreach ($array as $row) {
$productValues[] = $row['id_product'];
}
$this->fields_value['products[]'] = $productValues;
}
//categories value
$sql = 'SELECT id_category FROM ' . _DB_PREFIX_ . 'opartslideshow_slideshow_category WHERE id_opartslideshow_slideshow = ' . $obj->id;
$array = Db::getInstance()->executeS($sql);
if (count($array)) {
foreach ($array as $row) {
$categoriesValues[] = $row['id_category'];
}
$this->fields_value['categories[]'] = $categoriesValues;
}
//cms value
$sql = 'SELECT id_cms FROM ' . _DB_PREFIX_ . 'opartslideshow_slideshow_cms WHERE id_opartslideshow_slideshow = ' . $obj->id;
$array = Db::getInstance()->executeS($sql);
if (count($array)) {
foreach ($array as $row) {
$cmsValues[] = $row['id_cms'];
}
$this->fields_value['cms[]'] = $cmsValues;
}
}
$html = $header = $this->context->smarty->fetch(parent::getTemplatePath() . 'header.tpl');
$html .= parent::renderForm();
return $html;
}
开发者ID:AmineBENCHEIKHBRAHIM,项目名称:LnsTech-Prestashop-WebSite,代码行数:51,代码来源:AdminSlideshowController.php
示例5: initContent
public function initContent()
{
if (!$this->errors) {
$lampStart = 0;
$lampLimit = 5;
$lampOrderBy = 'id_product';
$lampOrderWay = 'ASC';
$lampOnlyActive = true;
$lampIdCategory = 42;
$id_lang = (int) $this->context->language->id;
$lampIdCategories = CategoryCore::getChildren($lampIdCategory, $id_lang);
Product::getProducts($id_lang, $lampStart, $lampLimit, $lampOrderBy, $lampOrderWay, $lampIdCategory, $lampOnlyActive);
$prod = $this->product;
$this->context->smarty->assign(array('HOOK_LAMP_ACCESSORIES' => Hook::exec('lampAccessories')));
}
parent::initContent();
$this->setTemplate(_PS_THEME_DIR_ . 'product.tpl');
}
示例6: createProductsArray
/**
* @return array
* @throws \Exception
* @author Panagiotis Vagenas <pan.vagenas@gmail.com>
* @since 150213
*/
public function createProductsArray()
{
$products = \Product::getProducts($this->defaultLang, 0, 0, 'id_product', 'ASC', false, $this->Options->getValue('include_disabled'));
$backOrdersAvailString = $this->Options->getValue('avail_backorders');
$outOfStockAvailString = $this->Options->getValue('avail_outOfStock');
$backOrdersInclude = $this->String->is_not_empty($backOrdersAvailString);
$outOfStockInclude = $this->String->is_not_empty($outOfStockAvailString);
foreach ((array) $products as $key => $product) {
$p = new \Product($product['id_product']);
// TODO Check for product avail etc
$hasStock = $p->getRealQuantity($p->id) > 0;
// TODO Is this a convenient way?
if ($p->getType() != 0 || $p->visibility == 'none' || $p->available_for_order == 0) {
unset($products[$key]);
// TODO Log skipped product
continue;
}
if (!$hasStock) {
// TODO backOrdersAllowed not working as expected
if ($p->getRealQuantity($p->id) == 0 && !$outOfStockInclude) {
unset($products[$key]);
// TODO Log skipped product
continue;
} else {
if ($p->getRealQuantity($p->id) < 0 && (!$backOrdersInclude || !$this->backOrdersAllowed($p))) {
// quantity < 0
unset($products[$key]);
// TODO Log skipped product
continue;
}
}
}
$pushArray = $this->getProductArray($p);
if (!empty($pushArray)) {
$products[$key] = $pushArray;
} else {
// TODO Log skipped product
unset($products[$key]);
}
}
return $products;
}
示例7: getProductsByCategoryAndManufacturerID
public function getProductsByCategoryAndManufacturerID()
{
if (!isset($_GET['id_category']) && !isset($_GET['id_manufacturer'])) {
return false;
}
$id_category = $_GET['id_category'];
$id_manufacturer = $_GET['id_manufacturer'];
$delimiter = $_GET['delimiter'];
$product = new Product();
$res = $product->getProducts($id_category, $id_manufacturer, $delimiter);
while ($row = PDOQuery::getInstance()->next_row($res)) {
// $products .= '<li class="product-list">';
// $products .= '<a max="'.$row['stock_available'].'" price='.$row['price'].' href="tools/ajax/AjaxProductsController.php?action=getProductByID&id_product='.
// $row['id_product'].'">'.$row['product'].' ('.$row['stock_available'].')</a>';
// $products .= '</li>';
$products .= '{"stock_available": "' . $row['stock_available'] . '", "price": "' . $row['price'] . '", "id_product": "' . $row['id_product'] . '", "product": "' . $row['product'] . '"},';
}
$products = '{"success": [' . rtrim($products, ',') . ']}';
echo $products;
}
示例8: foreach
<a href="<?php
echo BASE_URL . '/product';
?>
" class="btn btn-default">Cancel</a>
<input type="hidden" value="<?php
echo $getProduct->id;
?>
" id="prod_id" />
</div>
</div>
</div>
</form>
</div>
<?php
} else {
echo '<div class="col-md-8"><h4>No Record Found</h4></div>';
}
} else {
$getProducts = $Products->getProducts();
if (count($getProducts)) {
foreach ($getProducts as $val) {
echo "<div class='col-md-6'>\n\t\t\t\t \t\t<div class='panel panel-warning'>\n\t\t\t\t\t\t<div class='panel-heading'><a href='" . BASE_URL . "/editproduct/{$val->id}'>{$val->product}</a></div>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>";
}
} else {
echo "<h4>No Record Yet</h4>";
}
}
?>
</div>
</div>
示例9: Exception
} else {
throw new Exception('Invalid manufactuer id "' . $id . '" passed in');
}
}
$manufacturerIds = array_map(create_function('$a', 'return $a->getId();'), $manufacturers);
foreach ($categoryIds as $id) {
if (($i = ProductCategory::get($id)) instanceof ProductCategory) {
$categories[] = $i;
echo 'try to disable all product with category "' . $i->getName() . '"(' . $i->getId() . ')' . "\n";
} else {
throw new Exception('Invalid category id "' . $id . '" passed in');
}
}
$categoryIds = array_map(create_function('$a', 'return $a->getId();'), $categories);
// run
$products = Product::getProducts('', '', array(), $manufacturerIds, $categoryIds);
$count = 0;
echo 'found total ' . count($products) . ' products' . "\n";
foreach ($products as $product) {
if ($product->getStockOnHand() == 0 && $product->getStockOnOrder() == 0 && $product->getStockOnPO() == 0 && $product->getStockInParts() == 0) {
$sku = $product->getSku();
disableProduct($sku);
$count++;
}
}
echo 'total ' . $count . ' products changed' . "\n";
echo "Done disableProducts from magento MELB TIME: " . UDate::now(UDate::TIME_ZONE_MELB) . "\n";
function disableProduct($sku)
{
$sku = trim($sku);
$params = array();
示例10: dirname
include dirname(__FILE__) . '/../../config/config.inc.php';
require_once dirname(__FILE__) . '/../../init.php';
// Get data
$number = intval(Tools::getValue('n')) ? intval(Tools::getValue('n')) : 10;
$orderByValues = array(0 => 'name', 1 => 'price', 2 => 'date_add', 3 => 'date_upd', 4 => 'position', 5 => 'manufacturer_name', 6 => 'quantity');
$orderWayValues = array(0 => 'ASC', 1 => 'DESC');
$orderBy = Tools::strtolower(Tools::getValue('orderby', $orderByValues[intval(Configuration::get('PS_PRODUCTS_ORDER_BY'))]));
$orderWay = Tools::strtoupper(Tools::getValue('orderway', $orderWayValues[intval(Configuration::get('PS_PRODUCTS_ORDER_WAY'))]));
if (!in_array($orderBy, $orderByValues)) {
$orderBy = $orderByValues[0];
}
if (!in_array($orderWay, $orderWayValues)) {
$orderWay = $orderWayValues[0];
}
$id_category = intval(Tools::getValue('id_category')) ? intval(Tools::getValue('id_category')) : 1;
$products = Product::getProducts(intval($cookie->id_lang), 0, $number > 10 ? 10 : $number, $orderBy, $orderWay, $id_category, true);
$currency = new Currency(intval($cookie->id_currency));
$affiliate = Tools::getValue('ac') ? '?ac=' . intval(Tools::getValue('ac')) : '';
// Send feed
header("Content-Type:text/xml; charset=utf-8");
echo '<?xml version="1.0" encoding="UTF-8"?>' . "\n";
?>
<rss version="2.0">
<channel>
<title><![CDATA[<?php
echo Configuration::get('PS_SHOP_NAME');
?>
]]></title>
<link><?php
echo _PS_BASE_URL_ . __PS_BASE_URI__;
?>
示例11: actionDisplay
public function actionDisplay($type)
{
$product = new Product();
$this->productList = $product->getProducts($type);
$this->render("productList", array("type" => $type));
}
示例12: generateProductsData
protected function generateProductsData()
{
$delimiter = ';';
$titles = array();
$id_lang = $this->use_lang;
$new_path = new Sampledatainstall();
$f = fopen($new_path->sendPath() . 'output/products.vsc', 'w');
foreach ($this->product_fields as $field => $array) {
$titles[] = $array['label'];
}
fputcsv($f, $titles, $delimiter, '"');
$products = Product::getProducts($id_lang, 0, 0, 'id_product', 'ASC', false, true);
foreach ($products as $product) {
$line = array();
$p = new Product($product['id_product'], true, $id_lang, 1);
foreach ($this->product_fields as $field => $array) {
$line[$field] = property_exists('Product', $field) && !is_array($p->{$field}) && !Tools::isEmpty($p->{$field}) ? $p->{$field} : '';
}
$cats = $p->getProductCategoriesFull($p->id, 1);
$cat_array = array();
foreach ($cats as $cat) {
$cat_array[] = $cat['id_category'];
}
$line['categories'] = implode(',', $cat_array);
$line['price_tex'] = $p->getPrice(false);
$line['price_tin'] = $p->getPrice(true);
$line['upc'] = $p->upc ? $p->upc : '';
$line['features'] = '';
$features = $p->getFrontFeatures($id_lang);
$position = 1;
$devider = '';
foreach ($features as $feature) {
$sql = 'SELECT `id_feature`
FROM ' . _DB_PREFIX_ . 'feature_lang
WHERE `name` = "' . pSql($feature['name']) . '"';
$sql1 = 'SELECT `id_feature_value`
FROM ' . _DB_PREFIX_ . 'feature_value_lang
WHERE `value` = "' . pSql($feature['value']) . '"';
$id_feature = Db::getInstance()->getValue($sql);
$id_feature_value = Db::getInstance()->getValue($sql1);
$line['features'] .= $devider . $id_feature . ':' . $id_feature_value . ':' . $position;
$devider = ',';
$position++;
}
$specificPrice = SpecificPrice::getSpecificPrice($p->id, 1, 0, 0, 0, 0);
$line['reduction_price'] = '';
$line['reduction_percent'] = '';
$line['reduction_from'] = '';
$line['reduction_to'] = '';
if ($specificPrice) {
if ($specificPrice['reduction_type'] == 'amount') {
$line['reduction_price'] = $specificPrice['reduction'];
} elseif ($specificPrice['reduction_type'] == 'percent') {
$line['reduction_percent'] = $specificPrice['reduction'];
}
if ($line['reduction_price'] !== '' || $line['reduction_percent'] !== '') {
$line['reduction_from'] = $specificPrice['from'];
$line['reduction_to'] = $specificPrice['to'];
}
}
$tags = $p->getTags($id_lang);
$line['tags'] = $tags;
$link = new Link();
$imagelinks = array();
$images = $p->getImages($id_lang);
foreach ($images as $image) {
$imagelink = Tools::getShopProtocol() . $link->getImageLink($p->link_rewrite, $p->id . '-' . $image['id_image']);
$this->copyConverFileName($imagelink);
$imagelinks[] = $imagelink;
}
$line['image'] = implode(',', $imagelinks);
$line['delete_existing_images'] = 0;
$line['shop'] = 1;
$warehouses = Warehouse::getWarehousesByProductId($p->id);
$line['warehouse'] = '';
if (!empty($warehouses)) {
$line['warehouse'] = implode(',', array_map("{$this->getWarehouses}", $warehouses));
}
$values = array();
$accesories = $p->getAccessories($id_lang);
if (isset($accesories) && $accesories && count($accesories)) {
foreach ($accesories as $accesorie) {
$values[] = $accesorie['id_product'];
}
}
$line['accessories'] = $values ? implode(',', $values) : '';
$values = array();
$carriers = $p->getCarriers();
if (isset($carriers) && $carriers && count($carriers)) {
foreach ($carriers as $carrier) {
$values[] = $carrier['id_carrier'];
}
}
$line['carriers'] = $values ? implode(',', $values) : '';
$values = array();
$customization_fields_ids = $p->getCustomizationFieldIds();
if (class_exists('CustomizationField') && isset($customization_fields_ids) && $customization_fields_ids && count($customization_fields_ids)) {
foreach ($customization_fields_ids as $customization_field_id) {
$cf = new CustomizationField($customization_field_id['id_customization_field'], $this->use_lang);
$values[] = $cf->id . ':' . $cf->type . ':' . $cf->required . ':' . $cf->name;
//.........这里部分代码省略.........
示例13: showAction
public function showAction($title = 'Main', $idCategory = 0)
{
parent::GetSideCategories(0);
$this->tag->appendTitle(': ' . $title);
$this->view->products = Product::getProducts($idCategory);
}
示例14: getItems
/**
* Getting the items
*
* @param unknown $sender
* @param unknown $param
* @throws Exception
*
*/
public function getItems($sender, $param)
{
$results = $errors = array();
try {
$class = trim($this->_focusEntity);
if (!isset($param->CallbackParameter->searchCriteria) || count($serachCriteria = json_decode(json_encode($param->CallbackParameter->searchCriteria), true)) === 0) {
throw new Exception('System Error: search criteria not provided!');
}
$sumArray = array();
if (isset($serachCriteria['pro.id']) && ($product = Product::get($serachCriteria['pro.id'])) instanceof Product) {
$objects = array($product);
$stats = array('totalPages' => 1);
} else {
$pageNo = 1;
$pageSize = DaoQuery::DEFAUTL_PAGE_SIZE;
if (isset($param->CallbackParameter->pagination)) {
$pageNo = $param->CallbackParameter->pagination->pageNo;
$pageSize = $param->CallbackParameter->pagination->pageSize;
}
$stats = array();
$serachCriteria = $this->getSearchCriteria($serachCriteria);
$objects = Product::getProducts($serachCriteria->sku, $serachCriteria->name, $serachCriteria->supplierIds, $serachCriteria->manufacturerIds, $serachCriteria->categoryIds, $serachCriteria->productStatusIds, $serachCriteria->active, $pageNo, $pageSize, array('pro.name' => 'asc'), $stats, $serachCriteria->stockLevel, $sumArray, $serachCriteria->sh_from, $serachCriteria->sh_to, $serachCriteria->sellOnWeb);
}
$results['pageStats'] = $stats;
$results['items'] = array();
foreach ($objects as $obj) {
$results['items'][] = $obj->getJson();
}
$results['totalStockOnHand'] = isset($sumArray['totalStockOnHand']) ? trim($sumArray['totalStockOnHand']) : 0;
$results['totalOnHandValue'] = isset($sumArray['totalOnHandValue']) ? trim($sumArray['totalOnHandValue']) : 0;
} catch (Exception $ex) {
$errors[] = $ex->getMessage();
}
$param->ResponseData = StringUtilsAbstract::getJson($results, $errors);
}
示例15: getArticle
public function getArticle($start, $limit)
{
$product = new Product();
$procucts = $product->getProducts($this->id_lang, $start, $limit, 'id_product', 'ASC');
return $procucts;
}