function eStore_cart_display_checkout_button_form_part() { $output = ""; global $wp_eStore_config; if (defined('WP_PAYMENT_GATEWAY_BUNDLE_VERSION')) { // Load payment gateway bundle config $wp_pg_bundle_config = WP_Payment_Gateway_Bundle_Config::getInstance(); } //Check if minimum and maximum cart checkout amount restriction apply if ($wp_eStore_config->getValue('eStore_enable_checkout_amt_limit') == '1') { $minimum_cart_co_amount = $wp_eStore_config->getValue('eStore_checkout_amt_limit_minimum'); if (!empty($minimum_cart_co_amount)) { $minimum_cart_co_amount = number_format((double) $minimum_cart_co_amount, 2); } $maximum_cart_co_amount = $wp_eStore_config->getValue('eStore_checkout_amt_limit_maximum'); if (!empty($maximum_cart_co_amount)) { $maximum_cart_co_amount = number_format((double) $maximum_cart_co_amount, 2); } $cart_sub_total = eStore_get_cart_total(); if (is_numeric($minimum_cart_co_amount) && $cart_sub_total < $minimum_cart_co_amount) { $output .= '<p class="eStore_error_message">'; $output .= ESTORE_CART_DOES_NOT_MEET_MIN_REQUIREMENT; $output .= ESTORE_CART_MINIMUM_CHECKOUT_AMOUNT_REQUIRED . WP_ESTORE_CURRENCY_SYMBOL . $minimum_cart_co_amount; $output .= '</p>'; return $output; } if (is_numeric($maximum_cart_co_amount) && $cart_sub_total > $maximum_cart_co_amount) { $output .= '<p class="eStore_error_message">'; $output .= ESTORE_CART_DOES_NOT_MEET_MIN_REQUIREMENT; $output .= ESTORE_CART_MAXIMUM_CHECKOUT_AMOUNT_REQUIRED . WP_ESTORE_CURRENCY_SYMBOL . $maximum_cart_co_amount; $output .= '</p>'; return $output; } } //Create the checkout button form $output .= '<div class="eStore_cart_checkout_button">'; if (get_option('eStore_show_t_c')) { $output .= eStore_show_terms_and_cond(); } if (WP_ESTORE_ENABLE_NEW_CHECKOUT_REDIRECTION === '1') { //TODO - make the new checkout the default $output .= '<form action="' . WP_ESTORE_WP_SITE_URL . '?eStore_checkout=process" method="post">'; } else { $output .= '<form action="' . WP_ESTORE_URL . '/eStore_payment_submission.php" method="post">'; } $checkout_button = WP_ESTORE_URL . '/images/checkout_paypal.png'; if (get_option('eStore_use_multiple_gateways')) { $output .= ESTORE_PAYMENT_METHOD; $output .= '<select class="eStore_gateway" name="eStore_gateway">'; if (get_option('eStore_use_paypal_gateway')) { if (isset($_COOKIE['eStore_gateway']) && $_COOKIE['eStore_gateway'] == "paypal") { $output .= '<option value="paypal" selected="selected">' . ESTORE_PAYPAL . '</option>'; $checkout_button = WP_ESTORE_URL . '/images/checkout_paypal.png'; } else { $output .= '<option value="paypal">' . ESTORE_PAYPAL . '</option>'; } } if (get_option('eStore_use_manual_gateway')) { if (isset($_COOKIE['eStore_gateway']) && $_COOKIE['eStore_gateway'] == "manual") { $output .= '<option value="manual" selected="selected">' . ESTORE_MANUAL . '</option>'; $checkout_button = WP_ESTORE_URL . '/images/checkout_manual.png'; } else { $output .= '<option value="manual">' . ESTORE_MANUAL . '</option>'; } } if (get_option('eStore_use_2co_gateway')) { if (isset($_COOKIE['eStore_gateway']) && $_COOKIE['eStore_gateway'] == "2co") { $output .= '<option value="2co" selected="selected">' . ESTORE_TWO_CO . '</option>'; $checkout_button = WP_ESTORE_URL . '/images/checkout_2co.png'; } else { $output .= '<option value="2co">' . ESTORE_TWO_CO . '</option>'; } } if (get_option('eStore_use_authorize_gateway')) { if (isset($_COOKIE['eStore_gateway']) && $_COOKIE['eStore_gateway'] == "authorize") { $output .= '<option value="authorize" selected="selected">' . ESTORE_AUTHORIZE . '</option>'; $checkout_button = WP_ESTORE_URL . '/images/checkout_authorize.gif'; } else { $output .= '<option value="authorize">' . ESTORE_AUTHORIZE . '</option>'; } } //Add the payment gateway bundle checkout options if (defined('WP_PAYMENT_GATEWAY_BUNDLE_VERSION')) { if ($wp_pg_bundle_config->getValue('wp_pg_use_gco_gateway')) { if (isset($_COOKIE['eStore_gateway']) && $_COOKIE['eStore_gateway'] == "gco") { $output .= '<option value="gco" selected="selected">' . $wp_pg_bundle_config->getValue('wp_pg_gco_selector_label') . '</option>'; $checkout_button = WP_PAYMENT_GATEWAY_BUNDLE_PLUGIN_URL . '/images/checkout_gco.gif'; } else { $output .= '<option value="gco">' . $wp_pg_bundle_config->getValue('wp_pg_gco_selector_label') . '</option>'; } } if ($wp_pg_bundle_config->getValue('wp_pg_use_pppro_gateway')) { if (isset($_COOKIE['eStore_gateway']) && $_COOKIE['eStore_gateway'] == "pppro") { $output .= '<option value="pppro" selected="selected">' . $wp_pg_bundle_config->getValue('wp_pg_pppro_selector_label') . '</option>'; $checkout_button = WP_PAYMENT_GATEWAY_BUNDLE_PLUGIN_URL . '/images/checkout_pppro.gif'; } else { $output .= '<option value="pppro">' . $wp_pg_bundle_config->getValue('wp_pg_pppro_selector_label') . '</option>'; } } if ($wp_pg_bundle_config->getValue('wp_pg_use_sagepay_gateway')) { if (isset($_COOKIE['eStore_gateway']) && $_COOKIE['eStore_gateway'] == "sagepay") { $output .= '<option value="sagepay" selected="selected">' . $wp_pg_bundle_config->getValue('wp_pg_sagepay_selector_label') . '</option>'; $checkout_button = WP_PAYMENT_GATEWAY_BUNDLE_PLUGIN_URL . '/images/checkout_sagepay.gif'; } else { $output .= '<option value="sagepay">' . $wp_pg_bundle_config->getValue('wp_pg_sagepay_selector_label') . '</option>'; } } if ($wp_pg_bundle_config->getValue('wp_pg_use_auth_aim_gateway')) { if (isset($_COOKIE['eStore_gateway']) && $_COOKIE['eStore_gateway'] == "auth_aim") { $output .= '<option value="auth_aim" selected="selected">' . $wp_pg_bundle_config->getValue('wp_pg_auth_aim_selector_label') . '</option>'; $checkout_button = WP_PAYMENT_GATEWAY_BUNDLE_PLUGIN_URL . '/images/checkout_auth_aim.gif'; } else { $output .= '<option value="auth_aim">' . $wp_pg_bundle_config->getValue('wp_pg_auth_aim_selector_label') . '</option>'; } } if ($wp_pg_bundle_config->getValue('wp_pg_use_eway_gateway')) { if (isset($_COOKIE['eStore_gateway']) && $_COOKIE['eStore_gateway'] == "eway") { $output .= '<option value="eway" selected="selected">' . $wp_pg_bundle_config->getValue('wp_pg_eway_selector_label') . '</option>'; $checkout_button = WP_PAYMENT_GATEWAY_BUNDLE_PLUGIN_URL . '/images/checkout_eway.gif'; } else { $output .= '<option value="eway">' . $wp_pg_bundle_config->getValue('wp_pg_eway_selector_label') . '</option>'; } } if ($wp_pg_bundle_config->getValue('wp_pg_use_epay_dk_gateway')) { if (isset($_COOKIE['eStore_gateway']) && $_COOKIE['eStore_gateway'] == "epay_dk") { $output .= '<option value="epay_dk" selected="selected">' . $wp_pg_bundle_config->getValue('wp_pg_epay_dk_selector_label') . '</option>'; $checkout_button = WP_PAYMENT_GATEWAY_BUNDLE_PLUGIN_URL . '/images/checkout_epay_dk.gif'; } else { $output .= '<option value="epay_dk">' . $wp_pg_bundle_config->getValue('wp_pg_epay_dk_selector_label') . '</option>'; } } if ($wp_pg_bundle_config->getValue('wp_pg_use_verotel_flexpay_gateway')) { if (isset($_COOKIE['eStore_gateway']) && $_COOKIE['eStore_gateway'] == "verotel") { $output .= '<option value="verotel" selected="selected">' . $wp_pg_bundle_config->getValue('wp_pg_verotel_flexpay_selector_label') . '</option>'; $checkout_button = WP_PAYMENT_GATEWAY_BUNDLE_PLUGIN_URL . '/images/checkout_verotel.gif'; } else { $output .= '<option value="verotel">' . $wp_pg_bundle_config->getValue('wp_pg_verotel_flexpay_selector_label') . '</option>'; } } if ($wp_pg_bundle_config->getValue('wp_pg_use_freshbooks')) { if (isset($_COOKIE['eStore_gateway']) && $_COOKIE['eStore_gateway'] == "freshbooks") { $output .= '<option value="freshbooks" selected="selected">' . $wp_pg_bundle_config->getValue('wp_pg_freshbooks_selector_label') . '</option>'; $checkout_button = WP_PAYMENT_GATEWAY_BUNDLE_PLUGIN_URL . '/images/checkout_freshbooks.gif'; } else { $output .= '<option value="freshbooks">' . $wp_pg_bundle_config->getValue('wp_pg_freshbooks_selector_label') . '</option>'; } } } $output = apply_filters('eStore_cart_checkout_option_mc_filter', $output); $output .= '</select><br />'; } else { if (get_option('eStore_use_paypal_gateway')) { $output .= '<input type="hidden" name="eStore_gateway" id="eStore_gateway" value="paypal" />'; $checkout_button = WP_ESTORE_URL . '/images/checkout_paypal.png'; } else { if (get_option('eStore_use_manual_gateway')) { $output .= '<input type="hidden" name="eStore_gateway" id="eStore_gateway" value="manual" />'; $checkout_button = WP_ESTORE_URL . '/images/checkout_manual.png'; } else { if (get_option('eStore_use_2co_gateway')) { $output .= '<input type="hidden" name="eStore_gateway" id="eStore_gateway" value="2co" />'; $checkout_button = WP_ESTORE_URL . '/images/checkout_2co.png'; } else { if (get_option('eStore_use_authorize_gateway')) { $output .= '<input type="hidden" name="eStore_gateway" id="eStore_gateway" value="authorize" />'; $checkout_button = WP_ESTORE_URL . '/images/checkout_authorize.gif'; } else { if (defined('WP_PAYMENT_GATEWAY_BUNDLE_VERSION')) { if ($wp_pg_bundle_config->getValue('wp_pg_use_gco_gateway')) { $output .= '<input type="hidden" name="eStore_gateway" id="eStore_gateway" value="gco" />'; $checkout_button = WP_PAYMENT_GATEWAY_BUNDLE_PLUGIN_URL . '/images/checkout_gco.gif'; } else { if ($wp_pg_bundle_config->getValue('wp_pg_use_pppro_gateway')) { $output .= '<input type="hidden" name="eStore_gateway" id="eStore_gateway" value="pppro" />'; $checkout_button = WP_PAYMENT_GATEWAY_BUNDLE_PLUGIN_URL . '/images/checkout_pppro.gif'; } else { if ($wp_pg_bundle_config->getValue('wp_pg_use_sagepay_gateway')) { $output .= '<input type="hidden" name="eStore_gateway" id="eStore_gateway" value="sagepay" />'; $checkout_button = WP_PAYMENT_GATEWAY_BUNDLE_PLUGIN_URL . '/images/checkout_sagepay.gif'; } else { if ($wp_pg_bundle_config->getValue('wp_pg_use_auth_aim_gateway')) { $output .= '<input type="hidden" name="eStore_gateway" id="eStore_gateway" value="auth_aim" />'; $checkout_button = WP_PAYMENT_GATEWAY_BUNDLE_PLUGIN_URL . '/images/checkout_auth_aim.gif'; } else { if ($wp_pg_bundle_config->getValue('wp_pg_use_eway_gateway')) { $output .= '<input type="hidden" name="eStore_gateway" id="eStore_gateway" value="eway" />'; $checkout_button = WP_PAYMENT_GATEWAY_BUNDLE_PLUGIN_URL . '/images/checkout_eway.gif'; } else { if ($wp_pg_bundle_config->getValue('wp_pg_use_epay_dk_gateway')) { $output .= '<input type="hidden" name="eStore_gateway" id="eStore_gateway" value="epay_dk" />'; $checkout_button = WP_PAYMENT_GATEWAY_BUNDLE_PLUGIN_URL . '/images/checkout_epay_dk.gif'; } else { if ($wp_pg_bundle_config->getValue('wp_pg_use_verotel_flexpay_gateway')) { $output .= '<input type="hidden" name="eStore_gateway" id="eStore_gateway" value="verotel" />'; $checkout_button = WP_PAYMENT_GATEWAY_BUNDLE_PLUGIN_URL . '/images/checkout_verotel.gif'; } else { if ($wp_pg_bundle_config->getValue('wp_pg_use_freshbooks')) { $output .= '<input type="hidden" name="eStore_gateway" id="eStore_gateway" value="freshbooks" />'; $checkout_button = WP_PAYMENT_GATEWAY_BUNDLE_PLUGIN_URL . '/images/checkout_freshbooks.gif'; } else { $output = apply_filters('eStore_cart_checkout_option_single_filter', $output); } } } } } } } } } } } } } } $checkout_button = apply_filters('eStore_cart_checkout_button_img_url_filter', $checkout_button); //$output .= '<input type="hidden" name="eStore_url" id="eStore_url" value="'.WP_ESTORE_URL.'" />'; if (get_option('eStore_enable_fancy_redirection_on_checkout')) { if (WP_ESTORE_ENABLE_NEW_CHECKOUT_REDIRECTION === '1') { $output .= '<a href="' . WP_ESTORE_WP_SITE_URL . '?eStore_checkout=process" class="redirect_trigger" rel="#overlay">'; } else { $output .= '<a href="' . WP_ESTORE_URL . '/eStore_payment_submission.php" class="redirect_trigger" rel="#overlay">'; } $output .= '<input type="image" src="' . $checkout_button . '" name="submit" class="eStore_paypal_checkout_button" alt="Checkout" />'; $output .= '</a>'; } else { $output .= '<input type="image" src="' . $checkout_button . '" name="submit" class="eStore_paypal_checkout_button" alt="Checkout" />'; } $output .= '</form>'; $output .= '</div>'; $output = apply_filters('eStore_cart_checkout_button_form_filter', $output); $below_cart_co_button = ""; $below_cart_co_button = apply_filters('eStore_below_cart_checkout_filter', $below_cart_co_button); if (!empty($below_cart_co_button)) { $output .= '<div class="eStore_below_cart_checkout">' . $below_cart_co_button . '</div>'; } return $output; }
function print_eStore_subscribe_button_form($id) { global $wpdb; $products_table_name = WP_ESTORE_PRODUCTS_TABLE_NAME; $ret_product = $wpdb->get_row("SELECT * FROM {$products_table_name} WHERE id = '{$id}'", OBJECT); $output = ""; if (is_numeric($ret_product->available_copies)) { if ($ret_product->available_copies < 1) { return eStore_get_sold_out_button(); } } if (!empty($ret_product->paypal_email)) { $paypal_email = $ret_product->paypal_email; } else { $paypal_email = get_option('cart_paypal_email'); } if (!empty($ret_product->currency_code)) { $paypal_currency = $ret_product->currency_code; } else { $paypal_currency = get_option('cart_payment_currency'); } //$paypal_currency = get_option('cart_payment_currency'); $return = get_option('cart_return_from_paypal_url'); // Find out if the product should be delivered automatically through a notify email if (get_option('eStore_auto_product_delivery') == '') { $notify = ''; } else { if (WP_ESTORE_ENABLE_NEW_CHECKOUT_REDIRECTION === '1') { $notify = WP_ESTORE_WP_SITE_URL . '/?estore_pp_ipn=process'; } else { $notify = WP_ESTORE_URL . '/paypal.php'; } } $urls = ""; if (!empty($notify)) { $urls .= '<input type="hidden" name="notify_url" value="' . $notify . '" />'; } if (!empty($ret_product->return_url)) { $urls .= '<input type="hidden" name="return" value="' . $ret_product->return_url . '" />'; } else { if (!empty($return)) { $urls .= '<input type="hidden" name="return" value="' . $return . '" />'; } } $cancel_url = get_option('cart_cancel_from_paypal_url'); if (!empty($cancel_url)) { $urls .= '<input type="hidden" name="cancel_return" value="' . $cancel_url . '" />'; } $button = $ret_product->button_image_url; $button_type = ""; if (!empty($button)) { $button_type .= '<input type="image" src="' . $button . '" class="eStore_subscribe_button" alt="' . WP_ESTORE_SUBSCRIBE . '"/>'; } else { $button_type .= '<input type="submit" class="eStore_subscribe_button" value="' . WP_ESTORE_SUBSCRIBE . '" />'; } $sandbox_enabled = get_option('eStore_cart_enable_sandbox'); if ($sandbox_enabled) { $form_submit_url = PAYPAL_SANDBOX_URL; } else { $form_submit_url = PAYPAL_LIVE_URL; } $form_submit_url = apply_filters('eStore_pp_subscribe_form_submit_url', $form_submit_url); //Subscribe button form $output = ""; $output .= '<div class="eStore_button_wrapper eStore_pp_subscribe_wrapper">'; $output .= '<form action="' . $form_submit_url . '" method="post" onsubmit="return ReadForm1(this, 3);">'; $line_break = true; //variation code $output .= get_variation_and_input_code($ret_product, $line_break, 3); //Custom price if ($ret_product->custom_price_option == '1') { $currSymbol = get_option('cart_currency_symbol'); $output .= WP_ESTORE_YOUR_PRICE . ': ' . $currSymbol . '<input type="text" name="custom_price" size="3" value="" /> '; if ($line_break) { $output .= '<br />'; } } $output .= '<input type="hidden" name="product_name_tmp1" value="' . htmlspecialchars($ret_product->name) . '" /><input type="hidden" name="price_tmp1" value="' . $ret_product->a3 . '" />'; if (defined('WP_ESTORE_FORCE_LANGUAGE_OF_PAYPAL_PAGE') && WP_ESTORE_FORCE_LANGUAGE_OF_PAYPAL_PAGE !== '0') { //Set the country/region preference by force. $output .= '<input type="hidden" name="lc" value="' . WP_ESTORE_FORCE_LANGUAGE_OF_PAYPAL_PAGE . '" />'; } $output .= '<input type="hidden" name="cmd" value="_xclick-subscriptions" />'; $output .= '<input type="hidden" name="charset" value="utf-8" />'; $output .= "<input type=\"hidden\" name=\"business\" value=\"{$paypal_email}\" />"; $output .= '<input type="hidden" name="item_name" value="' . htmlspecialchars($ret_product->name) . '" />'; $output .= "<input type=\"hidden\" name=\"currency_code\" value=\"{$paypal_currency}\" />"; $output .= "<input type=\"hidden\" name=\"item_number\" value=\"{$id}\" />"; $output .= '<input type="hidden" name="rm" value="2" /><input type="hidden" name="no_note" value="1" />'; if (!empty($ret_product->p1)) { $output .= "<input type=\"hidden\" name=\"a1\" value=\"{$ret_product->a1}\" /><input type=\"hidden\" name=\"p1\" value=\"{$ret_product->p1}\" /><input type=\"hidden\" name=\"t1\" value=\"{$ret_product->t1}\" />"; } if (!empty($ret_product->p3)) { if (empty($ret_product->a3)) { $output .= "<div style='color:red;'>Looks like you did not specify a recurring amount in the subscription details. Please note that you must specify a value for the Recurring Billing Amount to create a working subscription payment button!</div>"; } else { $output .= "<input type=\"hidden\" name=\"a3\" value=\"{$ret_product->a3}\" /><input type=\"hidden\" name=\"p3\" value=\"{$ret_product->p3}\" /><input type=\"hidden\" name=\"t3\" value=\"{$ret_product->t3}\" />"; } } if ($ret_product->sra == '1') { $output .= '<input type="hidden" name="sra" value="1" />'; } if ($ret_product->srt > 1) { $output .= "<input type=\"hidden\" name=\"src\" value=\"1\" /><input type=\"hidden\" name=\"srt\" value=\"{$ret_product->srt}\" />"; } else { if ($ret_product->srt == '0') { $output .= "<input type=\"hidden\" name=\"src\" value=\"1\" />"; } } if (is_numeric($ret_product->shipping_cost) && $ret_product->shipping_cost == 0) { $output .= "<input type=\"hidden\" name=\"no_shipping\" value='1' />"; } $output .= $urls; $output .= '<input type="hidden" name="mrb" value="3FWGC6LFTMTUG" />'; $returnButtonText = get_option('eStore_paypal_return_button_text'); $output .= '<input type="hidden" name="cbt" value="' . $returnButtonText . '" />'; $page_style_name = get_option('eStore_paypal_co_page_style'); $output .= '<input type="hidden" name="page_style" value="' . $page_style_name . '" />'; if (empty($ret_product->ref_text)) { $output .= aff_add_custom_field(); } else { $custom_field_val = eStore_get_custom_field_value(); $subsc_ref_val = 'subsc_ref=' . $ret_product->ref_text; if (empty($custom_field_val)) { $custom_field_val = $subsc_ref_val; } else { $custom_field_val = $custom_field_val . '&' . $subsc_ref_val; } $output .= '<input type="hidden" name="custom" value="' . $custom_field_val . '" id="eStore_custom_values" />'; } if (get_option('eStore_show_t_c_for_buy_now')) { $output .= eStore_show_terms_and_cond(); } $output .= $button_type; $output .= '</form>'; $output .= '</div>'; return $output; }