function receipt_kaznachey($order_id) { $this->kaznachey_init(); $order = new jigoshop_order($order_id); $sum = $qty = 0; foreach ($order->items as $item) { $thumb = wp_get_attachment_image_src(get_post_thumbnail_id($item['id']), 'large'); $request['Products'][] = array("ProductId" => $item['id'], "ProductName" => $item['name'], "ProductPrice" => $item['cost'], "ProductItemsNum" => $item['qty'], "ImageUrl" => isset($thumb[0]) ? $thumb[0] : ''); $sum += $item['cost'] * $item['qty']; $qty += $item['qty']; } // Доставка if (jigoshop_shipping::is_enabled()) { if ($order->order_shipping > 0) { $request['Products'][] = array("ProductId" => 1, "ProductName" => 'Доставка', "ProductPrice" => $order->order_shipping, "ProductItemsNum" => 1, "ImageUrl" => ''); $sum += $order->order_shipping; $qty += 1; } } $request["MerchantGuid"] = $this->merchantGuid; $request['SelectedPaySystemId'] = $_COOKIE['cc_types'] ? $_COOKIE['cc_types'] : $this->GetMerchnatInfo(false, true); $request['Currency'] = $this->currency; $request['Language'] = $this->language; $checkout_redirect = apply_filters('jigoshop_get_checkout_redirect_page_id', jigoshop_get_page_id('thanks')); $request['PaymentDetails'] = array("EMail" => $order->billing_email, "PhoneNumber" => $order->billing_phone, "MerchantInternalPaymentId" => $order->id, "MerchantInternalUserId" => $order->user_id, "StatusUrl" => add_query_arg('key', $order->order_key, add_query_arg('order', $order->id, get_permalink($checkout_redirect))), "ReturnUrl" => get_permalink($checkout_redirect), "CustomMerchantInfo" => "", "BuyerCountry" => $order->billing_country, "BuyerFirstname" => $order->billing_first_name, "BuyerPatronymic" => '', "BuyerLastname" => $order->billing_last_name, "BuyerStreet" => $order->billing_address_1, "BuyerZone" => $order->billing_state, "BuyerZip" => '', "BuyerCity" => $order->billing_city, "DeliveryFirstname" => $order->shipping_first_name, "DeliveryPatronymic" => '', "DeliveryLastname" => $order->shipping_last_name, "DeliveryZip" => '', "DeliveryCountry" => $order->shipping_country, "DeliveryStreet" => $order->shipping_address_1, "DeliveryCity" => $order->shipping_city, "DeliveryZone" => $order->shipping_state); $request["Signature"] = md5(strtoupper($this->merchantGuid) . number_format($sum, 2, ".", "") . $request["SelectedPaySystemId"] . $request["PaymentDetails"]["EMail"] . $request["PaymentDetails"]["PhoneNumber"] . $request["PaymentDetails"]["MerchantInternalUserId"] . $request["PaymentDetails"]["MerchantInternalPaymentId"] . strtoupper($request["Language"]) . strtoupper($request["Currency"]) . strtoupper($this->merchnatSecretKey)); $response = $this->sendRequestKaznachey(json_encode($request), "CreatePaymentEx"); $result = json_decode($response, true); if ($result['ErrorCode'] != 0) { wp_redirect(home_url()); exit; } echo base64_decode($result["ExternalForm"]); jigoshop_cart::empty_cart(); exit; }
/** * Validate the checkout */ public function validate_checkout() { if (jigoshop_cart::is_empty()) { jigoshop::add_error(sprintf(__('Sorry, your session has expired. <a href="%s">Return to homepage →</a>', 'jigoshop'), home_url())); } // Process Discount Codes if (!empty($_POST['coupon_code'])) { $coupon = sanitize_title($_POST['coupon_code']); jigoshop_cart::add_discount($coupon); } foreach (jigoshop_cart::get_coupons() as $coupon) { jigoshop_cart::is_valid_coupon($coupon); } // Checkout fields $this->posted['shipping_method'] = ''; $this->posted['shipping_service'] = ''; if (isset($_POST['shipping_method'])) { $shipping_method = jigowatt_clean($_POST['shipping_method']); $shipping_data = explode(':', $shipping_method); $this->posted['shipping_method'] = $shipping_data[0]; $this->posted['shipping_service'] = $shipping_data[1]; } $this->posted['shiptobilling'] = isset($_POST['shiptobilling']) ? jigowatt_clean($_POST['shiptobilling']) : ''; $this->posted['payment_method'] = isset($_POST['payment_method']) ? jigowatt_clean($_POST['payment_method']) : ''; $this->posted['order_comments'] = isset($_POST['order_comments']) ? jigowatt_clean($_POST['order_comments']) : ''; $this->posted['terms'] = isset($_POST['terms']) ? jigowatt_clean($_POST['terms']) : ''; $this->posted['create_account'] = isset($_POST['create_account']) ? jigowatt_clean($_POST['create_account']) : ''; $this->posted['account_username'] = isset($_POST['account_username']) ? jigowatt_clean($_POST['account_username']) : ''; $this->posted['account_password'] = isset($_POST['account_password']) ? jigowatt_clean($_POST['account_password']) : ''; $this->posted['account_password_2'] = isset($_POST['account_password_2']) ? jigowatt_clean($_POST['account_password_2']) : ''; if (jigoshop_cart::get_total(false) == 0) { $this->posted['payment_method'] = 'no_payment'; } // establish customer billing and shipping locations if (jigoshop_cart::ship_to_billing_address_only()) { $this->posted['shiptobilling'] = 'true'; } $country = isset($_POST['billing_country']) ? jigowatt_clean($_POST['billing_country']) : ''; $state = isset($_POST['billing_state']) ? jigowatt_clean($_POST['billing_state']) : ''; $allowed_countries = Jigoshop_Base::get_options()->get('jigoshop_allowed_countries'); if ($allowed_countries === 'specific') { $specific_countries = Jigoshop_Base::get_options()->get('jigoshop_specific_allowed_countries'); if (!in_array($country, $specific_countries)) { jigoshop::add_error(__('Invalid billing country.', 'jigoshop')); return; } } if (jigoshop_countries::country_has_states($country)) { $states = jigoshop_countries::get_states($country); if (!in_array($state, array_keys($states))) { jigoshop::add_error(__('Invalid billing state.', 'jigoshop')); return; } } $postcode = isset($_POST['billing_postcode']) ? jigowatt_clean($_POST['billing_postcode']) : ''; $ship_to_billing = Jigoshop_Base::get_options()->get('jigoshop_ship_to_billing_address_only') == 'yes'; jigoshop_customer::set_location($country, $state, $postcode); if (Jigoshop_Base::get_options()->get('jigoshop_calc_shipping') == 'yes') { if ($ship_to_billing || !empty($_POST['shiptobilling'])) { jigoshop_customer::set_shipping_location($country, $state, $postcode); } else { $country = isset($_POST['shipping_country']) ? jigowatt_clean($_POST['shipping_country']) : ''; $state = isset($_POST['shipping_state']) ? jigowatt_clean($_POST['shipping_state']) : ''; $postcode = isset($_POST['shipping_postcode']) ? jigowatt_clean($_POST['shipping_postcode']) : ''; if ($allowed_countries === 'specific') { $specific_countries = Jigoshop_Base::get_options()->get('jigoshop_specific_allowed_countries'); if (!in_array($country, $specific_countries)) { jigoshop::add_error(__('Invalid shipping country.', 'jigoshop')); return; } } if (jigoshop_countries::country_has_states($country)) { $states = jigoshop_countries::get_states($country); if (!in_array($state, array_keys($states))) { jigoshop::add_error(__('Invalid shipping state.', 'jigoshop')); return; } } jigoshop_customer::set_shipping_location($country, $state, $postcode); } } // Billing Information foreach ($this->billing_fields as $field) { $field = apply_filters('jigoshop_billing_field', $field); $this->posted[$field['name']] = isset($_POST[$field['name']]) ? jigowatt_clean($_POST[$field['name']]) : ''; // Format if (isset($field['format'])) { switch ($field['format']) { case 'postcode': $this->posted[$field['name']] = strtolower(str_replace(' ', '', $this->posted[$field['name']])); break; } } // Required if ($field['name'] == 'billing_state' && jigoshop_customer::has_valid_shipping_state()) { $field['required'] = false; } if (isset($field['required']) && $field['required'] && empty($this->posted[$field['name']])) { jigoshop::add_error($field['label'] . __(' (billing) is a required field.', 'jigoshop')); } if ($field['name'] == 'billing_euvatno') { $vatno = isset($this->posted['billing_euvatno']) ? $this->posted['billing_euvatno'] : ''; $vatno = str_replace(' ', '', $vatno); $country = jigoshop_tax::get_customer_country(); // strip any country code from the beginning of the number if (strpos($vatno, $country) === 0) { $vatno = substr($vatno, strlen($country)); } if ($vatno != '') { $url = 'http://isvat.appspot.com/' . $country . '/' . $vatno . '/'; $httpRequest = curl_init(); curl_setopt($httpRequest, CURLOPT_FAILONERROR, true); curl_setopt($httpRequest, CURLOPT_RETURNTRANSFER, true); curl_setopt($httpRequest, CURLOPT_HEADER, false); curl_setopt($httpRequest, CURLOPT_URL, $url); $result = curl_exec($httpRequest); curl_close($httpRequest); if ($result === 'false') { jigoshop_log('EU VAT validation error with URL: ' . $url); jigoshop::add_error($field['label'] . __(' (billing) is not a valid VAT Number. Leave it blank to disable VAT validation. (VAT may be charged depending on your location)', 'jigoshop')); } else { $this->valid_euvatno = jigoshop_countries::get_base_country() != jigoshop_tax::get_customer_country() && jigoshop_countries::is_eu_country(jigoshop_tax::get_customer_country()); } } } // Validation if (isset($field['validate']) && !empty($this->posted[$field['name']])) { switch ($field['validate']) { case 'phone': if (!jigoshop_validation::is_phone($this->posted[$field['name']])) { jigoshop::add_error($field['label'] . __(' (billing) is not a valid number.', 'jigoshop')); } break; case 'email': if (!jigoshop_validation::is_email($this->posted[$field['name']])) { jigoshop::add_error($field['label'] . __(' (billing) is not a valid email address.', 'jigoshop')); } break; case 'postcode': if (!jigoshop_validation::is_postcode($this->posted[$field['name']], $_POST['billing_country'])) { jigoshop::add_error($field['label'] . __(' (billing) is not a valid postcode/ZIP.', 'jigoshop')); } else { $this->posted[$field['name']] = jigoshop_validation::format_postcode($this->posted[$field['name']], $_POST['billing_country']); } break; } } } // Shipping Information if (jigoshop_shipping::is_enabled() && !jigoshop_cart::ship_to_billing_address_only() && empty($this->posted['shiptobilling'])) { foreach ($this->shipping_fields as $field) { $field = apply_filters('jigoshop_shipping_field', $field); if (isset($_POST[$field['name']])) { $this->posted[$field['name']] = jigowatt_clean($_POST[$field['name']]); } else { $this->posted[$field['name']] = ''; } // Format if (isset($field['format'])) { switch ($field['format']) { case 'postcode': $this->posted[$field['name']] = strtolower(str_replace(' ', '', $this->posted[$field['name']])); break; } } // Required if ($field['name'] == 'shipping_state' && jigoshop_customer::has_valid_shipping_state()) { $field['required'] = false; } if (isset($field['required']) && $field['required'] && empty($this->posted[$field['name']])) { jigoshop::add_error($field['label'] . __(' (shipping) is a required field.', 'jigoshop')); } // Validation if (isset($field['validate']) && !empty($this->posted[$field['name']])) { switch ($field['validate']) { case 'postcode': if (!jigoshop_validation::is_postcode($this->posted[$field['name']], $country)) { jigoshop::add_error($field['label'] . __(' (shipping) is not a valid postcode/ZIP.', 'jigoshop')); } else { $this->posted[$field['name']] = jigoshop_validation::format_postcode($this->posted[$field['name']], $country); } break; } } } } if ($this->must_register && empty($this->posted['create_account'])) { jigoshop::add_error(__('Sorry, you must agree to creating an account', 'jigoshop')); } if ($this->must_register || empty($user_id) && $this->posted['create_account']) { if (!$this->show_signup) { jigoshop::add_error(__('Sorry, the shop owner has disabled guest purchases.', 'jigoshop')); } if (empty($this->posted['account_username'])) { jigoshop::add_error(__('Please enter an account username.', 'jigoshop')); } if (empty($this->posted['account_password'])) { jigoshop::add_error(__('Please enter an account password.', 'jigoshop')); } if ($this->posted['account_password_2'] !== $this->posted['account_password']) { jigoshop::add_error(__('Passwords do not match.', 'jigoshop')); } // Check the username if (!validate_username($this->posted['account_username'])) { jigoshop::add_error(__('Invalid email/username.', 'jigoshop')); } elseif (username_exists($this->posted['account_username'])) { jigoshop::add_error(__('An account is already registered with that username. Please choose another.', 'jigoshop')); } // Check the e-mail address if (email_exists($this->posted['billing_email'])) { jigoshop::add_error(__('An account is already registered with your email address. Please login.', 'jigoshop')); } } // Terms if (!isset($_POST['update_totals']) && empty($this->posted['terms']) && jigoshop_get_page_id('terms') > 0) { jigoshop::add_error(__('You must accept our Terms & Conditions.', 'jigoshop')); } if (jigoshop_cart::needs_shipping()) { // Shipping Method $available_methods = jigoshop_shipping::get_available_shipping_methods(); if (!isset($available_methods[$this->posted['shipping_method']])) { jigoshop::add_error(__('Invalid shipping method.', 'jigoshop')); } } }
/** * 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; for ($i = 1; $i < $item_loop; $i++) { $sum += $paypal_args['amount_' . $i]; } $item_loop++; if ($sum == 0 || $order->order_discount && $sum - $order->order_discount == 0) { $paypal_args['item_name_' . $item_loop] = __('Force payment on free', 'jigoshop'); $paypal_args['quantity_' . $item_loop] = '1'; $paypal_args['amount_' . $item_loop] = 0.01; // force payment } } } $paypal_args = apply_filters('jigoshop_paypal_args', $paypal_args); return jigoshop_render_result('gateways/paypal', array('url' => $url, 'fields' => $paypal_args)); }
/** looks through the cart to see if shipping is actually required */ public static function needs_shipping() { if (!jigoshop_shipping::is_enabled() || !is_array(self::$cart_contents)) { return false; } foreach (self::$cart_contents as $values) { /** @var jigoshop_product $_product */ $_product = $values['data']; if ($_product->requires_shipping()) { return true; } } return false; }
function my_cart($atts) { $errors = array(); unset(jigoshop_session::instance()->selected_rate_id); // Process Discount Codes if (isset($_POST['apply_coupon']) && $_POST['apply_coupon'] && jigoshop::verify_nonce('cart')) { $coupon_code = stripslashes(trim($_POST['coupon_code'])); jigoshop_cart::add_discount($coupon_code); // Update Shipping } elseif (isset($_POST['calc_shipping']) && $_POST['calc_shipping'] && jigoshop::verify_nonce('cart')) { unset(jigoshop_session::instance()->chosen_shipping_method_id); $country = $_POST['calc_shipping_country']; $state = $_POST['calc_shipping_state']; $postcode = $_POST['calc_shipping_postcode']; if ($postcode && !jigoshop_validation::is_postcode($postcode, $country)) { jigoshop::add_error(__('Please enter a valid postcode/ZIP.', 'jigoshop')); $postcode = ''; } elseif ($postcode) { $postcode = jigoshop_validation::format_postcode($postcode, $country); } if ($country) { // Update customer location jigoshop_customer::set_location($country, $state, $postcode); jigoshop_customer::set_shipping_location($country, $state, $postcode); jigoshop::add_message(__('Shipping costs updated.', 'jigoshop')); } else { jigoshop_customer::set_shipping_location('', '', ''); jigoshop::add_message(__('Shipping costs updated.', 'jigoshop')); } } elseif (isset($_POST['shipping_rates'])) { $rates_params = explode(":", $_POST['shipping_rates']); $available_methods = jigoshop_shipping::get_available_shipping_methods(); $shipping_method = $available_methods[$rates_params[0]]; if ($rates_params[1] != NULL) { jigoshop_session::instance()->selected_rate_id = $rates_params[1]; } $shipping_method->choose(); // choses the method selected by user. } // Re-Calc prices. This needs to happen every time the cart page is loaded and after checking post results. It will happen twice for coupon. jigoshop_cart::calculate_totals(); $result = jigoshop_cart::check_cart_item_stock(); if (is_wp_error($result)) { jigoshop::add_error($result->get_error_message()); } jigoshop::show_messages(); if (sizeof(jigoshop_cart::$cart_contents) == 0) { echo '<p>' . __('Your cart is empty.', 'jigoshop') . '</p>'; ?> <p><a href="<?php echo esc_url(jigoshop_cart::get_shop_url()); ?> " class="button"><?php _e('← Return to Shop', 'jigoshop'); ?> </a></p><?php return; } ?> <form action="<?php echo esc_url(jigoshop_cart::get_cart_url()); ?> " method="post"> <table class="shop_table cart" cellspacing="0" id="shop-cart"> <thead> <tr> <th class="product-remove">Remove</th> <th class="product-thumbnail"></th> <th class="product-name"><span class="nobr"><?php _e('Product Name', 'jigoshop'); ?> </span></th> <th class="product-price"><span class="nobr"><?php _e('Unit Price', 'jigoshop'); ?> </span></th> <th class="product-quantity"><?php _e('Quantity', 'jigoshop'); ?> </th> <th class="product-subtotal"><?php _e('Price', 'jigoshop'); ?> </th> </tr> <?php do_action('jigoshop_shop_table_cart_head'); ?> </thead> <tbody> <?php if (sizeof(jigoshop_cart::$cart_contents) > 0) { foreach (jigoshop_cart::$cart_contents as $cart_item_key => $values) { $_product = $values['data']; if ($_product->exists() && $values['quantity'] > 0) { $additional_description = jigoshop_cart::get_item_data($values); ?> <tr> <td class="product-remove"><a href="<?php echo esc_url(jigoshop_cart::get_remove_url($cart_item_key)); ?> " class="remove" title="<?php echo esc_attr(__('Remove this item.', 'jigoshop')); ?> ">×</a></td> <td class="product-thumbnail"><a href="<?php echo esc_url(apply_filters('jigoshop_product_url_display_in_cart', get_permalink($values['product_id']), $cart_item_key)); ?> "> <?php if ($values['variation_id'] && has_post_thumbnail($values['variation_id'])) { echo get_the_post_thumbnail($values['variation_id'], 'shop_tiny'); } else { if (has_post_thumbnail($values['product_id'])) { echo get_the_post_thumbnail($values['product_id'], 'shop_tiny'); } else { echo '<img src="' . jigoshop::assets_url() . '/assets/images/placeholder.png" alt="Placeholder" width="' . jigoshop::get_var('shop_tiny_w') . '" height="' . jigoshop::get_var('shop_tiny_h') . '" />'; } } ?> </a> </td> <td class="product-name"> <a href="<?php echo esc_url(apply_filters('jigoshop_product_url_display_in_cart', get_permalink($values['product_id']), $cart_item_key)); ?> "><?php echo apply_filters('jigoshop_cart_product_title', $_product->get_title(), $_product); ?> </a> <?php echo $additional_description; ?> <?php if (!empty($values['variation_id'])) { $product_id = $values['variation_id']; } else { $product_id = $values['product_id']; } $custom_products = (array) jigoshop_session::instance()->customized_products; $custom = isset($custom_products[$product_id]) ? $custom_products[$product_id] : ''; if (!empty($custom_products[$product_id])) { ?> <dl class="customization"> <dt class="customized_product_label"><?php echo apply_filters('jigoshop_customized_product_label', __('Personal: ', 'jigoshop')); ?> </dt> <dd class="customized_product"><?php echo esc_textarea($custom); ?> </dd> </dl> <?php } ?> </td> <td class="product-price"><span class="m-label">Unit price:</span><?php echo jigoshop_price($_product->get_price()); ?> </td> <td class="product-quantity"> <span class="m-label">Quantity:</span> <div class="quantity"><input name="cart[<?php echo $cart_item_key; ?> ][qty]" value="<?php echo esc_attr($values['quantity']); ?> " size="4" title="Qty" class="input-text qty text" maxlength="12" /></div> </td> <td class="product-subtotal"><span class="m-label">Price:</span><?php echo jigoshop_price($_product->get_price() * $values['quantity']); ?> </td> </tr> <?php } } } do_action('jigoshop_shop_table_cart_body'); ?> </tbody> <tfoot> <tr> <td colspan="6" class="actions"> <?php $coupons = JS_Coupons::get_coupons(); if (!empty($coupons)) { ?> <div class="coupon"> <label for="coupon_code"><?php _e('Coupon', 'jigoshop'); ?> :</label> <input type="text" name="coupon_code" class="input-text" id="coupon_code" value="" /> <input type="submit" class="button" name="apply_coupon" value="<?php _e('Apply Coupon', 'jigoshop'); ?> " /> </div> <?php } ?> <?php jigoshop::nonce_field('cart'); ?> <input type="submit" class="button" name="update_cart" value="<?php _e('Update Shopping Cart', 'jigoshop'); ?> " /> <a href="<?php echo esc_url(jigoshop_cart::get_checkout_url()); ?> " class="checkout-button button-alt"><?php _e('Proceed to Checkout →', 'jigoshop'); ?> </a> </td> </tr> <?php if (count(jigoshop_cart::$applied_coupons)) { ?> <tr> <td colspan="6" class="applied-coupons"> <div> <span class="applied-coupons-label"><?php _e('Applied Coupons: ', 'jigoshop'); ?> </span> <?php foreach (jigoshop_cart::$applied_coupons as $code) { ?> <a href="?unset_coupon=<?php echo $code; ?> " id="<?php echo $code; ?> " class="applied-coupons-values"><?php echo $code; ?> <span class="close">×</span> </a> <?php } ?> </div> </td> </tr> <?php } do_action('jigoshop_shop_table_cart_foot'); ?> </tfoot> <?php do_action('jigoshop_shop_table_cart'); ?> </table> </form> <div class="cart-collaterals"> <?php do_action('cart-collaterals'); ?> <div class="cart_totals"> <?php // Hide totals if customer has set location and there are no methods going there $available_methods = jigoshop_shipping::get_available_shipping_methods(); $jigoshop_options = Jigoshop_Base::get_options(); if ($available_methods || !jigoshop_customer::get_shipping_country() || !jigoshop_shipping::is_enabled()) { ?> <h2><?php _e('Cart Totals', 'jigoshop'); ?> </h2> <div class="cart_totals_table"> <table cellspacing="0" cellpadding="0"> <tbody> <tr> <?php $price_label = jigoshop_cart::show_retail_price() ? __('Retail Price', 'jigoshop') : __('Subtotal', 'jigoshop'); ?> <th class="cart-row-subtotal-title"><?php echo $price_label; ?> </th> <td class="cart-row-subtotal"><?php echo jigoshop_cart::get_cart_subtotal(); ?> </td> </tr> <?php if (jigoshop_cart::get_cart_shipping_total()) { ?> <tr> <th class="cart-row-shipping-title"><?php _e('Shipping', 'jigoshop'); ?> <small><?php echo jigoshop_countries::shipping_to_prefix() . ' ' . __(jigoshop_countries::$countries[jigoshop_customer::get_shipping_country()], 'jigoshop'); ?> </small></th> <td class="cart-row-shipping"><?php echo jigoshop_cart::get_cart_shipping_total(); ?> <small><?php echo jigoshop_cart::get_cart_shipping_title(); ?> </small></td> </tr> <?php } ?> <?php if (jigoshop_cart::show_retail_price()) { ?> <tr> <th class="cart-row-subtotal-title"><?php _e('Subtotal', 'jigoshop'); ?> </th> <td class="cart-row-subtotal"><?php echo jigoshop_cart::get_cart_subtotal(true, true); ?> </td> </tr> <?php } ?> <?php if (jigoshop_cart::tax_after_coupon()) { ?> <tr class="discount"> <th class="cart-row-discount-title"><?php _e('Discount', 'jigoshop'); ?> </th> <td class="cart-row-discount">-<?php echo jigoshop_cart::get_total_discount(); ?> </td> </tr> <?php } ?> <?php if (Jigoshop_Base::get_options()->get_option('jigoshop_calc_taxes') == 'yes') { foreach (jigoshop_cart::get_applied_tax_classes() as $tax_class) { if (jigoshop_cart::get_tax_for_display($tax_class)) { ?> <tr> <th class="cart-row-tax-title"><?php echo jigoshop_cart::get_tax_for_display($tax_class); ?> </th> <td class="cart-row-tax"><?php echo jigoshop_cart::get_tax_amount($tax_class); ?> </td> </tr> <?php } } } ?> <?php if (!jigoshop_cart::tax_after_coupon() && jigoshop_cart::get_total_discount()) { ?> <tr class="discount"> <th class="cart-row-discount-title"><?php _e('Discount', 'jigoshop'); ?> </th> <td class="cart-row-discount">-<?php echo jigoshop_cart::get_total_discount(); ?> </td> </tr> <?php } ?> <tr> <th class="cart-row-total-title"><strong><?php _e('Total', 'jigoshop'); ?> </strong></th> <td class="cart-row-total"><strong><?php echo jigoshop_cart::get_total(); ?> </strong></td> </tr> </tbody> </table> </div> <?php } else { echo '<p>' . __(jigoshop_shipping::get_shipping_error_message(), 'jigoshop') . '</p>'; } ?> </div> <?php jigoshop_shipping_calculator(); ?> </div> <?php }
?> </tfoot> <?php do_action('jigoshop_shop_table_cart'); ?> </table> </form> <div class="cart-collaterals"> <?php do_action('cart-collaterals'); ?> <div class="cart_totals"> <?php // Hide totals if customer has set location and there are no methods going there $available_methods = jigoshop_shipping::get_available_shipping_methods(); if ($available_methods || !jigoshop_customer::get_shipping_country() || !jigoshop_shipping::is_enabled()) { do_action('jigoshop_before_cart_totals'); ?> <h2><?php _e('Cart Totals', 'jigoshop'); ?> </h2> <div class="cart_totals_table"> <table cellspacing="0" cellpadding="0"> <tbody> <tr> <?php $price_label = jigoshop_cart::show_retail_price() ? __('Retail Price', 'jigoshop') : __('Subtotal', 'jigoshop'); ?> <th class="cart-row-subtotal-title"><?php echo $price_label;