function show_shipping_details_form_new($gateway = "manual")
{
    ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title><?php 
    echo ESTORE_COLLECT_DETAILS;
    ?>
</title>
<META http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="view/eStore_form_css.css" />
</head>
<body>

<div id="canvas">
<div id="paymentform_body">
<div id="paymentform_inside">

<div id="order_summary_body">
<?php 
    if (get_option('eStore_manual_co_do_not_collect_shipping_charge') != '') {
        //do not charge shipping
        $_SESSION['eStore_cart_postage_cost'] = 0;
    }
    $defaultSymbol = get_option('cart_currency_symbol');
    //$defaultCurrency = get_option('cart_payment_currency');
    echo '<div class="summary_title">' . WP_ESTORE_ORDER_SUMMARY . '</div>';
    echo '<table class="order_summary">';
    echo '<th>' . WP_ESTORE_DESCRIPTION . '</th><th>' . ESTORE_PRICE . '</th>';
    foreach ($_SESSION['eStore_cart'] as $item) {
        $item_price = $item['price'] * $item['quantity'];
        //$rounded_price = number_format($item_price, 2);
        $truncated_item_name = substr($item['name'], 0, 28);
        echo '<tr><td>';
        echo $truncated_item_name . "...";
        echo '<br />' . ESTORE_PRICE . ': ' . print_digi_cart_payment_currency($item_price, $defaultSymbol);
        echo '<br />' . ESTORE_QUANTITY . ': ' . $item['quantity'];
        echo '</td><td>' . print_digi_cart_payment_currency($item_price, $defaultSymbol) . '</td></tr>';
    }
    $raw_total = $_SESSION['eStore_cart_sub_total'] + $_SESSION['eStore_cart_postage_cost'] + $_SESSION['eStore_cart_total_tax'];
    $shipping_total = (double) $_SESSION['eStore_cart_postage_cost'];
    $tax_total = $_SESSION['eStore_cart_total_tax'];
    //$total = number_format(($_SESSION['eStore_cart_sub_total'] + $_SESSION['eStore_cart_postage_cost'] + $_SESSION['eStore_cart_total_tax']),2);
    echo '<tr><td>';
    echo ESTORE_SUB_TOTAL . ':<br />';
    if ($shipping_total > 1) {
        echo ESTORE_SHIPPING . ':<br />';
    }
    if (!empty($tax_total)) {
        echo WP_ESTORE_TAX . ':<br />';
    }
    echo '</td><td>';
    echo print_digi_cart_payment_currency($_SESSION['eStore_cart_sub_total'], $defaultSymbol) . '<br />';
    if ($shipping_total > 1) {
        echo print_digi_cart_payment_currency($shipping_total, $defaultSymbol) . '<br />';
    }
    if (!empty($tax_total)) {
        echo print_digi_cart_payment_currency($tax_total, $defaultSymbol);
    }
    echo '</td></tr>';
    echo '<tr><td>' . ESTORE_TOTAL . ': </td><td>' . print_digi_cart_payment_currency($raw_total, $defaultSymbol) . '</td></tr>';
    $conversion_rate = get_option('eStore_secondary_currency_conversion_rate');
    if (!empty($conversion_rate)) {
        $secondary_total = $raw_total * $conversion_rate;
        $secondary_curr_symbol = get_option('eStore_secondary_currency_symbol');
        echo '<tr><td>' . ESTORE_TOTAL . ' (' . get_option('eStore_secondary_currency_code') . '): </td><td>' . print_digi_cart_payment_currency($secondary_total, $secondary_curr_symbol) . '</td></tr>';
    }
    echo '</table>';
    if (get_option('eStore_display_continue_shopping')) {
        $products_page = get_option('eStore_products_page_url');
        echo '<br /><a href="' . $products_page . '"><strong>' . ESTORE_CONTINUE_SHOPPING . '</strong></a>';
    }
    if (function_exists('wp_eMember_install')) {
        global $auth;
        $auth = Emember_Auth::getInstance();
        $user_id = $auth->getUserInfo('member_id');
        if (!empty($user_id)) {
            //eMember user is logged in... load member's details into the fields.
            if (empty($_POST['email'])) {
                $_POST['email'] = $auth->getUserInfo('email');
                $_POST['firstname'] = $auth->getUserInfo('first_name');
                $_POST['lastname'] = $auth->getUserInfo('last_name');
                $_POST['address'] = $auth->getUserInfo('address_street');
                $_POST['city'] = $auth->getUserInfo('address_city');
                $_POST['state'] = $auth->getUserInfo('address_state');
                $_POST['postcode'] = $auth->getUserInfo('address_zipcode');
                $_POST['country'] = $auth->getUserInfo('country');
                $_POST['phone'] = $auth->getUserInfo('phone');
            }
        }
    }
    ?>
</div>

<form id="payment" action="" method="post">

<h3><?php 
    echo ESTORE_FILL_IN_SHIPPING_DETAILS;
    ?>
</h3>

<input type="hidden" name="eStore_gateway" id="eStore_gateway" value="<?php 
    echo $gateway;
    ?>
" />
<input type="hidden" name="submit_shipping" id="submit_shipping" value="true" />

	<fieldset>
		<ol>
			<li>
				<label for=firstname><?php 
    echo ESTORE_FIRST_NAME;
    ?>
 *</label>
				<input id="firstname" name="firstname" type="text" value="<?php 
    echo isset($_POST['firstname']) ? $_POST['firstname'] : '';
    ?>
" required autofocus>
			</li>
			<li>
				<label for=lastname><?php 
    echo ESTORE_LAST_NAME;
    ?>
 *</label>
				<input id="lastname" name="lastname" type="text" value="<?php 
    echo isset($_POST['lastname']) ? $_POST['lastname'] : '';
    ?>
" required>
			</li>
			<li>
				<label for=address><?php 
    echo ESTORE_ADDRESS;
    ?>
 *</label>
				<textarea id="address" name="address" rows=5 required><?php 
    echo isset($_POST['address']) ? $_POST['address'] : '';
    ?>
</textarea>
			</li>
			<li>
				<label for=city><?php 
    echo ESTORE_CITY;
    ?>
 *</label>
				<input id="city" name="city" type="text" value="<?php 
    echo isset($_POST['city']) ? $_POST['city'] : '';
    ?>
" required>
			</li>
			<li>
				<label for=state><?php 
    echo ESTORE_STATE;
    ?>
 *</label>
				<input id="state" name="state" type="text" value="<?php 
    echo isset($_POST['state']) ? $_POST['state'] : '';
    ?>
" required>
			</li>
			<li>
				<label for=postcode><?php 
    echo ESTORE_POSTCODE;
    ?>
 *</label>
				<input id="postcode" name="postcode" type="text" value="<?php 
    echo isset($_POST['postcode']) ? $_POST['postcode'] : '';
    ?>
" required>
			</li>
			<li>
				<label for=country><?php 
    echo ESTORE_COUNTRY;
    ?>
 *</label>
				<input id="country" name="country" type="text" value="<?php 
    echo isset($_POST['country']) ? $_POST['country'] : '';
    ?>
" required>
			</li>
			<li>
				<label for=phone><?php 
    echo ESTORE_PHONE;
    ?>
</label>
				<input id="phone" name="phone" type="text" value="<?php 
    echo isset($_POST['phone']) ? $_POST['phone'] : '';
    ?>
">
			</li>
			<li>
				<label for=email><?php 
    echo ESTORE_EMAIL;
    ?>
 *</label>
				<input id="email" name="email" type="email" value="<?php 
    echo isset($_POST['email']) ? $_POST['email'] : '';
    ?>
" required>
			</li>
			<?php 
    if ($gateway == "manual") {
        ?>
			    <li>
				<label for=additional_comment><?php 
        echo ESTORE_ADDITIONAL_COMMENT;
        ?>
</label>
				<textarea id="additional_comment" name="additional_comment" rows=5><?php 
        echo isset($_POST['additional_comment']) ? $_POST['additional_comment'] : '';
        ?>
</textarea>
			    </li>
                        <?php 
    }
    ?>
		</ol>
	</fieldset>
	<fieldset>
	    <input type="hidden" name="eStore_manaul_gateway" id="eStore_manaul_gateway" value="process" />
		<button type="submit" name="confirm"><?php 
    echo ESTORE_CONFIRM_ORDER;
    ?>
</button>
	</fieldset>
</form>

</div></div>
</div>

</body>
</html>

<?php 
}
function get_variation_and_input_code($ret_product, $line_break = true, $button_type = 1, $nggImage = '')
{
    $var_output = "";
    $variation_add_string = WP_ESTORE_VARIATION_ADD_SYMBOL;
    $curr_sign = WP_ESTORE_CURRENCY_SYMBOL;
    //get_option('cart_currency_symbol');
    $var_output .= '<div class="eStore_variation_top"></div>';
    if (!empty($ret_product->variation1)) {
        $pieces = explode('|', $ret_product->variation1);
        $variation1_name = $pieces[0];
        //if ($line_break) $var_output .= '<br />';
        if (!empty($variation1_name)) {
            $var_output .= '<span class="eStore_variation_name">' . $variation1_name . ' : </span>';
        }
        if ($button_type == 1) {
            $var_output .= '<select name="variation1" class="eStore_variation" onchange="ReadForm1 (this.form, 1);">';
        } else {
            if ($button_type == 2) {
                $var_output .= '<select name="variation1" class="eStore_variation" onchange="ReadForm1 (this.form, 2);">';
            } else {
                if ($button_type == 3) {
                    $var_output .= '<select name="variation1" class="eStore_variation" onchange="ReadForm1 (this.form, 3);">';
                }
            }
        }
        for ($i = 1; $i < sizeof($pieces); $i++) {
            $pieces2 = explode(':', $pieces[$i]);
            if (sizeof($pieces2) > 1) {
                $tmp_txt = $pieces2[0] . ' [' . $variation_add_string . ' ' . print_digi_cart_payment_currency($pieces2[1], $curr_sign) . ']';
            } else {
                $tmp_txt = $pieces2[0];
            }
            $var_output .= '<option value="' . htmlspecialchars($tmp_txt) . '">' . $tmp_txt . '</option>';
        }
        $var_output .= '</select>';
        if ($line_break) {
            $var_output .= '<br />';
        } else {
            $var_output .= ' ';
        }
    }
    if (!empty($ret_product->variation2)) {
        $pieces = explode('|', $ret_product->variation2);
        $variation2_name = $pieces[0];
        if (!empty($variation2_name)) {
            $var_output .= '<span class="eStore_variation_name">' . $variation2_name . ' : </span>';
        }
        if ($button_type == 1) {
            $var_output .= '<select name="variation2" class="eStore_variation" onchange="ReadForm1 (this.form, 1);">';
        } else {
            if ($button_type == 2) {
                $var_output .= '<select name="variation2" class="eStore_variation" onchange="ReadForm1 (this.form, 2);">';
            } else {
                if ($button_type == 3) {
                    $var_output .= '<select name="variation2" class="eStore_variation" onchange="ReadForm1 (this.form, 3);">';
                }
            }
        }
        for ($i = 1; $i < sizeof($pieces); $i++) {
            $pieces2 = explode(':', $pieces[$i]);
            if (sizeof($pieces2) > 1) {
                $tmp_txt = $pieces2[0] . ' [' . $variation_add_string . ' ' . print_digi_cart_payment_currency($pieces2[1], $curr_sign) . ']';
            } else {
                $tmp_txt = $pieces2[0];
            }
            $var_output .= '<option value="' . htmlspecialchars($tmp_txt) . '">' . $tmp_txt . '</option>';
        }
        $var_output .= '</select>';
        if ($line_break) {
            $var_output .= '<br />';
        } else {
            $var_output .= ' ';
        }
    }
    if (!empty($ret_product->variation4)) {
        $pieces = explode('|', $ret_product->variation4);
        $variation4_name = $pieces[0];
        if (!empty($variation4_name)) {
            $var_output .= '<span class="eStore_variation_name">' . $variation4_name . ' : </span>';
        }
        if ($button_type == 1) {
            $var_output .= '<select name="variation4" class="eStore_variation" onchange="ReadForm1 (this.form, 1);">';
        } else {
            if ($button_type == 2) {
                $var_output .= '<select name="variation4" class="eStore_variation" onchange="ReadForm1 (this.form, 2);">';
            } else {
                if ($button_type == 3) {
                    $var_output .= '<select name="variation4" class="eStore_variation" onchange="ReadForm1 (this.form, 3);">';
                }
            }
        }
        for ($i = 1; $i < sizeof($pieces); $i++) {
            $pieces2 = explode(':', $pieces[$i]);
            if (sizeof($pieces2) > 1) {
                $tmp_txt = $pieces2[0] . ' [' . $variation_add_string . ' ' . print_digi_cart_payment_currency($pieces2[1], $curr_sign) . ']';
            } else {
                $tmp_txt = $pieces2[0];
            }
            $var_output .= '<option value="' . htmlspecialchars($tmp_txt) . '">' . $tmp_txt . '</option>';
        }
        $var_output .= '</select>';
        if ($line_break) {
            $var_output .= '<br />';
        } else {
            $var_output .= ' ';
        }
    }
    if (!empty($ret_product->variation3)) {
        $pieces = explode('|', $ret_product->variation3);
        $variation3_name = $pieces[0];
        if (!empty($variation3_name)) {
            $var_output .= '<span class="eStore_variation_name">' . $variation3_name . ' : </span>';
        }
        if ($button_type == 1) {
            $var_output .= '<select name="variation3" class="eStore_variation" onchange="ReadForm1 (this.form, 1);">';
        } else {
            if ($button_type == 2) {
                $var_output .= '<select name="variation3" class="eStore_variation" onchange="ReadForm1 (this.form, 2);">';
            } else {
                if ($button_type == 3) {
                    $var_output .= '<select name="variation3" class="eStore_variation" onchange="ReadForm1 (this.form, 3);">';
                }
            }
        }
        for ($i = 1; $i < sizeof($pieces); $i++) {
            $pieces2 = explode('::', $pieces[$i]);
            if (sizeof($pieces2) > 1) {
                if (is_numeric($pieces2[1])) {
                    $tmp_txt = $pieces2[0] . ' [' . $variation_add_string . ' ' . print_digi_cart_payment_currency($pieces2[1], $curr_sign) . ']';
                } else {
                    $tmp_txt = $pieces2[0];
                }
            } else {
                $tmp_txt = $pieces2[0];
            }
            $var_output .= '<option value="' . htmlspecialchars($tmp_txt) . '">' . $tmp_txt . '</option>';
        }
        $var_output .= '</select>';
        if ($line_break) {
            $var_output .= '<br />';
        } else {
            $var_output .= ' ';
        }
    }
    if ($ret_product->custom_input == '1') {
        if (!empty($ret_product->custom_input_label)) {
            $var_output .= '<span class="eStore_custom_input_name">' . $ret_product->custom_input_label . ': </span><textarea name="custom_input" cols="20" rows="3" /></textarea>';
        } else {
            $var_output .= '<span class="eStore_custom_input_name">List The songs, seperated with a comma that you would like to perform: </span><textarea name="custom_input" cols="20" rows="3" /></textarea>';
        }
        if ($line_break) {
            $var_output .= '<br />';
        } else {
            $var_output .= ' ';
        }
    }
    if (!empty($nggImage->pid)) {
        $var_output .= '<input type="text" name="eStore_ngg_pid" value="[pid:' . $nggImage->pid . ']" class="eStore_hidden_textfield" />';
    }
    return $var_output;
}
Example #3
0
function eStore_cart_display_shipping_variation_part($postage_cost, $button_type = 1)
{
    $output = "";
    $always_display_shipping_var = get_option('eStore_always_display_shipping_variation');
    if ($postage_cost != 0 || $always_display_shipping_var != '') {
        $shippping_var_txt = get_option('eStore_shipping_variation');
        if (!empty($shippping_var_txt)) {
            $var_output = "";
            //eStore_load_shipping_var_change_warning_jquery();//in the footer
            $variation_add_string = WP_ESTORE_VARIATION_ADD_SYMBOL;
            //"+";
            $curr_sign = WP_ESTORE_CURRENCY_SYMBOL;
            $pieces = explode('|', $shippping_var_txt);
            $variation1_name = $pieces[0];
            $var_output .= $variation1_name . " : ";
            $var_output .= '<select name="eStore_shipping_variation" class="shipping_variation">';
            for ($i = 1; $i < sizeof($pieces); $i++) {
                $pieces2 = explode(':', $pieces[$i]);
                if (sizeof($pieces2) > 1) {
                    $tmp_txt = $pieces2[0] . ' [' . $variation_add_string . ' ' . print_digi_cart_payment_currency($pieces2[1], $curr_sign) . ']';
                } else {
                    $tmp_txt = $pieces2[0];
                }
                if (!isset($pieces2[1])) {
                    $pieces2[1] = '';
                }
                $var_output .= '<option value="' . htmlspecialchars($pieces2[0] . "|" . $pieces2[1]) . '" ' . eStore_is_shipping_option_selected($pieces2[0]) . '>' . $tmp_txt . '</option>';
            }
            $var_output .= '</select>';
            $output .= '<tr><td colspan="4">';
            //Used to show shipping variations
            $output .= '<strong>' . ESTORE_SHIPPING_VARIATION . '</strong>
		    		    <form method="post" action="" >
		    		    ' . $var_output . '
		    		    <input type="submit" class="eStore_shipping_update_button" value="' . ESTORE_UPDATE . '" />
		    		    </form>';
            if (!isset($_SESSION['eStore_shipping_variation_updated_once']) || $_SESSION['eStore_shipping_variation_updated_once'] != '1') {
                $output .= '<div class="shipping_var_changed_default eStore_warning">' . ESTORE_CLICK_UPDATE_BUTTON . '</div>';
            }
            $output .= '<div class="shipping_var_changed eStore_warning">' . ESTORE_CLICK_UPDATE_BUTTON . '</div>';
            //used from javascript
            $output .= '</td></tr>';
        }
    }
    return $output;
}
function eStore_manual_gateway_form_processing_code()
{
    if (isset($_POST['submit_shipping'])) {
        if (eStore_get_total_cart_item_qty() < 1) {
            //Cart does not have any item
            echo '<div class="eStore_error_message">Error! Your shopping cart is empty. Please add items to your cart before checking out.</div>';
            return;
        }
        $input_verified = false;
        global $wpdb;
        $wp_eStore_config = WP_eStore_Config::getInstance();
        $err_msg = eStore_check_address_details();
        if (!empty($err_msg)) {
            $msg = '<div id="error">';
            $msg .= ESTORE_REQUIRED_FIELDS_MISSING;
            $msg .= $err_msg;
            $msg .= '</div>';
            echo $msg;
        } else {
            //Fire the begin processing hook
            $clientip = $_SERVER['REMOTE_ADDR'];
            $clientemail = $_POST['email'];
            do_action('eStore_begin_manual_co_processing', $clientemail, $clientip);
            $last_records_id = $wp_eStore_config->getValue('eStore_custom_receipt_counter');
            //get_option('eStore_custom_receipt_counter');
            if (empty($last_records_id)) {
                $last_records_id = 0;
            }
            $receipt_counter = $last_records_id + 1;
            $wp_eStore_config->setValue('eStore_custom_receipt_counter', $receipt_counter);
            $wp_eStore_config->saveConfig();
            $address = $_POST['address'] . ", " . $_POST['city'] . ", " . $_POST['state'] . " " . $_POST['postcode'] . " " . $_POST['country'];
            $payment_data = extract_manaul_co_general_payment_data($_POST['firstname'], $_POST['lastname'], $_POST['email'], $address, $_POST['phone']);
            $cart_items = extract_manual_item_data();
            $cust_direction = get_option('eStore_manual_co_cust_direction');
            $curr_symbol = get_option('cart_currency_symbol');
            if (!empty($cust_direction)) {
                $cust_direction_mod = eStore_apply_post_payment_dynamic_tags($cust_direction, $payment_data, $cart_items);
                $body .= "\n-------------------------------\n";
                $body .= $cust_direction_mod;
                $body .= "\n-------------------------------\n";
            }
            $count = 1;
            $constructed_download_link .= "<br />";
            $product_key_data = "";
            $show_tax_inc_price = $wp_eStore_config->getValue('eStore_show_tax_inclusive_price');
            foreach ($_SESSION['eStore_cart'] as $item) {
                $products_table_name = $wpdb->prefix . "wp_eStore_tbl";
                $key = $item['item_number'];
                $retrieved_product = $wpdb->get_row("SELECT * FROM {$products_table_name} WHERE id = '{$key}'", OBJECT);
                $rounded_price = round($item['price'], 2);
                $body .= "\n" . WP_ESTORE_DETAILS_OF_ORDERED_PRODUCT . ": " . $count;
                $body .= "\n-------------------------";
                $body .= "\n" . ESTORE_PRODUCT_ID . ": " . $item['item_number'];
                $body .= "\n" . ESTORE_PRODUCT_NAME . ": " . $item['name'];
                if ($show_tax_inc_price == '1') {
                    $rounded_price = eStore_get_tax_include_price_by_prod_id($item['item_number'], $rounded_price);
                }
                $formatted_price = print_digi_cart_payment_currency($rounded_price, $curr_symbol);
                $body .= "\n" . ESTORE_PRICE . ": " . $formatted_price;
                $body .= "\n" . ESTORE_QUANTITY . ": " . $item['quantity'] . "\n";
                if (get_option('eStore_manual_co_give_download_links') != '') {
                    $download_link = generate_download_link_for_product($item['item_number'], $item['name'], $payment_data);
                    $constructed_download_link .= $download_link . "<br />";
                    $body .= $download_link . "\n";
                    $product_key = eStore_post_sale_retrieve_serial_key_and_update($retrieved_product, $item['name'], $item['quantity']);
                    $product_key_data .= $product_key;
                    $body .= $product_key;
                    $product_specific_instructions = eStore_get_product_specific_instructions($retrieved_product);
                    $product_specific_instructions = eStore_apply_post_payment_dynamic_tags($product_specific_instructions, $payment_data, $cart_items);
                    $body .= $product_specific_instructions;
                }
                $count++;
                //Check and signup WishList or WP eMember user if needed
                //if(get_option('eStore_manual_co_auto_update_db')=='1')
                if ($wp_eStore_config->getValue('eStore_manual_co_auto_create_membership') == '1') {
                    $member_ref = $retrieved_product->ref_text;
                    eStore_payment_debug('Checking if membership inegration is being used. Reference Text Value: ' . $member_ref, true);
                    if (!empty($member_ref)) {
                        if (get_option('eStore_enable_wishlist_int')) {
                            eStore_payment_debug('WishList integration is being used... doing member account creation/upgrade task... see the "subscription_handle_debug.log" file for details', true);
                            wl_handle_subsc_signup($payment_data, $member_ref, $payment_data['txn_id']);
                        } else {
                            if (function_exists('wp_eMember_install')) {
                                $eMember_id = $payment_data['eMember_userid'];
                                eStore_payment_debug('eMember integration is being used... doing member account creation/upgrade task... see the "subscription_handle_debug.log" file for details', true);
                                eMember_handle_subsc_signup($payment_data, $member_ref, $payment_data['txn_id'], $eMember_id);
                            }
                        }
                    }
                }
                //=== End of membership handling code ===
            }
            $body .= "\n-------------------------------\n";
            if ($show_tax_inc_price != '1') {
                $body .= ESTORE_SUB_TOTAL . ": " . print_digi_cart_payment_currency($_SESSION['eStore_cart_sub_total'], $curr_symbol);
            }
            if (!empty($_SESSION['eStore_cart_postage_cost'])) {
                $body .= "\n" . ESTORE_SHIPPING . ": " . print_digi_cart_payment_currency($_SESSION['eStore_cart_postage_cost'], $curr_symbol);
            }
            if (!empty($_SESSION['eStore_cart_total_tax'])) {
                $body .= "\n" . WP_ESTORE_TAX . ": " . print_digi_cart_payment_currency($_SESSION['eStore_cart_total_tax'], $curr_symbol);
            }
            $total = $_SESSION['eStore_cart_sub_total'] + $_SESSION['eStore_cart_postage_cost'] + $_SESSION['eStore_cart_total_tax'];
            $body .= "\n" . ESTORE_TOTAL . ": " . print_digi_cart_payment_currency($total, $curr_symbol);
            $conversion_rate = get_option('eStore_secondary_currency_conversion_rate');
            if (!empty($conversion_rate)) {
                $secondary_curr_symbol = get_option('eStore_secondary_currency_symbol');
                $body .= "\n" . ESTORE_TOTAL . ' (' . get_option('eStore_secondary_currency_code') . '): ' . print_digi_cart_payment_currency($total * $conversion_rate, $secondary_curr_symbol);
            }
            if (isset($_SESSION['eStore_store_pickup_checked']) && $_SESSION['eStore_store_pickup_checked'] == '1') {
                $body .= "\nStore Pickup: Yes";
            }
            $total_items = $count - 1;
            $body .= "\n" . WP_ESTORE_TOTAL_ITEMS_ORDERED . ": " . $total_items;
            $body .= "\n" . ESTORE_TRANSACTION_ID . ": " . $payment_data['txn_id'];
            $body .= "\n\n" . WP_ESTORE_CUSTOMER_DETAILS;
            $body .= "\n-------------------------";
            $body .= "\n" . WP_ESTORE_NAME . ": " . $_POST['firstname'] . " " . $_POST['lastname'];
            $body .= "\n" . ESTORE_EMAIL . ": " . $_POST['email'];
            $body .= "\n" . ESTORE_PHONE . ": " . $_POST['phone'];
            $body .= "\n" . ESTORE_ADDRESS . ": " . $_POST['address'];
            $body .= "\n" . ESTORE_CITY . ": " . $_POST['city'];
            $body .= "\n" . ESTORE_STATE . ": " . $_POST['state'];
            $body .= "\n" . ESTORE_POSTCODE . ": " . $_POST['postcode'];
            $body .= "\n" . ESTORE_COUNTRY . ": " . $_POST['country'];
            $body .= "\n" . WP_ESTORE_ADDITIONAL_COMMENT . ": " . $_POST['additional_comment'];
            $notify_email = get_option('eStore_manual_notify_email');
            $buyer_email = $_POST['email'];
            if (empty($notify_email)) {
                $notify_email = get_bloginfo('admin_email');
            }
            // Get referrer
            if (!empty($_SESSION['ap_id'])) {
                $referrer = $_SESSION['ap_id'];
            } else {
                if (isset($_COOKIE['ap_id'])) {
                    $referrer = $_COOKIE['ap_id'];
                }
            }
            //Call the filter for email notification body
            eStore_payment_debug('Applying filter - eStore_notification_email_body_filter', true);
            $body = apply_filters('eStore_notification_email_body_filter', $body, $payment_data, $cart_items);
            $seller_email_body = $body . "\n\n" . WP_ESTORE_REFERRER . ": " . $referrer;
            $from_email_address = get_option('eStore_download_email_address');
            $headers = 'From: ' . $from_email_address . "\r\n";
            // Notify Seller
            $n_subject = $wp_eStore_config->getValue('seller_email_subject_manual_co');
            if (empty($n_subject)) {
                $n_subject = get_option('eStore_seller_email_subj');
            }
            wp_mail($notify_email, $n_subject, $seller_email_body, $headers);
            // Notify Buyer
            $buyer_email_subj = $wp_eStore_config->getValue('buyer_email_subject_manual_co');
            if (empty($buyer_email_subj)) {
                $buyer_email_subj = get_option('eStore_buyer_email_subj');
            }
            wp_mail($buyer_email, $buyer_email_subj, $body, $headers);
            if (!empty($product_key_data)) {
                //Lets add any serial key info to the data
                $payment_data['product_key_data'] = $product_key_data;
            }
            //Fire the manual checkout hook
            do_action('eStore_manual_checkout_form_data', $payment_data, $cart_items);
            //Add to the customer database if the option is enabled
            if (get_option('eStore_manual_co_auto_update_db') == '1') {
                record_sales_data($payment_data, $cart_items);
            }
            //Perform autoresponder signup
            if (get_option('eStore_manual_co_do_autoresponder_signup') == '1') {
                eStore_item_specific_autoresponder_signup($cart_items, $_POST['firstname'], $_POST['lastname'], $_POST['email']);
                eStore_global_autoresponder_signup($_POST['firstname'], $_POST['lastname'], $_POST['email']);
            }
            //Award Affiliate Commission
            eStore_award_commission_manual_co($payment_data, $cart_items);
            // Revenue sharing
            eStore_award_author_commission_manual_co($payment_data, $cart_items);
            //Create affiliate account if needed
            eStore_handle_auto_affiliate_account_creation($payment_data);
            //Post IPN data to external site if needed
            eStore_POST_IPN_data_to_url($payment_data, '', $cart_items);
            //Save transaction result for thank you page display
            if (get_option('eStore_manual_co_give_download_links') != '') {
                $constructed_download_link = wp_eStore_replace_url_in_string_with_link($constructed_download_link);
                eStore_save_trans_result_for_thank_you_page_display($payment_data, $constructed_download_link, $cart_items);
            }
            $return_url = get_option('eStore_manual_return_url');
            if (empty($return_url)) {
                $return_url = get_bloginfo('wpurl');
            }
            //Google analytics tracking
            if (get_option('eStore_enable_analytics_tracking') && get_option('eStore_manual_co_give_download_links') != '') {
                eStore_track_ga_ecommerce($payment_data, $cart_items);
                $return_url = eStore_append_http_get_data_to_url($return_url, "eStore_manual_co_track_ga", "1");
            }
            //Reset cart and redirect to Thank you page
            reset_eStore_cart();
            eStore_redirect_to_url($return_url);
        }
    }
}
function eStore_show_product_details($id, $info)
{
    if ($id == 'no id') {
        return '<div class="eStore_error_message">You did not specify a Product ID. Please enter a Product ID with this shortcode</div>';
    }
    if (empty($info)) {
        return '<div class="eStore_error_message">You did not specify which information of the product you want to show (the "info" parameter is empty). Please check the shortcode documentation to learn the usage of this shortcode.</div>';
    }
    $condition = " id='" . $id . "'";
    $product_details = WP_eStore_Db_Access::find(WP_ESTORE_PRODUCTS_TABLE_NAME, $condition);
    //var_dump($product_details);
    if ($info == 'all') {
        var_dump($product_details);
        return "";
    }
    if ($info == "description") {
        $description = html_entity_decode($product_details->{$info}, ENT_COMPAT, "UTF-8");
        $description = do_shortcode($description);
        return $description;
    }
    if (isset($product_details->{$info})) {
        return $product_details->{$info};
    } else {
        if ($info === "price_formatted") {
            $item_price = $product_details->price;
            $defaultSymbol = WP_ESTORE_CURRENCY_SYMBOL;
            $price_formatted = print_digi_cart_payment_currency($item_price, $defaultSymbol);
            return $price_formatted;
        } else {
            if ($info === "price_tax_inclusive") {
                if (!empty($product_details->tax)) {
                    $tax_rate = $product_details->tax;
                } else {
                    $global_store_tax_rate = get_option('eStore_global_tax_rate');
                    $tax_rate = $global_store_tax_rate;
                }
                $tax_inc_price = eStore_calculate_tax_included_price_without_qty($product_details->price, $tax_rate);
                $tax_inc_price = number_format($tax_inc_price, 2, '.', '');
                return $tax_inc_price;
            } else {
                return '<div class="eStore_error_message">The value you specified for the "info" parameter does not exist in the eStore product database. Please check the shortcode documentation to learn the usage of this shortcode.</div>';
            }
        }
    }
}
Example #6
0
function print_tax_inclusive_payment_currency_if_enabled($price, $symbol, $tax_rate = '', $ret_product = '', $decimal = '.', $thousands_sep = ',')
{
    if (WP_ESTORE_DISPLAY_TAX_INCLUSIVE_PRICE == '1') {
        if (empty($tax_rate) && !empty($ret_product)) {
            //Lets check the product specific tax
            if (!empty($ret_product->tax)) {
                $tax_rate = $ret_product->tax;
            }
        }
        $payment_currency = print_digi_cart_payment_currency_with_tax($price, $symbol, $tax_rate, $decimal, $thousands_sep);
        return $payment_currency;
    } else {
        return print_digi_cart_payment_currency($price, $symbol, $decimal, $thousands_sep);
    }
}