本文整理汇总了PHP中fn_gather_additional_product_data函数的典型用法代码示例。如果您正苦于以下问题:PHP fn_gather_additional_product_data函数的具体用法?PHP fn_gather_additional_product_data怎么用?PHP fn_gather_additional_product_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fn_gather_additional_product_data函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fn_required_products_get_product_data_more
function fn_required_products_get_product_data_more(&$product, &$auth)
{
if (!empty($product['product_id'])) {
list($requered) = fn_get_products(array('for_required_product' => $product['product_id'], 'type' => 'extended'));
if (count($requered)) {
$product['have_required'] = 'Y';
$ids = array();
foreach ($requered as $entry) {
$ids[] = $entry['product_id'];
}
$have = fn_required_products_get_existent($auth, $ids, false);
$product['required_products'] = array();
foreach ($requered as $entry) {
$id = $entry['product_id'];
fn_gather_additional_product_data($entry, true, true, true, true, true);
$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';
}
}
}
示例2: fn_get_category_data
// Get full data for current category
$category_data = fn_get_category_data($_REQUEST['category_id'], CART_LANGUAGE, '*');
if (!empty($category_data['meta_description']) || !empty($category_data['meta_keywords'])) {
$view->assign('meta_description', $category_data['meta_description']);
$view->assign('meta_keywords', $category_data['meta_keywords']);
}
$params = $_REQUEST;
$params['cid'] = $_REQUEST['category_id'];
$params['type'] = 'extended';
if (Registry::get('settings.General.show_products_from_subcategories') == 'Y') {
$params['subcats'] = 'Y';
}
list($products, $search) = fn_get_products($params, Registry::get('settings.Appearance.products_per_page'));
if (!empty($products)) {
foreach ($products as $k => $v) {
fn_gather_additional_product_data($products[$k], true, true, true, true, true);
}
}
$selected_layout = fn_get_products_layout($_REQUEST);
$view->assign('products', $products);
$view->assign('search', $search);
$view->assign('selected_layout', $selected_layout);
$view->assign('category_data', $category_data);
// If page title for this category is exist than assign it to template
if (!empty($category_data['page_title'])) {
$view->assign('page_title', $category_data['page_title']);
}
fn_define('FILTER_CUSTOM_ADVANCED', true);
// this constant means that extended filtering should be stayed on the same page
if (!empty($_REQUEST['advanced_filter']) && $_REQUEST['advanced_filter'] == 'Y') {
list($filters) = fn_get_filters_products_count($_REQUEST);
示例3: fn_twg_get_api_product_data
function fn_twg_get_api_product_data($product_id, $lang_code = CART_LANGUAGE)
{
$auth =& $_SESSION['auth'];
$get_features = $get_discounts = $get_options = AREA == 'C';
$product = fn_get_product_data($product_id, $auth, $lang_code, '', true, true, true, $get_discounts, false, $get_features, null, true);
if (empty($product)) {
return array();
}
$product['main_product_code'] = $product['product_code'];
fn_gather_additional_product_data($product, true, true, $get_options, $get_discounts);
// Delete empty product feature groups
if ($get_features && !empty($product['product_features'])) {
foreach ($product['product_features'] as $feature_id => $feature) {
if ($feature['feature_type'] == 'G' and empty($feature['subfeatures'])) {
unset($product['product_features'][$feature_id]);
}
}
}
$product['product_options'] = array();
$product_options = fn_twg_api_get_product_options($product);
if (!empty($product['combination'])) {
$selected_options = fn_get_product_options_by_combination($product['combination']);
$product['product_options'] = !empty($selected_options) ? fn_get_selected_product_options($product['product_id'], $selected_options, $lang_code) : $product_options[$product_id];
}
$product['product_options'] = $product_options;
foreach ($product['product_options'] as $key1 => $val1) {
$option_descriptions = db_get_row("SELECT option_name, option_text, description, comment\n FROM ?:product_options_descriptions\n WHERE option_id = ?i AND lang_code = ?s", $val1['option_id'], $lang_code);
foreach ($option_descriptions as $key2 => $val2) {
$product['product_options'][$key1][$key2] = $val2;
}
$val1['variants'] = isset($val1['variants']) ? $val1['variants'] : array();
foreach (array_keys($val1['variants']) as $vid) {
if ($val1['option_type'] == 'C') {
$product['product_options'][$key1]['variants'][$vid]['variant_name'] = empty($val1['position']) ? __('no', $lang_code) : __('yes', $lang_code);
} elseif ($val1['option_type'] == 'S' || $val1['option_type'] == 'R') {
$variant_description = db_get_field("SELECT variant_name\n FROM ?:product_option_variants_descriptions\n WHERE variant_id = ?i AND lang_code = ?s", $vid, $lang_code);
$product['product_options'][$key1]['variants'][$vid]['variant_name'] = $variant_description;
}
}
}
$product['category_id'] = $product['main_category'];
$product['images'] = array();
$images_config = TwigmoSettings::get('images');
$image_params = $images_config['big'];
if (!empty($product['main_pair'])) {
$product['icon'] = TwigmoImage::getApiImageData($product['main_pair'], 'product', 'icon', $images_config['prewiew']);
$product['images'][] = TwigmoImage::getApiImageData($product['main_pair'], 'product', 'detailed', $image_params);
}
foreach ($product['image_pairs'] as $v) {
$product['images'][] = TwigmoImage::getApiImageData($v, 'product', 'detailed', $image_params);
}
$product['category'] = db_get_field("SELECT category FROM ?:category_descriptions WHERE category_id = ?i AND lang_code = ?s", $product['main_category'], $lang_code);
$product['product_options_exceptions'] = fn_twg_get_api_product_options_exceptions($product_id);
$product['product_options_inventory'] = fn_twg_get_api_product_options_inventory($product_id, $lang_code);
$_product = Api::getAsApiObject('products', $product);
$_product['avail_since_formated'] = strftime(Registry::get('settings.Appearance.date_format'), $_product['avail_since']);
$_product['TIME'] = TIME;
if (AREA == 'C') {
$_product['tabs'] = fn_twg_get_product_tabs(array('product_id' => $product_id, 'descr_sl' => DESCR_SL));
}
$_product['default_image'] = fn_get_image_pairs($product_id, 'product', 'M', true, true);
if (!empty($product['points_info'])) {
$_product['points_info'] = $product['points_info'];
}
return $_product;
}
示例4: fn_get_product_data_for_compare
function fn_get_product_data_for_compare($product_ids, $action)
{
$auth =& $_SESSION['auth'];
$comparison_data = array('product_features' => array(0 => array()));
$tmp = array();
foreach ($product_ids as $product_id) {
$product_data = fn_get_product_data($product_id, $auth, CART_LANGUAGE, '', false, true, false, false);
fn_gather_additional_product_data($product_data, false, false, false, true, false);
if (!empty($product_data['product_features'])) {
foreach ($product_data['product_features'] as $k => $v) {
if ($v['feature_type'] == 'G' && empty($v['subfeatures'])) {
continue;
}
$_features = $v['feature_type'] == 'G' ? $v['subfeatures'] : array($k => $v);
$group_id = $v['feature_type'] == 'G' ? $k : 0;
$comparison_data['feature_groups'][$k] = $v['description'];
foreach ($_features as $_k => $_v) {
if (in_array($_k, $_SESSION['excluded_features'])) {
if (empty($comparison_data['hidden_features'][$_k])) {
$comparison_data['hidden_features'][$_k] = $_v['description'];
}
continue;
}
if (empty($comparison_data['product_features'][$group_id][$_k])) {
$comparison_data['product_features'][$group_id][$_k] = $_v['description'];
}
}
}
}
$comparison_data['products'][] = $product_data;
unset($product_data);
}
if ($action != 'show_all' && !empty($comparison_data['product_features'])) {
$value = '';
foreach ($comparison_data['product_features'] as $group_id => $v) {
foreach ($v as $feature_id => $_v) {
unset($value);
$c = $action == 'similar_only' ? true : false;
foreach ($comparison_data['products'] as $product) {
$features = !empty($group_id) && isset($product['product_features'][$group_id]) ? $product['product_features'][$group_id]['subfeatures'] : $product['product_features'];
if (empty($features[$feature_id])) {
$c = !$c;
break;
}
if (!isset($value)) {
$value = fn_get_feature_selected_value($features[$feature_id]);
continue;
} elseif ($value != fn_get_feature_selected_value($features[$feature_id])) {
$c = !$c;
break;
}
}
if ($c == false) {
unset($comparison_data['product_features'][$group_id][$feature_id]);
}
}
}
}
return $comparison_data;
}
示例5: 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. *
****************************************************************************/
//
// $Id: products.pre.php 10229 2010-07-27 14:21:39Z 2tl $
//
if (!defined('AREA')) {
die('Access denied');
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
if ($mode == 'options') {
if (!empty($_REQUEST['event_products']) && !empty($_REQUEST['appearance']['events'])) {
$event_data['products'] = db_get_hash_array("SELECT * FROM ?:giftreg_event_products LEFT JOIN ?:product_descriptions ON ?:product_descriptions.product_id = ?:giftreg_event_products.product_id AND ?:product_descriptions.lang_code = ?s WHERE event_id = ?i", 'item_id', CART_LANGUAGE, $_REQUEST['appearance']['event_id']);
foreach ($event_data['products'] as $k => $v) {
$event_data['products'][$k]['extra'] = $event_data['products'][$k]['selected_options'] = @$_REQUEST['event_products'][$k]['product_options'];
$product_options = $event_data['products'][$k]['extra'];
$event_data['products'][$k]['product_options'] = fn_get_selected_product_options($v['product_id'], $product_options, CART_LANGUAGE);
$event_data['products'][$k]['original_price'] = $event_data['products'][$k]['price'] = fn_get_product_price($v['product_id'], 1, $auth);
$event_data['products'][$k]['avail_amount'] = $v['amount'] - $v['ordered_amount'];
fn_gather_additional_product_data($event_data['products'][$k], true, false, true, true);
}
$view->assign('event_id', $_REQUEST['appearance']['event_id']);
$view->assign('event_data', $event_data);
$view->display('addons/gift_registry/views/events/components/event_products.tpl');
exit;
}
}
}
示例6: fn_specific_development_products_from_current_category
function fn_specific_development_products_from_current_category($category_id)
{
if (!$category_id) {
return array();
}
$params = array('sl' => 'EN', 'type' => 'extended', 'cid' => $category_id);
if (!empty($_REQUEST['sl'])) {
$params['sl'] = $_REQUEST['sl'];
}
list($products) = fn_get_products($params);
if (!empty($products)) {
foreach ($products as $k => $v) {
fn_gather_additional_product_data($products[$k], false, true, false, false, true);
}
}
fn_specific_development_view_category($products);
return $products;
}
示例7: fn_get_product_data_for_compare
function fn_get_product_data_for_compare($product_ids, $action)
{
$auth =& $_SESSION['auth'];
$comparison_data = array('product_features' => array(0 => array()));
$tmp = array();
foreach ($product_ids as $product_id) {
$inventory_product_ids = array();
$product_data = fn_get_product_data($product_id, $auth, CART_LANGUAGE, '', false, true, false, false);
fn_gather_additional_product_data($product_data, false, false, false, true, false);
if (!empty($product_data['product_features'])) {
foreach ($product_data['product_features'] as $k => $v) {
if ($v['feature_type'] == 'G' && empty($v['subfeatures'])) {
continue;
}
$_features = $v['feature_type'] == 'G' ? $v['subfeatures'] : array($k => $v);
$group_id = $v['feature_type'] == 'G' ? $k : 0;
$comparison_data['feature_groups'][$k] = $v['description'];
foreach ($_features as $_k => $_v) {
if (in_array($_k, $_SESSION['excluded_features'])) {
if (empty($comparison_data['hidden_features'][$_k])) {
$comparison_data['hidden_features'][$_k] = $_v['description'];
}
continue;
}
if (!empty($_v['full_description'])) {
$comparison_data['product_features_full_description'][$_k] = $_v['full_description'];
}
if (empty($comparison_data['product_features'][$group_id][$_k])) {
$comparison_data['product_features'][$group_id][$_k] = $_v['description'];
}
}
}
}
$inventory_product_ids = db_get_row("SELECT MIN(b.price ) AS min_price, MAX(b.price ) AS max_price FROM ?:products as a JOIN ?:product_options_inventory_prices as b ON a.product_id=b.product_id WHERE a.product_id = ?i GROUP BY a.product_id", $product_id);
if ($inventory_product_ids && count($inventory_product_ids) > 0) {
$product_data['price_range'] = $inventory_product_ids;
}
$comparison_data['products'][] = $product_data;
unset($product_data);
}
if ($action != 'show_all' && !empty($comparison_data['product_features'])) {
$value = '';
foreach ($comparison_data['product_features'] as $group_id => $v) {
foreach ($v as $feature_id => $_v) {
unset($value);
$c = $action == 'similar_only' ? true : false;
foreach ($comparison_data['products'] as $product) {
$features = !empty($group_id) && isset($product['product_features'][$group_id]) ? $product['product_features'][$group_id]['subfeatures'] : $product['product_features'];
if (empty($features[$feature_id])) {
$c = !$c;
break;
}
if (!isset($value)) {
$value = fn_get_feature_selected_value($features[$feature_id]);
continue;
} elseif ($value != fn_get_feature_selected_value($features[$feature_id])) {
$c = !$c;
break;
}
}
if ($c == false) {
unset($comparison_data['product_features'][$group_id][$feature_id]);
}
}
}
}
return $comparison_data;
}
示例8: fn_get_price_by_selected_options
function fn_get_price_by_selected_options($product_id, $product_data = array(), $selected_options = array())
{
if (empty($product_data)) {
$product = fn_get_product_data($product_id, $_SESSION['auth'], CART_LANGUAGE, '', true, true, true, true, $auth['area'] == 'A' && !empty($_REQUEST['action']) && $_REQUEST['action'] == 'preview');
} else {
$product = $product_data;
$product_id = $product_data['product_id'];
}
$params = array('get_icon' => false, 'get_detailed' => false, 'get_options' => true, 'get_discounts' => true, 'get_features' => false);
if (empty($selected_options)) {
fn_gather_additional_product_data($product, $params['get_icon'], $params['get_detailed'], $params['get_options'], $params['get_discounts'], $params['get_features']);
$selectedOptions = $product['selected_options'];
//var_dump($product['product_options']);
if ($_REQUEST['product_data'][$product_id]['product_options']) {
$requestedSelectedOption = array();
foreach ($_REQUEST['product_data'][$product_id]['product_options'] as $selectedOptionId => $selectedOptionVariantId) {
if (intval($selectedOptionVariantId) > 0) {
$requestedSelectedOption[$selectedOptionId] = $selectedOptionVariantId;
}
}
$selectedOptions = $requestedSelectedOption;
$productArrayOtionsVariants = fn_get_options_variants_by_option_variant_id($product_id, $_REQUEST['product_data'][$product_id]['product_options']);
foreach ($productArrayOtionsVariants as $optionId => $productOptionVariants) {
if (!in_array($selectedOptions[$optionId], $productOptionVariants)) {
$selectedOptions[$optionId] = $productOptionVariants[0];
}
}
}
$wishlistOptionsVariantsSelected = array();
if (isset($_REQUEST['wishlist_id'])) {
$conditionWishListSql = db_quote(' ?:user_session_products.product_id = ?i AND ?:user_session_products.item_id=?i', $product_id, $_REQUEST['wishlist_id']);
$optsVariantsWishListSerialized = db_get_field("SELECT ?:user_session_products.extra FROM ?:user_session_products WHERE " . $conditionWishListSql . " LIMIT 1");
$optsVariantsWishListUnSerialized = unserialize($optsVariantsWishListSerialized);
$wishlistOptionsVariantsSelected = $optsVariantsWishListUnSerialized['product_options'];
}
$selected_options = $selectedOptions;
if (!empty($wishlistOptionsVariantsSelected)) {
$selected_options = $wishlistOptionsVariantsSelected;
}
}
$new_formula = fn_calculate_price($product_id, $product['product_options'], $selected_options, $putted_fields, true);
$price = fn_calc_opz(fn_to_opz($new_formula));
//var_dump($new_formula);echo"<br/>";
//var_dump($product_id);echo" ----->>>>> ";var_dump($price);echo"<br/>-------<br/>";
if ($price < $product['min_price_calc']) {
$price = $product['min_price_calc'];
}
return $price;
}
示例9: __construct
/**
* Construct
* @param int|array $product Product id or array of product data
* ```php
* array(
* 'product_id' => int,
* 'ebay_template_id' => int,
* ...
* )
* ```
* @param string|array $relations Default * - all relations load
* array(
* 'additional',
* 'options',
* 'external'
* );
*/
public function __construct($product, $relations = '*')
{
if (!is_array($product)) {
$product_id = (int) $product;
$auth = \Tygh::$app['session']['auth'];
$product = fn_get_product_data($product_id, $auth, CART_LANGUAGE);
if ($relations === '*' || in_array('additional', $relations)) {
fn_gather_additional_product_data($product, true, true);
}
}
if (!empty($product)) {
$this->init($product);
if ($relations === '*' || in_array('external', $relations)) {
$this->loadExternalData();
}
if ($relations === '*' || in_array('options', $relations)) {
$this->loadOptions();
}
}
}
示例10: fn_add_product_to_cart_old
function fn_add_product_to_cart_old($product_data, &$cart, &$auth, $update = false)
{
$ids = array();
if (!empty($product_data) && is_array($product_data)) {
if (!defined('GET_OPTIONS')) {
list($product_data, $cart) = fn_add_product_options_files($product_data, $cart, $auth, $update);
}
fn_set_hook('pre_add_to_cart', $product_data, $cart, $auth, $update);
//var_dump($product_data);die();
foreach ($product_data as $key => $data) {
if (empty($key)) {
continue;
}
if (empty($data['amount'])) {
continue;
}
$data['stored_price'] = !empty($data['stored_price']) && AREA != 'C' ? $data['stored_price'] : 'N';
if (empty($data['extra'])) {
$data['extra'] = array();
}
$product_id = !empty($data['product_id']) ? intval($data['product_id']) : intval($key);
if (!fn_check_add_product_to_cart($cart, $data, $product_id)) {
continue;
}
// Check if product options exist
if (!isset($data['product_options'])) {
$data['product_options'] = fn_get_default_product_options($product_id);
}
// Generate cart id
$data['extra']['product_options'] = $data['product_options'];
$_id = fn_generate_cart_id($product_id, $data['extra'], false);
if (isset($ids[$_id]) && $key == $_id) {
continue;
}
if (isset($data['extra']['exclude_from_calculate']) && $data['extra']['exclude_from_calculate']) {
if (!empty($cart['products'][$key]) && !empty($cart['products'][$key]['extra']['aoc'])) {
$cart['saved_product_options'][$cart['products'][$key]['extra']['saved_options_key']] = $data['product_options'];
}
if (isset($cart['deleted_exclude_products'][$data['extra']['exclude_from_calculate']][$_id])) {
continue;
}
}
$amount = fn_normalize_amount(@$data['amount']);
if (!isset($data['extra']['exclude_from_calculate']) || isset($data['extra']['exclude_from_calculate']) && !$data['extra']['exclude_from_calculate']) {
if ($data['stored_price'] != 'Y') {
$allow_add = true;
// Check if the product price with options modifiers equals to zero
$price = fn_get_product_price($product_id, $amount, $auth);
$zero_price_action = db_get_field("SELECT zero_price_action FROM ?:products WHERE product_id = ?i", $product_id);
if (!floatval($price) && $zero_price_action == 'A') {
if (isset($cart['products'][$key]['custom_user_price'])) {
$price = $cart['products'][$key]['custom_user_price'];
} else {
$custom_user_price = empty($data['price']) ? 0 : $data['price'];
}
}
if ($data['extra']['price_calc']['total_price_calc']) {
$productTest = fn_get_product_data($product_id, $auth, CART_LANGUAGE, '', true, true, true, true, fn_is_preview_action($auth, $_REQUEST));
$productTest['extra']['product_options'] = $data['extra']['product_options'];
fn_gather_additional_product_data($productTest, true, true);
$price = $productTest['price'];
} else {
$price = fn_apply_options_modifiers($data['product_options'], $price, 'P', array(), array('product_data' => $data));
}
if (!floatval($price)) {
$data['price'] = isset($data['price']) ? fn_parse_price($data['price']) : 0;
if (($zero_price_action == 'R' || $zero_price_action == 'A' && floatval($data['price']) < 0) && AREA == 'C') {
if ($zero_price_action == 'A') {
fn_set_notification('E', __('error'), __('incorrect_price_warning'));
}
$allow_add = false;
}
//
$price = empty($data['price']) ? 0 : $data['price'];
}
/**
* Recalculates price and checks if product can be added with the current price
*
* @param array $data Adding product data
* @param float $price Calculated product price
* @param boolean $allow_add Flag that determines if product can be added to cart
*/
fn_set_hook('add_product_to_cart_check_price', $data, $price, $allow_add);
if (!$allow_add) {
continue;
}
} else {
if (!$price) {
$price = fn_get_product_price($product_id, $amount, $auth);
}
$price = empty($data['price']) ? 0 : $data['price'];
}
} else {
$price = 0;
}
//var_dump($price);echo"<br/><br/>";
$_data = db_get_row('SELECT is_edp, options_type, tracking, unlimited_download FROM ?:products WHERE product_id = ?i', $product_id);
if (isset($_data['is_edp'])) {
$data['is_edp'] = $_data['is_edp'];
} elseif (!isset($data['is_edp'])) {
//.........这里部分代码省略.........
示例11: die
* *
* Copyright (c) 2009 Simbirsk Technologies Ltd. All rights reserved. *
* *
* This is commercial software, only users who have purchased a valid *
* license and accept to the terms of the License Agreement can install *
* and use this program. *
* *
****************************************************************************
* PLEASE READ THE FULL TEXT OF THE SOFTWARE LICENSE AGREEMENT IN THE *
* "copyright.txt" FILE PROVIDED WITH THIS DISTRIBUTION PACKAGE. *
****************************************************************************/
//
// $Id: products.post.php 7502 2009-05-19 14:54:59Z zeke $
//
if (!defined('AREA')) {
die('Access denied');
}
if ($_SERVER['REQUEST_METHOD'] == 'POST') {
return;
}
//
// View product details
//
if ($mode == 'add' && Registry::get('addons.tags.tags_for_products') == 'Y') {
Registry::set('navigation.tabs.tags', array('title' => fn_get_lang_var('tags'), 'js' => true));
} elseif ($mode == 'update' && Registry::get('addons.tags.tags_for_products') == 'Y') {
Registry::set('navigation.tabs.tags', array('title' => fn_get_lang_var('tags'), 'js' => true));
$product_data = $view->get_var('product_data');
fn_gather_additional_product_data($product_data, false, false, false, false, false);
$view->assign('product_data', $product_data);
}
示例12: fn_ebay_update_product_post
function fn_ebay_update_product_post($product_data, $product_id, $lang_code, $create)
{
if (empty($product_id)) {
return false;
}
$auth = $_SESSION['auth'];
$product_data = fn_get_product_data($product_id, $auth, CART_LANGUAGE);
fn_gather_additional_product_data($product_data, true, true);
if ($product_data['override'] == "Y") {
$title = substr(strip_tags($product_data['ebay_title']), 0, 80);
$description = !empty($product_data['ebay_description']) ? $product_data['ebay_description'] : $product_data['full_description'];
} else {
$title = substr(strip_tags($product_data['product']), 0, 80);
$description = $product_data['full_description'];
}
$hash_data = array('price' => fn_format_price($product_data['price']), 'title' => $title, 'description' => $description, 'product_features' => serialize($product_data['product_features']));
$product_hash = fn_crc32(implode('_', $hash_data));
db_query('UPDATE ?:products SET product_hash = ?s WHERE product_id = ?i', $product_hash, $product_id);
return true;
}
示例13: fn_gather_additional_product_data_for_search
function fn_gather_additional_product_data_for_search(&$product)
{
fn_gather_additional_product_data($product, true, true);
}
示例14: fn_fill_sequential_options
/**
* Fills sequential options with default values. Necessary for cart total calculation
*
* @param array $item Cart item
* @param int $changed_option Changed option identifier
* @return array New options list
*/
function fn_fill_sequential_options($item, $changed_option)
{
$params['pid'] = $item['product_id'];
list($product) = fn_get_products($params);
$product = reset($product);
$product['changed_option'] = $changed_option;
$product['selected_options'] = $item['product_options'];
fn_gather_additional_product_data($product, false, false, true, false, false);
if (count($item['product_options']) != count($product['selected_options'])) {
foreach ($item['product_options'] as $option_id => $variant_id) {
if (isset($product['selected_options'][$option_id]) || in_array($product['product_options'][$option_id]['option_type'], array('I', 'T', 'F'))) {
continue;
}
if (!empty($product['product_options'][$option_id]['variants'])) {
reset($product['product_options'][$option_id]['variants']);
$variant_id = key($product['product_options'][$option_id]['variants']);
} else {
$variant_id = '';
}
$product['selected_options'][$option_id] = $variant_id;
$product['changed_option'] = $option_id;
fn_gather_additional_product_data($product, false, false, true, false, false);
}
}
return $product['selected_options'];
}
示例15: define
if (!empty($_SESSION['shipping_rates'])) {
define('CACHED_SHIPPING_RATES', true);
}
list($cart_products, $_SESSION['shipping_rates']) = fn_calculate_cart_content($cart, $auth, 'E', true, Registry::get('settings.General.one_page_checkout') == 'Y' ? 'F' : 'I');
// we need this for promotions only actually...
$profile_fields = fn_get_profile_fields('O');
if (empty($cart['payment_id']) && floatval($cart['total']) || !fn_allow_place_order($cart)) {
return array(CONTROLLER_STATUS_REDIRECT, "checkout.checkout");
}
fn_checkout_summary($cart);
fn_get_default_credit_card($cart, empty($cart['user_data']) ? array() : $cart['user_data']);
$view->assign('shipping_rates', $_SESSION['shipping_rates']);
if (defined('AJAX_REQUEST')) {
if (!empty($cart_products)) {
foreach ($cart_products as $k => $v) {
fn_gather_additional_product_data($cart_products[$k], true, false, true, false);
}
}
$view->assign('cart', $cart);
$view->assign('cart_products', array_reverse($cart_products, true));
$view->assign('location', 'checkout');
$view->assign('profile_fields', $profile_fields);
$view->assign('use_ajax', true);
if (Registry::get('settings.General.one_page_checkout') == 'Y') {
$view->assign('edit_step', 'step_four');
$view->display('views/checkout/components/checkout_steps.tpl');
$view->display('views/checkout/components/cart_items.tpl');
} else {
$view->display('views/checkout/checkout.tpl');
}
$view->display('views/checkout/components/checkout_totals.tpl');