当前位置: 首页>>代码示例>>PHP>>正文


PHP cw_call函数代码示例

本文整理汇总了PHP中cw_call函数的典型用法代码示例。如果您正苦于以下问题:PHP cw_call函数的具体用法?PHP cw_call怎么用?PHP cw_call使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了cw_call函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: cw_error_check

function cw_error_check(&$array_to_check, $rules, $attributes_type = '')
{
    $error = array();
    $index = 1;
    foreach ($rules as $k => $v) {
        $func = is_array($v) && isset($v['func']) ? $v['func'] : $v;
        if ($func && function_exists($func)) {
            $is_error = $func($array_to_check[$k], $k, $array_to_check);
        } else {
            $is_error = empty($array_to_check[$k]) || !$array_to_check[$k];
        }
        if ($is_error) {
            $var = 'err_field_' . ($v['lng'] ? $v['lng'] : $k);
            $lng = cw_get_langvar_by_name($var, '', false, true);
            $error[] = $index++ . '. ' . ($lng ? $lng : $var);
        }
    }
    if ($attributes_type) {
        $error = array_merge($error, cw_call('cw_attributes_check', array($array_to_check['attribute_class_id'], &$array_to_check['attributes'], $attributes_type, $index)));
    }
    if (!count($error)) {
        return false;
    }
    return implode("<br/>\n", $error);
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:25,代码来源:cw.error.php

示例2: cw_ps_bundle_update

function cw_ps_bundle_update($product_id)
{
    global $tables, $config;
    $product_id = (int) $product_id;
    if ($_SERVER['REQUEST_METHOD'] != 'POST') {
        cw_ps_bundle_redirect($product_id);
    }
    $offer_id = cw_call('cw_ps_offer_bundle_update', array($product_id, $_POST));
    // Delete selected products
    if (is_array($_POST['del_cond'])) {
        foreach ($_POST['del_cond'] as $k => $v) {
            $k = intval($k);
            db_query("DELETE FROM {$tables['ps_cond_details']} WHERE offer_id='{$offer_id}' AND object_id='{$k}' AND object_type='" . PS_OBJ_TYPE_PRODS . "'");
            db_query("DELETE FROM {$tables['ps_bonus_details']} WHERE offer_id='{$offer_id}' AND object_id='{$k}' AND object_type='" . PS_OBJ_TYPE_PRODS . "'");
        }
    }
    $cond_products = cw_query_column("SELECT object_id FROM {$tables['ps_cond_details']} WHERE offer_id='{$offer_id}' AND object_type='" . PS_OBJ_TYPE_PRODS . "'");
    if (count($cond_products) <= 1) {
        //delete offer
        cw_call('cw_ps_offer_delete', array($offer_id));
    }
    cw_array2update('ps_offers', array('auto' => 0), "offer_id='{$offer_id}'");
    // TODO: Domain assignation
    cw_ps_bundle_redirect($product_id);
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:25,代码来源:product_modify.php

示例3: cw_speed_bar_delete

function cw_speed_bar_delete($item_id)
{
    global $tables;
    db_query("delete from {$tables['speed_bar']} where item_id='{$item_id}'");
    db_query("delete from {$tables['speed_bar_lng']} where item_id='{$item_id}'");
    cw_call('cw_attributes_cleanup', array($item_id, 'B'));
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:7,代码来源:cw.speed_bar.php

示例4: cw_product_filter_get_price_ranges

function cw_product_filter_get_price_ranges($attribute_id, $price_values = null)
{
    global $config, $tables;
    $values = cw_call('cw_attributes_get_attribute_default_value', array($attribute_id));
    $ranges = array();
    foreach ($values as $v) {
        $pr = explode('-', $v['value_key']);
        $range['counter'] = 0;
        if (is_array($price_values)) {
            foreach ($price_values as $k => $p) {
                if ($k >= $pr[0] && $k <= $pr[1]) {
                    $range['counter'] += $p['counter'];
                }
            }
        }
        if ($range['counter'] == 0 || $v['active'] == 0) {
            continue;
        }
        $range['id'] = $v['attribute_value_id'];
        $range['url'] = cw_query_first_cell("SELECT value FROM {$tables['attributes_values']} WHERE item_id = '{$v['attribute_value_id']}'");
        $range['value'] = $v['value_key'];
        if ($config['product_filter']['show_ranges_values'] == "Y") {
            $range['name'] = $v['value'] . '(' . $config['General']['currency_symbol'] . str_replace('-', ' - ' . $config['General']['currency_symbol'], $v['value_key']) . ')';
        } else {
            $range['name'] = $v['value'];
        }
        array_push($ranges, $range);
    }
    return $ranges;
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:30,代码来源:cw.product-filter.php

示例5: cw_vertical_response_get_newslists_by_customer

/**
 * get mail lists by customer
 *
 * @param $customer_id
 * @return null
 */
function cw_vertical_response_get_newslists_by_customer($customer_id)
{
    global $config;
    $return = cw_get_return();
    if ($customer_id) {
        $userinfo = cw_call('cw_user_get_info', array($customer_id, 0));
    } else {
        return $return;
    }
    $vertical_response_data =& cw_session_register('vertical_response_data', array());
    // clear data after day
    if (isset($vertical_response_data['time']) && $vertical_response_data['time'] + SECONDS_PER_DAY < cw_core_get_time()) {
        $vertical_response_data = array();
    }
    if (isset($vertical_response_data['lists']) && !empty($vertical_response_data['lists'])) {
        foreach ($vertical_response_data['lists'] as $list) {
            if ($list->status == 'active') {
                $return['vr_' . $list->id] = array('list_id' => 'vr_' . $list->id, 'name' => $list->name, 'descr' => $list->name, 'direct' => in_array($list->id, $vertical_response_data['user_lists']) ? 1 : 0);
            }
        }
    } else {
        $vertical_response_email = trim($config[vertical_response_addon_name]['vertical_response_email']);
        $vertical_response_password = trim($config[vertical_response_addon_name]['vertical_response_password']);
        try {
            $vertical_response_data['time'] = cw_core_get_time();
            // lifetime
            $vr = new SoapClient(vertical_response_wsdl, array('connection_timeout' => 5));
            $sid = $vr->login(array('username' => "{$vertical_response_email}", 'password' => "{$vertical_response_password}", 'session_duration_minutes' => vertical_response_ses_time));
            // get all lists
            $lists = $vr->enumerateLists(array('session_id' => $sid, 'type' => 'email', 'include_field_info' => false, 'limit' => 20));
            $vertical_response_data['lists'] = $lists;
            if (!empty($lists) && count($lists)) {
                foreach ($lists as $list) {
                    if ($list->status == 'active') {
                        // find lists with user with email $userinfo['email']
                        $list_members = $vr->searchListMembers(array('session_id' => $sid, 'field_name' => 'email_address', 'field_value' => $userinfo['email'], 'list_id' => $list->id, 'max_records' => 1));
                        if (!empty($list_members) && count($list_members)) {
                            $vertical_response_data['user_lists'][] = $list_members[0]->list_id;
                            $vertical_response_data['user_lists'] = array_unique($vertical_response_data['user_lists']);
                            if (empty($vertical_response_data['hash'])) {
                                foreach ($list_members[0]->member_data as $data) {
                                    if ($data->name == 'hash') {
                                        $vertical_response_data['hash'] = $data->value;
                                        break;
                                    }
                                }
                            }
                        }
                        $return['vr_' . $list->id] = array('list_id' => 'vr_' . $list->id, 'name' => $list->name, 'descr' => $list->name, 'direct' => !empty($list_members) ? 1 : 0);
                    }
                }
            }
        } catch (SoapFault $exception) {
            //exit ('fault: "' . $exception->faultcode . '" - ' . $exception->faultstring . "\n");
            return $return;
        }
    }
    return $return;
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:65,代码来源:func.vertical_response.php

示例6: smarty_function_pages_url

function smarty_function_pages_url($params, &$smarty)
{
    if ($params['assign']) {
        $smarty->assign($params['assign'], cw_call('cw_core_get_html_page_url', array($params)));
    } else {
        return cw_call('cw_core_get_html_page_url', array($params));
    }
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:8,代码来源:function.pages_url.php

示例7: view

function view($product_id)
{
    global $smarty;
    $product_video = cw_call('cw\\' . addon_name . '\\get_product_video', array($product_id));
    $smarty->assign('product_video', $product_video);
    //cw_var_dump($product_video);
    return true;
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:8,代码来源:product.php

示例8: product_stages_view

function product_stages_view()
{
    global $smarty, $product_id, $tables;
    $product_stages = cw_call('cw\\' . addon_name . '\\cw_product_stages_get_product_settings', array($product_id));
    $lib_stages = cw_query("select * from {$tables['product_stages_library']} order by title");
    $smarty->assign('product_stages', $product_stages);
    $smarty->assign('lib_stages', $lib_stages);
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:8,代码来源:modify.php

示例9: 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);
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:57,代码来源:amazon_export.php

示例10: cw_pages_delete_page

function cw_pages_delete_page($page_id)
{
    global $tables, $var_dirs;
    $page_data = cw_query_first("select * from {$tables['pages']} where page_id='{$page_id}'");
    if (!$page_data['page_id']) {
        return;
    }
    db_query("delete from {$tables['pages']} where page_id='{$page_id}'");
    cw_call('cw_attributes_cleanup', array($page_id, 'S'));
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:10,代码来源:cw.pages.php

示例11: smarty_function_select_country

function smarty_function_select_country($params, &$smarty)
{
    extract($params);
    if (empty($assign)) {
        $smarty->trigger_error("assign: missing 'assign' parameter");
        return;
    }
    cw_load('map');
    $smarty->assign($assign, cw_call('cw_map_get_countries'));
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:10,代码来源:function.select_country.php

示例12: cw_product_shipping_option_default

function cw_product_shipping_option_default(&$product)
{
    if (empty($product['product_shipping_option'])) {
        $shipping_options_data = cw_call('cw_product_shipping_get_options', array($product['product_id']));
        if (!empty($shipping_options_data['shipping_values'])) {
            $product['product_shipping_option'] = $shipping_options_data['shipping_values'][0]['shipping_id'];
        }
    }
    return $product;
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:10,代码来源:func.php

示例13: cw_group_edit_copy_product_status

function cw_group_edit_copy_product_status($status)
{
    global $ge_id;
    if (!$ge_id) {
        return;
    }
    while ($pid = cw_group_edit_each($ge_id, 1, $product_id)) {
        cw_call('cw_product_update_status', array($pid, $status));
    }
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:10,代码来源:cw.group_edit.php

示例14: cw_on_warehouse_recalculate

function cw_on_warehouse_recalculate($product_id)
{
    global $tables;
    if (cw_product_has_variants($product_id)) {
        $to_update = cw_query_first("select sum(avail) as avail, sum(avail_ordered) as avail_ordered, sum(avail_sold) as avail_sold, sum(avail_reserved) as avail_reserved from {$tables['products_warehouses_amount']} where product_id='{$product_id}' and warehouse_customer_id = 0 and variant_id != 0");
        $to_update['warehouse_customer_id'] = 0;
        $to_update['product_id'] = $product_id;
        $to_update['variant_id'] = 0;
        cw_call('cw_warehouse_insert_avail', array('insert' => $to_update));
    }
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:11,代码来源:hooks.php

示例15: cw_payment_process_void

function cw_payment_process_void($order)
{
    global $config;
    $doc_id = $order['doc_id'];
    $result = cw_call('cw_payment_do_void', array($order));
    if (!is_error($result)) {
        cw_call('cw_doc_place_extras_data', array($doc_id, array('capture_status' => 'V')));
        cw_call('cw_doc_change_status', array($doc_id, 'D'));
        cw_add_top_message('Payment voided, order status is changed to Declined');
    }
    return $result;
}
开发者ID:CartworksPlatform,项目名称:cartworksplatform,代码行数:12,代码来源:docs_O.php


注:本文中的cw_call函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。