本文整理汇总了PHP中fn_get_product_data函数的典型用法代码示例。如果您正苦于以下问题:PHP fn_get_product_data函数的具体用法?PHP fn_get_product_data怎么用?PHP fn_get_product_data使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了fn_get_product_data函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: fn_calculate_price
function fn_calculate_price($product_id, $product_options, $selected_options, $putted_fields, $default_params = false)
{
$fields = fn_get_fields($product_id);
$formula = db_get_field('SELECT formula FROM ?:ppc_formula WHERE product_id = ?i', $product_id);
if (!empty($fields)) {
if ($default_params === true) {
foreach ($fields as $k1 => $v1) {
$putted_fields[$v1['name']] = $v1['default_value'];
}
}
foreach ($fields as $k1 => $v1) {
$formula = str_replace('[val_' . $v1['position'] . ']', '[' . $putted_fields[$v1['name']] . ']', $formula);
if ($v1['additional'] > 0) {
if ($default_params === true) {
$formula = str_replace('[addval_' . $v1['position'] . ']', '[' . 0 . ']', $formula);
} else {
$formula = str_replace('[addval_' . $v1['position'] . ']', '[' . $putted_fields['add' . $v1['name']] . ']', $formula);
}
}
}
}
//$productArrayOtionsVariants = fn_get_options_variants_by_option_variant_id($product_id, $selected_options);
//$view->assign('product_array_otions_variants', $productArrayOtionsVariants);
//var_dump($productArrayOtionsVariants);
if (!empty($selected_options)) {
foreach ($selected_options as $k1 => $v1) {
foreach ($product_options as $option) {
if ($option['option_id'] == $k1) {
if (!empty($option['variants'])) {
foreach ($option['variants'] as $variant) {
if ($variant['variant_id'] == $v1) {
$var = !empty($variant['modifier']) ? $variant['modifier'] : 0;
if ($_POST['variant_modifier_value']) {
$var = $_POST['variant_modifier_value'];
}
break;
}
}
}
break;
}
}
if (empty($var)) {
$var = '0';
}
$formula = str_replace('[opt_' . $k1 . ']', '[' . $var . ']', $formula);
unset($var);
}
}
// fn_get_product_option_data($option_id, $product_id, $lang_code = DESCR_SL)
if (!empty($selected_options)) {
foreach ($selected_options as $k1 => $v1) {
foreach ($product_options as $option) {
if ($option['option_id'] == $k1) {
if (!empty($option['variants'])) {
foreach ($option['variants'] as $variant) {
if ($variant['variant_id'] == $v1) {
$var = !empty($variant['weight_modifier']) ? $variant['weight_modifier'] : 0;
break;
}
}
}
break;
}
}
if (empty($var)) {
$var = '0';
}
$formula = str_replace('[optw_' . $k1 . ']', '[' . $var . ']', $formula);
unset($var);
}
}
$auth = $_SESSION['auth'];
$def_price = fn_get_product_price($product_id, 1, $auth);
$product = fn_get_product_data($product_id, $auth, CART_LANGUAGE, true, true, false, false, false);
$def_weight = db_get_field('SELECT weight FROM ?:products WHERE product_id = ?i', $product_id);
// fn_promotion_apply('catalog', $product, $auth);
// if (!empty($product['discount'])) {
// $def_price -= $product['discount'];
// if ($def_price < 0) {
// $def_price = 0;
// }
// }
$formula = str_replace('[price]', '[' . $def_price . ']', $formula);
$formula = str_replace('[weight]', '[' . floatval($def_weight) . ']', $formula);
return $formula;
}
示例2: 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);
}
示例3: ls_get_fav_data
function ls_get_fav_data()
{
//wishlist products footer carousel
$_SESSION['wishlist'] = isset($_SESSION['wishlist']) ? $_SESSION['wishlist'] : array();
$wishlist =& $_SESSION['wishlist'];
$_SESSION['continue_url'] = fn_ls_get_base_url();
$auth =& $_SESSION['auth'];
//view products
$products_footer = !empty($wishlist['products']) ? $wishlist['products'] : array();
$extra_products = array();
$wishlist_is_empty = fn_cart_is_empty($wishlist);
if (!empty($products_footer)) {
foreach ($products_footer as $k => $v) {
$_options = array();
$extra = $v['extra'];
if (!empty($v['product_options'])) {
$_options = $v['product_options'];
}
$products_footer[$k] = fn_get_product_data($v['product_id'], $auth, CART_LANGUAGE, '', true, true, true, false, false, true, false, true);
if (empty($products_footer[$k])) {
unset($products_footer[$k], $wishlist['products'][$k]);
continue;
}
$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;
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));
return $products_footer;
}
示例4: fn_exim_google_export_format_price
function fn_exim_google_export_format_price($product_price, $product_id = 0)
{
static $auth;
if (empty($auth)) {
$auth = fn_fill_auth();
}
$product = fn_get_product_data($product_id, $auth, CART_LANGUAGE, false, false, false, false, false, false, false);
fn_promotion_apply('catalog', $product, $auth);
$_discount = 0;
if (!empty($product['discount'])) {
$_discount = $product['discount'];
}
return fn_format_price($product_price - $_discount, CART_PRIMARY_CURRENCY, null, false);
}
示例5: isset
$_SESSION['wishlist'] = isset($_SESSION['wishlist']) ? $_SESSION['wishlist'] : array();
$wishlist =& $_SESSION['wishlist'];
$_SESSION['continue_url'] = isset($_SESSION['continue_url']) ? $_SESSION['continue_url'] : '';
$auth =& $_SESSION['auth'];
//view products
$products_footer = !empty($wishlist['products']) ? $wishlist['products'] : array();
$extra_products = array();
$wishlist_is_empty = fn_cart_is_empty($wishlist);
if (!empty($products_footer)) {
foreach ($products_footer as $k => $v) {
$_options = array();
$extra = $v['extra'];
if (!empty($v['product_options'])) {
$_options = $v['product_options'];
}
$products_footer[$k] = fn_get_product_data($v['product_id'], $auth, CART_LANGUAGE, '', true, true, true, false, false, true, false, true);
if (empty($products_footer[$k])) {
unset($products_footer[$k], $wishlist['products'][$k]);
continue;
}
$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;
示例6: fn_twg_api_get_session_cart
function fn_twg_api_get_session_cart(&$cart, $lang_code = CART_LANGUAGE)
{
$data = array('amount' => 0, 'subtotal' => 0);
$auth = $_SESSION['auth'];
if (empty($cart)) {
return $data;
}
$payment_methods = fn_twg_get_payment_methods();
if (isset($payment_methods['payment'])) {
$payment_methods = $payment_methods['payment'];
}
if (false != ($first_method = reset($payment_methods)) && empty($cart['payment_id']) && isset($cart['total']) && floatval($cart['total']) != 0) {
$cart['payment_id'] = $first_method['payment_id'];
}
if (isset($cart['total']) && floatval($cart['total']) == 0) {
$cart['payment_id'] = 0;
}
// fetch cart data
$cart_data = array_merge($data, Api::getAsApiObject('cart', $cart, array(), array('lang_code' => $lang_code)));
if (!empty($cart_data['taxes'])) {
$cart_data['taxes'] = Api::getAsList('taxes', $cart_data['taxes']);
}
if (!empty($cart_data['products'])) {
$cart_data['products'] = array_reverse($cart_data['products']);
}
if (!empty($cart_data['payment_surcharge'])) {
$cart_data['total'] += $cart_data['payment_surcharge'];
} else {
$cart_data['payment_surcharge'] = 0;
}
// ================ Payment buttons ========================================
$payment_buttons = array();
$checkout_processors = array('amazon_checkout.php', 'paypal_express.php', 'google_checkout.php');
$included_files = get_included_files();
$is_payments_included = false;
foreach ($checkout_processors as $checkout_processor) {
if (in_array(Registry::get('config.dir.payments') . $checkout_processor, $included_files)) {
$is_payments_included = true;
break;
}
}
if ($is_payments_included) {
// Get from templater
$view = fn_twg_get_view_object();
$smarty_vars = array('checkout_add_buttons', 'checkout_buttons');
foreach ($smarty_vars as $smarty_var) {
$buttons = $view->getTemplateVars($smarty_var);
if ($buttons !== null) {
$payment_buttons = $buttons;
break;
}
}
} else {
// Get payments fiels
if (!empty($cart['products'])) {
foreach ($cart['products'] as $product_key => $product) {
if (!isset($cart['products'][$product_key]['product'])) {
$product_data = fn_get_product_data($product['product_id'], $auth);
$cart['products'][$product_key]['product'] = $product_data['product'];
$cart['products'][$product_key]['short_description'] = $product_data['short_description'];
}
}
$mode = Registry::get('runtime.mode');
Registry::set('runtime.mode', 'cart');
# for the paypal express checkout
$payment_buttons = fn_get_checkout_payment_buttons($cart, $cart['products'], $auth);
Registry::set('runtime.mode', $mode);
}
}
$cart_data['payment_buttons'] = fn_twg_filter_payment_buttons($payment_buttons);
// ================ /Payment buttons =======================================
$cart_data['empty_payments'] = empty($payment_methods) ? 'Y' : 'N';
$cart_data['coupons'] = empty($cart['coupons']) ? array() : array_keys($cart['coupons']);
$cart_data['use_gift_certificates'] = array();
$cart_data['gift_certificates_total'] = 0;
if (isset($cart['use_gift_certificates'])) {
foreach ($cart['use_gift_certificates'] as $code => $cert) {
$cart_data['use_gift_certificates'][] = array('code' => $code, 'cost' => $cert['cost']);
$cart_data['gift_certificates_total'] += $cert['cost'];
}
}
foreach ($cart_data['products'] as &$product) {
if (!empty($product['extra']['points_info']['reward']) && !is_array($product['extra']['points_info']['reward'])) {
$product['extra']['points_info']['reward'] = array('amount' => $product['extra']['points_info']['reward']);
}
if (isset($product['extra']['points_info']) && Registry::get('addons.reward_points.status') != 'A') {
unset($product['extra']['points_info']);
}
}
if (!empty($cart['points_info'])) {
$cart_data['points_info'] = $cart['points_info'];
}
return $cart_data;
}
示例7: array
if (!empty($_REQUEST['banner_id']) && !isset($banner_product_ids[$_REQUEST['banner_id']])) {
$banner_product_ids = array($_REQUEST['banner_id'] => array());
}
$banner_data = fn_get_aff_banner_data($_REQUEST['banner_id'], CART_LANGUAGE, true);
$banner_data['product_ids'] = implode('-', $banner_product_ids[$_REQUEST['banner_id']]);
$banner_data['example'] = fn_get_aff_banner_html('js', $banner_data);
$banner_data['code'] = fn_get_aff_banner_html('js', $banner_data, '', $auth['user_id']);
$banner_data['url'] = fn_get_aff_banner_url($banner_data, $auth['user_id']);
$view->assign('banner', $banner_data);
// [Breadcrumbs]
fn_add_breadcrumb(fn_get_lang_var('product_banners'), "banners_manager.manage?banner_type=P");
fn_add_breadcrumb($banner_data['title']);
// [/Breadcrumbs]
$linked_products = array();
foreach ($banner_product_ids[$_REQUEST['banner_id']] as $prod_id) {
$linked_products[$prod_id] = fn_get_product_data($prod_id, $auth);
$linked_products[$prod_id]['url'] = "{$banner_data['url']}&product_id={$prod_id}";
}
$view->assign('linked_products', $linked_products);
$view->assign('banner_id', $banner_data['banner_id']);
} else {
// [Page sections]
if ($_REQUEST['banner_type'] != 'P') {
foreach (array('groups' => 'product_groups', 'categories' => 'categories', 'products' => 'products', 'url' => 'url') as $k => $v) {
Registry::set('navigation.tabs.' . $k, array('title' => fn_get_lang_var($v), 'href' => "banners_manager.manage?banner_type={$_REQUEST['banner_type']}&selected_section={$k}"));
}
}
// [/Page sections]
$banners = array();
$selected_section = empty($_REQUEST['selected_section']) ? $_REQUEST['banner_type'] == 'P' ? 'url' : 'groups' : $_REQUEST['selected_section'];
if ($selected_section == 'groups') {
示例8: unset
unset($cart_products[$cart_id]);
$cart_products[$product['object_id']] = $product;
}
}
}
$_cart = $_SESSION['cart'];
if (AREA == 'A') {
$_auth = $_SESSION['customer_auth'];
if (empty($_auth)) {
$_auth = fn_fill_auth(array(), array(), false, 'C');
}
}
foreach ($cart_products as $cart_id => $item) {
if (isset($_cart['products'][$cart_id])) {
$amount = isset($item['amount']) ? $item['amount'] : 1;
$product_data = fn_get_product_data($item['product_id'], $auth, CART_LANGUAGE, '', false, false, false, false, false, false, false);
if ($product_data['options_type'] == 'S' && isset($item['product_options']) && isset($_REQUEST['changed_option'][$cart_id])) {
$item['product_options'] = fn_fill_sequential_options($item, $_REQUEST['changed_option'][$cart_id]);
unset($_REQUEST['changed_option']);
}
$product_options = isset($item['product_options']) ? $item['product_options'] : array();
$amount = fn_check_amount_in_stock($item['product_id'], $amount, $product_options, $cart_id, $_cart['products'][$cart_id]['is_edp'], 0, $_cart);
if ($amount === false) {
unset($_cart['products'][$cart_id]);
continue;
}
$_cart['products'][$cart_id]['amount'] = $amount;
$_cart['products'][$cart_id]['product_options'] = isset($item['product_options']) ? $item['product_options'] : array();
if (!empty($_cart['products'][$cart_id]['extra']['saved_options_key'])) {
$_cart['saved_product_options'][$_cart['products'][$cart_id]['extra']['saved_options_key']] = $_cart['products'][$cart_id]['product_options'];
}
示例9: fn_add_gift_certificate_to_wishlist
/**
* Add gift certificate to wishlist
*
* @param array $wishlist wishlist data storage
* @param array $gift_cert_data array with data for the certificate to add
* @return array array with gift certificate ID and data if addition is successful and empty array otherwise
*/
function fn_add_gift_certificate_to_wishlist(&$wishlist, $gift_cert_data)
{
if (!empty($gift_cert_data) && is_array($gift_cert_data)) {
fn_correct_gift_certificate($gift_cert_data);
// Generate wishlist id
$gift_cert_wishlist_id = fn_generate_gift_certificate_cart_id($gift_cert_data);
$wishlist['gift_certificates'][$gift_cert_wishlist_id] = $gift_cert_data;
$gift_cert_data['display_subtotal'] = $gift_cert_data['amount'];
if (!empty($gift_cert_data['products'])) {
$product_data = array();
foreach ($gift_cert_data['products'] as $w_id => $_data) {
if (empty($_data['amount'])) {
unset($gift_cert_data['products'][$w_id]);
continue;
}
if (empty($_data['product_options'])) {
$_data['product_options'] = fn_get_default_product_options($_data['product_id']);
}
$wishlist_id = fn_generate_cart_id($_data['product_id'], array('product_options' => $_data['product_options'], 'parent' => array('certificate' => $gift_cert_wishlist_id)), true);
$product_data[$wishlist_id] = $_data;
$wishlist['products'][$wishlist_id] = array('product_id' => $_data['product_id'], 'product_options' => $_data['product_options'], 'amount' => $_data['amount'], 'extra' => array('parent' => array('certificate' => $gift_cert_wishlist_id)));
$product = fn_get_product_data($_data['product_id'], $_SESSION['auth']);
$gift_cert_data['display_subtotal'] += $_data['amount'] * $product['price'];
}
$gift_cert_data['products'] = $wishlist['gift_certificates'][$gift_cert_wishlist_id]['products'] = $product_data;
}
return array($gift_cert_wishlist_id, $gift_cert_data);
} else {
return array();
}
}
示例10: empty
if ($mode == 'get_products') {
$_REQUEST['type'] = empty($_REQUEST['type']) ? 'extended' : $_REQUEST['type'];
list($products) = fn_get_products($_REQUEST, Registry::get('settings.Appearance.products_per_page'));
if (!empty($products)) {
foreach ($products as $k => $v) {
fn_gather_additional_product_data($products[$k], 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');
}
}
if ($mode == 'get_categories') {
$_REQUEST['category_id'] = empty($_REQUEST['category_id']) ? 0 : $_REQUEST['category_id'];
$params = array('category_id' => $_REQUEST['category_id'], 'visible' => false, 'plain' => !empty($_REQUEST['format']) && $_REQUEST['format'] == 'plain' ? true : false);
list($categories, ) = fn_get_categories($params, CART_LANGUAGE);
$xml .= fn_array_to_xml($categories, 'categories');
}
if ($mode == 'get_category') {
示例11: 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'])) {
//.........这里部分代码省略.........
示例12: elseif
$recent_order_status_text = "order_declined";
} elseif ($recent_order_status == "F") {
$recent_order_status_text = "order_failed";
} elseif ($recent_order_status == "I") {
$recent_order_status_text = "order_canceled";
} elseif ($recent_order_status == "O") {
$recent_order_status_text = "order_opened";
} elseif ($recent_order_status == "P") {
$recent_order_status_text = "order_processed";
} else {
$recent_order_status_text = "opened";
}
$shortlist = db_get_array("SELECT * FROM ?:user_session_products WHERE user_id=?i AND type='W' ORDER BY timestamp DESC", $auth['user_id']);
$shortlist_number = count($shortlist);
$last_shortlist_product_info = unserialize($shortlist[0]['extra']);
$product = fn_get_product_data($last_shortlist_product_info['product_id'], $auth, CART_LANGUAGE, '', true, true, true, true);
$product['selected_options'] = $last_shortlist_product_info['product_options'];
fn_gather_additional_product_data($product, true, true);
$return_requests = db_get_array("SELECT * FROM ?:rma_returns WHERE user_id=?i ORDER BY timestamp DESC", $auth['user_id']);
$return_requests_number = count($return_requests);
$aviable_return_requests = array();
if (count($return_requests) > 0) {
foreach ($return_requests as $return_request) {
if (in_array($return_request['status'], array('O'))) {
array_push($aviable_return_requests, $return_request);
}
}
}
$aviable_return_requests_number = count($aviable_return_requests);
Registry::get('view')->assign('orders_number', $orders_number);
Registry::get('view')->assign('recent_order_status', $recent_order_status_text);
示例13: content_55dc81a6027c27_25441318
function content_55dc81a6027c27_25441318($_smarty_tpl)
{
if (!is_callable('smarty_function_math')) {
include '/var/www/html/market/app/lib/vendor/smarty/smarty/libs/plugins/function.math.php';
}
if (!is_callable('smarty_block_hook')) {
include '/var/www/html/market/app/functions/smarty_plugins/block.hook.php';
}
fn_preload_lang_vars(array('delete', 'edit', 'remove'));
if (fn_allowed_for("ULTIMATE") && $_smarty_tpl->tpl_vars['product_id']->value && $_smarty_tpl->tpl_vars['runtime']->value['company_id']) {
?>
<?php
$_smarty_tpl->tpl_vars["product_data"] = new Smarty_variable(fn_get_product_data($_smarty_tpl->tpl_vars['product_id']->value, $_SESSION['auth'], @constant('CART_LANGUAGE'), "?:products.company_id,?:product_descriptions.product", false, false, false, false, false, false, true), null, 0);
?>
<?php
if ($_smarty_tpl->tpl_vars['product_data']->value['company_id'] != $_smarty_tpl->tpl_vars['runtime']->value['company_id']) {
?>
<?php
$_smarty_tpl->tpl_vars["product"] = new Smarty_variable(($tmp = @$_smarty_tpl->tpl_vars['product_data']->value['product']) === null || $tmp === '' ? $_smarty_tpl->tpl_vars['product']->value : $tmp, null, 0);
?>
<?php
if ($_smarty_tpl->tpl_vars['owner_company_id']->value && $_smarty_tpl->tpl_vars['owner_company_id']->value != $_smarty_tpl->tpl_vars['runtime']->value['company_id']) {
?>
<?php
$_smarty_tpl->tpl_vars["show_only_name"] = new Smarty_variable(true, null, 0);
?>
<?php
}
?>
<?php
}
}
?>
<?php
if ($_smarty_tpl->tpl_vars['type']->value == "options") {
?>
<tr <?php
if (!$_smarty_tpl->tpl_vars['clone']->value) {
?>
id="<?php
echo htmlspecialchars($_smarty_tpl->tpl_vars['root_id']->value, ENT_QUOTES, 'UTF-8');
?>
_<?php
echo htmlspecialchars($_smarty_tpl->tpl_vars['delete_id']->value, ENT_QUOTES, 'UTF-8');
?>
" <?php
}
?>
class="cm-js-item<?php
if ($_smarty_tpl->tpl_vars['clone']->value) {
?>
cm-clone hidden<?php
}
?>
">
<?php
if ($_smarty_tpl->tpl_vars['position_field']->value) {
?>
<td><input type="text" name="<?php
echo htmlspecialchars($_smarty_tpl->tpl_vars['input_name']->value, ENT_QUOTES, 'UTF-8');
?>
[<?php
echo htmlspecialchars($_smarty_tpl->tpl_vars['delete_id']->value, ENT_QUOTES, 'UTF-8');
?>
]" value="<?php
echo smarty_function_math(array('equation' => "a*b", 'a' => $_smarty_tpl->tpl_vars['position']->value, 'b' => 10), $_smarty_tpl);
?>
" size="3" class="input-text-short" <?php
if ($_smarty_tpl->tpl_vars['clone']->value) {
?>
disabled="disabled"<?php
}
?>
/></td><?php
}
?>
<td>
<?php
echo htmlspecialchars($_smarty_tpl->tpl_vars['product']->value, ENT_QUOTES, 'UTF-8');
if ($_smarty_tpl->tpl_vars['show_only_name']->value) {
echo $_smarty_tpl->getSubTemplate("views/companies/components/company_name.tpl", $_smarty_tpl->cache_id, $_smarty_tpl->compile_id, 0, null, array('object' => $_smarty_tpl->tpl_vars['product_data']->value), 0);
}
?>
<?php
if ($_smarty_tpl->tpl_vars['options']->value) {
?>
<br>
<small><?php
echo $_smarty_tpl->tpl_vars['options']->value;
?>
</small>
<?php
}
?>
<?php
if (is_array($_smarty_tpl->tpl_vars['options_array']->value)) {
?>
<?php
$_smarty_tpl->tpl_vars["option"] = new Smarty_Variable();
//.........这里部分代码省略.........
开发者ID:AlanIsrael0,项目名称:market,代码行数:101,代码来源:790f58d615a78ef6f7d59ad11a65b99663d80052.tygh.js.tpl.php
示例14: fn_get_paginated_product_features
function fn_get_paginated_product_features($request, $auth, $product_data = array(), $lang_code = DESCR_SL)
{
$path = array();
if (!empty($request['over'])) {
// get features for categories of selected products only
$categories = db_get_fields("SELECT ?:categories.id_path FROM ?:products_categories LEFT JOIN ?:categories ON ?:categories.category_id = ?:products_categories.category_id WHERE product_id IN (?n)", $_SESSION['product_ids']);
foreach ($categories as $category) {
$path = array_merge($path, explode('/', $category));
}
$path = array_unique($path);
}
if (empty($product_data) && !empty($request['product_id'])) {
$product_data = fn_get_product_data($request['product_id'], $auth, $lang_code, '', false, false, false, false, false, false, false, false);
}
if (!empty($product_data['product_id'])) {
$path = !empty($product_data['main_category']) ? explode('/', db_get_field("SELECT id_path FROM ?:categories WHERE category_id = ?i", $product_data['main_category'])) : '';
if (fn_allowed_for('ULTIMATE')) {
if ($product_data['shared_product'] == 'Y') {
//we should get features for all categories, not only main
$path = !empty($product_data['category_ids']) ? explode('/', implode('/', db_get_fields("SELECT id_path FROM ?:categories WHERE category_id IN (?a)", $product_data['category_ids']))) : '';
}
}
}
$_params = fn_array_merge($request, array('category_ids' => $path, 'product_company_id' => !empty($product_data['company_id']) ? $product_data['company_id'] : 0, 'statuses' => array('A', 'H'), 'variants' => true, 'plain' => false, 'display_on' => '', 'existent_only' => false, 'variants_selected_only' => false));
return fn_get_product_features($_params, PRODUCT_FEATURES_THRESHOLD, $lang_code);
}
示例15: fn_look_through_variants_prices
function fn_look_through_variants_prices($product_id, $options, $variants)
{
$product = fn_get_product_data($product_id, $_SESSION['auth'], CART_LANGUAGE, '', true, true, true, true, $auth['area'] == 'A' && !empty($_REQUEST['action']) && $_REQUEST['action'] == 'preview');
$product['product_options'] = fn_get_product_options(array($product_id), CART_LANGUAGE);
$product = fn_apply_options_rules($product);
//var_dump($product['product_options']);
$position = 0;
$hashes = array();
$combinations = fn_get_options_combinations($options, $variants);
//var_dump($combinations);
foreach ($combinations as $key => $combination) {
$flagToUnsetArrayElement = 0;
$productArrayOtionsVariants = fn_get_options_variants_by_option_variant_id($product_id, $combination);
foreach ($combination as $optionId => $variantId) {
if ($productArrayOtionsVariants[$optionId] && !in_array($variantId, $productArrayOtionsVariants[$optionId])) {
$flagToUnsetArrayElement = 1;
}
}
if ($flagToUnsetArrayElement == 1) {
unset($combinations[$key]);
}
}
//var_dump($combinations);
if (!empty($combinations)) {
foreach ($combinations as $combination) {
$_data = array();
$_data['product_id'] = $product_id;
$_data['combination_hash'] = fn_generate_cart_id($product_id, array('product_options' => $combination));
if (array_search($_data['combination_hash'], $hashes) === false) {
$hashes[] = $_data['combination_hash'];
$_data['combination'] = fn_get_options_combination($combination);
$product['product_options'] = fn_get_selected_product_options($product['product_id'], $combination, CART_LANGUAGE);
$product = fn_apply_options_rules($product);
$_data['price'] = fn_calculate_price_of_a_product($product, $combination);
$old_data = db_get_row("SELECT combination_hash, price " . "FROM ?:product_options_inventory_prices " . "WHERE product_id = ?i AND combination_hash = ?i AND temp = 1", $product_id, $_data['combination_hash']);
/**
* Changes data before update combination
*
* @param array $combination Array of combination data
* @param array $data Combination data to update
* @param int $product_id Product identifier
* @param int $amount Default combination amount
* @param array $options Array of options identifiers
* @param array $variants Array of option variants identifiers arrays in order corresponding to $options parameter
*/
db_query("REPLACE INTO ?:product_options_inventory_prices ?e", $_data);
$combinations[] = $combination;
}
echo str_repeat('. ', count($combination));
}
}
}