本文整理汇总了PHP中fn_gather_additional_products_data函数的典型用法代码示例。如果您正苦于以下问题:PHP fn_gather_additional_products_data函数的具体用法?PHP fn_gather_additional_products_data怎么用?PHP fn_gather_additional_products_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fn_gather_additional_products_data函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: processProducts
/**
* Gets products for printing and print them
* @param array $params product search params
*/
protected function processProducts($params)
{
$total = static::ITEMS_PER_PAGE;
while (static::ITEMS_PER_PAGE * ($params['page'] - 1) <= $total) {
list($products, $search) = fn_get_products($params, static::ITEMS_PER_PAGE);
$total = $search['total_items'];
if ($params['page'] == 1) {
fn_set_progress('parts', $total);
}
$get_images = !empty($this->selected_fields['image']);
$_params = array('get_icon' => $get_images, 'get_detailed' => $get_images, 'get_options' => Registry::get('addons.price_list.include_options') == 'Y' ? true : false, 'get_discounts' => false);
fn_gather_additional_products_data($products, $_params);
$params['page']++;
$this->printProductsBatch(true);
foreach ($products as $product) {
fn_set_progress('echo');
if (Registry::get('addons.price_list.include_options') == 'Y' && $product['has_options']) {
$product = fn_price_list_get_combination($product);
foreach ($product['combinations'] as $c_id => $c_value) {
$product['price'] = $product['combination_prices'][$c_id];
$product['weight'] = $product['combination_weight'][$c_id];
$product['amount'] = $product['combination_amount'][$c_id];
$product['product_code'] = $product['combination_code'][$c_id];
$this->printProductRow($product, $c_value);
}
} else {
$this->printProductRow($product);
}
}
$this->printProductsBatch();
}
}
开发者ID:ambient-lounge,项目名称:site,代码行数:36,代码来源:AGenerator.php
示例2: fn_required_products_get_product_data_post
function fn_required_products_get_product_data_post(&$product, &$auth)
{
if (!empty($product['product_id'])) {
list($required) = fn_get_products(array('for_required_product' => $product['product_id']));
if (count($required)) {
$product['have_required'] = 'Y';
$ids = fn_array_column($required, 'product_id');
$have = fn_required_products_get_existent($auth, $ids);
$product['required_products'] = array();
fn_gather_additional_products_data($required, array('get_icon' => true, 'get_detailed' => true, 'get_options' => true, 'get_discounts' => true));
foreach ($required as $entry) {
$id = $entry['product_id'];
$product['required_products'][$id] = $entry;
$product['required_products'][$id]['bought'] = $have && in_array($id, $have) ? 'Y' : 'N';
}
if (!empty($have) && count($have) >= count($ids)) {
$product['can_add_to_cart'] = 'Y';
} else {
$product['can_add_to_cart'] = 'N';
}
} else {
$product['have_required'] = 'N';
}
}
}
开发者ID:ambient-lounge,项目名称:site,代码行数:25,代码来源:func.php
示例3: index
public function index($id = 0, $params = array())
{
$lang_code = $this->safeGet($params, 'lang_code', DEFAULT_LANGUAGE);
if ($this->getParentName() == 'categories') {
$parent_category = $this->getParentData();
$params['cid'] = $parent_category['category_id'];
}
if (!empty($id)) {
$data = fn_get_product_data($id, $this->auth, $lang_code, '', true, true, true, false, false, false, false);
if (empty($data)) {
$status = Response::STATUS_NOT_FOUND;
} else {
$status = Response::STATUS_OK;
}
} else {
$items_per_page = $this->safeGet($params, 'items_per_page', Registry::get('settings.Appearance.admin_products_per_page'));
$params['extend'][] = 'categories';
list($products, $search) = fn_get_products($params, $items_per_page, $lang_code);
$params['get_options'] = $this->safeGet($params, 'get_options', false);
$params['get_features'] = $this->safeGet($params, 'get_features', true);
$params['get_detailed'] = $this->safeGet($params, 'get_detailed', true);
$params['get_icon'] = $this->safeGet($params, 'get_icon', true);
$params['get_additional'] = $this->safeGet($params, 'get_additional', true);
$params['detailed_params'] = $this->safeGet($params, 'detailed_params', false);
$params['features_display_on'] = 'A';
fn_gather_additional_products_data($products, $params);
$data = array('products' => array_values($products), 'params' => $search);
$status = Response::STATUS_OK;
}
return array('status' => $status, 'data' => $data);
}
开发者ID:askzap,项目名称:ultimate,代码行数:31,代码来源:Products.php
示例4: fn_required_products_get_product_data_post
function fn_required_products_get_product_data_post(&$product, &$auth)
{
if (!empty($product['product_id'])) {
list($required) = fn_get_products(array('for_required_product' => $product['product_id']));
//var_dump($required);
//var_dump(AREA);
if (AREA != "A") {
$checkedVariants = db_get_fields("SELECT required_id FROM ?:product_required_products WHERE product_id=?i AND linked=1", $_REQUEST['product_id']);
foreach ($required as $keyProductRequired => $productRequired) {
if (in_array($productRequired['product_id'], $checkedVariants)) {
unset($required[$keyProductRequired]);
}
}
}
if (count($required)) {
$product['have_required'] = 'Y';
$ids = array();
foreach ($required as $entry) {
$ids[] = $entry['product_id'];
}
$have = fn_required_products_get_existent($auth, $ids, false);
$product['required_products'] = array();
fn_gather_additional_products_data($required, array('get_icon' => true, 'get_detailed' => true, 'get_options' => true, 'get_discounts' => true));
foreach ($required as $entry) {
$id = $entry['product_id'];
$product['required_products'][$id] = $entry;
$product['required_products'][$id]['bought'] = $have && in_array($id, $have) ? 'Y' : 'N';
}
if (!empty($have) && count($have) >= count($ids)) {
$product['can_add_to_cart'] = 'Y';
} else {
$product['can_add_to_cart'] = 'N';
}
} else {
$product['have_required'] = 'N';
}
}
}
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:38,代码来源:func.php
示例5: fn_rssf_get_items
function fn_rssf_get_items($params, $lang_code = CART_LANGUAGE)
{
$items_data = $additional_data = $block_data = array();
if (!empty($params['bid']) && !empty($params['sid']) && empty($params['category_id'])) {
$block_data = Block::instance()->getById($params['bid'], $params['sid'], array(), $lang_code);
if (!empty($block_data['content']['filling']) && $block_data['content']['filling'] == 'products') {
$_params = array('sort_by' => $block_data['properties']['filling']['products']['rss_sort_by'] == 'U' ? 'updated_timestamp' : 'timestamp', 'sort_order' => 'desc');
$max_items = !empty($block_data['properties']['max_item']) ? $block_data['properties']['max_item'] : 5;
list($products) = fn_get_products($_params, $max_items, $lang_code);
fn_gather_additional_products_data($products, array('get_icon' => true, 'get_detailed' => true, 'get_options' => false, 'get_discounts' => false));
$additional_data['title'] = !empty($block_data['properties']['feed_title']) ? $block_data['properties']['feed_title'] : __('products') . '::' . __('page_title', '', $lang_code);
$additional_data['description'] = !empty($block_data['properties']['feed_description']) ? $block_data['properties']['feed_description'] : $additional_data['title'];
$additional_data['link'] = fn_url('', 'C', 'http', $lang_code);
$additional_data['language'] = $lang_code;
$additional_data['lastBuildDate'] = !empty($products[0]['updated_timestamp']) ? $products[0]['updated_timestamp'] : TIME;
$items_data = fn_format_products_items($products, $block_data['properties']['filling']['products'], $lang_code);
}
} else {
//show rss feed for categories page
list($items_data, $additional_data) = fn_format_categories_items($params, $lang_code);
}
fn_set_hook('generate_rss_feed', $items_data, $additional_data, $block_data, $lang_code);
return array($items_data, $additional_data);
}
开发者ID:arpad9,项目名称:bygmarket,代码行数:24,代码来源:rss.php
示例6: fn_mailru_prepare_offer
function fn_mailru_prepare_offer($products, $options, $enclosure)
{
//array error
$error_products = array('products_zero_price' => '', 'disabled_products' => '', 'out_of_stock' => '', 'empty_brand' => '', 'empty_model' => '', 'disable_cat_list' => '', 'disable_cat_list_d' => '');
//data addons mail
$addon_settings = Registry::get('addons.rus_tovary_mailru');
$delivery_type = $addon_settings['delivery_type'];
list($products, $product_ids) = fn_mailru_filter_products($products, $addon_settings, $error_products);
if (empty($products)) {
return true;
}
//category
$visible_categories = fn_mailru_get_visible_categories($addon_settings);
$fields = array('p.product_id', 'p.mailru_brand', 'p.mailru_model', 'p.mailru_delivery', 'p.mailru_pickup', 'p.mailru_cost', 'p.mailru_type_prefix', 'p.mailru_mcp');
$fields[] = "(\n SELECT GROUP_CONCAT(IF(pc2.link_type = 'M', CONCAT(pc2.category_id, 'M'), pc2.category_id))\n FROM ?:products_categories as pc2\n WHERE product_id = p.product_id\n ) as category_ids";
$mailru_products = db_get_hash_array('SELECT ' . implode(', ', $fields) . ' FROM ?:products as p WHERE product_id IN (?n)', 'product_id', $product_ids);
$products_zero_price = '';
foreach ($products as $key => $product) {
$products[$key]['category_ids'] = $mailru_products[$product['product_id']]['category_ids'];
}
$params = array('get_options' => false, 'get_taxed_prices' => false, 'detailed_params' => false);
fn_gather_additional_products_data($products, $params);
foreach ($products as $data) {
$yml = array();
if ($data['status'] != 'A') {
continue;
}
if ($addon_settings['disable_cat_d'] == "Y") {
if (!in_array($data['category'], $visible_categories)) {
$error_products['disable_cat_list_d'] .= $data['product_name'] . ', ';
continue;
}
}
$avail = fn_is_accessible_product(array('product_id' => $data['product_id'])) ? 'true' : 'false';
$currency = Registry::get('currencies.' . CART_PRIMARY_CURRENCY);
$data['price'] = !empty($data['price']) ? $data['price'] : $data['price'];
$data['price'] = fn_format_price($data['price'], $currency['currency_code'], $currency['decimals'], false);
if (CART_PRIMARY_CURRENCY != "RUB") {
$currencies = Registry::get('currencies');
if (isset($currencies['RUB'])) {
$currency = $currencies['RUB'];
$price = fn_format_rate_value($data['price'], 'F', $currency['decimals'], $currency['decimals_separator'], $currency['thousands_separator'], $currency['coefficient']);
} else {
$price = $data['price'];
}
$price = !floatval($price) ? fn_parse_price($price) : $price;
$delivery_cost = fn_mailru_format_price($mailru_products[$data['product_id']]['mailru_cost'], "RUB");
$delivery_cost = !floatval($delivery_cost) ? fn_parse_price($delivery_cost) : $delivery_cost;
} else {
$price = !floatval($data['price']) ? fn_parse_price($data['price']) : $data['price'];
$delivery_cost = !floatval($mailru_products[$data['product_id']]['mailru_cost']) ? fn_parse_price($mailru_products[$data['product_id']]['mailru_cost']) : $mailru_products[$data['product_id']]['mailru_cost'];
}
if (empty($price)) {
$products_zero_price .= $data['product'] . ', ';
continue;
}
$brand = fn_mailru_get_brand($data, $mailru_products[$data['product_id']], $addon_settings);
$url = fn_url($data['product_url']);
$url = htmlentities($url);
$offer_attrs = '';
if (!empty($mailru_products[$data['product_id']]['mailru_mcp'])) {
$offer_attrs .= '@cbid=' . $mailru_products[$data['product_id']]['mailru_mcp'];
}
if (CART_PRIMARY_CURRENCY == "RUB") {
$currency_id = "RUR";
} elseif (CART_PRIMARY_CURRENCY == "EUR") {
$currency_id = "EURO";
} else {
$currency_id = CART_PRIMARY_CURRENCY;
}
$image_url = fn_tovary_mailru_c_encode($data['image_url']);
$s = urlencode("–");
$image_url = str_replace("–", $s, $image_url);
$yml['url'] = $url;
$yml['price'] = $price;
$yml['currencyId'] = $currency_id;
$yml['categoryId'] = $data['category'];
if (!empty($image_url)) {
$yml['picture'] = $image_url;
}
if ($addon_settings['mail_settings'] == "type_name") {
$yml['name'] = htmlspecialchars($data['product_name']);
} elseif ($addon_settings['mail_settings'] == "type_detailed" && !empty($mailru_products[$data['product_id']]['mailru_model'])) {
if ($addon_settings['type_prefix'] == "Y") {
if (!empty($mailru_products[$data['product_id']]['mailru_type_prefix'])) {
$yml['typePrefix'] = $mailru_products[$data['product_id']]['mailru_type_prefix'];
} else {
$yml['typePrefix'] = $data['category_descriptions'];
}
}
if (empty($brand)) {
$error_products['empty_brand'] .= $data['product_name'] . ', ';
} else {
$yml['vendor'] = $brand;
}
$yml['model'] = $mailru_products[$data['product_id']]['mailru_model'];
} else {
continue;
}
if (!empty($data['full_description'])) {
//.........这里部分代码省略.........
开发者ID:ambient-lounge,项目名称:site,代码行数:101,代码来源:func.php
示例7: empty
$products_footer[$k]['extra'] = empty($products_footer[$k]['extra']) ? array() : $products_footer[$k]['extra'];
$products_footer[$k]['extra'] = array_merge($products_footer[$k]['extra'], $extra);
if (isset($products_footer[$k]['extra']['product_options']) || $_options) {
$products_footer[$k]['selected_options'] = empty($products_footer[$k]['extra']['product_options']) ? $_options : $products_footer[$k]['extra']['product_options'];
}
if (!empty($products_footer[$k]['selected_options'])) {
$options = fn_get_selected_product_options($v['product_id'], $v['product_options'], CART_LANGUAGE);
foreach ($products_footer[$k]['selected_options'] as $option_id => $variant_id) {
foreach ($options as $option) {
if ($option['option_id'] == $option_id && !in_array($option['option_type'], array('I', 'T', 'F')) && empty($variant_id)) {
$products_footer[$k]['changed_option'] = $option_id;
break 2;
}
}
}
}
$products_footer[$k]['display_subtotal'] = $products_footer[$k]['price'] * $v['amount'];
$products_footer[$k]['display_amount'] = $v['amount'];
$products_footer[$k]['cart_id'] = $k;
/* $products_footer[$k]['product_options'] = fn_get_selected_product_options($v['product_id'], $v['product_options'], CART_LANGUAGE);
$products_footer[$k]['price'] = fn_apply_options_modifiers($v['product_options'], $products_footer[$k]['price'], 'P'); */
if (!empty($products_footer[$k]['extra']['parent'])) {
$extra_products[$k] = $products_footer[$k];
unset($products_footer[$k]);
continue;
}
}
}
fn_gather_additional_products_data($products_footer, array('get_icon' => true, 'get_detailed' => true, 'get_options' => true, 'get_discounts' => true));
//$view->assign('show_qty', true);
$view->assign('products_footer', $products_footer);
开发者ID:OneataBogdan,项目名称:coriolan_backup,代码行数:31,代码来源:checkout.php
示例8: fn_twg_api_get_products
/**
* Get products as API list
* @param array $params
* @param integer $items_per_page
* @param string $lang_code
* @return array array('products' => array(), 'params' => array())
*/
function fn_twg_api_get_products($params, $items_per_page = 10, $lang_code = CART_LANGUAGE)
{
$to_unserialize = array('extend', 'variants');
foreach ($to_unserialize as $field) {
if (!empty($params[$field]) && is_string($params[$field])) {
$params[$field] = unserialize($params[$field]);
}
}
if (empty($params['extend'])) {
$params['extend'] = array('description');
}
if (!empty($params['pid']) && !is_array($params['pid'])) {
$params['pid'] = explode(',', $params['pid']);
}
if (!empty($params['q'])) {
// search by product code
$params['ppcode'] = 'Y';
$params['subcats'] = 'Y';
$params['status'] = 'A';
$params['pshort'] = 'Y';
$params['pfull'] = 'Y';
$params['pname'] = 'Y';
$params['pkeywords'] = 'Y';
$params['search_performed'] = 'Y';
}
if (isset($params['company_id']) and $params['company_id'] == 0) {
unset($params['company_id']);
}
if (empty($params['page'])) {
$params['page'] = 1;
}
list($products, $params) = fn_get_products($params, $items_per_page, $lang_code);
fn_gather_additional_products_data($products, array('get_icon' => true, 'get_detailed' => true, 'get_options' => true, 'get_discounts' => true, 'get_features' => false));
if (empty($products)) {
return array(array(), array());
}
$product_ids = array();
$image_params = TwigmoSettings::get('images.catalog');
foreach ($products as $k => $v) {
if (!empty($products[$k]['short_description']) || !empty($products[$k]['full_description'])) {
$products[$k]['short_description'] = !empty($products[$k]['short_description']) ? strip_tags($products[$k]['short_description']) : fn_substr(strip_tags($products[$k]['full_description']), 0, TWG_MAX_DESCRIPTION_LEN);
unset($products[$k]['full_description']);
} else {
$products[$k]['short_description'] = '';
}
$product_ids[] = $v['product_id'];
// Get product image data
if (!empty($v['main_pair'])) {
$products[$k]['icon'] = TwigmoImage::getApiImageData($v['main_pair'], 'product', 'icon', $image_params);
}
}
$category_descr = !empty($product_ids) ? db_get_hash_array("SELECT p.product_id, p.category_id, c.category\n FROM ?:products_categories AS p, ?:category_descriptions AS c\n WHERE c.category_id = p.category_id\n AND c.lang_code = ?s\n AND p.product_id IN (?a)\n AND p.link_type = 'M'", 'product_id', $lang_code, $product_ids) : array();
foreach ($products as $key => $product) {
if (!empty($product['product_id']) && !empty($category_descr[$product['product_id']])) {
$products[$key]['category'] = $category_descr[$product['product_id']]['category'];
$products[$key]['category_id'] = $category_descr[$product['product_id']]['category_id'];
}
if (!empty($product['inventory_amount']) && $product['inventory_amount'] > $product['amount']) {
$products[$key]['amount'] = $product['inventory_amount'];
}
}
$result = Api::getAsList('products', $products);
return array($result, $params);
}
开发者ID:arpad9,项目名称:bygmarket,代码行数:71,代码来源:func.php
示例9: die
* and use this program. *
* *
****************************************************************************
* PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
****************************************************************************/
use Tygh\Registry;
if (!defined('BOOTSTRAP')) {
die('Access denied');
}
$xml = '<?xml version="1.0" encoding="' . CHARSET . '"?>';
// Products management
if ($mode == 'get_products') {
$_REQUEST['extend'] = empty($_REQUEST['type']) ? array('description') : array($_REQUEST['type']);
list($products) = fn_get_products($_REQUEST, Registry::get('settings.Appearance.products_per_page'));
fn_gather_additional_products_data($products, array('get_icon' => true));
$xml .= fn_array_to_xml($products, 'products');
}
//
// View product details
//
if ($mode == 'get_product') {
$_REQUEST['product_id'] = empty($_REQUEST['product_id']) ? 0 : $_REQUEST['product_id'];
$product = fn_get_product_data($_REQUEST['product_id'], $auth, CART_LANGUAGE);
if (!empty($product)) {
if (!empty($_REQUEST['combination'])) {
$product['combination'] = $combination;
}
fn_gather_additional_product_data($product, true, true);
$xml .= fn_array_to_xml($product, 'product_data');
}
开发者ID:askzap,项目名称:ultimate,代码行数:31,代码来源:xml_feeds.php
示例10: while
$tbl .= '</table>';
Pdf::batchAdd($tbl);
$page = 1;
$total = ITEMS_PER_PAGE;
$fill = true;
$params = $_REQUEST;
$params['sort_by'] = $price_schema['fields'][Registry::get('addons.price_list.price_list_sorting')]['sort_by'];
$params['page'] = $page;
$params['skip_view'] = 'Y';
$params['cid'] = $category['category_id'];
$params['subcats'] = 'N';
while (ITEMS_PER_PAGE * ($params['page'] - 1) <= $total) {
list($products, $search) = fn_get_products($params, ITEMS_PER_PAGE);
$total = $search['total_items'];
$_params = array('get_icon' => true, 'get_detailed' => true, 'get_options' => Registry::get('addons.price_list.include_options') == 'Y' ? true : false, 'get_discounts' => false);
fn_gather_additional_products_data($products, $_params);
$params['page']++;
$tbl = '<table border="0" cellpadding="' . TABLE_CELLPADDING . '" cellspacing="' . TABLE_CELLSPACING . '" width="100%">';
// Write products information
foreach ($products as $product) {
if ($fill) {
$style = 'style="background-color: ' . FIELDS_ODD_BG_COLOR . '"';
} else {
$style = '';
}
if (Registry::get('addons.price_list.include_options') == 'Y' && $product['has_options']) {
$product = fn_price_list_get_combination($product);
foreach ($product['combinations'] as $c_id => $c_value) {
$product['price'] = $product['combination_prices'][$c_id];
$product['weight'] = $product['combination_weight'][$c_id];
$product['amount'] = $product['combination_amount'][$c_id];
开发者ID:askzap,项目名称:ultimate,代码行数:31,代码来源:pdf.php
示例11: fn_buy_together_get_chains
/**
* Get products chains
*
* @param array $params Parameters for the function
* @param array $auth Array of user authentication data
* @param string $lang_code 2-letter language code (e.g. 'en', 'ru', etc.)
*
* @return array Chains of products
*/
function fn_buy_together_get_chains($params = array(), $auth = array(), $lang_code = CART_LANGUAGE)
{
/**
* Modify product chains get parameters
*
* @param array $params Parameters for the function
* @param array $auth Array of user authentication data
* @param string $lang_code 2-letter language code (e.g. 'en', 'ru', etc.)
*/
fn_set_hook('buy_together_get_chains_pre', $parms, $auth, $lang_code);
$fields = array('items.chain_id', 'items.product_id', 'items.products', 'items.modifier', 'items.modifier_type', 'items.date_from', 'items.date_to', 'items.display_in_promotions', 'items.status', 'descr.name', 'descr.description');
if (fn_allowed_for('ULTIMATE')) {
$fields[] = 'p.company_id';
}
$conditions = array();
$joins = array();
$joins[] = db_quote("LEFT JOIN ?:products AS p ON p.product_id = items.product_id");
$joins[] = db_quote("LEFT JOIN ?:buy_together_descriptions AS descr ON items.chain_id = descr.chain_id AND descr.lang_code = ?s", $lang_code);
if (!empty($params['product_id'])) {
$conditions['product_id'] = db_quote('items.product_id = ?i', $params['product_id']);
}
if (!empty($params['chain_id'])) {
$conditions['chain_id'] = db_quote('items.chain_id = ?i', $params['chain_id']);
}
if (!empty($params['status'])) {
$conditions['status'] = db_quote('items.status = ?s', $params['status']);
}
if (!empty($params['date']) && $params['date']) {
$date = mktime(0, 0, 0);
$conditions['date'] = db_quote('(items.date_from <= ?i AND items.date_to >= ?i)', $date, $date);
}
if (!empty($params['promotions']) && $params['promotions']) {
$conditions['promotions'] = db_quote('items.display_in_promotions = ?s', 'Y');
}
/**
* Change select condition (fields, conditions, joins) before selecting payment method data
*
* @param array $params Parameters for the function
* @param array $auth Array of user authentication data
* @param string $lang_code 2-letter language code (e.g. 'en', 'ru', etc.)
* @param array $fields Array of fields to be selected
* @param array $conditions Array of complete condition expressions to be applied to the end of an SQL-query
* @param array $joins List of strings with the complete JOIN information (JOIN type, tables and fields) for an SQL-query
*
*/
fn_set_hook('buy_together_get_chains', $params, $auth, $lang_code, $fields, $conditions, $joins);
if (!empty($conditions)) {
$condition = 'WHERE ' . implode(' AND ', $conditions);
} else {
$condition = '';
}
$fields = implode(', ', $fields);
$joins = implode(' ', $joins);
$chains = db_get_array("SELECT {$fields} FROM ?:buy_together AS items {$joins} {$condition}");
if (!empty($chains)) {
$selected_options = isset($params['selected_options']) ? $params['selected_options'] : array();
$product_ids = array();
$products = array();
if (!empty($params['full_info'])) {
foreach ($chains as $chain) {
$product_ids[$chain['product_id']] = $chain['product_id'];
$chain_products = unserialize($chain['products']);
foreach ($chain_products as $product) {
$product_ids[$product['product_id']] = $product['product_id'];
}
}
list($products) = fn_get_products(array('pid' => $product_ids));
}
foreach ($chains as $key => &$chain) {
$chain['products'] = unserialize($chain['products']);
if (!empty($params['full_info'])) {
$is_valid = true;
if (isset($auth['area']) && $auth['area'] == 'C' && empty($chain['products'])) {
unset($chains[$key]);
continue;
}
if (!isset($products[$chain['product_id']])) {
unset($chains[$key]);
continue;
}
$chain['products_info'] = $chain['products'];
$main_product = $products[$chain['product_id']];
$option_key = $main_product['product_id'] . '_' . $chain['chain_id'];
$main_product['selected_options'] = isset($selected_options[$option_key]['selected_options']) ? $selected_options[$option_key]['selected_options'] : '';
$main_product['changed_option'] = isset($selected_options[$option_key]['changed_option']) ? $params['selected_options'][$option_key]['changed_option'] : '';
fn_gather_additional_products_data($main_product, array('get_icon' => true, 'get_detailed' => true, 'get_additional' => false, 'get_options' => true, 'get_discounts' => true));
$chain['product_name'] = $main_product['product'];
$chain['chain_amount'] = $main_product['min_qty'] > 0 ? $main_product['min_qty'] : 1;
$chain['min_qty'] = $main_product['min_qty'] = 1;
$chain['price'] = $main_product['price'];
$chain['list_price'] = $main_product['list_price'];
//.........这里部分代码省略.........
开发者ID:ambient-lounge,项目名称:site,代码行数:101,代码来源:func.php
示例12: list
if (Registry::get('settings.General.show_products_from_subcategories') == 'Y') {
$params['subcats'] = 'Y';
}
if (isset($_REQUEST['ls_view_all'])) {
list($products, $search) = fn_get_products($params, 10000, CART_LANGUAGE);
$ls_view_all = true;
list($products2, $search2) = fn_get_products($params, Registry::get('settings.Appearance.products_per_page'), CART_LANGUAGE);
} else {
list($products, $search) = fn_get_products($params, Registry::get('settings.Appearance.products_per_page'), CART_LANGUAGE);
$ls_view_all = false;
}
if (isset($search['page']) && $search['page'] > 1 && empty($products)) {
return array(CONTROLLER_STATUS_NO_PAGE);
}
$colorOptionFlag = false;
$colorOptionVariants = array();
foreach ($products as $product123) {
$colorOptionCheck = db_get_row("SELECT ?:product_options.option_id FROM ?:product_options LEFT JOIN ?:product_global_option_links ON ?:product_options.option_id=?:product_global_option_links.option_id WHERE (?:product_options.product_id=?i OR ?:product_global_option_links.product_id=?i) AND ?:product_options.option_id = 2291", $product123['product_id'], $product123['product_id']);
if (!empty($colorOptionCheck)) {
$colorOptionFlag = true;
}
}
if ($colorOptionFlag) {
$colorOptionVariants = db_get_array("SELECT ?:product_option_variants.*, ?:product_option_variants_descriptions.variant_name FROM ?:product_option_variants JOIN ?:product_option_variants_descriptions ON ?:product_option_variants.variant_id=?:product_option_variants_descriptions.variant_id WHERE ?:product_option_variants.option_id=2291 AND ?:product_option_variants_descriptions.lang_code = ?s", CART_LANGUAGE);
}
Registry::get('view')->assign('colorOptionVariants', $colorOptionVariants);
fn_gather_additional_products_data($products, array('get_icon' => true, 'get_detailed' => true, 'get_additional' => true, 'get_options' => true, 'get_discounts' => true, 'get_features' => false, 'get_extra' => false, 'get_taxed_prices' => true, 'get_for_one_product' => !is_array(reset($products)) ? true : false, 'detailed_params' => true, 'features_display_on' => 'C', 'ls_category_page' => true));
$show_no_products_block = !empty($params['features_hash']) && !$products;
Registry::get('view')->assign('show_no_products_block', $show_no_products_block);
foreach ($products as $keyProduct => $categoryProducts) {
$promoName = "";
开发者ID:OneataBogdan,项目名称:lead_coriolan,代码行数:31,代码来源:categories.php
示例13: elseif
} elseif ($mode == 'on_sale') {
$title = __("on_sale");
$params['on_sale'] = true;
} elseif ($mode == 'bestsellers') {
$title = __("bestsellers");
$params['bestsellers'] = true;
$params['sales_amount_from'] = Registry::get('addons.bestsellers.sales_amount_from');
} elseif ($mode == 'newest') {
$title = __("newest");
$params['sort_by'] = empty($params['sort_by']) ? 'timestamp' : $params['sort_by'];
$params['plain'] = true;
$params['visible'] = true;
$period = Registry::get('addons.bestsellers.period');
$params['period'] = 'A';
if ($period == 'today') {
$params['period'] = 'D';
} elseif ($period == 'last_days') {
$params['period'] = 'HC';
$params['last_days'] = Registry::get('addons.bestsellers.last_days');
}
} else {
$title = __('products');
}
fn_add_breadcrumb($title);
list($products, $search) = fn_get_products($params, Registry::get('settings.Appearance.products_per_page'));
fn_gather_additional_products_data($products, array('get_icon' => true, 'get_detailed' => true, 'get_additional' => true, 'get_options' => true));
$selected_layout = fn_get_products_layout($params);
Registry::get('view')->assign('products', $products);
Registry::get('view')->assign('search', $search);
Registry::get('view')->assign('selected_layout', $selected_layout);
}
开发者ID:heg-arc-ne,项目名称:cscart,代码行数:31,代码来源:products.post.php
示例14: body
protected function body($file)
{
$offered = array();
if ($this->options['disable_cat_d'] == "Y") {
$visible_categories = $this->getVisibleCategories();
}
$fields = array('p.product_id', 'p.product_code', 'd.lang_code', 'pc.category_id', 'cd.category', 'pp.price', 'p.list_price', 'p.status', 'p.amount', 'p.weight', 'p.shipping_freight', 'p.free_shipping', 'd.product', 'd.full_description', 'p.company_id', 'p.tracking', 'p.list_price', 'p.yml_brand', 'p.yml_origin_country', 'p.yml_store', 'p.yml_pickup', 'p.yml_delivery', 'p.yml_adult', 'p.yml_cost', 'p.yml_export_yes', 'p.yml_bid', 'p.yml_cbid', 'p.yml_model', 'p.yml_sales_notes', 'p.yml_type_prefix', 'p.yml_market_category', 'p.yml_manufacturer_warranty', 'p.yml_seller_warranty');
$fields[] = "(\n SELECT GROUP_CONCAT(IF(pc2.link_type = 'M', CONCAT(pc2.category_id, 'M'), pc2.category_id))\n FROM ?:products_categories as pc2\n WHERE product_id = p.product_id\n ) as category_ids";
$joins = array(db_quote("LEFT JOIN ?:product_descriptions as d ON d.product_id = p.product_id AND d.lang_code = ?s", $this->lang_code), db_quote("LEFT JOIN ?:product_prices as pp" . " ON pp.product_id = p.product_id AND pp.lower_limit = 1 AND pp.usergroup_id = 0"), db_quote("LEFT JOIN ?:products_categories as pc ON pc.product_id = p.product_id AND pc.link_type = ?s", 'M'), db_quote("LEFT JOIN ?:category_descriptions as cd ON cd.category_id = pc.category_id AND cd.lang_code = ?s", $this->lang_code));
$condition = '';
if ($this->company_id > 0) {
$condition .= db_quote(' AND company_id = ?i', $this->company_id);
}
$product_ids = db_get_fields("SELECT product_id FROM ?:products WHERE yml_export_yes = ?s AND status = ?s " . $condition, 'Y', 'A');
$offset = 0;
while ($ids = array_slice($product_ids, $offset, self::ITERATION_ITEMS)) {
$offset += self::ITERATION_ITEMS;
$products = db_get_array('SELECT ' . implode(', ', $fields) . ' FROM ?:products as p' . ' ' . implode(' ', $joins) . ' WHERE p.product_id IN(?n)', $ids);
$products_images_main = fn_get_image_pairs($ids, 'product', 'M', false, true, $this->lang_code);
$products_images_additional = fn_get_image_pairs($ids, 'product', 'A', false, true, $this->lang_code);
$params = array('get_options' => false, 'get_taxed_prices' => false, 'detailed_params' => false);
fn_gather_additional_products_data($products, $params);
foreach ($products as $k => &$product) {
$is_broken = false;
$price = !floatval($product['price']) ? fn_parse_price($product['price']) : intval($product['price']);
if ($this->options['export_null_price'] == 'N' && empty($price)) {
$is_broken = true;
}
if (in_array($product['category_id'], $this->disabled_category_ids)) {
$is_broken = true;
}
if ($this->options['disable_cat_d'] == 'Y' && !in_array($product['category_id'], $visible_categories)) {
$is_broken = true;
}
$product['product'] = $this->escape($product['product']);
$product['full_description'] = $this->escape($product['full_description']);
$product['product_features'] = $this->getProductFeatures($product);
$product['brand'] = $this->getBrand($product);
if ($this->options['export_type'] == 'vendor_model') {
if (empty($product['brand']) || empty($product['yml_model'])) {
$is_broken = true;
}
}
if ($product['tracking'] == 'O') {
$product['amount'] = db_get_field("SELECT SUM(amount) FROM ?:product_options_inventory WHERE product_id = ?i", $product['product_id']);
}
if ($this->options['export_stock'] == 'Y' && $product['amount'] <= 0) {
$is_broken = true;
}
if ($is_broken) {
unset($products[$k]);
continue;
}
$product['product_url'] = fn_url('products.view?product_id=' . $product['product_id']);
// Images
$images = array_merge($products_images_main[$product['product_id']], $products_images_additional[$product['product_id']]);
$product['images'] = array_slice($images, 0, self::IMAGES_LIMIT);
list($key, $value) = $this->offer($product);
$offered[$key] = $value;
}
if (!empty($offered)) {
fwrite($file, fn_yandex_market_array_to_yml($offered));
unset($offered);
}
}
}
开发者ID:askzap,项目名称:ask-zap,代码行数:66,代码来源:Yml.php
示例15: generateOffers
protected function generateOffers($file)
{
$fields = array('p.product_id', 'p.product_code', 'd.lang_code', 'pc.category_id', 'cd.category', 'pp.price', 'p.list_price', 'p.status', 'p.amount', 'p.weight', 'p.shipping_freight', 'p.shipping_params', 'p.free_shipping', 'd.product', 'd.short_description', 'd.full_description', 'p.company_id', 'p.bean_bag_quantity_150', 'p.bean_bag_quantity_300', 'p.tracking', 'p.list_price', 'p.yml2_brand', 'p.yml2_origin_country', 'p.yml2_store', 'p.yml2_pickup', 'p.yml2_delivery', 'p.yml2_delivery_options', 'p.yml2_bid', 'p.yml2_cbid', 'p.yml2_model', 'p.yml2_sales_notes', 'p.yml2_type_prefix', 'p.yml2_offer_type', 'p.yml2_market_category', 'p.yml2_manufacturer_warranty', 'p.yml2_seller_warranty', 'p.yml2_purchase_price');
$fields[] = "(\n SELECT GROUP_CONCAT(IF(pc2.link_type = 'M', CONCAT(pc2.category_id, 'M'), pc2.category_id))\n FROM ?:products_categories as pc2\n WHERE product_id = p.product_id\n ) as category_ids";
$joins = array(db_quote("LEFT JOIN ?:product_descriptions as d ON d.product_id = p.product_id AND d.lang_code = ?s", $this->lang_code), db_quote("LEFT JOIN ?:product_prices as pp" . " ON pp.product_id = p.product_id AND pp.lower_limit = 1 AND pp.usergroup_id = 0"), db_quote("LEFT JOIN ?:products_categories as pc ON pc.product_id = p.product_id AND pc.link_type = ?s", 'M'), db_quote("LEFT JOIN ?:category_descriptions as cd ON cd.category_id = pc.category_id AND cd.lang_code = ?s", $this->lang_code));
$condition = '';
if ($this->company_id > 0) {
$condition .= db_quote(' AND company_id = ?i', $this->company_id);
}
$exclude_products_ids = array();
if (!empty($this->options['exclude_categories_not_logging']) && $this->options['exclude_categories_not_logging'] == 'Y' && !empty($this->exclude_category_ids)) {
$exclude_products_ids = db_get_fields("SELECT DISTINCT product_id FROM ?:products_categories WHERE category_id IN (?a)", $this->exclude_category_ids);
}
$products_ids = db_get_fields("SELECT DISTINCT object_id FROM ?:yml_exclude_objects WHERE price_id = ?i AND object_type = 'product'", $this->price_id);
$exclude_products_ids = array_merge($exclude_products_ids, $products_ids);
if (!empty($exclude_products_ids)) {
$condition .= db_quote(' AND product_id NOT IN (?a)', $exclude_products_ids);
}
$product_ids = db_get_fields("SELECT product_id FROM ?:products WHERE status = ?s {$condition}", 'A');
fn_set_storage_data('yml2_export_count_' . $this->price_id, count($product_ids));
$shared_product_ids = array();
if (isset($this->options['export_shared_products']) && $this->options['export_shared_products'] == 'Y') {
$categories_join = db_quote('INNER JOIN ?:categories ON ?:categories.category_id = ?:products_categories.category_id');
$products_join = db_quote('INNER JOIN ?:products ON ?:products.product_id = ?:products_categories.product_id');
$shared_product_ids = db_get_fields("SELECT DISTINCT ?:products_categories.product_id FROM ?:products_categories {$categories_join} {$products_join} " . "WHERE ?:categories.company_id = ?i AND link_type = 'A' AND ?:products.status = 'A' ", $this->company_id);
$product_ids = array_merge($product_ids, $shared_product_ids);
}
$this->offer = new Offers($this->options, $this->log);
$offers_count = 0;
while ($ids = array_slice($product_ids, $this->offset, self::ITERATION_ITEMS)) {
$this->offset += self::ITERATION_ITEMS;
$products = db_get_array('SELECT ' . implode(', ', $fields) . ' FROM ?:products as p' . ' ' . implode(' ', $joins) . ' WHERE p.product_id IN(?n)' . ' GROUP BY p.product_id', $ids);
$products_images_main = fn_get_image_pairs($ids, 'product', 'M', false, true, $this->lang_code);
$products_images_additional = fn_get_image_pairs($ids, 'product', 'A', false, true, $this->lang_code);
$params = array('get_options' => true, 'get_taxed_prices' => false, 'detailed_params' => false);
fn_gather_additional_products_data($products, $params);
foreach ($products as $k => &$product) {
if (in_array($product['product_id'], $shared_product_ids)) {
$this->prepareSharedProduct($product);
}
$product['product_features'] = $this->getProductFeatures($product);
if (!$this->preBuild($product, $products_images_main, $products_images_additional)) {
$this->yml2_product_skip++;
continue;
}
list($xml, $product_skip) = $this->offer->build($product);
$this->yml2_product_skip += $product_skip;
$this->stopGeneration();
fwrite($file, $xml . "\n");
$this->yml2_product_export++;
}
$offers_count += count($products);
fn_set_storage_data('yml2_export_offset_' . $this->price_id, $this->offset);
if (!defined('CONSOLE') && $offers_count >= self::ITERATION_OFFERS) {
fn_set_storage_data('yml2_product_export_' . $this->price_id, $this->yml2_product_export);
fn_set_storage_data('yml2_product_skip_' . $t
|
请发表评论