本文整理汇总了PHP中cw_func_call函数的典型用法代码示例。如果您正苦于以下问题:PHP cw_func_call函数的具体用法?PHP cw_func_call怎么用?PHP cw_func_call使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cw_func_call函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: cw_sections_get
function cw_sections_get($section, $data = array(), $where = '', $info_type = 264)
{
global $tables, $current_area, $user_account;
// extract($params);
$table = $tables[$section];
if (!$info_type) {
$info_type = 264;
}
if ($current_area == 'C') {
$where .= ($where ? ' and ' : ' ') . $table . '.active=1 ';
if (in_array($section, array('arrivals', 'hot_deals', 'clearance', 'super_deals'))) {
$current_time = time();
$where .= " and ({$table}.from_time <= {$current_time} or {$table}.from_time = 0) and ({$table}.to_time >={$current_time} or {$table}.to_time = 0) and ({$table}.min_amount <= {$tables['products_warehouses_amount']}.avail or {$table}.min_amount = 0)";
}
$add_data['query_joins'][$section] = array('on' => "{$tables['products']}.product_id={$table}.product_id", 'is_inner' => 1);
$data['where'] = $where;
if ($data['sort_field'] == 'orderby' || empty($data['sort_field'])) {
$data['sort_field'] = "{$table}.pos";
}
$return = cw_func_call('cw_product_search', array('data' => $data, 'user_account' => $user_account, 'current_area' => $current_area, 'info_type' => $info_type), $add_data);
if ($data['all']) {
$return = $return[0];
}
} else {
$return = cw_query("select {$table}.*, {$tables['products']}.product_id, {$tables['products']}.product from {$table}, {$tables['products']}, {$tables['products_warehouses_amount']} where {$tables['products_warehouses_amount']}.product_id = {$tables['products']}.product_id and {$tables['products_warehouses_amount']}.warehouse_customer_id = 0 and {$tables['products_warehouses_amount']}.variant_id=0 and {$tables['products']}.product_id={$table}.product_id {$where} order by {$table}.pos, {$tables['products']}.product");
}
return $return;
}
示例2: export
function export()
{
global $REQUEST_METHOD, $smarty, $config, $addons, $top_message, $customer_id, $tables;
global $mode, $action, $amazon_config;
$success = false;
if ($REQUEST_METHOD != 'POST') {
cw_header_location('index.php?target=' . addon_target);
}
if ($_POST['export_type'] == 'PaQ' && (empty($_POST['price']) && empty($_POST['quantity']))) {
$top_message = array('content' => 'At least Price or Quantity must be exported.', 'type' => 'E');
cw_header_location('index.php?target=' . addon_target);
return false;
}
$_filename = 'files/amazon/' . date('Ymd') . '_' . date('His') . '_' . $_POST['export_type'] . '.csv';
if (($filename = cw_allow_file($_filename, true)) && ($file = cw_fopen($_filename, 'w', true))) {
$pids = cw_call('cw_objects_get_list_ids', array('P'));
if (empty($pids)) {
$pids = cw_query_column("SELECT product_id FROM {$tables['products']} WHERE status=1");
// Very bad. Use API
}
if ($pids) {
$amazon_config = cw_array_merge($amazon_config, $config['amazon'], $_POST);
cw_config_update('amazon', $_POST);
$warnings = array();
$data = array();
$header_put = false;
foreach ($pids as $v) {
$variants = array();
$prod = cw_func_call('cw_product_get', array('id' => $v, 'info_type' => 8 | 64 | 128 | 256 | 512 | 2048));
$attr = cw_query_hash("SELECT a.field, av.value\n FROM {$tables['attributes_values']} av, {$tables['attributes']} a\n WHERE av.item_id={$v} AND av.item_type='P' AND a.attribute_id=av.attribute_id", 'field', false, true);
// very bad. Use API
if ($prod['is_variants']) {
$variants = cw_call('cw_get_product_variants', array($v));
} else {
$variants[0] = $prod;
}
foreach ($variants as $var) {
$var = cw_array_merge($var, $attr);
if ($_POST['export_type'] == 'PaQ') {
$data = array('sku' => $var['productcode'], 'price' => $_POST['price'] ? $var['price'] : '', 'quantity' => $_POST['quantity'] ? $var['avail'] : '', 'leadtime-to-ship' => $amazon_config['default_leadtime_to_ship']);
}
if ($_POST['export_type'] == 'InvLoad') {
$data = array('sku' => $var['productcode'], 'product-id' => empty($amazon_config['product_id_type']) ? '' : (string) $var[$amazon_config['product_id']], 'product-id-type' => $amazon_config['product_id_type'], 'price' => $var['price'], 'item-condition' => empty($var[$amazon_config['item_condition']]) ? $amazon_config['default_item_condition'] : $var[$amazon_config['item_condition']], 'quantity' => empty($amazon_config['fulfillment_center_id']) ? $var['avail'] : '', 'add-delete' => empty($_POST['add-delete']) ? 'a' : $_POST['add-delete'], 'will-ship-internationally' => empty($var[$amazon_config['ship_internationally']]) ? $amazon_config['default_ship_internationally'] : $var[$amazon_config['ship_internationally']], 'expedited-shipping' => empty($var[$amazon_config['expedited_shipping']]) ? $amazon_config['default_expedited_shipping'] : $var[$amazon_config['expedited_shipping']], 'standard-plus' => empty($var[$amazon_config['standard_plus']]) ? $amazon_config['default_standard_plus'] : $var[$amazon_config['standard_plus']], 'item-note' => $var[$amazon_config['item_note']], 'fulfillment-center-id' => $amazon_config['fulfillment_center_id'], 'product-tax-code' => $amazon_config['default_product_tax_code'], 'leadtime-to-ship' => $amazon_config['default_leadtime_to_ship']);
}
if (!$header_put) {
fputcsv($file, array_keys($data), "\t");
$header_put = true;
}
fputcsv($file, $data, "\t");
}
}
}
fclose($file);
$top_message = array('content' => 'File <b>' . $_filename . '</b> successfully created');
}
cw_header_location('index.php?target=' . addon_target);
}
示例3: smarty_function_select_category
function smarty_function_select_category($params, &$smarty)
{
extract($params);
if (empty($assign)) {
$smarty->trigger_error("assign: missing 'assign' parameter");
return;
}
cw_load('category');
$smarty->assign($assign, cw_func_call('cw_category_get', array('cat' => $category_id)));
}
示例4: on_add_cart
function on_add_cart(&$cart, $added_product)
{
global $smarty;
cw_load('ajax', 'product');
$product_id = $cart['products'][$added_product['productindex']]['product_id'];
$product = cw_func_call('cw_product_get', array('id' => $product_id, 'info_type' => 0 | 128));
$product = cw_array_merge($product, $added_product);
$smarty->assign('product', $product);
cw_add_ajax_block(array('id' => 'add2cart_popup', 'action' => 'update', 'template' => 'addons/ajax_add2cart/add2cart_popup.tpl'), 'add2cart_popup');
cw_add_ajax_block(array('id' => 'script', 'content' => 'sm("add2cart_popup",add2cart_popup_width,add2cart_popup_height, true, "' . $added_product['added_amount'] . ($added_product['added_amount'] > 1 ? ' items' : ' item') . ' added to cart")'), 'add2cart_popup_script');
}
示例5: dashboard_action_setting
function dashboard_action_setting()
{
global $smarty, $tables;
$params = array('mode' => 'setting', 'sections' => null);
$dashboard = cw_func_call('dashboard_build_sections', $params);
foreach ($dashboard as $name => $dash) {
$dashboard[$name] = array_merge($dashboard[$name], cw_query_first('SELECT * FROM ' . $tables['dashboard'] . ' WHERE name="' . mysql_real_escape_string($name) . '"'));
}
uasort($dashboard, 'cw_uasort_by_order');
$smarty->assign('dashboard', $dashboard);
}
示例6: cw_checkout_login
function cw_checkout_login()
{
global $smarty;
cw_func_call('cw_checkout_login_prepare');
$top_message =& cw_session_register('top_message');
$smarty->assign('top_message', $top_message);
$top_message = array();
header("Content-type: application/xml");
cw_display('customer/checkout/xml_login.tpl', $smarty);
die;
}
示例7: cw_attributes_get
function cw_attributes_get($params, $return)
{
if ($params['item_type'] != 'P' || empty($params['item_id'])) {
return $return;
}
$product = cw_func_call('cw_product_get', array('id' => $params['item_id'], 'info_type' => 0));
if (is_array($product) && $product['product_id'] && !cw_is_catalog_product($product)) {
unset($return['original_url']);
}
return $return;
}
示例8: cw_ps_products_in_cart_pre
function cw_ps_products_in_cart_pre($cart, $user_info)
{
$special_offers_apply =& cw_session_register("special_offers_apply");
# Delete all free added products
if (is_array($cart['products'])) {
foreach ($cart['products'] as $kk => $vv) {
if ($vv["promotion_suite"]["free_product"] == 'Y') {
cw_call('cw_delete_from_cart', array(&$cart, $vv['cartid']));
}
}
}
# / Delete all free added products
if (!empty($special_offers_apply['free_products'])) {
foreach ($special_offers_apply['free_products'] as $pid => $qty) {
#
# Add product to the cart
#
$product = cw_func_call('cw_product_get', array('id' => $pid, 'info_type' => 8192));
$avail_amount = $product['avail'];
$qty = min($qty, $avail_amount);
$min_amount = $product['min_amount'];
if ($qty >= $min_amount) {
cw_load('warehouse');
$possible_warehouses = cw_warehouse_get_avails_customer($pid);
$warehouse = key($possible_warehouses);
$add_product = array();
$add_product["product_id"] = $pid;
$add_product["amount"] = $qty;
$add_product["product_options"] = "";
$add_product["price"] = 0.0;
// warehouse is required, otherwise free product will be placed as separate order
$add_product['warehouse_customer_id'] = $warehouse;
// do to use cw_warehouse_add_to_cart_simple. It operates with global $cart while we use here local $cart copy
// $result = cw_call('cw_warehouse_add_to_cart_simple', array($pid, $qty, '', 0.00));
$result = cw_call('cw_add_to_cart', array(&$cart, $add_product));
# Adjust just added product
foreach ($cart['products'] as $ck => $cv) {
if ($cv["cartid"] == $result['cartid']) {
$cart['products'][$ck]["promotion_suite"]["free_product"] = true;
// mark just added product as offered
}
}
} else {
unset($special_offers_apply['free_products'][$pid]);
}
}
// foreach
}
// if
return new EventReturn($cart['products'], array($cart, $user_info));
// replace cart in input params for main function
}
示例9: cw_google_base_cron
function cw_google_base_cron()
{
global $domain_id;
cw_include('addons/google_base/gb_attributes_map.php');
$log = array();
$domains = cw_func_call('cw_md_get_domains');
foreach ($domains as $domain) {
$domain_id = $domain['domain_id'];
$count = cw_include('addons/google_base/create_gb_xml.php');
$log[] = $count . ' records were exported to feed';
}
return join("\n", $log);
}
示例10: smarty_modifier_attribute_data
function smarty_modifier_attribute_data($value)
{
cw_load('attributes');
$data = "";
$use_description =& cw_session_register('use_description', true);
if (preg_match('/(\\w+)\\.name/', $value, $matches)) {
// Get attribute name by field
$field_name = $matches[1];
if (!empty($field_name)) {
$attribute_id = cw_attributes_get_attribute_by_field($field_name);
$attribute = cw_func_call('cw_attributes_get_attribute', array('attribute_id' => $attribute_id));
$data = $attribute['name'];
}
} else {
if (preg_match('/(\\w+)\\.value/', $value, $matches)) {
// Get attribute value by field
global $product_filter;
$pf =& $product_filter;
$field_name = $matches[1];
if ($pf && $field_name) {
foreach ($pf as $pf_value) {
if ($pf_value['field'] == $field_name) {
if ($pf_value['selected']) {
foreach ($pf_value['selected'] as $pfs_value) {
if (isset($pf_value['values'][$pfs_value])) {
$data = $pf_value['values'][$pfs_value]['name'];
}
}
}
}
}
}
} else {
if ($use_description && preg_match('/(\\w+)\\.description/', $value, $matches)) {
// Get attribute value by field
$field_name = $matches[1];
if (!empty($field_name)) {
global $smarty;
$attribute_id = cw_attributes_get_attribute_by_field($field_name);
$attribute = cw_func_call('cw_attributes_get_attribute', array('attribute_id' => $attribute_id));
$use_description = false;
require_once $smarty->_get_plugin_filepath('function', 'eval');
$data = smarty_function_eval(array('var' => $attribute['description']), $smarty);
$use_description = true;
}
}
}
}
return $data;
}
示例11: cw_ac_get_product_info
function cw_ac_get_product_info($product_id)
{
global $user_account, $addons, $tables, $config;
$product_id = intval($product_id);
if (empty($product_id)) {
return false;
}
$product = cw_func_call('cw_product_get', array('id' => $product_id, 'info_type' => 8 | 32 | 64 | 128 | 2048, 'user_account' => $user_account));
if (!(!empty($product) && is_array($product))) {
return false;
}
if (!empty($addons['wholesale_trading'])) {
$allowed_membership_ids = array(0);
$membership_id = intval($user_account['membership_id']);
if (!empty($membership_id)) {
$allowed_membership_ids[] = $membership_id;
}
$query = "SELECT pp.quantity, pp.price " . "FROM {$tables['products_prices']} AS pp " . "WHERE pp.product_id = '" . $product_id . "' AND pp.membership_id IN ('" . implode("','", $allowed_membership_ids) . "') " . "AND pp.quantity > 1 AND pp.variant_id = 0 " . "GROUP BY pp.quantity " . "ORDER BY pp.quantity";
$wholesale_prices = cw_query($query);
if (!empty($wholesale_prices) && is_array($wholesale_prices)) {
$query = "SELECT MIN(pp.price) " . "FROM {$tables['products_prices']} AS pp " . "WHERE pp.quantity = 1 AND pp.membership_id IN ('" . implode("','", $allowed_membership_ids) . "') " . "AND pp.variant_id = 0 AND pp.product_id = '" . $product_id . "'";
$min_price = doubleval(cw_query_first_cell($query));
$prev_key = false;
foreach ($wholesale_prices as $k => $wholesale_price) {
if (doubleval($wholesale_price['price']) > $min_price) {
unset($wholesale_prices[$k]);
continue;
}
$min_price = doubleval($wholesale_price['price']);
$wholesale_taxes = cw_tax_price(intval($wholesale_price['price']), $user_account, $product_id);
$wholesale_prices[$k]['taxed_price'] = $wholesale_taxes['taxed_price'];
$wholesale_prices[$k]['taxes'] = $wholesale_taxes['taxes'];
if ($prev_key !== false && isset($wholesale_prices[$prev_key])) {
$wholesale_prices[$prev_key]['next_quantity'] = intval($wholesale_price['quantity']) - 1;
if (intval($product_accessory['min_amount']) > intval($wholesale_prices[$prev_key]['next_quantity'])) {
unset($wholesale_prices[$prev_key]);
} elseif (intval($product_accessory['min_amount']) > intval($wholesale_price['quantity'])) {
$wholesale_prices[$prev_key]['quantity'] = intval($product_accessory['min_amount']);
}
}
$prev_key = $k;
}
$wholesale_prices = array_values($wholesale_prices);
$product['product_wholesale'] = $wholesale_prices;
}
}
return $product;
}
示例12: smarty_function_price_filter_url
function smarty_function_price_filter_url($params, &$smarty)
{
static $pf_count = null;
if (is_null($pf_count)) {
$pf_count = count($smarty->get_template_vars('product_filter'), COUNT_RECURSIVE);
}
if ($pf_count > 200 || 1) {
// For big filter
unset($params['ns']);
$params['prepared'] = 'no';
// This marker says to cw_pf_load() that passed URL is not prepared and must be re-requested from server
return http_build_query($params);
} else {
// Old approach is not optimal for huge amount of attribute values
return cw_func_call('cw_product_navigation_filter_url', $params);
}
}
示例13: cw_mobile_get_domain_by_mobile_host_attr
function cw_mobile_get_domain_by_mobile_host_attr($host)
{
global $tables, $HTTPS;
cw_load('attributes');
$mobile_attributes = cw_func_call('cw_attributes_get_attributes_by_field', array('field' => 'mobile_host'));
if (!empty($mobile_attributes['DM'])) {
$attribute_id = intval($mobile_attributes['DM']);
// get domain data
return cw_query_first("SELECT d.*, av.value as mobile_host \n\t\t\t\t\t\t\t\tFROM {$tables['domains']} d\n\t\t\t\t\t\t\t\tLEFT JOIN {$tables['attributes_values']} av ON av.item_id = d.domain_id\n\t\t\t\t\t\t\t\tLEFT JOIN {$tables['attributes']} a ON a.attribute_id = av.attribute_id\n\t\t\t\t\t\t\t\tWHERE av.attribute_id = '" . $attribute_id . "'\n\t\t\t\t\t\t\t\t\tAND av.value = '" . $host . "' \n\t\t\t\t\t\t\t\t\tAND a.active = 1");
} else {
$mobile_mobile_flag = cw_session_register('mobile_mobile_flag');
if ($mobile_mobile_flag == 'on' && $_GET['mobile_version'] != 'off') {
$result = cw_query_first("SELECT *, http_host as mobile_host\n\t\t\t\t\tFROM {$tables['domains']}\n\t\t\t\t\tWHERE " . ($HTTPS ? "https_host" : "http_host") . " ='" . $host . "'");
$result['skin'] .= mobile_addon_skin_prefix;
return $result;
}
}
return array();
}
示例14: parse_ini_str
function parse_ini_str($content, $name = '')
{
if (!is_object($this->_parse_ini_obj)) {
require_once SMARTY_DIR . $this->config_class . '.class.php';
$this->_parse_ini_obj = new $this->config_class();
$this->_parse_ini_obj->overwrite = $this->config_overwrite;
$this->_parse_ini_obj->booleanize = $this->config_booleanize;
$this->_parse_ini_obj->read_hidden = $this->config_read_hidden;
$this->_parse_ini_obj->fix_newlines = $this->config_fix_newlines;
}
# kornev
# only required data
$ret = array();
$buttons = array();
$_tmp = $this->_parse_ini_obj->parse_contents($content);
$js_tab = $_tmp['vars']['default_tab'];
$default_template = $_tmp['vars']['default_template'];
if (is_array($_tmp['sections'])) {
foreach ($_tmp['sections'] as $section => $vars) {
if ($section == 'submit' || $section == 'reset' || $vars['vars']['type'] == 'button') {
$buttons[] = $vars['vars'];
continue;
}
if (!$vars['vars']['template']) {
$vars['vars']['template'] = $default_template;
}
$ret[$section] = $vars['vars'];
if (!$js_tab || !$_tmp['sections'][$js_tab]) {
$js_tab = $section;
}
}
}
$ret = cw_func_call('cw_tabs_js_abstract', array('name' => $name, 'selected' => $js_tab, 'js_tabs' => $ret, 'buttons' => $buttons));
# kornev, we should defaine the selected tab....
# kornev, try to find the default once again
if ($ret['selected'] != $_tmp['vars']['default_tab']) {
if (isset($ret['js_tabs'][$_tmp['vars']['default_tab']])) {
$ret['selected'] = $_tmp['vars']['default_tab'];
}
}
return $ret;
}
示例15: cw_top_menu_make_sql_query
function cw_top_menu_make_sql_query()
{
global $tables, $app_web_dir;
cw_load('category');
$pcats_ = cw_func_call('cw_category_search', array('data' => array('active' => 1, 'all' => 1)));
$pcats_ = $pcats_[0];
foreach ($pcats_ as $v) {
extract($v);
$mid = 'p' . $category_id;
$pmid = $parent_id;
if ($pmid != 0) {
$pmid = 'p' . $pmid;
}
$title = $category;
$pcount = $product_count_web;
//$link="$app_web_dir/?target=index&cat=$category_id";
$link = cw_call('cw_core_get_html_page_url', array(array('var' => 'index', 'cat' => $category_id)));
$pos = $tm_pos;
$active = $tm_active;
$title2 = $tm_title;
$type = 'pcat';
if (APP_AREA != 'customer' || $active != 0) {
$pcats[] = compact('mid', 'pmid', 'title', 'pcount', 'link', 'pos', 'active', 'title2', 'type');
}
}
unset($pcats_);
$fields = "CONCAT('u',category_id) as mid, CONCAT(parent_id_tag,parent_id) as pmid, category as title,\n";
$fields .= "0 as pcount, link, pos, active, '' as title2, 'ucat' as type\n";
if (APP_AREA == 'customer') {
$where = "where active=1";
} else {
$where = "";
}
$sql = "select {$fields} from {$tables['top_menu_user_categories']} {$where};";
$ucats = cw_query($sql);
$cats = array_merge($pcats, $ucats);
foreach ($cats as $k => $v) {
$sorter[$k] = $v['pos'];
}
array_multisort($sorter, $cats);
return $cats;
}