本文整理汇总了PHP中WPSC_Purchase_Log::get_data方法的典型用法代码示例。如果您正苦于以下问题:PHP WPSC_Purchase_Log::get_data方法的具体用法?PHP WPSC_Purchase_Log::get_data怎么用?PHP WPSC_Purchase_Log::get_data使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类WPSC_Purchase_Log
的用法示例。
在下文中一共展示了WPSC_Purchase_Log::get_data方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: transaction_results
/**
* transaction_results function main function for creating the purchase reports, transaction results page, and email receipts
* @access public
*
* @since 3.7
* @param $sessionid (string) unique session id
* @param echo_to_screen (boolean) whether to output the results or return them (potentially redundant)
* @param $transaction_id (int) the transaction id
*/
function transaction_results($sessionid, $display_to_screen = true, $transaction_id = null)
{
global $message_html, $echo_to_screen, $purchase_log;
// pre-3.8.9 variable
$echo_to_screen = $display_to_screen;
$purchase_log_object = new WPSC_Purchase_Log($sessionid, 'sessionid');
// compatibility with pre-3.8.9 templates where they use a global
// $purchase_log object which is simply just a database row
$purchase_log = $purchase_log_object->get_data();
// pre-3.8.9 templates also use this global variable
$message_html = wpsc_get_transaction_html_output($purchase_log_object);
do_action('wpsc_transaction_results_shutdown', $purchase_log_object, $sessionid, $display_to_screen);
return $message_html;
}
示例2: wpsc_purchlog_edit_status
function wpsc_purchlog_edit_status($purchlog_id = '', $purchlog_status = '')
{
global $wpdb;
if (empty($purchlog_id) && empty($purchlog_status)) {
$purchlog_id = absint($_POST['id']);
$purchlog_status = absint($_POST['new_status']);
}
$purchase_log = new WPSC_Purchase_Log($purchlog_id);
//in the future when everyone is using the 2.0 merchant api, we should use the merchant class to update the staus,
// then you can get rid of this hook and have each person overwrite the method that updates the status.
do_action('wpsc_edit_order_status', array('purchlog_id' => $purchlog_id, 'purchlog_data' => $purchase_log->get_data(), 'new_status' => $purchlog_status));
$result = wpsc_update_purchase_log_status($purchlog_id, $purchlog_status);
wpsc_clear_stock_claims();
return $result;
}
示例3: push_sales_data
/**
* Pushes sales data back to Baikonur
*
* Only pushes once. Accounts for annoying potential edge case of status-switching admins
*
* @param WPSC_Purchase_Log object $purchase_log Purchase Log object
* @return void
*/
public static function push_sales_data($purchase_log_id, $current_status, $old_status, $purchase_log)
{
$purchase_log = new WPSC_Purchase_Log($purchase_log_id);
$id = absint($purchase_log->get('id'));
//Also checking is_order_received, as that's what Manual Payments do.
if ($purchase_log->is_transaction_completed() || $purchase_log->is_order_received()) {
$pushed_to_sass = wpsc_get_meta($id, '_pushed_to_wpeconomy', 'purchase_log');
if (empty($pushed_to_saas)) {
$data = $purchase_log->get_data();
$cart_contents = $purchase_log->get_cart_contents();
//We want to push sales data - but naturally, IDs will differ, even names could potentially.
//So we add the slug to the object we POST
foreach ($cart_contents as $key => $cart_item) {
$slug = get_post_field('post_name', $cart_item->prodid);
$cart_contents[$key]->slug = $slug;
}
$args = array('body' => array('data' => json_encode($data), 'cart_contents' => json_encode($cart_contents)));
$request = wp_remote_post('http://www.wpeconomy.org/?sales_data=true', $args);
$response = wp_remote_retrieve_response_code($request);
//For some reason, if the site is down, we want the ability to ensure we can grab the sale later.
$success = 200 === $response;
wpsc_update_meta($id, '_pushed_to_wpeconomy', $success, 'purchase_log');
}
}
}
示例4: array
function do_export_file()
{
global $wpdb;
$trnsid = 1;
$gateway_accounts = get_option('pbci_gateway_accounts', array());
$export_accounts = get_option('pbci_export_accounts', array('sales_revenue' => 'Product Revenue', 'shipping' => 'Shipping', 'sales_tax_account' => 'Sales Tax Payable', 'sales_tax_payee' => 'Sales Tax'));
$cust = array('NAME' => '', 'FIRSTNAME' => '', 'LASTNAME' => '', 'EMAIL' => '', 'PHONE1' => '', 'BADDR1' => '', 'BADDR2' => '', 'BADDR3' => '', 'BADDR4' => '', 'SADDR1' => '', 'SADDR2' => '', 'SADDR3' => '', 'SADDR4' => '');
$trans = array('TRNSID' => '', 'TRNSTYPE' => '', 'DATE' => '', 'ACCNT' => '', 'AMOUNT' => '', 'NAME' => '', 'MEMO' => '', 'PAYMETH' => '');
$spl = array('SPLID' => '', 'TRNSTYPE' => '', 'DATE' => '', 'ACCNT' => '', 'AMOUNT' => '', 'NAME' => '', 'MEMO' => '', 'INVITEM' => '', 'PRICE' => '', 'EXTRA' => '');
$content = "";
$cust_content = "";
$headers = "";
$headers .= "!CUST\tNAME\t\n";
$headers .= "!ACCNT\tNAME\tACCNTTYPE\tEXTRA\tACCNUM\n";
$content .= "ACCNT\t" . $export_accounts['sales_revenue'] . "\tINC\t\n";
$content .= "ACCNT\t" . $export_accounts['shipping'] . "\tINC\t\n";
$content .= "ACCNT\t" . $export_accounts['sales_tax_account'] . "\tOCLIAB\tSALESTAX\t2201\n";
foreach ($gateway_accounts as $gateway => $account_name) {
if (!empty($account_name)) {
$content .= "ACCNT\t" . $account_name . "\tBANK\t\n";
}
}
// !TRNS line
$headers .= '!TRNS';
foreach ($trans as $key => $value) {
$headers .= "\t" . $key;
}
$headers .= "\n";
// !SPL line
$headers .= '!SPL';
foreach ($spl as $key => $value) {
$headers .= "\t" . $key;
}
$headers .= "\n";
// !CUST line
$headers .= '!CUST';
foreach ($cust as $key => $value) {
$headers .= "\t" . $key;
}
$headers .= "\n";
// !ENDTRNS line
//$content .= '!ENDTRNS' . "\n";
$export_dates = array_keys($_POST['period']);
foreach ($export_dates as $export_date) {
$a = explode('-', $export_date);
$year = $a[0];
$month = $a[1];
$sql = "SELECT ID FROM " . WPSC_TABLE_PURCHASE_LOGS . ' WHERE MONTH( FROM_UNIXTIME( date ) ) = ' . $month . ' AND YEAR( FROM_UNIXTIME( DATE ) ) = ' . $year . ' ORDER by date DESC';
$result = $wpdb->get_col($sql, 0);
$purchase_log_ids = array_map('intval', $result);
$max_rows = 1;
foreach ($purchase_log_ids as $purchase_log_id) {
$purchase_log = new WPSC_Purchase_Log($purchase_log_id);
$gateway_id = $purchase_log->get('gateway');
$data = $purchase_log->get_data();
if (empty($gateway_accounts[$gateway_id])) {
continue;
}
// reset the transaction array back to empty
foreach ($trans as $key => $value) {
$trans[$key] = '';
}
// reset the customer array back to empty
foreach ($cust as $key => $value) {
$cust[$key] = '';
}
if ($purchase_log->get('processed') != WPSC_Purchase_Log::ACCEPTED_PAYMENT && $purchase_log->get('processed') != WPSC_Purchase_Log::CLOSED_ORDER) {
continue;
}
$checkout_form_data = new WPSC_Checkout_Form_Data($purchase_log_id);
$checkout = $checkout_form_data->get_data();
if (!isset($checkout['billingstate'])) {
$checkout['billingstate'] = '';
}
if (!isset($checkout['shippingstate'])) {
$checkout['shippingstate'] = '';
}
$timestamp = $purchase_log->get('date');
$thedate = date('m/d/Y', $timestamp);
foreach ($trans as $key => $value) {
switch ($key) {
case 'TRNSID':
$trans[$key] = $trnsid++;
break;
case 'TIMESTAMP':
$trans[$key] = $purchase_log->get('date');
break;
case 'TRNSTYPE':
$trans[$key] = 'CASH SALE';
break;
case 'DATE':
$trans[$key] = $thedate;
break;
case 'ACCNT':
$trans[$key] = $gateway_accounts[$gateway_id];
break;
case 'NAME':
$trans[$key] = $checkout['billingfirstname'] . ' ' . $checkout['billinglastname'];
break;
case 'AMOUNT':
//.........这里部分代码省略.........