\n\r";
$output .= " \n\r";
$output .= " ".TXT_WPSC_COUPON_CODE." \n\r";
$output .= " ".TXT_WPSC_DISCOUNT." \n\r";
$output .= " ".TXT_WPSC_START." \n\r";
$output .= " ".TXT_WPSC_EXPIRY." \n\r";
$output .= " ".TXT_WPSC_USE_ONCE." \n\r";
$output .= " ".TXT_WPSC_ACTIVE." \n\r";
$output .= " ".TXT_WPSC_PERTICKED." \n\r";
$output .= " \n\r";
$output .= " \n\r";
$output .= " \n\r";
$output .= " \n\r";
$output .= " \n\r";
$output .= " \n\r";
$output .= " \n\r";
$output .= " ";
$output .= " ";
$output .= " $ \n\r";//
$output .= " % \n\r";
$output .= " \n\r";
$output .= " \n\r";
$output .= " \n\r";
$coupon_start = explode(" ",$coupon['start']);
$output .= " ";
/* $output .= " \n\r";
for($i = 1; $i <=31; ++$i) {
$selected = '';
if($i == date("d", $start_timestamp)) { $selected = "selected='true'"; }
$output .= " $i ";
}
$output .= " \n\r";
$output .= " \n\r";
for($i = 1; $i <=12; ++$i) {
$selected = '';
if($i == (int)date("m", $start_timestamp)) { $selected = "selected='true'"; }
$output .= " ".date("M",mktime(0, 0, 0, $i, 1, date("Y")))." ";
}
$output .= " \n\r";
$output .= " \n\r";
for($i = date("Y"); $i <= (date("Y") +12); ++$i) {
$selected = '';
if($i == date("Y", $start_timestamp)) { $selected = "selected='true'"; }
$output .= " ".$i." ";
}
$output .= " \n\r";*/
$output .= " \n\r";
$output .= " \n\r";
$coupon_expiry = explode(" ",$coupon['expiry']);
$output .= " ";
/*$output .= " \n\r";
for($i = 1; $i <=31; ++$i) {
$selected = '';
if($i == date("d", $end_timestamp)) { $selected = "selected='true'"; }
$output .= " $i ";
}
$output .= " \n\r";
$output .= " \n\r";
for($i = 1; $i <=12; ++$i) {
$selected = '';
if($i == (int)date("m", $end_timestamp)) { $selected = "selected='true'"; }
$output .= " ".date("M",mktime(0, 0, 0, $i, 1, date("Y")))." ";
}
$output .= " \n\r";
$output .= " \n\r";
for($i = date("Y"); $i <= (date("Y") +12); ++$i) {
$selected = '';
if($i == (date("Y", $end_timestamp))) { $selected = "selected='true'"; }
$output .= " ".$i." \n\r";
}
$output .= " \n\r";*/
$output .= " \n\r";
$output .= " \n\r";
$output .= " \n\r";
$output .= " \n\r";
$output .= " \n\r";
$output .= " \n\r";
$output .= " \n\r";
$output .= " \n\r";
$output .= " \n\r";
$output .= " \n\r";
$output .= " \n\r";
$output .= " \n\r";
$output .= " \n\r";
$output .= " \n\r";
$output .= " \n\r";
//$output .= " \n\r";
$output .= " \n\r";
$output .= " \n\r";
$output .= " \n\r";
$output .= " \n\r";
if($conditions != null){
$output .= "";
$output .= "";
$output .= "Conditions";
$output .= " ";
$output .= " ";
$output .= "";
$output .= "Delete";
$output .= " ";
$output .= "";
$output .= "Property";
$output .= " ";
$output .= "";
$output .= "Logic";
$output .= " ";
$output .= "";
$output .= "Value";
$output .= " ";
$output .= " \n\r";
$output .= "";
$output .= "";
$output .= " ";
$output .= " ";
$output .= " ";
$output .= "";
$output .= $conditions['property'];
$output .= " ";
$output .= "";
$output .= $conditions['logic'];
$output .= " ";
$output .= "";
$output .= $conditions['value'];
$output .= " ";
$output .= " ";
}elseif($conditions == null){
$output .= wpsc_coupons_conditions( $id);
}
?>
\n\r";
$output .= "\n\r";
echo $output;
return $output;
}
function wpsc_coupons_conditions($id){
?>
Conditions
';
return $output;
}
function setting_button(){
$itemsFeedURL = "http://www.google.com/base/feeds/items";
$next_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['PHP_SELF']."?page=wpsc-edit-products";
$redirect_url = 'https://www.google.com/accounts/AuthSubRequest?session=1';
$redirect_url .= '&next=';
$redirect_url .= urlencode($next_url);
$redirect_url .= "&scope=";
$redirect_url .= urlencode($itemsFeedURL);
// $output.="";
$output.="
";
return $output;
}
function wpsc_right_now() {
global $wpdb,$nzshpcrt_imagesize_info;
$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);
$replace_values[":productcount:"] = $wpdb->get_var("SELECT COUNT(*) FROM `".WPSC_TABLE_PRODUCT_LIST."` WHERE `active` IN ('1')");
$product_count = $wpdb->get_var("SELECT COUNT(*) FROM `".WPSC_TABLE_PRODUCT_LIST."` WHERE `active` IN ('1')");
$replace_values[":productcount:"] .= " ".(($replace_values[":productcount:"] == 1) ? TXT_WPSC_PRODUCTCOUNT_SINGULAR : TXT_WPSC_PRODUCTCOUNT_PLURAL);
$product_unit = (($replace_values[":productcount:"] == 1) ? TXT_WPSC_PRODUCTCOUNT_SINGULAR : TXT_WPSC_PRODUCTCOUNT_PLURAL);
$replace_values[":groupcount:"] = $wpdb->get_var("SELECT COUNT(*) FROM `".WPSC_TABLE_PRODUCT_CATEGORIES."` WHERE `active` IN ('1')");
$group_count = $wpdb->get_var("SELECT COUNT(*) FROM `".WPSC_TABLE_PRODUCT_CATEGORIES."` WHERE `active` IN ('1')");
$replace_values[":groupcount:"] .= " ".(($replace_values[":groupcount:"] == 1) ? TXT_WPSC_GROUPCOUNT_SINGULAR : TXT_WPSC_GROUPCOUNT_PLURAL);
$group_unit = (($replace_values[":groupcount:"] == 1) ? TXT_WPSC_GROUPCOUNT_SINGULAR : TXT_WPSC_GROUPCOUNT_PLURAL);
$replace_values[":salecount:"] = $wpdb->get_var("SELECT COUNT(*) FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `date` BETWEEN '".$start_timestamp."' AND '".$end_timestamp."'");
$sales_count = $wpdb->get_var("SELECT COUNT(*) FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `date` BETWEEN '".$start_timestamp."' AND '".$end_timestamp."'");
$replace_values[":salecount:"] .= " ".(($replace_values[":salecount:"] == 1) ? TXT_WPSC_SALECOUNT_SINGULAR : TXT_WPSC_SALECOUNT_PLURAL);
$sales_unit = (($replace_values[":salecount:"] == 1) ? TXT_WPSC_SALECOUNT_SINGULAR : TXT_WPSC_SALECOUNT_PLURAL);
$replace_values[":monthtotal:"] = nzshpcrt_currency_display(admin_display_total_price($start_timestamp, $end_timestamp),1);
$replace_values[":overaltotal:"] = nzshpcrt_currency_display(admin_display_total_price(),1);
$variation_count = $wpdb->get_var("SELECT COUNT(*) FROM `".WPSC_TABLE_PRODUCT_VARIATIONS."`");
$variation_unit = (($variation_count == 1) ? TXT_WPSC_VARIATION_SINGULAR : TXT_WPSC_VARIATION_PLURAL);
$replace_values[":pendingcount:"] = $wpdb->get_var("SELECT COUNT(*) FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `processed` IN ('1')");
$pending_sales = $wpdb->get_var("SELECT COUNT(*) FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `processed` IN ('1')");
$replace_values[":pendingcount:"] .= " " . (($replace_values[":pendingcount:"] == 1) ? TXT_WPSC_PENDINGCOUNT_SINGULAR : TXT_WPSC_PENDINGCOUNT_PLURAL);
$pending_sales_unit = (($replace_values[":pendingcount:"] == 1) ? TXT_WPSC_PENDINGCOUNT_SINGULAR : TXT_WPSC_PENDINGCOUNT_PLURAL);
$accept_sales = $wpdb->get_var("SELECT COUNT(*) FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `processed` IN ('2' ,'3', '4')");
$accept_sales_unit = (($accept_sales == 1) ? TXT_WPSC_PENDINGCOUNT_SINGULAR : TXT_WPSC_PENDINGCOUNT_PLURAL);
$replace_values[":theme:"] = get_option('wpsc_selected_theme');
$replace_values[":versionnumber:"] = WPSC_PRESENTABLE_VERSION;
if (function_exists('add_object_page')) {
$output="";
$output.="
";
$output.="
";
$output.=" ".TXT_WPSC_CURRENT_MONTH." ";
$output.=" ";
$output.=" ";
$output .= "
";
$output .= "
".TXT_WPSC_AT_A_GLANCE."
";
//$output.="
".TXT_WPSC_SALES_DASHBOARD."
";
$output .= "
";
$output .= "
";
$output .= "";
$output .= "";
$output .= "".$product_count." ";
$output .= " ";
$output .= "";
$output .= ucfirst($product_unit);
$output .= " ";
$output .= "";
$output .= "".$sales_count." ";
$output .= " ";
$output .= "";
$output .= ucfirst($sales_unit);
$output .= " ";
$output .= " ";
$output .= "";
$output .= "";
$output .= "".$group_count." ";
$output .= " ";
$output .= "";
$output .= ucfirst($group_unit);
$output .= " ";
$output .= "";
$output .= "".$pending_sales." ";
$output .= " ";
$output .= "".TXT_WPSC_PENDING." ";
$output .= ucfirst($pending_sales_unit);
$output .= " ";
$output .= " ";
$output .= "";
$output .= "";
$output .= "".$variation_count." ";
$output .= " ";
$output .= "";
$output .= ucfirst($variation_unit);
$output .= " ";
$output .= "";
$output .= "".$accept_sales." ";
$output .= " ";
$output .= "".TXT_WPSC_CLOSED." ";
$output .= ucfirst($accept_sales_unit);
$output .= " ";
$output .= " ";
$output .= "
";
$output .= "
";
$output .= "
";
$output .= "
";
$output.="
";
} else {
$output="";
$output.="
\n\r";
$output.="
\n\r";
$output.=" ".TXT_WPSC_ADD_NEW_PRODUCT." \n\r";
$output.=" "._('Right Now')." \n\r";
//$output.=" \n\r";
$output.=" \n\r";
$output.="
".TXT_WPSC_SALES_DASHBOARD."
\n\r";
$output.="
\n\r";
$output.=" ".TXT_WPSC_YOUAREUSING."\n\r";
//$output.=" Change Theme \n\r";
//$output.="This is WordPress version 2.6. Update to 2.6.1 \n\r";
$output.="
\n\r";
$output.="
\n\r";
$output.="
\n\r";
$output = str_replace(array_keys($replace_values), array_values($replace_values),$output);
}
return $output;
}
function wpsc_packing_slip($purchase_id) {
global $wpdb;
$purch_sql = "SELECT * FROM `".WPSC_TABLE_PURCHASE_LOGS."` WHERE `id`='".$purchase_id."'";
$purch_data = $wpdb->get_row($purch_sql,ARRAY_A) ;
//echo "
".TXT_WPSC_DATE." :".date("jS M Y", $purch_data['date'])."
";
$cartsql = "SELECT * FROM `".WPSC_TABLE_CART_CONTENTS."` WHERE `purchaseid`=".$purchase_id."";
$cart_log = $wpdb->get_results($cartsql,ARRAY_A) ;
$j = 0;
if($cart_log != null) {
echo "
\n\r";
echo "
".TXT_WPSC_PACKING_SLIP." \n\r";
echo "
".TXT_WPSC_ORDER." # ".$purchase_id."
\n\r";
echo "
\n\r";
$form_sql = "SELECT * FROM `".WPSC_TABLE_SUBMITED_FORM_DATA."` WHERE `log_id` = '".(int)$purchase_id."'";
$input_data = $wpdb->get_results($form_sql,ARRAY_A);
foreach($input_data as $input_row) {
$rekeyed_input[$input_row['form_id']] = $input_row;
}
if($input_data != null) {
$form_data = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_CHECKOUT_FORMS."` WHERE `active` = '1'",ARRAY_A);
foreach($form_data as $form_field) {
switch($form_field['type']) {
case 'country':
$delivery_region_count = $wpdb->get_var("SELECT COUNT(`regions`.`id`) FROM `".WPSC_TABLE_REGION_TAX."` AS `regions` INNER JOIN `".WPSC_TABLE_CURRENCY_LIST."` AS `country` ON `country`.`id` = `regions`.`country_id` WHERE `country`.`isocode` IN('".$wpdb->escape( $purch_data['billing_country'])."')");
if(is_numeric($purch_data['shipping_region']) && ($delivery_region_count > 0)) {
echo " ".__('State', 'wpsc').": ".wpsc_get_region($purch_data['shipping_region'])." \n\r";
}
echo " ".wp_kses($form_field['name'], array() ).": ".wpsc_get_country($purch_data['billing_country'])." \n\r";
break;
case 'delivery_country':
echo " ".wp_kses($form_field['name'], array() ).": ".wpsc_get_country($purch_data['shipping_country'])." \n\r";
break;
case 'heading':
echo " ".wp_kses($form_field['name'], array() ).": \n\r";
break;
default:
echo " ".wp_kses($form_field['name'], array() ).": ".htmlentities(stripslashes($rekeyed_input[$form_field['id']]['value']), ENT_QUOTES)." \n\r";
break;
}
}
} else {
echo " ".TXT_WPSC_NAME.": ".$purch_data['firstname']." ".$purch_data['lastname']." \n\r";
echo " ".TXT_WPSC_ADDRESS.": ".$purch_data['address']." \n\r";
echo " ".TXT_WPSC_PHONE.": ".$purch_data['phone']." \n\r";
echo " ".TXT_WPSC_EMAIL.": ".$purch_data['email']." \n\r";
}
if(get_option('payment_method') == 2) {
$gateway_name = '';
foreach($GLOBALS['nzshpcrt_gateways'] as $gateway) {
if($purch_data['gateway'] != 'testmode') {
if($gateway['internalname'] == $purch_data['gateway'] ) {
$gateway_name = $gateway['name'];
}
} else {
$gateway_name = "Manual Payment";
}
}
}
// echo " \n\r";
// echo " ".TXT_WPSC_PAYMENT_METHOD.": ".$gateway_name." \n\r";
// //echo " ".TXT_WPSC_PURCHASE_NUMBER.": ".$purch_data['id']." \n\r";
// echo " ".TXT_WPSC_HOWCUSTOMERFINDUS.": ".$purch_data['find_us']." \n\r";
// $engrave_line = explode(",",$purch_data['engravetext']);
// echo " ".TXT_WPSC_ENGRAVE." \n\r";
// echo " ".TXT_WPSC_ENGRAVE_LINE_ONE.": ".$engrave_line[0]." \n\r";
// echo " ".TXT_WPSC_ENGRAVE_LINE_TWO.": ".$engrave_line[1]." \n\r";
// if($purch_data['transactid'] != '') {
// echo " ".TXT_WPSC_TXN_ID.": ".$purch_data['transactid']." \n\r";
// }
echo "
\n\r";
echo "
";
echo "";
echo " ".TXT_WPSC_QUANTITY." ";
echo " ".TXT_WPSC_NAME." ";
echo " ".TXT_WPSC_PRICE." ";
echo " ".TXT_WPSC_SHIPPING." ";
echo 'Tax ';
echo ' ';
$endtotal = 0;
$all_donations = true;
$all_no_shipping = true;
$file_link_list = array();
foreach($cart_log as $cart_row) {
$alternate = "";
$j++;
if(($j % 2) != 0) {
$alternate = "class='alt'";
}
$productsql= "SELECT * FROM `".WPSC_TABLE_PRODUCT_LIST."` WHERE `id`=".$cart_row['prodid']."";
$product_data = $wpdb->get_results($productsql,ARRAY_A);
$variation_sql = "SELECT * FROM `".WPSC_TABLE_CART_ITEM_VARIATIONS."` WHERE `cart_id`='".$cart_row['id']."'";
$variation_data = $wpdb->get_results($variation_sql,ARRAY_A);
$variation_count = count($variation_data);
if($variation_count > 1) {
$variation_list = " (";
$i = 0;
foreach($variation_data as $variation) {
if($i > 0) {
$variation_list .= ", ";
}
$value_id = $variation['value_id'];
$value_data = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_VARIATION_VALUES."` WHERE `id`='".$value_id."' LIMIT 1",ARRAY_A);
$variation_list .= $value_data[0]['name'];
$i++;
}
$variation_list .= ")";
} else if($variation_count == 1) {
$value_id = $variation_data[0]['value_id'];
$value_data = $wpdb->get_results("SELECT * FROM `".WPSC_TABLE_VARIATION_VALUES."` WHERE `id`='".$value_id."' LIMIT 1",ARRAY_A);
$variation_list = " (".$value_data[0]['name'].")";
} else {
$variation_list = '';
}
if($cart_row['donation'] != 1) {
$all_donations = false;
}
if($cart_row['no_shipping'] != 1) {
$shipping = $cart_row['pnp'] * $cart_row['quantity'];
$total_shipping += $shipping;
$all_no_shipping = false;
} else {
$shipping = 0;
}
$price = $cart_row['price'] * $cart_row['quantity'];
$gst = $price - ($price / (1+($cart_row['gst'] / 100)));
if($gst > 0) {
$tax_per_item = $gst / $cart_row['quantity'];
}
echo "";
echo " ";
echo $cart_row['quantity'];
echo " ";
echo " ";
echo $product_data[0]['name'];
echo stripslashes($variation_list);
echo " ";
echo " ";
echo nzshpcrt_currency_display( $price, 1);
echo " ";
echo " ";
echo nzshpcrt_currency_display($shipping, 1);
echo " ";
echo '';
echo nzshpcrt_currency_display($cart_row['tax_charged'],1);
echo ' ';
echo ' ';
}
echo "
";
echo "
\n\r";
} else {
echo "
".TXT_WPSC_USERSCARTWASEMPTY;
}
}
function wpsc_product_item_row() {
}
?>