本文整理汇总了PHP中jigoshop_get_page_id函数的典型用法代码示例。如果您正苦于以下问题:PHP jigoshop_get_page_id函数的具体用法?PHP jigoshop_get_page_id怎么用?PHP jigoshop_get_page_id使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了jigoshop_get_page_id函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: process_payment
/**
* @param int $order_id
* @return array
*/
function process_payment($order_id)
{
$order = new jigoshop_order($order_id);
$this->init_paymentwall_configs();
$return = array('result' => 'fail', 'redirect' => '');
$charge = new Paymentwall_Charge();
try {
$charge->create(array_merge($this->prepare_user_profile_data($order), $this->prepare_card_info($order)));
$response = $charge->getPublicData();
if ($charge->isSuccessful()) {
if ($charge->isCaptured()) {
// Add order note
$order->add_order_note(sprintf(__('Brick payment approved (ID: %s, Card: xxxx-%s)', PW_JIGO_TEXT_DOMAIN), $charge->getId(), $charge->getCard()->getAlias()));
// Payment complete
$order->payment_complete();
$return['result'] = 'success';
$checkout_redirect = apply_filters('jigoshop_get_checkout_redirect_page_id', jigoshop_get_page_id('thanks'));
$return['redirect'] = add_query_arg('key', $order->order_key, add_query_arg('order', $order_id, get_permalink($checkout_redirect)));
} elseif ($charge->isUnderReview()) {
$order->update_status('on-hold');
}
// Clear shopping cart
jigoshop_cart::empty_cart();
} else {
$errors = json_decode($response, true);
jigoshop::add_error(__($errors['error']['message']), 'error');
}
} catch (Exception $e) {
jigoshop::add_error($e->getMessage(), 'error');
}
// Return redirect
return $return;
}
示例2: successful_request
function successful_request($posted)
{
$checkout_redirect = apply_filters('jigoshop_get_checkout_redirect_page_id', jigoshop_get_page_id('thanks'));
if (!empty($posted['f_code'])) {
$order = new jigoshop_order((int) $posted['mer_txn']);
if ($order->status !== 'completed') {
switch ($posted['f_code']) {
case 'Ok':
$order->add_order_note(__('Atom Standard payment completed', 'jigoshop'));
$order->payment_complete();
wp_safe_redirect(add_query_arg('key', $order->order_key, add_query_arg('order', $order_id, get_permalink(jigoshop_get_page_id('thanks')))));
exit;
// case '0' : // Pending
// case '-2' : // Failed
// $order->update_status('on-hold', sprintf(__('Atom payment failed (%s)', 'jigoshop'), strtolower($posted['status']) ) );
// break;
// case '0' : // Pending
// case '-2' : // Failed
// $order->update_status('on-hold', sprintf(__('Atom payment failed (%s)', 'jigoshop'), strtolower($posted['status']) ) );
// break;
case 'F':
$order->update_status('cancelled', __('Atom payment cancelled', 'jigoshop'));
break;
default:
$order->update_status('cancelled', __('Atom exception', 'jigoshop'));
break;
}
}
exit;
}
}
示例3: widget
/**
* Widget
* Display the widget in the sidebar
* Save output to the cache if empty
*
* @param array sidebar arguments
* @param array instance
*/
public function widget($args, $instance)
{
extract($args);
// Print the widget wrapper
echo $before_widget;
if (is_user_logged_in()) {
// Get current user instance
global $current_user;
// Print title
$title = $instance['title_user'] ? $instance['title_user'] : __('Hey %s!', 'jigoshop');
if ($title) {
echo $before_title . sprintf($title, ucwords($current_user->display_name)) . $after_title;
}
// Create the default set of links
$links = apply_filters('jigoshop_widget_logout_user_links', array(__('My Account', 'jigoshop') => get_permalink(jigoshop_get_page_id('myaccount')), __('Change Password', 'jigoshop') => get_permalink(jigoshop_get_page_id('change_password')), __('Logout', 'jigoshop') => wp_logout_url(home_url())));
} else {
// Print title
$title = $instance['title_guest'] ? $instance['title_guest'] : __('Login', 'jigoshop');
if ($title) {
echo $before_title . $title . $after_title;
}
do_action('jigoshop_widget_login_before_form');
// Get redirect URI
$redirect_to = apply_filters('jigoshop_widget_login_redirect', get_permalink(jigoshop_get_page_id('myaccount')));
$fields = array();
// Support for other plugins which uses GET parameters
$fields = apply_filters('jigoshop_get_hidden_fields', $fields);
echo "<form action='" . esc_url(wp_login_url($redirect_to)) . "' method='post' class='jigoshop_login_widget'>";
foreach ($fields as $key => $value) {
echo '<input type="hidden" name="' . $key . '" value="' . $value . '" />';
}
// Username
echo "\n\t\t\t<p>\n\t\t\t\t<label for='log'>" . __('Username', 'jigoshop') . "</label>\n\t\t\t\t<input type='text' name='log' id='log' class='input-text username' />\n\t\t\t</p>\n\t\t\t";
// Password
echo "\n\t\t\t<p>\n\t\t\t\t<label for='pwd'>" . __('Password', 'jigoshop') . "</label>\n\t\t\t\t<input type='password' name='pwd' id='pwd' class='input-text password' />\n\t\t\t</p>\n\t\t\t";
echo "\n\t\t\t<p>\n\t\t\t\t<input type='submit' name='submit' value='" . __('Login', 'jigoshop') . "' class='input-submit' />\n\t\t\t\t<a class='forgot' href='" . esc_url(wp_lostpassword_url($redirect_to)) . "'>" . __('Forgot it?', 'jigoshop') . "</a>\n\t\t\t</p>\n\t\t\t";
if (Jigoshop_Base::get_options()->get('jigoshop_enable_signup_form') == 'yes') {
echo '<p class="register">';
wp_register(__('New user?', 'jigoshop') . ' ', '');
echo '</p>';
}
echo "</form>";
do_action('jigoshop_widget_login_after_form');
$links = apply_filters('jigoshop_widget_login_user_links', array());
}
// Loop & print out the links
if ($links) {
echo "\n\t\t\t<nav role='navigation'>\n\t\t\t\t<ul class='pagenav'>";
foreach ($links as $title => $href) {
$href = esc_url($href);
echo "<li><a title='Go to {$title}' href='{$href}'>{$title}</a></li>";
}
echo "\n\t\t\t\t</ul>\n\t\t\t</nav>";
}
// Print closing widget wrapper
echo $after_widget;
}
示例4: process_payment
/**
* Process the payment and return the result
**/
function process_payment($order_id)
{
$order = new jigoshop_order($order_id);
// Mark as on-hold (we're awaiting the cheque)
$order->update_status('waiting-for-payment', __('Awaiting cheque payment', 'jigoshop'));
// Remove cart
jigoshop_cart::empty_cart();
// Return thankyou redirect
$checkout_redirect = apply_filters('jigoshop_get_checkout_redirect_page_id', jigoshop_get_page_id('thanks'));
return array('result' => 'success', 'redirect' => add_query_arg('key', $order->order_key, add_query_arg('order', $order_id, get_permalink($checkout_redirect))));
}
示例5: process_payment
/**
* Process the payment and return the result
**/
function process_payment($order_id)
{
$order = new jigoshop_order($order_id);
$status = Jigoshop_Base::get_options()->get('jigoshop_cod_status', 'processing');
$order->update_status($status, __('Waiting for cash delivery.', 'jigoshop'));
// Remove cart
jigoshop_cart::empty_cart();
// Return thankyou redirect
$checkout_redirect = apply_filters('jigoshop_get_checkout_redirect_page_id', jigoshop_get_page_id('thanks'));
return array('result' => 'success', 'redirect' => add_query_arg('key', $order->order_key, add_query_arg('order', $order_id, get_permalink($checkout_redirect))));
}
示例6: menu_item
public function menu_item()
{
$total = 0;
if (!empty(jigoshop_cart::$cart_contents)) {
foreach (jigoshop_cart::$cart_contents as $cart_item_key => $values) {
$product = $values['data'];
$total += $product->get_price() * $values['quantity'];
}
}
$total = jigoshop_price($total);
$menu_item = array('cart_url' => jigoshop_cart::get_cart_url(), 'shop_page_url' => get_permalink(jigoshop_get_page_id('shop')), 'cart_contents_count' => jigoshop_cart::$cart_contents_count, 'cart_total' => $total);
return $menu_item;
}
示例7: jigoshop_edit_address
function jigoshop_edit_address()
{
$account_url = get_permalink(jigoshop_get_page_id(JIGOSHOP_MY_ACCOUNT));
$user_id = get_current_user_id();
$load_address = jigoshop_get_address_to_edit();
$address = jigoshop_get_address_fields($load_address, $user_id);
if (isset($_POST['save_address']) && jigoshop::verify_nonce(JIGOSHOP_EDIT_ADDRESS)) {
if ($user_id > 0) {
foreach ($address as &$field) {
if (isset($_POST[$field['name']])) {
$field['value'] = jigowatt_clean($_POST[$field['name']]);
update_user_meta($user_id, $field['name'], $field['value']);
}
}
do_action('jigoshop_user_edit_address', $user_id, $address);
}
}
jigoshop_render('shortcode/my_account/edit_address', array('url' => add_query_arg('address', $load_address, apply_filters('jigoshop_get_edit_address_page_id', get_permalink(jigoshop_get_page_id(JIGOSHOP_EDIT_ADDRESS)))), 'account_url' => $account_url, 'load_address' => $load_address, 'address' => $address));
}
示例8: jigoshop_process_checkout
function jigoshop_process_checkout()
{
if (!is_checkout() || is_jigoshop_single_page(JIGOSHOP_PAY)) {
return;
}
if (count(jigoshop_cart::get_cart()) == 0) {
wp_safe_redirect(get_permalink(jigoshop_get_page_id('cart')));
exit;
}
/** @var jigoshop_checkout $_checkout */
$_checkout = jigoshop_checkout::instance();
$result = $_checkout->process_checkout();
if (isset($result['result']) && $result['result'] === 'success') {
wp_safe_redirect(apply_filters('jigoshop_is_ajax_payment_successful', $result['redirect']));
exit;
}
if (isset($result['redirect'])) {
wp_safe_redirect(get_permalink($result['redirect']));
exit;
}
}
示例9: widget
/**
* Widget
* Display the widget in the sidebar
* Save output to the cache if empty
*
* @param array sidebar arguments
* @param array instance
*/
public function widget($args, $instance)
{
// Otherwise Start buffering and output the Widget
ob_start();
extract($args);
// Set the widget title
$title = apply_filters('widget_title', $instance['title'] ? $instance['title'] : __('Product Categories', 'jigoshop'), $instance, $this->id_base);
// Get options
$count = (bool) isset($instance['count']) ? $instance['count'] : false;
$is_hierarchial = (bool) isset($instance['hierarchical']) ? $instance['hierarchical'] : false;
$is_dropdown = (bool) isset($instance['dropdown']) ? $instance['dropdown'] : false;
// Print the widget wrapper & title
echo $before_widget;
if ($title) {
echo $before_title . $title . $after_title;
}
// Define options for the list
$args = array('orderby' => 'name', 'show_count' => $count, 'hierarchical' => $is_hierarchial, 'taxonomy' => 'product_cat', 'title_li' => null);
if (is_product()) {
global $post;
$categories = get_the_terms($post->ID, 'product_cat');
if (!empty($categories)) {
foreach ($categories as $id => $cat) {
$args['current_category'] = apply_filters('jigoshop_product_cat_widget_terms', $cat->term_id, $categories);
break;
// we can only take the first one
}
}
}
// Output as dropdown or unordered list
if ($is_dropdown) {
// Set up arguments
$args['name'] = 'dropdown_product_cat';
// Print dropdown
// wp_dropdown_categories($args); Commented out due to wordpress bug 13258 not supporting custom taxonomies
// See: http://core.trac.wordpress.org/ticket/13258
jigoshop_product_dropdown_categories($args['show_count'], $args['hierarchical']);
// TODO: Move this javascript to its own file (plugins.js?)
?>
<script type='text/javascript'>
/* <![CDATA[ */
var dropdown = document.getElementById("dropdown_product_cat");
function onCatChange(){
if(dropdown.options[dropdown.selectedIndex].value !== ''){
location.href = "<?php
echo home_url();
?>
/?product_cat=" + dropdown.options[dropdown.selectedIndex].value;
} else {
location.href = "<?php
echo get_permalink(jigoshop_get_page_id('shop'));
?>
"
}
}
dropdown.onchange = onCatChange;
/* ]]> */
</script>
<?php
} else {
// Print list of categories
echo '<ul>';
wp_list_categories(apply_filters('widget_product_categories_args', $args));
echo '</ul>';
}
// Print closing widget wrapper
echo $after_widget;
// Flush output buffer and save to transient cache
$result = ob_get_flush();
$cache[$this->id] = $result;
set_transient('jigoshop_widget_cache', $cache, 3600 * 3);
// 3 hours ahead
}
示例10: process_payment
function process_payment($order_id)
{
$order = new jigoshop_order($order_id);
return array('result' => 'success', 'redirect' => add_query_arg('order', $order->id, add_query_arg('key', $order->order_key, get_permalink(jigoshop_get_page_id('pay')))));
}
示例11: _e
<div class="page-title-wrapper">
<div class="page-title">
<div class="wrapper">
<div class="row-fluid">
<div class="span12">
<h3><?php
if (is_search()) {
_e('Search', kopa_get_domain());
} elseif (is_tax('product_cat') || is_tax('product_tag')) {
$queried_object = get_queried_object();
echo $queried_object->name;
} elseif (is_post_type_archive('product') && jigoshop_get_page_id('shop')) {
echo get_the_title(jigoshop_get_page_id('shop'));
} else {
single_post_title();
}
?>
</h3>
<?php
kopa_breadcrumb();
?>
</div><!--span12-->
</div><!--row-fluid-->
</div><!--wrapper-->
</div><!--page-title-->
</div><!--page-title-wrapper-->
示例12: jigoshop_page_body_classes
function jigoshop_page_body_classes()
{
global $jigoshop_body_classes;
$jigoshop_body_classes = (array) $jigoshop_body_classes;
if (is_order_tracker()) {
jigoshop_add_body_class(array('jigoshop', 'jigoshop-tracker'));
}
if (is_checkout()) {
jigoshop_add_body_class(array('jigoshop', 'jigoshop-checkout'));
}
if (is_cart()) {
jigoshop_add_body_class(array('jigoshop', 'jigoshop-cart'));
}
if (is_page(jigoshop_get_page_id('thanks'))) {
jigoshop_add_body_class(array('jigoshop', 'jigoshop-thanks'));
}
if (is_page(jigoshop_get_page_id('pay'))) {
jigoshop_add_body_class(array('jigoshop', 'jigoshop-pay'));
}
if (is_account()) {
jigoshop_add_body_class(array('jigoshop', 'jigoshop-myaccount'));
}
}
示例13: process_gateway_html_form
private function process_gateway_html_form($order)
{
// Return pay page redirect
return array('result' => 'success', 'redirect' => add_query_arg(array('order' => $order->id, 'key' => $order->order_key), get_permalink(jigoshop_get_page_id('pay'))));
}
示例14: jigoshop_breadcrumb
function jigoshop_breadcrumb($delimiter = ' › ', $wrap_before = '<div id="breadcrumb">', $wrap_after = '</div>', $before = '', $after = '', $home = null)
{
global $post, $wp_query, $author;
$options = Jigoshop_Base::get_options();
if (!$home) {
$home = _x('Home', 'breadcrumb', 'jigoshop');
}
$home_link = home_url();
$prepend = '';
if ($options->get('jigoshop_prepend_shop_page_to_urls') == "yes" && jigoshop_get_page_id('shop') && get_option('page_on_front') !== jigoshop_get_page_id('shop')) {
$prepend = $before . '<a href="' . esc_url(jigoshop_cart::get_shop_url()) . '">' . get_the_title(jigoshop_get_page_id('shop')) . '</a> ' . $after . $delimiter;
}
if (!is_home() && !is_front_page() && !(is_post_type_archive() && get_option('page_on_front') == jigoshop_get_page_id('shop')) || is_paged()) {
echo $wrap_before;
echo $before . '<a class="home" href="' . $home_link . '">' . $home . '</a> ' . $after . $delimiter;
if (is_category()) {
$cat_obj = $wp_query->get_queried_object();
$this_category = $cat_obj->term_id;
$this_category = get_category($this_category);
if ($this_category->parent != 0) {
$parent_category = get_category($this_category->parent);
echo get_category_parents($parent_category->term_id, true, $delimiter);
}
echo $before . single_cat_title('', false) . $after;
} elseif (is_tax('product_cat')) {
$term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
$parents = array();
$parent = $term->parent;
while ($parent) {
$parents[] = $parent;
$new_parent = get_term_by('id', $parent, get_query_var('taxonomy'));
$parent = $new_parent->parent;
}
if (!empty($parents)) {
$parents = array_reverse($parents);
foreach ($parents as $parent) {
$item = get_term_by('id', $parent, get_query_var('taxonomy'));
echo $before . '<a href="' . get_term_link($item->slug, 'product_cat') . '">' . $item->name . '</a>' . $after . $delimiter;
}
}
$queried_object = $wp_query->get_queried_object();
echo $prepend . $before . $queried_object->name . $after;
} elseif (is_tax('product_tag')) {
$queried_object = $wp_query->get_queried_object();
echo $prepend . $before . __('Products tagged “', 'jigoshop') . $queried_object->name . '”' . $after;
} elseif (is_day()) {
echo $before . '<a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a>' . $after . $delimiter;
echo $before . '<a href="' . get_month_link(get_the_time('Y'), get_the_time('m')) . '">' . get_the_time('F') . '</a>' . $after . $delimiter;
echo $before . get_the_time('d') . $after;
} elseif (is_month()) {
echo $before . '<a href="' . get_year_link(get_the_time('Y')) . '">' . get_the_time('Y') . '</a>' . $after . $delimiter;
echo $before . get_the_time('F') . $after;
} elseif (is_year()) {
echo $before . get_the_time('Y') . $after;
} elseif (is_post_type_archive('product') && get_option('page_on_front') !== jigoshop_get_page_id('shop')) {
$_name = jigoshop_get_page_id('shop') ? get_the_title(jigoshop_get_page_id('shop')) : ucwords($options->get('jigoshop_shop_slug'));
if (is_search()) {
echo $before . '<a href="' . get_post_type_archive_link('product') . '">' . $_name . '</a>' . $delimiter . __('Search results for “', 'jigoshop') . get_search_query() . '”' . $after;
} else {
echo $before . '<a href="' . get_post_type_archive_link('product') . '">' . $_name . '</a>' . $after;
}
} elseif (is_single() && !is_attachment()) {
if (get_post_type() == 'product') {
echo $prepend;
if ($terms = get_the_terms($post->ID, 'product_cat')) {
$term = apply_filters('jigoshop_product_cat_breadcrumb_terms', current($terms), $terms);
$parents = array();
$parent = $term->parent;
while ($parent) {
$parents[] = $parent;
$new_parent = get_term_by('id', $parent, 'product_cat');
$parent = $new_parent->parent;
}
if (!empty($parents)) {
$parents = array_reverse($parents);
foreach ($parents as $parent) {
$item = get_term_by('id', $parent, 'product_cat');
echo $before . '<a href="' . get_term_link($item->slug, 'product_cat') . '">' . $item->name . '</a>' . $after . $delimiter;
}
}
echo $before . '<a href="' . get_term_link($term->slug, 'product_cat') . '">' . $term->name . '</a>' . $after . $delimiter;
}
echo $before . get_the_title() . $after;
} elseif (get_post_type() != 'post') {
$post_type = get_post_type_object(get_post_type());
echo $before . '<a href="' . get_post_type_archive_link(get_post_type()) . '">' . $post_type->labels->singular_name . '</a>' . $after . $delimiter;
echo $before . get_the_title() . $after;
} else {
$cat = current(get_the_category());
echo get_category_parents($cat, true, $delimiter);
echo $before . get_the_title() . $after;
}
} elseif (is_404()) {
echo $before . __('Error 404', 'jigoshop') . $after;
} elseif (!is_single() && !is_page() && get_post_type() != 'post') {
$post_type = get_post_type_object(get_post_type());
if ($post_type) {
echo $before . $post_type->labels->singular_name . $after;
}
} elseif (is_attachment()) {
//.........这里部分代码省略.........
示例15: generate_paypal_form
/**
* Generate the paypal button link
*
* @param int $order_id
* @return string
*/
public function generate_paypal_form($order_id)
{
$order = new jigoshop_order($order_id);
if ($this->testmode == 'yes') {
$url = $this->testurl . '?test_ipn=1&';
} else {
$url = $this->liveurl . '?';
}
if (in_array($order->billing_country, array('US', 'CA'))) {
$order->billing_phone = str_replace(array('(', '-', ' ', ')'), '', $order->billing_phone);
$phone_args = array('night_phone_a' => substr($order->billing_phone, 0, 3), 'night_phone_b' => substr($order->billing_phone, 3, 3), 'night_phone_c' => substr($order->billing_phone, 6, 4), 'day_phone_a' => substr($order->billing_phone, 0, 3), 'day_phone_b' => substr($order->billing_phone, 3, 3), 'day_phone_c' => substr($order->billing_phone, 6, 4));
} else {
$phone_args = array('night_phone_b' => $order->billing_phone, 'day_phone_b' => $order->billing_phone);
}
// filter redirect page
$checkout_redirect = apply_filters('jigoshop_get_checkout_redirect_page_id', jigoshop_get_page_id('thanks'));
$paypal_args = array_merge(array('cmd' => '_cart', 'business' => $this->testmode == 'yes' ? $this->testemail : $this->email, 'no_note' => 1, 'currency_code' => Jigoshop_Base::get_options()->get('jigoshop_currency'), 'charset' => 'UTF-8', 'rm' => 2, 'upload' => 1, 'return' => add_query_arg('key', $order->order_key, add_query_arg('order', $order_id, get_permalink($checkout_redirect))), 'cancel_return' => $order->get_cancel_order_url(), 'custom' => $order_id, 'notify_url' => $this->notify_url, 'first_name' => $order->billing_first_name, 'last_name' => $order->billing_last_name, 'company' => $order->billing_company, 'address1' => $order->billing_address_1, 'address2' => $order->billing_address_2, 'city' => $order->billing_city, 'state' => $order->billing_state, 'zip' => $order->billing_postcode, 'country' => $order->billing_country, 'email' => $order->billing_email, 'invoice' => $order->get_order_number(), 'amount' => number_format((double) $order->order_total, $this->decimals), 'bn' => 'Jigoshop_SP'), $phone_args);
if ($this->send_shipping == 'yes') {
$paypal_args['no_shipping'] = 1;
$paypal_args['address_override'] = 1;
$paypal_args['first_name'] = $order->shipping_first_name;
$paypal_args['last_name'] = $order->shipping_last_name;
$paypal_args['address1'] = $order->shipping_address_1;
$paypal_args['address2'] = $order->shipping_address_2;
$paypal_args['city'] = $order->shipping_city;
$paypal_args['state'] = $order->shipping_state;
$paypal_args['zip'] = $order->shipping_postcode;
$paypal_args['country'] = $order->shipping_country;
// PayPal counts Puerto Rico as a US Territory, won't allow payment without it
if ($paypal_args['country'] == 'PR') {
$paypal_args['country'] = 'US';
$paypal_args['state'] = 'PR';
}
} else {
$paypal_args['no_shipping'] = 1;
$paypal_args['address_override'] = 0;
}
// If prices include tax, send the whole order as a single item
if (Jigoshop_Base::get_options()->get('jigoshop_prices_include_tax') == 'yes') {
// Discount
$paypal_args['discount_amount_cart'] = number_format((double) $order->order_discount, $this->decimals);
// Don't pass items - PayPal breaks tax due to catalog prices include tax.
// PayPal has no option for tax inclusive pricing.
// Pass 1 item for the order items overall
$item_names = array();
foreach ($order->items as $item) {
$_product = $order->get_product_from_item($item);
$title = $_product->get_title();
//if variation, insert variation details into product title
if ($_product instanceof jigoshop_product_variation) {
$title .= ' (' . jigoshop_get_formatted_variation($_product, $item['variation'], true) . ')';
}
$item_names[] = $title . ' x ' . $item['qty'];
}
$paypal_args['item_name_1'] = sprintf(__('Order %s', 'jigoshop'), $order->get_order_number()) . ' - ' . implode(', ', $item_names);
$paypal_args['quantity_1'] = 1;
$paypal_args['amount_1'] = number_format($order->order_total - $order->order_shipping - $order->order_shipping_tax + $order->order_discount, $this->decimals, '.', '');
if ($order->order_shipping + $order->order_shipping_tax > 0) {
$paypal_args['item_name_2'] = __('Shipping cost', 'jigoshop');
$paypal_args['quantity_2'] = '1';
$paypal_args['amount_2'] = number_format($order->order_shipping + $order->order_shipping_tax, $this->decimals, '.', '');
}
} else {
// Cart Contents
$item_loop = 0;
foreach ($order->items as $item) {
$_product = $order->get_product_from_item($item);
if ($_product->exists() && $item['qty']) {
$item_loop++;
$title = $_product->get_title();
//if variation, insert variation details into product title
if ($_product instanceof jigoshop_product_variation) {
$title .= ' (' . jigoshop_get_formatted_variation($_product, $item['variation'], true) . ')';
}
$paypal_args['item_name_' . $item_loop] = $title;
$paypal_args['quantity_' . $item_loop] = $item['qty'];
$paypal_args['amount_' . $item_loop] = number_format(apply_filters('jigoshop_paypal_adjust_item_price', $item['cost'], $item, 10, 2), $this->decimals);
//Apparently, Paypal did not like "28.4525" as the amount. Changing that to "28.45" fixed the issue.
}
}
// Shipping Cost
if (jigoshop_shipping::is_enabled() && $order->order_shipping > 0) {
$item_loop++;
$paypal_args['item_name_' . $item_loop] = __('Shipping cost', 'jigoshop');
$paypal_args['quantity_' . $item_loop] = '1';
$paypal_args['amount_' . $item_loop] = number_format((double) $order->order_shipping, $this->decimals);
}
$paypal_args['tax'] = $order->get_total_tax(false, false);
// no currency sign or pricing options for separators
$paypal_args['tax_cart'] = $order->get_total_tax(false, false);
// no currency sign or pricing options for separators
$paypal_args['discount_amount_cart'] = $order->order_discount;
if ($this->force_payment == 'yes') {
$sum = 0;
//.........这里部分代码省略.........