user_level <= 2) {
if(file_exists(WPSC_UPGRADES_DIR.'gold_cart_files/affiliates.php')) {
require_once(WPSC_UPGRADES_DIR.'gold_cart_files/affiliates.php');
add_object_page(__('Store', 'wpsc'), __('Store', 'wpsc'), 0, WPSC_URL.'/gold_cart_files/affiliates.php','affiliate_page', WPSC_URL."/images/credit_cards.png");
} else {
if (function_exists('add_object_page')) {
add_object_page(__('Store', 'wpsc'), __('Store', 'wpsc'), 2, $base_page,array(), WPSC_URL."/images/credit_cards.png");
} else {
add_menu_page(__('Store', 'wpsc'), __('Store', 'wpsc'), 2, $base_page);
}
}
} else {
if (function_exists('add_object_page')) {
add_object_page(__('Store', 'wpsc'), __('Store', 'wpsc'), 2, $base_page,array(), WPSC_URL."/images/credit_cards.png");
} else {
add_menu_page(__('Store', 'wpsc'), __('Store', 'wpsc'), 2, $base_page);
}
}
$purchase_log_page = add_submenu_page($base_page, __('Sales', 'wpsc'), __('Sales', 'wpsc'), 7, 'wpsc-sales-logs', 'wpsc_display_sales_logs');
$page_hooks[] = $purchase_log_page;
//echo add_submenu_page($base_page,__("Products"), __("Products"), 7, 'wpsc-edit-products', 'wpsc_display_products_page');
$edit_products_page = add_submenu_page($base_page,__('Products', 'wpsc'),__('Products', 'wpsc'), 7, 'wpsc-edit-products', 'wpsc_display_edit_products_page');
$page_hooks[] = $edit_products_page;
//echo $edit_products_page;
$page_hooks[] = add_submenu_page($base_page,__('Categories', 'wpsc'), __('Categories', 'wpsc'), 7, 'wpsc-edit-groups', 'wpsc_display_groups_page');
//print_r($page_hooks);
// add_submenu_page($base_page,__('Variations', 'wpsc'), __('Variations', 'wpsc'), 7, WPSC_DIR_NAME.'/display_variations.php');
$page_hooks[] = add_submenu_page($base_page,__('Variations', 'wpsc'), __('Variations', 'wpsc'), 7, 'wpsc-edit-variations', 'wpsc_display_variations_page');
foreach((array)get_option('wpsc_product_page_order') as $box) {
$boxes[$box] = ucwords(str_replace("_"," ",$box));
} //exit('-->'.$help);
if (function_exists('add_contextual_help')) {
add_contextual_help(WPSC_DIR_NAME.'/display-log',"About this page");
add_contextual_help(WPSC_DIR_NAME.'/display-category',"About this page");
add_contextual_help(WPSC_DIR_NAME.'/display_variations',"About this page");
add_contextual_help(WPSC_DIR_NAME.'/display-coupons',"About this page");
add_contextual_help(WPSC_DIR_NAME.'/options',"General Settings
Presentation Options
Admin Options
Shipping Options
Payment Options
");
add_contextual_help(WPSC_DIR_NAME.'/display-items',"About this page");
}
//exit('base page:'.$base_page);
// exit($GLOBALS['wp_version']);
if(IS_WPMU || $GLOBALS['wp_version'] == '3.0'){
$page_hooks[] = add_submenu_page($base_page,__('Marketing', 'wpsc'), __('Marketing', 'wpsc'), 10,'wpsc_display_coupons_page','wpsc_display_coupons_page');
}else{
$page_hooks[] = add_submenu_page($base_page,__('Marketing', 'wpsc'), __('Marketing', 'wpsc'), 7,'wpsc_display_coupons_page','wpsc_display_coupons_page');
}
//add_submenu_page('themes.php', 'Marketing', 'Marketing', 7, 'my_test_screen', 'my_test_screen');
$edit_options_page = add_submenu_page($base_page,__('Settings', 'wpsc'), __('Settings', 'wpsc'), 7, 'wpsc-settings', 'wpsc_display_settings_page');
$page_hooks[] = $edit_options_page;
$page_hooks[] = add_submenu_page($base_page,__('Upgrades', 'wpsc'), __('Upgrades', 'wpsc'), 7, 'wpsc-upgrades', 'wpsc_display_upgrades_page');
//$page_hooks[] = add_submenu_page($base_page,__('Upgrades (Old)', 'wpsc'), __('Upgrades (Old)', 'wpsc'), 7, 'wpsc-gold-options','wpsc_gold_shpcrt_options_page');
if(($_SESSION['wpsc_activate_debug_page'] == true) || (defined('WPSC_ADD_DEBUG_PAGE') && (constant('WPSC_ADD_DEBUG_PAGE') == true))) {
$page_hooks[] = add_submenu_page($base_page,__('- Debug'), __('- Debug'), 9, 'wpsc-debug', 'wpsc_debug_page');
}
$page_hooks = apply_filters( 'wpsc_additional_pages', $page_hooks, $base_page);
do_action('wpsc_add_submenu');
}
//add_action('load-'.WPSC_DIR_NAME.'/display-coupons.php', 'wpsc_admin_include_coupon_js');
// exit('
'.print_r($page_hooks, true).''); // Include the javascript and CSS for this page foreach($page_hooks as $page_hook) { add_action("load-$page_hook", 'wpsc_admin_include_css_and_js'); switch($page_hook) { case $edit_products_page: add_action("load-$page_hook", 'wpsc_admin_edit_products_page_js'); break; case $edit_options_page: add_action("load-$page_hook", 'wpsc_admin_include_optionspage_css_and_js'); break; case $purchase_log_page: add_action('admin_head', 'wpsc_product_log_rss_feed'); break; case 'store_page_wpsc_display_coupons_page': add_action("load-$page_hook", 'wpsc_admin_include_coupon_js'); break; } } /// some updating code is run from here, is as good a place as any, and better than some if((get_option('wpsc_trackingid_subject') == null) && (get_option('wpsc_trackingid_message') == null)) { update_option('wpsc_trackingid_subject', __('Product Tracking Email', 'wpsc')); update_option('wpsc_trackingid_message', __("Track & Trace means you may track the progress of your parcel with our online parcel tracker, just login to our website and enter the following Tracking ID to view the status of your order.\n\nTracking ID: %trackid%\n", 'wpsc')); } return; } function wpsc_product_log_rss_feed() { echo ""; } function wpsc_admin_include_coupon_js() { $version_identifier = WPSC_VERSION.".".WPSC_MINOR_VERSION; //exit('called'); wp_enqueue_script('wp-e-commerce-admin-parameters', $siteurl."/wp-admin/admin.php?wpsc_admin_dynamic_js=true", false, $version_identifier); wp_enqueue_style( 'wp-e-commerce-admin_2.7', WPSC_URL.'/wpsc-admin/css/settingspage.css', false, false, 'all' ); wp_enqueue_script('livequery', WPSC_URL.'/wpsc-admin/js/jquery.livequery.js', array('jquery'), '1.0.3'); wp_enqueue_style( 'wp-e-commerce-admin', WPSC_URL.'/wpsc-admin/css/admin.css', false, $version_identifier, 'all' ); wp_enqueue_script('datepicker-ui', WPSC_URL."/js/ui.datepicker.js",array('jquery-ui-core'), $version_identifier); wp_enqueue_script('wp-e-commerce-admin_legacy', WPSC_URL.'/admin.js', array('jquery', 'jquery-ui-core', 'jquery-ui-sortable','datepicker-ui'), $version_identifier); } /** * wpsc_admin_css_and_js function, includes the wpsc_admin CSS and JS * No parameters, returns nothing */ function wpsc_admin_include_css_and_js() { $siteurl = get_option('siteurl'); if(is_ssl()) { $siteurl = str_replace("http://", "https://", $siteurl); } wp_admin_css( 'dashboard' ); wp_admin_css( 'media' ); wp_enqueue_script( 'postbox', '/wp-admin/js/postbox.js', array('jquery')); $version_identifier = WPSC_VERSION.".".WPSC_MINOR_VERSION; wp_enqueue_script('jCrop', WPSC_URL.'/wpsc-admin/js/jquery.Jcrop.min.js', array('jquery'), '0.9.8'); wp_enqueue_script('livequery', WPSC_URL.'/wpsc-admin/js/jquery.livequery.js', array('jquery'), '1.0.3'); wp_enqueue_script('wp-e-commerce-admin-parameters', $siteurl."/wp-admin/admin.php?wpsc_admin_dynamic_js=true", false, $version_identifier); wp_enqueue_script('wp-e-commerce-admin', WPSC_URL.'/wpsc-admin/js/admin.js', array('jquery', 'jquery-ui-core', 'jquery-ui-sortable'), $version_identifier); wp_enqueue_script('wp-e-commerce-legacy-ajax', WPSC_URL.'/wpsc-admin/js/ajax.js', false, $version_identifier); // needs removing wp_enqueue_script('wp-e-commerce-variations', WPSC_URL.'/wpsc-admin/js/variations.js', array('jquery'), $version_identifier); wp_enqueue_style( 'wp-e-commerce-admin', WPSC_URL.'/wpsc-admin/css/admin.css', false, $version_identifier, 'all' ); wp_enqueue_style( 'wp-e-commerce-admin-dynamic', $siteurl."/wp-admin/admin.php?wpsc_admin_dynamic_css=true" , false, $version_identifier, 'all' ); wp_localize_script( 'wp-e-commerce-tags', 'postL10n', array( 'tagsUsed' => __('Tags used on this post:'), 'add' => attribute_escape(__('Add')), 'addTag' => attribute_escape(__('Add new tag')), 'separate' => __('Separate tags with commas'), )); if(defined('WPSC_GOLD_DIR_NAME') && WPSC_GOLD_DIR_NAME != ''){ wp_enqueue_style('gold_cart', WPSC_GOLD_FILE_URL.'/gold_cart.css',false, $version_identifier, 'all'); } // Prototype breaks dragging and dropping, I need it gone wp_deregister_script('prototype'); // remove the old javascript and CSS, we want it no more, it smells bad remove_action('admin_head', 'wpsc_admin_css'); } function wpsc_admin_edit_products_page_js() { wp_enqueue_script('wp-e-commerce-tags', WPSC_URL.'/wpsc-admin/js/product_tagcloud.js', array('livequery'), $version_identifier); if ( user_can_richedit() ) { wp_enqueue_script('editor'); } wp_enqueue_script('media-upload'); wp_enqueue_style('thickbox'); wp_enqueue_script('swfupload'); wp_enqueue_script('swfupload-swfobject'); wp_enqueue_script('swfupload-queue'); wp_enqueue_script('wpsc-swfupload-handlers', WPSC_URL.'/wpsc-admin/js/wpsc-swfupload-handlers.js', false, $version_identifier); add_action( 'admin_head', 'wp_tiny_mce' ); // remove cforms timymce code from running on the products page, because it breaks tinymce for us remove_filter( 'mce_external_plugins', 'cforms_plugin'); remove_filter( 'mce_buttons', 'cforms_button'); //add_action( 'admin_print_footer_scripts', 'wp_tiny_mce', 25 ); wp_enqueue_script('quicktags'); do_action('wpsc_admin_edit_products_js'); } /** * wpsc_admin_include_optionspage_css_and_js function, includes the wpsc_admin CSS and JS for the specific options page * No parameters, returns nothing */ function wpsc_admin_include_optionspage_css_and_js(){ wp_enqueue_script('wp-e-commerce-js-ajax', WPSC_URL.'/js/ajax.js', false, $version_identifier); wp_enqueue_script('wp-e-commerce-js-ui-tabs', WPSC_URL.'/wpsc-admin/js/jquery-ui.js', false, $version_identifier); wp_enqueue_script('wp-e-commerce-js-dimensions', WPSC_URL.'/wpsc-admin/js/dimensions.js', false, $version_identifier); wp_enqueue_style( 'wp-e-commerce-admin_2.7', WPSC_URL.'/wpsc-admin/css/settingspage.css', false, false, 'all' ); wp_enqueue_style( 'wp-e-commerce-ui-tabs', WPSC_URL.'/wpsc-admin/css/jquery.ui.tabs.css', false, $version_identifier, 'all' ); } function wpsc_meta_boxes(){ //$pagename = 'products_page_wpsc-edit-products'; $pagename = 'store_page_wpsc-edit-products'; add_meta_box('wpsc_product_category_and_tag_forms', 'Category and Tags', 'wpsc_product_category_and_tag_forms', $pagename, 'normal', 'high'); add_meta_box('wpsc_product_price_and_stock_forms', 'Price and Stock', 'wpsc_product_price_and_stock_forms', $pagename, 'normal', 'high'); add_meta_box('wpsc_product_variation_forms', 'Variations', 'wpsc_product_variation_forms', $pagename, 'normal', 'high'); add_meta_box('wpsc_product_shipping_forms', 'Shipping', 'wpsc_product_shipping_forms', $pagename, 'normal', 'high'); add_meta_box('wpsc_product_advanced_forms', 'Advanced Settings', 'wpsc_product_advanced_forms', $pagename, 'normal', 'high'); add_meta_box('wpsc_product_download_forms', 'Product Download', 'wpsc_product_download_forms', $pagename, 'normal', 'high'); add_meta_box('wpsc_product_image_forms', 'Product Images', 'wpsc_product_image_forms', $pagename, 'normal', 'high'); } add_action('admin_menu', 'wpsc_meta_boxes'); function wpsc_admin_dynamic_js() { header('Content-Type: text/javascript'); header('Expires: '.gmdate('r',mktime(0,0,0,date('m'),(date('d')+12),date('Y'))).''); header('Cache-Control: public, must-revalidate, max-age=86400'); header('Pragma: public'); $siteurl = get_option('siteurl'); $hidden_boxes = get_option('wpsc_hidden_box'); $form_types1 = get_option('wpsc_checkout_form_fields'); $unique_names1 = Array('billingfirstname', 'billinglastname', 'billingaddress', 'billingcity', 'billingcountry', 'billingemail', 'billingphone', 'billingpostcode', 'delivertoafriend', 'shippingfirstname', 'shippinglastname', 'shippingaddress', 'shippingcity', 'shippingstate', 'shippingcountry', 'shippingpostcode'); foreach($form_types1 as $form_type) { $form_types .= ""; } $unique_names = ""; foreach($unique_names1 as $unique_name){ $unique_names.= ""; } $hidden_boxes = implode(',', (array)$hidden_boxes); echo "var base_url = '".$siteurl."';\n\r"; echo "var WPSC_URL = '". WPSC_URL."';\n\r"; echo "var WPSC_IMAGE_URL = '".WPSC_IMAGE_URL."';\n\r"; echo "var WPSC_DIR_NAME = '".WPSC_DIR_NAME."';\n\r"; echo "var WPSC_IMAGE_URL = '".WPSC_IMAGE_URL."';\n\r"; // LightBox Configuration start echo "var fileLoadingImage = '".WPSC_URL."/images/loading.gif';\n\r"; echo "var fileBottomNavCloseImage = '".WPSC_URL."/images/closelabel.gif';\n\r"; echo "var fileThickboxLoadingImage = '".WPSC_URL."/images/loadingAnimation.gif';\n\r"; echo "var resizeSpeed = 9;\n\r"; echo "var borderSize = 10;\n\r"; echo "var hidden_boxes = '".$hidden_boxes."';\n\r"; echo "var IS_WP27 = '".IS_WP27."';\n\r"; echo "var TXT_WPSC_DELETE = '".__('Delete', 'wpsc')."';\n\r"; echo "var TXT_WPSC_TEXT = '".__('Text', 'wpsc')."';\n\r"; echo "var TXT_WPSC_EMAIL = '".__('Email', 'wpsc')."';\n\r"; echo "var TXT_WPSC_COUNTRY = '".__('Country', 'wpsc')."';\n\r"; echo "var TXT_WPSC_TEXTAREA = '".__('Textarea', 'wpsc')."';\n\r"; echo "var TXT_WPSC_HEADING = '".__('Heading', 'wpsc')."';\n\r"; echo "var TXT_WPSC_COUPON = '".__('Coupon', 'wpsc')."';\n\r"; echo "var HTML_FORM_FIELD_TYPES =\" ".$form_types."; \" \n\r"; echo "var HTML_FORM_FIELD_UNIQUE_NAMES = \" ".$unique_names."; \" \n\r"; echo "var TXT_WPSC_LABEL = '".__('Label', 'wpsc')."';\n\r"; echo "var TXT_WPSC_LABEL_DESC = '".__('Label Description', 'wpsc')."';\n\r"; echo "var TXT_WPSC_ITEM_NUMBER = '".__('Item Number', 'wpsc')."';\n\r"; echo "var TXT_WPSC_LIFE_NUMBER = '".__('Life Number', 'wpsc')."';\n\r"; echo "var TXT_WPSC_PRODUCT_CODE = '".__('Product Code', 'wpsc')."';\n\r"; echo "var TXT_WPSC_PDF = '".__('PDF', 'wpsc')."';\n\r"; echo "var TXT_WPSC_AND_ABOVE = '".__(' and above', 'wpsc')."';\n\r"; echo "var TXT_WPSC_IF_PRICE_IS = '".__('If price is ', 'wpsc')."';\n\r"; echo "var TXT_WPSC_IF_WEIGHT_IS = '".__('If weight is ', 'wpsc')."';\n\r"; exit(); } if($_GET['wpsc_admin_dynamic_js'] == 'true') { add_action("admin_init", 'wpsc_admin_dynamic_js'); } function wpsc_admin_dynamic_css() { header('Content-Type: text/css'); header('Expires: '.gmdate('r',mktime(0,0,0,date('m'),(date('d')+12),date('Y'))).''); header('Cache-Control: public, must-revalidate, max-age=86400'); header('Pragma: public'); $flash = apply_filters('flash_uploader', $flash); if($flash = 1) { ?> div.flash-image-uploader { display: block; } div.browser-image-uploader { display: none; } div.flash-image-uploader { display: none; } div.browser-image-uploader { display: block; } get_var("SELECT COUNT(*) FROM `".WPSC_TABLE_PURCHASE_LOGS."`"); /* * This is the right hand side for the past 30 days revenue on the wp dashboard */ echo "
"; // calculates total amount of orders for the month $year = date("Y"); $month = date("m"); $start_timestamp = mktime(0, 0, 0, $month, 1, $year); $end_timestamp = mktime(0, 0, 0, ($month+1), 0, $year); $sql = "SELECT COUNT(*) FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `date` BETWEEN '$start_timestamp' AND '$end_timestamp' AND `processed` IN (2,3,4) ORDER BY `date` DESC"; $currentMonthOrders = $wpdb->get_var($sql); //calculates amount of money made for the month $currentMonthsSales = nzshpcrt_currency_display(admin_display_total_price($start_timestamp, $end_timestamp),1); echo $currentMonthsSales; echo "".__('Sales', 'wpsc').""; echo "
"; echo ""; echo ""; echo $currentMonthOrders; echo ""; echo "".__('Orders', 'wpsc').""; echo "
"; echo ""; //echo ""; //calculates average sales amount per order for the month if($currentMonthOrders > 0){ $monthsAverage = ((int)admin_display_total_price($start_timestamp, $end_timestamp)/(int)$currentMonthOrders); echo nzshpcrt_currency_display($monthsAverage,1); } //echo ""; echo "".__('Avg Orders', 'wpsc').""; echo "
"; echo ""; echo nzshpcrt_currency_display(admin_display_total_price(),1); echo "".__('Sales', 'wpsc').""; echo "
"; echo ""; echo ""; echo $totalOrders; echo ""; echo "".__('Orders', 'wpsc').""; echo "
"; echo ""; //echo ""; //calculates average sales amount per order for the month if((admin_display_total_price() > 0) && ($totalOrders > 0) ) { $totalAverage = ((int)admin_display_total_price()/(int)$totalOrders); } else { $totalAverage = 0; } echo nzshpcrt_currency_display($totalAverage,1); //echo ""; echo "".__('Avg Orders', 'wpsc').""; echo "
"; echo ""; do_action('wpsc_admin_pre_activity'); // wpsc_admin_latest_activity(); do_action('wpsc_admin_post_activity'); echo "
At a Glance Revenue
01 ()
02 ()
03 ()
04 ()
At a Glance | '; foreach ($months as $mnth) { $output.='' . date("M", $mnth) . ' | '; } $output.='|
' . $tablerow . ' | ' . $product[1] . ' | '; $currsymbol=wpsc_get_currency_symbol(); $tablerow++; foreach ($product[0] as $amount) { $output.= '' . $currsymbol . number_format(absint($amount),2) . ' | '; } $output.='
"; wpsc_dashboard_4months_widget(); echo "
".__('Your "products page" is not currently set to display any products. You need to select a product grouping to display by default.
This is set in the Shop Settings page.', 'wpsc')."