function get_download_for_variation($cart_item_name, $ret_product, $script_location, $random_key, $payment_data = '')
{
    $eStore_auto_shorten_url = WP_ESTORE_AUTO_SHORTEN_DOWNLOAD_LINKS;
    $variations = eStore_get_all_string_inside("(", ")", $cart_item_name);
    eStore_payment_debug('Generating download link for digital variation...', true);
    $pieces = explode('|', $ret_product->variation3);
    for ($i = 1; $i < sizeof($pieces); $i++) {
        $pieces2 = explode('::', $pieces[$i]);
        $var3 = trim($pieces2[0]);
        if (sizeof($pieces2) > 1) {
            eStore_payment_debug('Matching digital variation to: ' . $var3, true);
            if (in_array($var3, $variations)) {
                eStore_payment_debug('Found a match for digital variation: ' . $var3, true);
                if (is_numeric($pieces2[1])) {
                    if (array_key_exists('2', $pieces2)) {
                        $url = $pieces2[2];
                    } else {
                        eStore_payment_debug('Download URL was not specified for this variation: ' . $var3, true);
                        $output = "\n" . $cart_item_name . WP_ESTORE_THIS_ITEM_DOES_NOT_HAVE_DOWNLOAD;
                        return $output;
                    }
                } else {
                    $url = $pieces2[1];
                }
                $download_key = eStore_check_stamping_flag_and_generate_download_key($ret_product, $ret_product->id, $url, $payment_data);
                $encrypted_download_url = eStore_construct_raw_encrypted_dl_url($download_key);
                $output = "\n" . stripslashes($cart_item_name) . " - " . $encrypted_download_url;
                eStore_register_link_in_db('', $download_key, $output, '', '', '', 0, $payment_data['txn_id']);
                return $output;
            }
        } else {
            eStore_payment_debug('Download URL or price increment was not specified for this variation: ' . $var3, true);
            $output = "\n" . $cart_item_name . WP_ESTORE_THIS_ITEM_DOES_NOT_HAVE_DOWNLOAD;
        }
    }
    return $output;
}
コード例 #2
0
function eStore_expport_customers_data_to_csv()
{
    global $wpdb;
    $customer_table_name = $wpdb->prefix . "wp_eStore_customer_tbl";
    $ret_customer_db = $wpdb->get_results("SELECT * FROM {$customer_table_name} ORDER BY id DESC", OBJECT);
    $csv_output = "Row ID, First Name, Last Name, Email, Purchased Product ID, Transaction ID, Date, Price Paid, Quantity Purchased, Unit Price, Coupon Code Used, eMember userid, Phone, Address, Product Name, Variations and Input, IP Address, Status, Admin Notes\n";
    foreach ($ret_customer_db as $result) {
        if (empty($result->purchase_qty)) {
            $result->purchase_qty = 1;
        }
        $unit_price = number_format($result->sale_amount / $result->purchase_qty, 2);
        $variations = eStore_get_all_string_inside("(", ")", $result->product_name);
        $var_and_custom_input = implode(", ", $variations);
        $csv_output .= eStore_escape_csv_value(stripslashes($result->id)) . ',' . eStore_escape_csv_value(stripslashes($result->first_name)) . ', ' . eStore_escape_csv_value(stripslashes($result->last_name)) . ',' . eStore_escape_csv_value(stripslashes($result->email_address)) . ', ' . eStore_escape_csv_value(stripslashes($result->purchased_product_id)) . ', ' . eStore_escape_csv_value(stripslashes($result->txn_id)) . ', ' . eStore_escape_csv_value(stripslashes($result->date)) . ', ' . eStore_escape_csv_value(stripslashes($result->sale_amount)) . ',' . eStore_escape_csv_value(stripslashes($result->purchase_qty)) . ',' . eStore_escape_csv_value(stripslashes($unit_price)) . ',' . eStore_escape_csv_value(stripslashes($result->coupon_code_used)) . ',' . eStore_escape_csv_value(stripslashes($result->member_username)) . ',' . eStore_escape_csv_value(stripslashes($result->phone)) . ',' . eStore_escape_csv_value(stripslashes($result->address)) . ',' . eStore_escape_csv_value(stripslashes($result->product_name)) . ',' . eStore_escape_csv_value(stripslashes($var_and_custom_input)) . ',' . eStore_escape_csv_value(stripslashes($result->ipaddress)) . ',' . eStore_escape_csv_value(stripslashes($result->status)) . ',' . eStore_escape_csv_value(stripslashes($result->notes)) . ',' . "\n";
    }
    $customer_list_file_path = dirname(__FILE__) . "/customer_list.csv";
    file_put_contents($customer_list_file_path, $csv_output);
    $file_url = WP_ESTORE_URL . '/customer_list.csv';
    return $file_url;
}