/**
  * @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;
 }
Example #2
0
	/** @see WP_Widget::widget */
	function widget($args, $instance) {
		$cache = wp_cache_get('widget_recent_products', 'widget');

		if ( !is_array($cache) ) $cache = array();

		if ( isset($cache[$args['widget_id']]) ) {
			echo $cache[$args['widget_id']];
			return;
		}

		ob_start();
		extract($args);
		
		$title = apply_filters('widget_title', empty($instance['title']) ? __('New Products', 'jigoshop') : $instance['title'], $instance, $this->id_base);
		if ( !$number = (int) $instance['number'] )
			$number = 10;
		else if ( $number < 1 )
			$number = 1;
		else if ( $number > 15 )
			$number = 15;

    $show_variations = $instance['show_variations'] ? '1' : '0';

    $args = array('showposts' => $number, 'nopaging' => 0, 'post_status' => 'publish', 'post_type' => 'product');

    if($show_variations=='0'){
      $args['meta_query'] = array(
			  array(
				  'key' => 'visibility',
				  'value' => array('catalog', 'visible'),
				  'compare' => 'IN'
			  )
		  );
		  $args['parent'] = '0';
    }

		$r = new WP_Query($args);
		
		if ($r->have_posts()) :
?>
		<?php echo $before_widget; ?>
		<?php if ( $title ) echo $before_title . $title . $after_title; ?>
		<ul class="product_list_widget">
		<?php  while ($r->have_posts()) : $r->the_post(); $_product = &new jigoshop_product(get_the_ID()); ?>
		<li><a href="<?php the_permalink() ?>" title="<?php echo esc_attr(get_the_title() ? get_the_title() : get_the_ID()); ?>">
			<?php if (has_post_thumbnail()) the_post_thumbnail('shop_tiny'); else echo '<img src="'.jigoshop::plugin_url().'/assets/images/placeholder.png" alt="Placeholder" width="'.jigoshop::get_var('shop_tiny_w').'px" height="'.jigoshop::get_var('shop_tiny_h').'px" />'; ?>
			<?php if ( get_the_title() ) the_title(); else the_ID(); ?>
		</a> <?php echo $_product->get_price_html(); ?></li>
		<?php endwhile; ?>
		</ul>
		<?php echo $after_widget; ?>
<?php
		// Reset the global $the_post as this query will have stomped on it
		//wp_reset_postdata();

		endif;

		if (isset($args['widget_id']) && isset($cache[$args['widget_id']])) $cache[$args['widget_id']] = ob_get_flush();
		wp_cache_set('widget_recent_products', $cache, 'widget');
	}
Example #3
0
 public function __construct()
 {
     parent::__construct();
     $this->id = 'skrill';
     $this->title = 'Skrill';
     $this->has_fields = false;
     $this->enabled = Jigoshop_Base::get_options()->get_option('jigoshop_skrill_enabled');
     $this->title = Jigoshop_Base::get_options()->get_option('jigoshop_skrill_title');
     $this->email = Jigoshop_Base::get_options()->get_option('jigoshop_skrill_email');
     $this->locale = $this->getLocale();
     $skrillIcon = Jigoshop_Base::get_options()->get_option('jigoshop_skrill_icon');
     if (!filter_var($skrillIcon, FILTER_VALIDATE_URL)) {
         $this->icon = jigoshop::assets_url() . '/assets/images/icons/skrill.png';
     } else {
         $this->icon = $skrillIcon;
     }
     $pMeth = (array) Jigoshop_Base::get_options()->get_option('jigoshop_skrill_payment_methods_multicheck');
     $cList = '';
     foreach ($pMeth as $key => $value) {
         if ($value) {
             $cList = $cList . $key . ',';
         }
     }
     $cList = rtrim($cList, ",");
     $this->payment_methods = $cList;
     add_action('init', array($this, 'check_status_response'));
     if (isset($_GET['skrillPayment']) && $_GET['skrillPayment'] == true) {
         add_action('init', array($this, 'generate_skrill_form'));
     }
     add_action('valid-skrill-status-report', array($this, 'successful_request'));
     add_action('receipt_skrill', array($this, 'receipt_skrill'));
 }
Example #4
0
 public function icon()
 {
     if ($this->icon) {
         return '<img src="' . jigoshop::force_ssl($this->icon) . '" alt="' . $this->title . '" />';
     }
     return '';
 }
Example #5
0
function jigoshop_checkout( $atts ) {

	if (!defined('JIGOSHOP_CHECKOUT')) define('JIGOSHOP_CHECKOUT', true);
	
	if (sizeof(jigoshop_cart::$cart_contents)==0) :
		wp_redirect(get_permalink(get_option('jigoshop_cart_page_id')));
		exit;
	endif;
	
	$non_js_checkout = (isset($_POST['update_totals']) && $_POST['update_totals']) ? true : false;
	
	$_checkout = jigoshop_checkout::instance();
	
	$_checkout->process_checkout();
	
	$result = jigoshop_cart::check_cart_item_stock();
	
	if (is_wp_error($result)) jigoshop::add_error( $result->get_error_message() );
	
	if ( jigoshop::error_count()==0 && $non_js_checkout) jigoshop::add_message( __('The order totals have been updated. Please confirm your order by pressing the Place Order button at the bottom of the page.', 'jigoshop') );
	
	jigoshop::show_messages();
	
	jigoshop_get_template('checkout/form.php', false);
	
}
function jigoshop_enqueue_product_quick_scripts()
{
    global $pagenow, $typenow;
    if (empty($typenow) && !empty($_GET['post'])) {
        $post = get_post($_GET['post']);
        $typenow = $post->post_type;
    }
    if ($typenow == 'product') {
        wp_enqueue_script('jigoshop-admin-quickedit', jigoshop::assets_url() . '/assets/js/product_quick_edit.js', array('jquery', 'inline-edit-post'), '', true);
        $jigoshop_quick_edit_params = array('assets_url' => jigoshop::assets_url(), 'ajax_url' => !is_ssl() ? str_replace('https', 'http', admin_url('admin-ajax.php')) : admin_url('admin-ajax.php'), 'get_stock_price_nonce' => wp_create_nonce("get-product-stock-price"), 'update_stock_price_nonce' => wp_create_nonce("update-product-stock-price"));
        wp_localize_script('jigoshop-admin-quickedit', 'jigoshop_quick_edit_params', $jigoshop_quick_edit_params);
    }
}
Example #7
0
 /** @see WP_Widget::widget */
 function widget($args, $instance)
 {
     if (is_cart()) {
         return;
     }
     extract($args);
     if (!empty($instance['title'])) {
         $title = $instance['title'];
     } else {
         $title = __('Cart', 'jigoshop');
     }
     $title = apply_filters('widget_title', $title, $instance, $this->id_base);
     echo $before_widget;
     if ($title) {
         echo $before_title . $title . $after_title;
     }
     echo '<ul class="cart_list">';
     if (sizeof(jigoshop_cart::$cart_contents) > 0) {
         foreach (jigoshop_cart::$cart_contents as $item_id => $values) {
             $_product = $values['data'];
             if ($_product->exists() && $values['quantity'] > 0) {
                 echo '<li><a href="' . get_permalink($item_id) . '">';
                 if (has_post_thumbnail($item_id)) {
                     echo get_the_post_thumbnail($item_id, 'shop_tiny');
                 } else {
                     echo '<img src="' . jigoshop::plugin_url() . '/assets/images/placeholder.png" alt="Placeholder" width="' . jigoshop::get_var('shop_tiny_w') . '" height="' . jigoshop::get_var('shop_tiny_h') . '" />';
                 }
                 echo apply_filters('jigoshop_cart_widget_product_title', $_product->get_title(), $_product) . '</a> ' . $values['quantity'] . ' &times; ' . jigoshop_price($_product->get_price()) . '</li>';
             }
         }
     } else {
         echo '<li class="empty">' . __('No products in the cart.', 'jigoshop') . '</li>';
     }
     echo '</ul>';
     if (sizeof(jigoshop_cart::$cart_contents) > 0) {
         echo '<p class="total"><strong>';
         if (get_option('js_prices_include_tax') == 'yes') {
             _e('Total', 'jigoshop');
         } else {
             _e('Subtotal', 'jigoshop');
         }
         echo ':</strong> ' . jigoshop_cart::get_cart_total();
         echo '</p>';
         do_action('jigoshop_widget_shopping_cart_before_buttons');
         echo '<p class="buttons"><a href="' . jigoshop_cart::get_cart_url() . '" class="button">' . __('View Cart &rarr;', 'jigoshop') . '</a> <a href="' . jigoshop_cart::get_checkout_url() . '" class="button checkout">' . __('Checkout &rarr;', 'jigoshop') . '</a></p>';
     }
     echo $after_widget;
 }
Example #8
0
function jigoshop_checkout($atts)
{
    if (!defined('JIGOSHOP_CHECKOUT')) {
        define('JIGOSHOP_CHECKOUT', true);
    }
    $non_js_checkout = isset($_POST['update_totals']) && $_POST['update_totals'] ? true : false;
    $result = jigoshop_cart::check_cart_item_stock();
    if (is_wp_error($result)) {
        jigoshop::add_error($result->get_error_message());
    }
    if (!jigoshop::has_errors() && $non_js_checkout) {
        jigoshop::add_message(__('The order totals have been updated. Please confirm your order by pressing the Place Order button at the bottom of the page.', 'jigoshop'));
    }
    jigoshop::show_messages();
    jigoshop_get_template('checkout/form.php', false);
}
Example #9
0
function jigoshop_cart($atts)
{
    unset(jigoshop_session::instance()->selected_rate_id);
    // Process Discount Codes
    if (isset($_POST['apply_coupon']) && $_POST['apply_coupon'] && jigoshop::verify_nonce('cart')) {
        $coupon_code = sanitize_title($_POST['coupon_code']);
        jigoshop_cart::add_discount($coupon_code);
    } elseif (isset($_POST['calc_shipping']) && $_POST['calc_shipping'] && jigoshop::verify_nonce('cart')) {
        // Update Shipping
        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();
        // chooses the method selected by user.
    }
    // Re-Calc prices. This needs to happen every time the cart page is loaded and after checking post results.
    jigoshop_cart::calculate_totals();
    $result = jigoshop_cart::check_cart_item_stock();
    if (is_wp_error($result)) {
        jigoshop::add_error($result->get_error_message());
    }
    jigoshop_render('shortcode/cart', array('cart' => jigoshop_cart::get_cart(), 'coupons' => jigoshop_cart::get_coupons()));
}
Example #10
0
	/** @see WP_Widget::widget */
	function widget($args, $instance) {
		$cache = wp_cache_get('widget_featured_products', 'widget');

		if ( !is_array($cache) ) $cache = array();

		if ( isset($cache[$args['widget_id']]) ) {
			echo $cache[$args['widget_id']];
			return;
		}

		ob_start();
		extract($args);

		$title = apply_filters('widget_title', empty($instance['title']) ? __('Featured Products', 'jigoshop') : $instance['title'], $instance, $this->id_base);
		if ( !$number = (int) $instance['number'] )
			$number = 10;
		else if ( $number < 1 )
			$number = 1;
		else if ( $number > 15 )
			$number = 15;

		$featured_posts = get_posts(array('numberposts' => $number, 'post_status' => 'publish', 'post_type' => 'product', 'meta_key' => 'featured', 'meta_value' => 'yes' ));
		if ($featured_posts) :
?>
		<?php echo $before_widget; ?>
		<?php if ( $title ) echo $before_title . $title . $after_title; ?>
		<ul class="product_list_widget">
		<?php foreach ($featured_posts as $r) : $_product = &new jigoshop_product( $r->ID ); ?>
		
		<li><a href="<?php echo get_permalink( $r->ID ) ?>" title="<?php echo esc_attr($r->post_title ? $r->post_title : $r->ID); ?>">
			<?php if (has_post_thumbnail( $r->ID )) echo get_the_post_thumbnail($r->ID, 'shop_tiny'); else echo '<img src="'.jigoshop::plugin_url().'/assets/images/placeholder.png" alt="Placeholder" width="'.jigoshop::get_var('shop_tiny_w').'px" height="'.jigoshop::get_var('shop_tiny_h').'px" />'; ?>
			<?php if ( $r->post_title ) echo $r->post_title; else echo $r->ID; ?>
		</a> <?php echo $_product->get_price_html(); ?></li>
		
		<?php endforeach; ?>
		</ul>
		<?php echo $after_widget; ?>
<?php

		endif;

		$cache[$args['widget_id']] = ob_get_flush();
		wp_cache_set('widget_featured_products', $cache, 'widget');
	}
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));
}
Example #12
0
	public function __construct() { 
        $this->id			= 'skrill';
        $this->title 		= 'Skrill';
        $this->icon 		= jigoshop::plugin_url() . '/assets/images/icons/skrill.png';
        $this->has_fields 	= false;
      	$this->enabled		= get_option('jigoshop_skrill_enabled');
		$this->title 		= get_option('jigoshop_skrill_title');
		$this->email 		= get_option('jigoshop_skrill_email');
		
		add_action( 'init', array(&$this, 'check_status_response') );
		
		if(isset($_GET['skrillPayment']) && $_GET['skrillPayment'] == true):
			add_action( 'init', array(&$this, 'generate_skrill_form') );
		endif;
		
		add_action('valid-skrill-status-report', array(&$this, 'successful_request') );
		
		add_action('jigoshop_update_options', array(&$this, 'process_admin_options'));
		add_option('jigoshop_skrill_enabled', 'yes');
		add_option('jigoshop_skrill_email', '');
		add_option('jigoshop_skrill_title', 'skrill');
		
		add_action('receipt_skrill', array(&$this, 'receipt_skrill'));
    }
 private function create_user_account()
 {
     $reg_errors = new WP_Error();
     do_action('register_post', $this->posted['billing_email'], $this->posted['billing_email'], $reg_errors);
     if ($reg_errors->get_error_code()) {
         jigoshop::add_error($reg_errors->get_error_message());
         return 0;
     }
     $user_pass = $this->posted['account_password'];
     $user_id = wp_create_user($this->posted['account_username'], $user_pass, $this->posted['billing_email']);
     if (!$user_id) {
         jigoshop::add_error(sprintf(__('<strong>ERROR</strong>: Couldn&#8217;t register you... please contact the <a href="mailto:%s">webmaster</a> !', 'jigoshop'), self::get_options()->get('jigoshop_email')));
         return 0;
     }
     wp_update_user(array('ID' => $user_id, 'role' => 'customer', 'first_name' => $this->posted['billing_first_name'], 'last_name' => $this->posted['billing_last_name']));
     do_action('jigoshop_created_customer', $user_id);
     // send the user a confirmation and their login details
     if (apply_filters('jigoshop_new_user_notification', true, $user_id, $user_pass)) {
         wp_new_user_notification($user_id, $user_pass);
     }
     wp_set_auth_cookie($user_id, true, is_ssl());
     return $user_id;
 }
Example #14
0
	/**
	 * Generate the paypal button link
	 **/
    public function generate_paypal_form( $order_id ) {
		
		$order = &new jigoshop_order( $order_id );
		
		if ( $this->testmode == 'yes' ):
			$paypal_adr = $this->testurl . '?test_ipn=1&';		
		else :
			$paypal_adr = $this->liveurl . '?';		
		endif;
		
		$shipping_name = explode(' ', $order->shipping_method);
		
		if (in_array($order->billing_country, array('US','CA'))) :
			$phone_args = array(
				'night_phone_a' => substr($order->billing_phone,0,3),
				'night_phone_b' => substr($order->billing_phone,0,3),
				'night_phone_c' => substr($order->billing_phone,0,3),
				'day_phone_a' 	=> substr($order->billing_phone,0,3),
				'day_phone_b' 	=> substr($order->billing_phone,0,3),
				'day_phone_c' 	=> substr($order->billing_phone,0,3)
			);
		else :
			$phone_args = array(
				'night_phone_b' => $order->billing_phone,
				'day_phone_b' 	=> $order->billing_phone
			);
		endif;		
		
		$paypal_args = array_merge(
			array(
				'cmd' 					=> '_cart',
				'business' 				=> $this->email,
				'no_note' 				=> 1,
				'currency_code' 		=> get_option('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(get_option('jigoshop_thanks_page_id')))),
				'cancel_return'			=> $order->get_cancel_order_url(),
				//'cancel_return'			=> home_url(),
				
				// Order key
				'custom'				=> $order_id,
				
				// IPN
				'notify_url'			=> trailingslashit(get_bloginfo('wpurl')).'?paypalListener=paypal_standard_IPN',
				
				// Address info
				'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,
	
				// Payment Info
				'invoice' 				=> $order->order_key,
				'tax'					=> $order->get_total_tax(),
				'tax_cart'				=> $order->get_total_tax(),
				'amount' 				=> $order->order_total,
				'discount_amount_cart' 	=> $order->order_discount
			), 
			$phone_args
		);
		
		if ($this->send_shipping=='yes') :
			$paypal_args['no_shipping'] = 0;
			$paypal_args['address_override'] = 1;
		else :
			$paypal_args['no_shipping'] = 1;
		endif;
		
		// Cart Contents
		$item_loop = 0;
		if (sizeof($order->items)>0) : foreach ($order->items as $item) :
			$_product = &new jigoshop_product($item['id']);
			if ($_product->exists() && $item['qty']) :
				
				$item_loop++;
				
				$paypal_args['item_name_'.$item_loop] = $_product->get_title();
				$paypal_args['quantity_'.$item_loop] = $item['qty'];
				$paypal_args['amount_'.$item_loop] = $_product->get_price_excluding_tax();
				
			endif;
		endforeach; endif;
		
		// Shipping Cost
		$item_loop++;
		$paypal_args['item_name_'.$item_loop] = __('Shipping cost', 'jigoshop');
		$paypal_args['quantity_'.$item_loop] = '1';
		$paypal_args['amount_'.$item_loop] = number_format($order->order_shipping, 2);
		
		$paypal_args_array = array();

		foreach ($paypal_args as $key => $value) {
			$paypal_args_array[] = '<input type="hidden" name="'.$key.'" value="'.$value.'" />';
		}
		
		return '<form action="'.$paypal_adr.'" method="post" id="paypal_payment_form">
				' . implode('', $paypal_args_array) . '
				<input type="submit" class="button-alt" id="submit_paypal_payment_form" value="'.__('Pay via PayPal', 'jigoshop').'" /> <a class="button cancel" href="'.$order->get_cancel_order_url().'">'.__('Cancel order &amp; restore cart', 'jigoshop').'</a>
				<script type="text/javascript">
					jQuery(function(){
						jQuery("body").block(
							{ 
								message: "<img src=\"'.jigoshop::plugin_url().'/assets/images/ajax-loader.gif\" alt=\"Redirecting...\" />'.__('Thank you for your order. We are now redirecting you to PayPal to make payment.', 'jigoshop').'", 
								overlayCSS: 
								{ 
									background: "#fff", 
									opacity: 0.6 
								},
								css: { 
							        padding:        20, 
							        textAlign:      "center", 
							        color:          "#555", 
							        border:         "3px solid #aaa", 
							        backgroundColor:"#fff", 
							        cursor:         "wait" 
							    } 
							});
						jQuery("#submit_paypal_payment_form").click();
					});
				</script>
			</form>';
		
	}
Example #15
0
						<li>
							<input type="radio" id="payment_method_<?php echo $gateway->id; ?>" class="input-radio" name="payment_method" value="<?php echo $gateway->id; ?>" <?php if ($gateway->chosen) echo 'checked="checked"'; ?> />
							<label for="payment_method_<?php echo $gateway->id; ?>"><?php echo $gateway->title; ?> <?php echo $gateway->icon(); ?></label> 
							<?php
								if ($gateway->has_fields || $gateway->description) : 
									echo '<div class="payment_box payment_method_'.$gateway->id.'" style="display:none;">';
									$gateway->payment_fields();
									echo '</div>';
								endif;
							?>
						</li>
						<?php
					endforeach;
				else :
				
					echo '<p>'.__('Sorry, it seems that there are no available payment methods for your location. Please contact us if you require assistance or wish to make alternate arrangements.', 'jigoshop').'</p>';
					
				endif;
			?>
		</ul>
		<?php endif; ?>

		<div class="form-row">
			<?php jigoshop::nonce_field('pay')?>
			<input type="submit" class="button-alt" name="pay" id="place_order" value="<?php _e('Pay for order', 'jigoshop'); ?>" />

		</div>

	</div>
	
</form>
Example #16
0
?>
<form action="<?php 
echo esc_url(apply_filters('jigoshop_get_change_password_page_id', get_permalink(jigoshop_get_page_id('change_password'))));
?>
" method="post">
	<p class="form-row form-row-first">
		<label for="password-1"><?php 
_e('New password', 'jigoshop');
?>
 <span class="required">*</span></label>
		<input type="password" class="input-text" name="password-1" id="password-1" />
	</p>

	<p class="form-row form-row-last">
		<label for="password-2"><?php 
_e('Re-enter new password', 'jigoshop');
?>
 <span class="required">*</span></label>
		<input type="password" class="input-text" name="password-2" id="password-2" />
	</p>

	<div class="clear"></div>
	<?php 
jigoshop::nonce_field('change_password');
?>
	<p><input type="submit" class="button" name="save_password" value="<?php 
_e('Save', 'jigoshop');
?>
" /></p>
</form>
Example #17
0
function jigoshop_get_product_thumbnail($size = 'shop_small', $placeholder_width = 0, $placeholder_height = 0)
{
    global $post;
    if (!$placeholder_width) {
        $placeholder_width = jigoshop::get_var('shop_small_w');
    }
    if (!$placeholder_height) {
        $placeholder_height = jigoshop::get_var('shop_small_h');
    }
    if (has_post_thumbnail()) {
        $thumb = get_the_post_thumbnail($post->ID, $size);
    } else {
        $thumb = '';
    }
    if (empty($thumb)) {
        $thumb = '<img src="' . jigoshop::plugin_url() . '/assets/images/placeholder.png" alt="Placeholder" width="' . $placeholder_width . '" height="' . $placeholder_height . '" />';
    }
    return $thumb;
}
 /**
  * Sets the Jigoshop default options
  *
  * This will create the default options array. Extensions may install options of the same format into this.
  *
  * @param   none
  * @return  Void
  *
  * @since	1.3
  *
  */
 private function set_default_options()
 {
     $symbols = jigoshop::currency_symbols();
     $countries = jigoshop::currency_countries();
     $currencies = array();
     foreach ($countries as $key => $country) {
         $currencies[$key] = $country . ' (' . $symbols[$key] . ')';
     }
     $currencies = apply_filters('jigoshop_currencies', $currencies);
     $cSymbol = '';
     if (function_exists('get_jigoshop_currency_symbol')) {
         $cSymbol = get_jigoshop_currency_symbol();
     }
     $cCode = $this->get('jigoshop_currency') ? $this->get('jigoshop_currency') : 'GBP';
     $cSep = $this->get('jigoshop_price_decimal_sep') ? $this->get('jigoshop_price_decimal_sep') : '.';
     self::$default_options = array(array('type' => 'tab', 'name' => __('Shop', 'jigoshop')), array('name' => __('Shop Options', 'jigoshop'), 'type' => 'title', 'desc' => ''), array('name' => __('Base Country/Region', 'jigoshop'), 'desc' => '', 'tip' => __('This is the base country for your business. Tax rates will be based on this country.', 'jigoshop'), 'id' => 'jigoshop_default_country', 'type' => 'single_select_country'), array('name' => __('Default Country/Region for customer', 'jigoshop'), 'desc' => '', 'tip' => __('This is the country for your clients with new accounts.', 'jigoshop'), 'id' => 'jigoshop_default_country_for_customer', 'std' => $this->get('jigoshop_default_country'), 'type' => 'single_select_country', 'options' => array('add_empty' => true)), array('name' => __('Currency', 'jigoshop'), 'desc' => '', 'tip' => __('This controls what currency the prices are listed with in the Catalog, and which currency PayPal, and other gateways, will take payments in.', 'jigoshop'), 'id' => 'jigoshop_currency', 'type' => 'select', 'choices' => $currencies), array('name' => __('Allowed Countries', 'jigoshop'), 'desc' => '', 'tip' => __('These are countries that you are willing to ship to.', 'jigoshop'), 'id' => 'jigoshop_allowed_countries', 'type' => 'select', 'choices' => array('all' => __('All Countries', 'jigoshop'), 'specific' => __('Specific Countries', 'jigoshop'))), array('name' => __('Specific Countries', 'jigoshop'), 'desc' => '', 'tip' => '', 'id' => 'jigoshop_specific_allowed_countries', 'type' => 'multi_select_countries'), array('name' => __('Demo store', 'jigoshop'), 'desc' => '', 'tip' => __('Enable this option to show a banner at the top of every page stating this shop is currently in testing mode.', 'jigoshop'), 'id' => 'jigoshop_demo_store', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Invoicing', 'jigoshop'), 'type' => 'title', 'desc' => ''), array('name' => __('Company Name', 'jigoshop'), 'desc' => '', 'tip' => __('Setting your company name will enable us to print it out on your invoice emails. Leave blank to disable.', 'jigoshop'), 'id' => 'jigoshop_company_name', 'type' => 'text'), array('name' => __('Tax Registration Number', 'jigoshop'), 'desc' => __('Add your tax registration label before the registration number and it will be printed as well. eg. <code>VAT Number: 88888888</code>', 'jigoshop'), 'tip' => __('Setting your tax number will enable us to print it out on your invoice emails. Leave blank to disable.', 'jigoshop'), 'id' => 'jigoshop_tax_number', 'type' => 'text'), array('name' => __('Address Line1', 'jigoshop'), 'desc' => '', 'tip' => __('Setting your address will enable us to print it out on your invoice emails. Leave blank to disable.', 'jigoshop'), 'id' => 'jigoshop_address_1', 'type' => 'longtext'), array('name' => __('Address Line2', 'jigoshop'), 'desc' => '', 'tip' => __('If address line1 is not set, address line2 will not display even if you put a value in it. Setting your address will enable us to print it out on your invoice emails. Leave blank to disable.', 'jigoshop'), 'id' => 'jigoshop_address_2', 'type' => 'longtext'), array('name' => __('Company Phone', 'jigoshop'), 'desc' => '', 'tip' => __('Setting your company phone number will enable us to print it out on your invoice emails. Leave blank to disable.', 'jigoshop'), 'id' => 'jigoshop_company_phone', 'type' => 'text'), array('name' => __('Company Email', 'jigoshop'), 'desc' => '', 'tip' => __('Setting your company email will enable us to print it out on your invoice emails. Leave blank to disable.', 'jigoshop'), 'id' => 'jigoshop_company_email', 'type' => 'email'), array('name' => __('Permalinks', 'jigoshop'), 'type' => 'title', 'desc' => ''), array('name' => __('Prepend shop categories and tags with base page', 'jigoshop'), 'desc' => '', 'tip' => __('This will only apply to tags &amp; categories.<br/>Enabled: http://yoursite.com / product_category / YourCategory<br/>Disabled: http://yoursite.com / base_page / product_category / YourCategory', 'jigoshop'), 'id' => 'jigoshop_prepend_shop_page_to_urls', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Prepend product permalinks with shop base page', 'jigoshop'), 'desc' => '', 'tip' => '', 'id' => 'jigoshop_prepend_shop_page_to_product', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Prepend product permalinks with product category', 'jigoshop'), 'desc' => '', 'tip' => '', 'id' => 'jigoshop_prepend_category_to_product', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Product category slug', 'jigoshop'), 'desc' => '', 'tip' => __('Slug displayed in product category URLs. Leave blank to use default "product-category"', 'jigoshop'), 'id' => 'jigoshop_product_category_slug', 'type' => 'text'), array('name' => __('Product tag slug', 'jigoshop'), 'desc' => '', 'tip' => __('Slug displayed in product tag URLs. Leave blank to use default "product-tag"', 'jigoshop'), 'id' => 'jigoshop_product_tag_slug', 'type' => 'text'), array('type' => 'tab', 'name' => __('General', 'jigoshop')), array('name' => __('General Options', 'jigoshop'), 'type' => 'title', 'desc' => ''), array('name' => __('Cart shows "Return to Shop" button', 'jigoshop'), 'desc' => '', 'tip' => __('Enabling this setting will display a "Return to Shop" button on the Cart page along with the "Continue to Checkout" button.', 'jigoshop'), 'id' => 'jigoshop_cart_shows_shop_button', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('After adding product to cart', 'jigoshop'), 'desc' => '', 'tip' => __('Define what should happen when a user clicks on &#34;Add to Cart&#34; on any product or page.', 'jigoshop'), 'id' => 'jigoshop_redirect_add_to_cart', 'type' => 'radio', 'extra' => array('vertical'), 'choices' => array('same_page' => __('Stay on the same page', 'jigoshop'), 'to_checkout' => __('Redirect to Checkout', 'jigoshop'), 'to_cart' => __('Redirect to Cart', 'jigoshop'))), array('name' => __('Cart status after login', 'jigoshop'), 'desc' => __('Current cart <b>always</b> will be loaded if customer logs in checkout page.', 'jigoshop'), 'tip' => __("Define what should happen with shopping cart if customer added items to shopping cart as guest and than he logs in to your shop.", 'jigoshop'), 'id' => 'jigoshop_cart_after_login', 'type' => 'select', 'choices' => array('load_saved' => __('Load saved cart', 'jigoshop'), 'load_current' => __('Load current cart', 'jigoshop'), 'merge' => __('Merge saved and current carts', 'jigoshop'))), array('name' => __('Reset pending Orders', 'jigoshop'), 'desc' => __("Change all 'Pending' Orders older than one month to 'On Hold'", 'jigoshop'), 'tip' => __("For customers that have not completed the Checkout process or haven't paid for an Order after a period of time, this will reset the Order to On Hold allowing the Shop owner to take action.  WARNING: For the first use on an existing Shop this setting <em>can</em> generate a <strong>lot</strong> of email!", 'jigoshop'), 'id' => 'jigoshop_reset_pending_orders', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Complete processing Orders', 'jigoshop'), 'desc' => __("Change all 'Processing' Orders older than one month to 'Completed'", 'jigoshop'), 'tip' => __("For orders that have been completed but the status is still set to 'processing'.  This will move them to a 'completed' status without sending an email out to all the customers.", 'jigoshop'), 'id' => 'jigoshop_complete_processing_orders', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Enforce login for downloads', 'jigoshop'), 'desc' => '', 'tip' => __('If a guest purchases a download, the guest can still download a link without logging in. We recommend disabling guest purchases if you enable this option.', 'jigoshop'), 'id' => 'jigoshop_downloads_require_login', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Disable Jigoshop frontend.css', 'jigoshop'), 'desc' => __('(The next option below will have no effect if this one is disabled)', 'jigoshop'), 'tip' => __('Useful if you want to disable Jigoshop styles and theme it yourself via your theme.', 'jigoshop'), 'id' => 'jigoshop_disable_css', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Include extra theme styles with Jigoshop frontend.css', 'jigoshop'), 'desc' => '', 'tip' => __("With this option <em>on</em>, Jigoshop's default frontend.css will still load, and any extra bits found in 'theme/jigoshop/style.css' for over-rides will also be loaded.", 'jigoshop'), 'id' => 'jigoshop_frontend_with_theme_css', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Disable bundled Lightbox', 'jigoshop'), 'desc' => __('Product galleries and images as well as the Add Review form will open in a lightbox.', 'jigoshop'), 'tip' => __('Useful if your theme or other plugin already loads our Lightbox script and css (prettyPhoto), or you want to use a different one.', 'jigoshop'), 'id' => 'jigoshop_disable_fancybox', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Use custom product category order', 'jigoshop'), 'desc' => '', 'tip' => __('This option allows to make custom product category order, by drag and drop method.', 'jigoshop'), 'id' => 'jigoshop_enable_draggable_categories', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Jigoshop messages', 'jigoshop'), 'type' => 'title', 'desc' => ''), array('name' => __('Message disappear time', 'jigoshop'), 'desc' => __('How long message is displayed before disappearing (in ms). Set to 0 to keep it displayed.', 'jigoshop'), 'id' => 'jigoshop_message_disappear_time', 'type' => 'natural'), array('name' => __('Error disappear time', 'jigoshop'), 'desc' => __('How long error is displayed before disappearing (in ms). Set to 0 to keep it displayed.', 'jigoshop'), 'id' => 'jigoshop_error_disappear_time', 'type' => 'natural'), array('name' => __('Email Details', 'jigoshop'), 'type' => 'title', 'desc' => ''), array('name' => __('Jigoshop email address', 'jigoshop'), 'desc' => '', 'tip' => __('The email address used to send all Jigoshop related emails, such as order confirmations and notices.  This may be different than your Company email address on "Shop Tab -> Invoicing".', 'jigoshop'), 'id' => 'jigoshop_email', 'type' => 'email'), array('name' => __('Email from name', 'jigoshop'), 'desc' => '', 'tip' => __('', 'jigoshop'), 'id' => 'jigoshop_email_from_name', 'type' => 'text'), array('name' => __('Email footer', 'jigoshop'), 'desc' => '', 'tip' => __('The email footer used in all jigoshop emails.', 'jigoshop'), 'id' => 'jigoshop_email_footer', 'type' => 'textarea'), array('name' => __('Use HTML emails', 'jigoshop'), 'desc' => '', 'tip' => __('This option enables HTML email templates.', 'jigoshop'), 'id' => 'jigoshop_enable_html_emails', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Generate default emails', 'jigoshop'), 'desc' => '', 'tip' => '', 'id' => 'jigoshop_email_generete_defaults', 'type' => 'user_defined', 'display' => array($this, 'generate_defaults_emails')), array('name' => __('Checkout page', 'jigoshop'), 'type' => 'title', 'desc' => ''), array('name' => __('Validate postal/zip codes', 'jigoshop'), 'desc' => '', 'tip' => __('Enabling this setting will force proper postcodes to be entered by a customer for a country.', 'jigoshop'), 'id' => 'jigoshop_enable_postcode_validating', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Show verify information message', 'jigoshop'), 'desc' => '', 'tip' => __('Enabling this setting will display a message at the bottom of the Checkout asking customers to verify all their informatioin is correctly entered before placing their Order.  This is useful in particular for Countries that have states to ensure the correct shipping state is selected.', 'jigoshop'), 'id' => 'jigoshop_verify_checkout_info_message', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Show EU VAT reduction message', 'jigoshop'), 'desc' => __('This will only apply to EU Union based Shops.', 'jigoshop'), 'tip' => __('Enabling this setting will display a message at the bottom of the Checkout informing the customer that EU VAT will not be removed until the Order is placed and only if they have provided a valid EU VAT Number.', 'jigoshop'), 'id' => 'jigoshop_eu_vat_reduction_message', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Allow guest purchases', 'jigoshop'), 'desc' => '', 'tip' => __('Enabling this setting will allow users to checkout without registering or signing up. Otherwise, users must be signed in or must sign up to checkout.', 'jigoshop'), 'id' => 'jigoshop_enable_guest_checkout', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Show login form', 'jigoshop'), 'desc' => '', 'id' => 'jigoshop_enable_guest_login', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Allow registration', 'jigoshop'), 'desc' => '', 'id' => 'jigoshop_enable_signup_form', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Force SSL on checkout', 'jigoshop'), 'desc' => '', 'tip' => __('This will load your checkout page with https://. An SSL certificate is <strong>required</strong> if you choose yes. Contact your hosting provider for more information on SSL Certs.', 'jigoshop'), 'id' => 'jigoshop_force_ssl_checkout', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Integration', 'jigoshop'), 'type' => 'title', 'desc' => ''), array('name' => __('ShareThis Publisher ID', 'jigoshop'), 'desc' => __("Enter your <a href='http://sharethis.com/account/'>ShareThis publisher ID</a> to show ShareThis on product pages.", 'jigoshop'), 'tip' => __('ShareThis is a small social sharing widget for posting links on popular sites such as Twitter and Facebook.', 'jigoshop'), 'id' => 'jigoshop_sharethis', 'type' => 'text'), array('name' => __('Google Analytics ID', 'jigoshop'), 'desc' => __('Log into your Google Analytics account to find your ID. e.g. <code>UA-XXXXXXX-X</code>', 'jigoshop'), 'id' => 'jigoshop_ga_id', 'type' => 'text'), array('name' => __('Enable eCommerce Tracking', 'jigoshop'), 'tip' => __('Add Google Analytics eCommerce tracking code upon successful orders', 'jigoshop'), 'desc' => __('<a href="//support.google.com/analytics/bin/answer.py?hl=en&answer=1009612">Learn how to enable</a> eCommerce tracking for your Google Analytics account.', 'jigoshop'), 'id' => 'jigoshop_ga_ecommerce_tracking_enabled', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('type' => 'tab', 'name' => __('Pages', 'jigoshop')), array('name' => __('Page configurations', 'jigoshop'), 'type' => 'title', 'desc' => ''), array('name' => __('Cart Page', 'jigoshop'), 'desc' => __('Shortcode to place on page: <code>[jigoshop_cart]</code>', 'jigoshop'), 'tip' => '', 'id' => 'jigoshop_cart_page_id', 'type' => 'single_select_page'), array('name' => __('Checkout Page', 'jigoshop'), 'desc' => __('Shortcode to place on page: <code>[jigoshop_checkout]</code>', 'jigoshop'), 'tip' => '', 'id' => 'jigoshop_checkout_page_id', 'type' => 'single_select_page'), array('name' => __('Pay Page', 'jigoshop'), 'desc' => __('Shortcode to place on page: <code>[jigoshop_pay]</code><br/>Default parent page: Checkout', 'jigoshop'), 'tip' => '', 'id' => 'jigoshop_pay_page_id', 'type' => 'single_select_page'), array('name' => __('Thanks Page', 'jigoshop'), 'desc' => __('Shortcode to place on page: <code>[jigoshop_thankyou]</code><br/>Default parent page: Checkout', 'jigoshop'), 'tip' => '', 'id' => 'jigoshop_thanks_page_id', 'type' => 'single_select_page'), array('name' => __('My Account Page', 'jigoshop'), 'desc' => __('Shortcode to place on page: <code>[jigoshop_my_account]</code>', 'jigoshop'), 'tip' => '', 'id' => 'jigoshop_myaccount_page_id', 'type' => 'single_select_page'), array('name' => __('Edit Address Page', 'jigoshop'), 'desc' => __('Shortcode to place on page: <code>[jigoshop_edit_address]</code><br/>Default parent page: My Account', 'jigoshop'), 'tip' => '', 'id' => 'jigoshop_edit_address_page_id', 'type' => 'single_select_page'), array('name' => __('View Order Page', 'jigoshop'), 'desc' => __('Shortcode to place on page: <code>[jigoshop_view_order]</code><br/>Default parent page: My Account', 'jigoshop'), 'tip' => '', 'id' => 'jigoshop_view_order_page_id', 'type' => 'single_select_page'), array('name' => __('Change Password Page', 'jigoshop'), 'desc' => __('Shortcode to place on page: <code>[jigoshop_change_password]</code><br/>Default parent page: My Account', 'jigoshop'), 'tip' => '', 'id' => 'jigoshop_change_password_page_id', 'type' => 'single_select_page'), array('name' => __('Track Order Page', 'jigoshop'), 'desc' => __('Shortcode to place on page: <code>[jigoshop_order_tracking]</code>', 'jigoshop'), 'tip' => '', 'id' => 'jigoshop_track_order_page_id', 'type' => 'single_select_page'), array('name' => __('Terms Page', 'jigoshop'), 'desc' => __('If you define a &#34;Terms&#34; page the customer will be asked to accept it before allowing them to place their order.', 'jigoshop'), 'tip' => '', 'id' => 'jigoshop_terms_page_id', 'type' => 'single_select_page', 'extra' => 'show_option_none=' . __('None', 'jigoshop')), array('type' => 'tab', 'name' => __('Catalog &amp; Pricing', 'jigoshop')), array('name' => __('Catalog Options', 'jigoshop'), 'type' => 'title', 'desc' => ''), array('name' => __('Catalog base page', 'jigoshop'), 'desc' => '', 'tip' => __('This sets the base page of your shop. You should not change this value once you have launched your site otherwise you risk breaking urls of other sites pointing to yours, etc.', 'jigoshop'), 'id' => 'jigoshop_shop_page_id', 'type' => 'single_select_page'), array('name' => __('Shop redirection page', 'jigoshop'), 'desc' => '', 'tip' => __('This will point users to the page you set for buttons like `Return to shop` or `Continue Shopping`.', 'jigoshop'), 'id' => 'jigoshop_shop_redirect_page_id', 'type' => 'single_select_page'), array('name' => __('Catalog product buttons show', 'jigoshop'), 'desc' => '', 'tip' => __('This will determine the type of button and the action it will use when clicked on the Shop and Category product listings.  You can also set it to use no button.', 'jigoshop'), 'id' => 'jigoshop_catalog_product_button', 'type' => 'radio', 'choices' => array('add' => __('Add to Cart', 'jigoshop'), 'view' => __('View Product', 'jigoshop'), 'none' => __('No Button', 'jigoshop'))), array('name' => __('Sort products in catalog by', 'jigoshop'), 'desc' => '', 'tip' => __('Determines the display sort order of products for the Shop, Categories, and Tag pages.', 'jigoshop'), 'id' => 'jigoshop_catalog_sort_orderby', 'type' => 'radio', 'choices' => array('post_date' => __('Creation Date', 'jigoshop'), 'title' => __('Product Title', 'jigoshop'), 'menu_order' => __('Product Post Order', 'jigoshop'))), array('name' => __('Catalog sort direction', 'jigoshop'), 'desc' => '', 'tip' => __('Determines whether the catalog sort orderby is ascending or descending.', 'jigoshop'), 'id' => 'jigoshop_catalog_sort_direction', 'type' => 'radio', 'choices' => array('asc' => __('Ascending', 'jigoshop'), 'desc' => __('Descending', 'jigoshop'))), array('name' => __('Catalog products per row', 'jigoshop'), 'desc' => __('Default = 3', 'jigoshop'), 'tip' => __('Determines how many products to show on one display row for Shop, Category and Tag pages.', 'jigoshop'), 'id' => 'jigoshop_catalog_columns', 'type' => 'number', 'extra' => array('min' => 1, 'max' => 10, 'step' => 1)), array('name' => __('Catalog products per page', 'jigoshop'), 'desc' => __('Default = 12', 'jigoshop'), 'tip' => __('Determines how many products to display on Shop, Category and Tag pages before needing next and previous page navigation.', 'jigoshop'), 'id' => 'jigoshop_catalog_per_page', 'type' => 'number', 'extra' => array('min' => 1, 'max' => 100, 'step' => 1)), array('name' => __('Pricing Options', 'jigoshop'), 'type' => 'title', 'desc' => ''), array('name' => __('Show prices with tax', 'jigoshop'), 'desc' => __("This controls the display of the product price in cart and checkout page.", 'jigoshop'), 'tip' => '', 'id' => 'jigoshop_show_prices_with_tax', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Currency display', 'jigoshop'), 'desc' => __("This controls the display of the currency symbol and currency code.", 'jigoshop'), 'tip' => '', 'id' => 'jigoshop_currency_pos', 'type' => 'select', 'choices' => array('left' => sprintf('%1$s0%2$s00', $cSymbol, $cSep), 'left_space' => sprintf('%1$s0 %2$s00', $cSymbol, $cSep), 'right' => sprintf('0%2$s00%1$s', $cSymbol, $cSep), 'right_space' => sprintf('0%2$s00 %1$s', $cSymbol, $cSep), 'left_code' => sprintf('%1$s0%2$s00', $cCode, $cSep), 'left_code_space' => sprintf('%1$s 0%2$s00', $cCode, $cSep), 'right_code' => sprintf('0%2$s00%1$s', $cCode, $cSep), 'right_code_space' => sprintf('0%2$s00 %1$s', $cCode, $cSep), 'symbol_code' => sprintf('%1$s0%2$s00%3$s', $cSymbol, $cSep, $cCode), 'symbol_code_space' => sprintf('%1$s 0%2$s00 %3$s', $cSymbol, $cSep, $cCode), 'code_symbol' => sprintf('%3$s0%2$s00%1$s', $cSymbol, $cSep, $cCode), 'code_symbol_space' => sprintf('%3$s 0%2$s00 %1$s', $cSymbol, $cSep, $cCode))), array('name' => __('Thousand separator', 'jigoshop'), 'desc' => __('This sets the thousand separator of displayed prices.', 'jigoshop'), 'tip' => '', 'id' => 'jigoshop_price_thousand_sep', 'type' => 'text'), array('name' => __('Decimal separator', 'jigoshop'), 'desc' => __('This sets the decimal separator of displayed prices.', 'jigoshop'), 'tip' => '', 'id' => 'jigoshop_price_decimal_sep', 'type' => 'text'), array('name' => __('Number of decimals', 'jigoshop'), 'desc' => __('This sets the number of decimal points shown in displayed prices.', 'jigoshop'), 'tip' => '', 'id' => 'jigoshop_price_num_decimals', 'type' => 'natural'), array('type' => 'tab', 'name' => __('Images', 'jigoshop')), array('name' => __('Image Options', 'jigoshop'), 'type' => 'title', 'desc' => sprintf(__('<p>Changing any of these settings will affect the dimensions of images used in your Shop. After changing these settings you may need to <a href="%s">regenerate your thumbnails</a>.</p><p>Crop: Leave unchecked to set the image size by resizing the image proportionally (that is, without distorting it). Leave checked to set the image size by hard cropping the image (either from the sides, or from the top and bottom).</p><p><strong>Note:</strong> Your images may not display in the size you choose below. This is because they may still be affected by CSS styles in your theme.', 'jigoshop'), 'https://wordpress.org/plugins/regenerate-thumbnails/')), array('name' => __('Cropping Options', 'jigoshop'), 'type' => 'title', 'desc' => ''), array('name' => __('Crop Tiny images', 'jigoshop'), 'desc' => '', 'tip' => __('Use No to set the image size by resizing the image proportionally (that is, without distorting it).<br />Use Yes to set the image size by hard cropping the image (either from the sides, or from the top and bottom).', 'jigoshop'), 'id' => 'jigoshop_use_wordpress_tiny_crop', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Crop Thumbnail images', 'jigoshop'), 'desc' => '', 'tip' => __('Use No to set the image size by resizing the image proportionally (that is, without distorting it).<br />Use Yes to set the image size by hard cropping the image (either from the sides, or from the top and bottom).', 'jigoshop'), 'id' => 'jigoshop_use_wordpress_thumbnail_crop', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Crop Catalog images', 'jigoshop'), 'desc' => '', 'tip' => __('Use No to set the image size by resizing the image proportionally (that is, without distorting it).<br />Use Yes to set the image size by hard cropping the image (either from the sides, or from the top and bottom).', 'jigoshop'), 'id' => 'jigoshop_use_wordpress_catalog_crop', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Crop Large images', 'jigoshop'), 'desc' => '', 'tip' => __('Use No to set the image size by resizing the image proportionally (that is, without distorting it).<br />Use Yes to set the image size by hard cropping the image (either from the sides, or from the top and bottom).', 'jigoshop'), 'id' => 'jigoshop_use_wordpress_featured_crop', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Image Sizes', 'jigoshop'), 'type' => 'title', 'desc' => ''), array('name' => __('Tiny Image Width', 'jigoshop'), 'desc' => __('Default = 36px', 'jigoshop'), 'tip' => __('Set the width of the small image used in the Cart, Checkout, Orders and Widgets.', 'jigoshop'), 'id' => 'jigoshop_shop_tiny_w', 'type' => 'natural'), array('name' => __('Tiny Image Height', 'jigoshop'), 'desc' => __('Default = 36px', 'jigoshop'), 'tip' => __('Set the height of the small image used in the Cart, Checkout, Orders and Widgets.', 'jigoshop'), 'id' => 'jigoshop_shop_tiny_h', 'type' => 'natural'), array('name' => __('Thumbnail Image Width', 'jigoshop'), 'desc' => __('Default = 90px', 'jigoshop'), 'tip' => __('Set the width of the thumbnail image for Single Product page extra images.', 'jigoshop'), 'id' => 'jigoshop_shop_thumbnail_w', 'type' => 'natural'), array('name' => __('Thumbnail Image Height', 'jigoshop'), 'desc' => __('Default = 90px', 'jigoshop'), 'tip' => __('Set the height of the thumbnail image for Single Product page extra images.', 'jigoshop'), 'id' => 'jigoshop_shop_thumbnail_h', 'type' => 'natural'), array('name' => __('Catalog Image Width', 'jigoshop'), 'desc' => __('Default = 150px', 'jigoshop'), 'tip' => __('Set the width of the catalog image for Shop, Categories, Tags, and Related Products.', 'jigoshop'), 'id' => 'jigoshop_shop_small_w', 'type' => 'natural'), array('name' => __('Catalog Image Height', 'jigoshop'), 'desc' => __('Default = 150px', 'jigoshop'), 'tip' => __('Set the height of the catalog image for Shop, Categories, Tags, and Related Products.', 'jigoshop'), 'id' => 'jigoshop_shop_small_h', 'type' => 'natural'), array('name' => __('Large Image Width', 'jigoshop'), 'desc' => __('Default = 300px', 'jigoshop'), 'tip' => __('Set the width of the Single Product page large or Featured image.', 'jigoshop'), 'id' => 'jigoshop_shop_large_w', 'type' => 'natural'), array('name' => __('Large Image Height', 'jigoshop'), 'desc' => __('Default = 300px', 'jigoshop'), 'tip' => __('Set the height of the Single Product page large or Featured image.', 'jigoshop'), 'id' => 'jigoshop_shop_large_h', 'type' => 'natural'), array('type' => 'tab', 'name' => __('Products & Inventory', 'jigoshop')), array('name' => __('Product Options', 'jigoshop'), 'type' => 'title', 'desc' => ''), array('name' => __('Enable SKU field', 'jigoshop'), 'desc' => '', 'tip' => __('Turning off the SKU field will give products an SKU of their post id.', 'jigoshop'), 'id' => 'jigoshop_enable_sku', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Enable weight field', 'jigoshop'), 'desc' => '', 'tip' => '', 'id' => 'jigoshop_enable_weight', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Weight Unit', 'jigoshop'), 'desc' => '', 'tip' => __("This controls what unit you will define weights in.", 'jigoshop'), 'id' => 'jigoshop_weight_unit', 'type' => 'radio', 'choices' => array('kg' => __('Kilograms', 'jigoshop'), 'lbs' => __('Pounds', 'jigoshop'))), array('name' => __('Enable product dimensions', 'jigoshop'), 'desc' => '', 'tip' => '', 'id' => 'jigoshop_enable_dimensions', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Dimensions Unit', 'jigoshop'), 'desc' => '', 'tip' => __('This controls what unit you will define dimensions in.', 'jigoshop'), 'id' => 'jigoshop_dimension_unit', 'type' => 'radio', 'choices' => array('cm' => __('centimeters', 'jigoshop'), 'in' => __('inches', 'jigoshop'))), array('name' => __('Product thumbnail images per row', 'jigoshop'), 'desc' => __('Default = 3', 'jigoshop'), 'tip' => __('Determines how many extra product thumbnail images attached to a product to show on one row for the Single Product page.', 'jigoshop'), 'id' => 'jigoshop_product_thumbnail_columns', 'type' => 'number', 'extra' => array('min' => 1, 'max' => 10, 'step' => 1)), array('name' => __('Show related products', 'jigoshop'), 'desc' => '', 'tip' => __('To show or hide the related products section on a single product page.', 'jigoshop'), 'id' => 'jigoshop_enable_related_products', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Inventory Options', 'jigoshop'), 'type' => 'title', 'desc' => ''), array('name' => __('Manage stock', 'jigoshop'), 'desc' => __('If you are not managing stock, turn it off here to disable it in admin and on the front-end.', 'jigoshop'), 'tip' => __('You can manage stock on a per-item basis if you leave this option on.', 'jigoshop'), 'id' => 'jigoshop_manage_stock', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Show stock amounts', 'jigoshop'), 'desc' => '', 'tip' => __('Set to yes to allow customers to view the amount of stock available for a product.', 'jigoshop'), 'id' => 'jigoshop_show_stock', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Notify on low stock', 'jigoshop'), 'desc' => '', 'id' => 'jigoshop_notify_low_stock', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Low stock threshold', 'jigoshop'), 'desc' => '', 'tip' => __('You will receive a notification as soon this threshold is hit (if notifications are turned on).', 'jigoshop'), 'id' => 'jigoshop_notify_low_stock_amount', 'type' => 'natural', 'std' => '2'), array('name' => __('Notify on out of stock', 'jigoshop'), 'desc' => '', 'id' => 'jigoshop_notify_no_stock', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Out of stock threshold', 'jigoshop'), 'desc' => '', 'tip' => __('You will receive a notification as soon this threshold is hit (if notifications are turned on).', 'jigoshop'), 'id' => 'jigoshop_notify_no_stock_amount', 'type' => 'natural'), array('name' => __('Hide out of stock products', 'jigoshop'), 'desc' => '', 'tip' => __('For Yes: When the Out of Stock Threshold (above) is reached, the product visibility will be set to hidden so that it will not appear on the Catalog or Shop product lists.', 'jigoshop'), 'id' => 'jigoshop_hide_no_stock_product', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('type' => 'tab', 'name' => __('Tax', 'jigoshop')), array('name' => __('Tax Options', 'jigoshop'), 'type' => 'title', 'desc' => ''), array('name' => __('Calculate Taxes', 'jigoshop'), 'desc' => __('Only turn this off if you are exclusively selling non-taxable items.', 'jigoshop'), 'tip' => __('If you are not calculating taxes then you can ignore all other tax options.', 'jigoshop'), 'id' => 'jigoshop_calc_taxes', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Apply Taxes After Coupon', 'jigoshop'), 'desc' => __('This will have no effect if Calculate Taxes is turned off.', 'jigoshop'), 'tip' => __('If yes, taxes get applied after coupons. When no, taxes get applied before coupons.', 'jigoshop'), 'id' => 'jigoshop_tax_after_coupon', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Catalog Prices include tax?', 'jigoshop'), 'desc' => __('This will only apply to the Shop, Category and Product pages.', 'jigoshop'), 'tip' => __('This will have no effect on the Cart, Checkout, Emails, or final Orders; prices are always shown with tax out.', 'jigoshop'), 'id' => 'jigoshop_prices_include_tax', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Country to base taxes on', 'jigoshop'), 'desc' => __('This option defines whether to use billing or shipping address to calculate taxes.', 'jigoshop'), 'id' => 'jigoshop_country_base_tax', 'type' => 'select', 'choices' => array('billing_country' => __('Billing', 'jigoshop'), 'shipping_country' => __('Shipping', 'jigoshop'))), array('name' => __('Additional Tax classes', 'jigoshop'), 'desc' => __('List 1 per line. This is in addition to the default <em>Standard Rate</em>.', 'jigoshop'), 'tip' => __('List product and shipping tax classes here, e.g. Zero Tax, Reduced Rate.', 'jigoshop'), 'id' => 'jigoshop_tax_classes', 'type' => 'textarea'), array('name' => __('Tax rates', 'jigoshop'), 'desc' => '', 'tip' => __('To avoid rounding errors, insert tax rates with 4 decimal places.', 'jigoshop'), 'id' => 'jigoshop_tax_rates', 'type' => 'tax_rates'), array('name' => __('Default options for new products', 'jigoshop'), 'type' => 'title', 'desc' => ''), array('name' => __('Tax status', 'jigoshop'), 'tip' => __('Whether new products should be taxable by default.', 'jigoshop'), 'id' => 'jigoshop_tax_defaults_status', 'type' => 'select', 'std' => 'taxable', 'choices' => array('taxable' => __('Taxable', 'jigoshop'), 'shipping' => __('Shipping', 'jigoshop'), 'none' => __('None', 'jigoshop'))), array('name' => __('Tax classes', 'jigoshop'), 'tip' => __('List of tax classes added by default to new products.', 'jigoshop'), 'id' => 'jigoshop_tax_defaults_classes', 'type' => 'user_defined', 'display' => array($this, 'display_default_tax_classes'), 'update' => array($this, 'update_default_tax_classes')), array('type' => 'tab', 'name' => __('Shipping', 'jigoshop')), array('name' => __('Shipping Options', 'jigoshop'), 'type' => 'title', 'desc' => ''), array('name' => __('Enable Shipping', 'jigoshop'), 'desc' => __('Only turn this off if you are <strong>not</strong> shipping items, or items have shipping costs included.', 'jigoshop'), 'tip' => __('If turned off, this will also remove shipping address fields on the Checkout.', 'jigoshop'), 'id' => 'jigoshop_calc_shipping', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Enable shipping calculator on cart', 'jigoshop'), 'desc' => '', 'tip' => '', 'id' => 'jigoshop_enable_shipping_calc', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Only ship to billing address?', 'jigoshop'), 'desc' => '', 'tip' => __('When activated, Shipping address fields will not appear on the Checkout.', 'jigoshop'), 'id' => 'jigoshop_ship_to_billing_address_only', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Checkout always shows Shipping fields?', 'jigoshop'), 'desc' => __('This will have no effect if "Only ship to billing address" is activated.', 'jigoshop'), 'tip' => __('When activated, Shipping address fields will appear by default on the Checkout.', 'jigoshop'), 'id' => 'jigoshop_show_checkout_shipping_fields', 'type' => 'checkbox', 'choices' => array('no' => __('No', 'jigoshop'), 'yes' => __('Yes', 'jigoshop'))), array('name' => __('Available Shipping Methods', 'jigoshop'), 'type' => 'title', 'desc' => __('Please enable all of the Shipping Methods you wish to make available to your customers.', 'jigoshop')), array('type' => 'tab', 'name' => __('Payment Gateways', 'jigoshop')), array('name' => __('Gateway Options', 'jigoshop'), 'type' => 'title', 'desc' => ''), array('name' => __('Default Gateway', 'jigoshop'), 'desc' => __('Only enabled gateways will appear in this list.', 'jigoshop'), 'tip' => __('This will determine which gateway appears first in the Payment Methods list on the Checkout.', 'jigoshop'), 'id' => 'jigoshop_default_gateway', 'type' => 'default_gateway', 'choices' => apply_filters('jigoshop_available_payment_gateways', array())), array('name' => __('Available gateways', 'jigoshop'), 'type' => 'title', 'desc' => __('Please enable all of the Payment Gateways you wish to make available to your customers.', 'jigoshop')));
 }
Example #19
0
/**
 * Outputs the pay page - payment gateways can hook in here to show payment forms etc
 **/
function jigoshop_pay() {
	
	if ( isset($_GET['pay_for_order']) && isset($_GET['order']) && isset($_GET['order_id']) ) :
		
		// Pay for existing order
		$order_key = urldecode( $_GET['order'] );
		$order_id = (int) $_GET['order_id'];
		$order = &new jigoshop_order( $order_id );
		
		if ($order->id == $order_id && $order->order_key == $order_key && $order->status=='pending') :
			
			// Set customer location to order location
			if ($order->billing_country) jigoshop_customer::set_country( $order->billing_country );
			if ($order->billing_state) jigoshop_customer::set_state( $order->billing_state );
			if ($order->billing_postcode) jigoshop_customer::set_postcode( $order->billing_postcode );
			
			// Pay form was posted - process payment
			if (isset($_POST['pay']) && jigoshop::verify_nonce('pay')) :
			
				// Update payment method
				if ($order->order_total > 0 ) : 
					$payment_method 			= jigowatt_clean($_POST['payment_method']);
					$data 						= (array) maybe_unserialize( get_post_meta( $order_id, 'order_data', true ) );
					$data['payment_method']		= $payment_method;
					update_post_meta( $order_id, 'order_data', $data );
			
					$available_gateways = jigoshop_payment_gateways::get_available_payment_gateways();
				
					$result = $available_gateways[$payment_method]->process_payment( $order_id );
					
					// Redirect to success/confirmation/payment page
					if ($result['result']=='success') :
						wp_safe_redirect( $result['redirect'] );
						exit;
					endif;
				else :
					
					// No payment was required for order
					$order->payment_complete();
					wp_safe_redirect( get_permalink(get_option('jigoshop_thanks_page_id')) );
					exit;
					
				endif;
	
			endif;
			
			// Show messages
			jigoshop::show_messages();
			
			// Show form
			jigoshop_pay_for_existing_order( $order );
		
		elseif ($order->status!='pending') :
			
			jigoshop::add_error( __('Your order has already been paid for. Please contact us if you need assistance.', 'jigoshop') );
			
			jigoshop::show_messages();
			
		else :
		
			jigoshop::add_error( __('Invalid order.', 'jigoshop') );
			
			jigoshop::show_messages();
			
		endif;
		
	else :
		
		// Pay for order after checkout step
		if (isset($_GET['order'])) $order_id = $_GET['order']; else $order_id = 0;
		if (isset($_GET['key'])) $order_key = $_GET['key']; else $order_key = '';
		
		if ($order_id > 0) :
		
			$order = &new jigoshop_order( $order_id );
		
			if ($order->order_key == $order_key && $order->status=='pending') :
		
				?>
				<ul class="order_details">
					<li class="order">
						<?php _e('Order:', 'jigoshop'); ?>
						<strong># <?php echo $order->id; ?></strong>
					</li>
					<li class="date">
						<?php _e('Date:', 'jigoshop'); ?>
						<strong><?php echo date(get_option('date_format'), strtotime($order->order_date)); ?></strong>
					</li>
					<li class="total">
						<?php _e('Total:', 'jigoshop'); ?>
						<strong><?php echo jigoshop_price($order->order_total); ?></strong>
					</li>
					<li class="method">
						<?php _e('Payment method:', 'jigoshop'); ?>
						<strong><?php 
							$gateways = jigoshop_payment_gateways::payment_gateways();
							if (isset($gateways[$order->payment_method])) echo $gateways[$order->payment_method]->title;
							else echo $order->payment_method; 
						?></strong>
					</li>
				</ul>
				
				<?php do_action( 'receipt_' . $order->payment_method, $order_id ); ?>
				
				<div class="clear"></div>
				<?php
				
			else :
			
				wp_safe_redirect( get_permalink(get_option('jigoshop_myaccount_page_id')) );
				exit;
				
			endif;
			
		else :
			
			wp_safe_redirect( get_permalink(get_option('jigoshop_myaccount_page_id')) );
			exit;
			
		endif;

	endif;
}
Example #20
0
    function jigoshop_login_form()
    {
        if (is_user_logged_in()) {
            return;
        }
        ?>
		<form method="post" class="login">
			<p class="form-row form-row-first">
				<label for="username"><?php 
        _e('Username', 'jigoshop');
        ?>
 <span class="required">*</span></label>
				<input type="text" class="input-text" name="username" id="username" />
			</p>
			<p class="form-row form-row-last">
				<label for="password"><?php 
        _e('Password', 'jigoshop');
        ?>
 <span class="required">*</span></label>
				<input class="input-text" type="password" name="password" id="password" />
			</p>
			<div class="clear"></div>
			
			<p class="form-row">
				<?php 
        jigoshop::nonce_field('login', 'login');
        ?>
				<input type="submit" class="button" name="login" value="<?php 
        _e('Login', 'jigoshop');
        ?>
" />
				<a class="lost_password" href="<?php 
        echo home_url('wp-login.php?action=lostpassword');
        ?>
"><?php 
        _e('Lost Password?', 'jigoshop');
        ?>
</a>
			</p>
		</form>
		<?php 
    }
Example #21
0
function jigoshop_check_comment_rating($comment_data) {
	// If posting a comment (not trackback etc) and not logged in
	if ( isset($_POST['rating']) && !jigoshop::verify_nonce('comment_rating') )
		wp_die( __('You have taken too long. Please go back and refresh the page.', 'jigoshop') );
		
	elseif ( isset($_POST['rating']) && empty($_POST['rating']) && $comment_data['comment_type']== '' ) {
		wp_die( __('Please rate the product.',"jigowatt") );
		exit;
	}
	return $comment_data;
}
Example #22
0
function jigoshop_pay_action()
{
    if (!is_jigoshop_single_page(JIGOSHOP_PAY)) {
        return;
    }
    if (isset($_GET['pay_for_order']) && isset($_GET['order']) && isset($_GET['order_id'])) {
        // Pay for existing order
        $order_key = urldecode($_GET['order']);
        $order_id = (int) $_GET['order_id'];
        $order = new jigoshop_order($order_id);
        if ($order->id == $order_id && $order->order_key == $order_key && $order->status == 'pending') {
            // Set customer location to order location
            if ($order->billing_country) {
                jigoshop_customer::set_country($order->billing_country);
            }
            if ($order->billing_state) {
                jigoshop_customer::set_state($order->billing_state);
            }
            if ($order->billing_postcode) {
                jigoshop_customer::set_postcode($order->billing_postcode);
            }
            // Pay form was posted - process payment
            if (isset($_POST['pay']) && jigoshop::verify_nonce('pay')) {
                // Update payment method
                if ($order->order_total > 0) {
                    $payment_method = jigowatt_clean($_POST['payment_method']);
                    $data = (array) maybe_unserialize(get_post_meta($order_id, 'order_data', true));
                    $data['payment_method'] = $payment_method;
                    update_post_meta($order_id, 'order_data', $data);
                    $available_gateways = jigoshop_payment_gateways::get_available_payment_gateways();
                    $result = $available_gateways[$payment_method]->process_payment($order_id);
                    // Redirect to success/confirmation/payment page
                    if ($result['result'] == 'success') {
                        wp_safe_redirect($result['redirect']);
                        exit;
                    }
                } else {
                    // No payment was required for order
                    $order->payment_complete();
                    // filter redirect page
                    $checkout_redirect = apply_filters('jigoshop_get_checkout_redirect_page_id', jigoshop_get_page_id('thanks'));
                    wp_safe_redirect(get_permalink($checkout_redirect));
                    exit;
                }
            }
        } elseif ($order->status != 'pending') {
            jigoshop::add_error(__('Your order has already been paid for. Please contact us if you need assistance.', 'jigoshop'));
        } else {
            jigoshop::add_error(__('Invalid order.', 'jigoshop'));
        }
    } else {
        // Pay for order after checkout step
        if (isset($_GET['order'])) {
            $order_id = $_GET['order'];
        } else {
            $order_id = 0;
        }
        if (isset($_GET['key'])) {
            $order_key = $_GET['key'];
        } else {
            $order_key = '';
        }
        if ($order_id > 0) {
            $order = new jigoshop_order($order_id);
            if ($order->order_key != $order_key || $order->status != 'pending') {
                wp_safe_redirect(apply_filters('jigoshop_get_myaccount_page_id', get_permalink(jigoshop_get_page_id('myaccount'))));
                exit;
            }
        } else {
            wp_safe_redirect(apply_filters('jigoshop_get_myaccount_page_id', get_permalink(jigoshop_get_page_id('myaccount'))));
            exit;
        }
    }
}
                echo '<div class="payment_box payment_method_' . esc_attr($gateway->id) . '" style="display:none;">';
                $gateway->payment_fields();
                echo '</div>';
            }
            ?>
                        </li>
                        <?php 
        }
    } else {
        echo '<p>' . __('Sorry, it seems that there are no available payment methods for your location. Please contact us if you require assistance or wish to make alternate arrangements.', 'jigoshop') . '</p>';
    }
    ?>
            </ul>
        <?php 
}
?>

        <div class="form-row">
            <?php 
jigoshop::nonce_field('pay');
?>
            <input type="submit" class="button-alt" name="pay" id="place_order" value="<?php 
_e('Pay for order', 'jigoshop');
?>
" />

        </div>

    </div>

</form>
Example #24
0
function jigoshop_cancel_order() {
	
	if ( isset($_GET['cancel_order']) && isset($_GET['order']) && isset($_GET['order_id']) ) :
		
		$order_key = urldecode( $_GET['order'] );
		$order_id = (int) $_GET['order_id'];
		
		$order = &new jigoshop_order( $order_id );

		if ($order->id == $order_id && $order->order_key == $order_key && $order->status=='pending' && jigoshop::verify_nonce('cancel_order', '_GET')) :
			
			// Cancel the order + restore stock
			$order->cancel_order( __('Order cancelled by customer.', 'jigoshop') );
			
			// Message
			jigoshop::add_message( __('Your order was cancelled.', 'jigoshop') );
		
		elseif ($order->status!='pending') :
			
			jigoshop::add_error( __('Your order is no longer pending and could not be cancelled. Please contact us if you need assistance.', 'jigoshop') );
			
		else :
		
			jigoshop::add_error( __('Invalid order.', 'jigoshop') );
			
		endif;
		
		wp_safe_redirect(jigoshop_cart::get_cart_url());
		exit;
		
	endif;
}
Example #25
0
		clearTimeout(updateTimer);
		update_checkout();
	}).change();
	jQuery('input#billing-country, input#billing-state, #billing-postcode, input#shipping-country, input#shipping-state, #shipping-postcode').live('keydown', function(){
		clearTimeout(updateTimer);
		updateTimer = setTimeout("update_checkout()", '1000');
	});
	jQuery('select#billing-country, select#billing-state, select#shipping-country, select#shipping-state, #shiptobilling input').live('change', function(){
		clearTimeout(updateTimer);
		update_checkout();
	});
	
	/* AJAX Form Submission */
	jQuery('form.checkout').submit(function(){
		var form = this;
		jQuery(form).block({ message: null, overlayCSS: { background: '#fff url(<?php echo jigoshop::plugin_url(); ?>/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.6 } });
		jQuery.ajax({
			type: 		'POST',
			url: 		'<?php echo admin_url('admin-ajax.php?action=jigoshop-checkout') ?>',
			data: 		jQuery(form).serialize(),
			success: 	function( code ) {
							jQuery('.jigoshop_error, .jigoshop_message').remove();
							try {
								success = jQuery.parseJSON( code );					
								window.location = decodeURI(success.redirect);
							}
							catch(err) {
							  	jQuery(form).prepend( code );
								jQuery(form).unblock(); 
								jQuery.scrollTo(jQuery(form).parent(), { easing:'swing' });
							}
			'email'  => '<p class="comment-form-email"><label for="email">' . __( 'Email' ) . '</label> ' . '<span class="required">*</span>' .
			            '<input id="email" name="email" type="text" value="' . esc_attr(  $commenter['comment_author_email'] ) . '" size="30" aria-required="true" /></p>',
		),
		'label_submit' => __('Submit Review', 'jigoshop'),
		'logged_in_as' => '',
		'comment_field' => '
			<p class="comment-form-rating"><label for="rating">' . __('Rating', 'jigoshop') .'</label><select name="rating" id="rating">
				<option value="">'.__('Rate...','jigoshop').'</option>
				<option value="5">'.__('Perfect','jigoshop').'</option>
				<option value="4">'.__('Good','jigoshop').'</option>
				<option value="3">'.__('Average','jigoshop').'</option>
				<option value="2">'.__('Not that bad','jigoshop').'</option>
				<option value="1">'.__('Very Poor','jigoshop').'</option>
			</select></p>
			<p class="comment-form-comment"><label for="comment">' . _x( 'Your Review', 'noun' ) . '</label><textarea id="comment" name="comment" cols="45" rows="8" aria-required="true"></textarea></p>'
			. jigoshop::nonce_field('comment_rating', true, false)
	)); 

	echo '</div></div>';
	
?><div class="clear"></div></div>
<script type="text/javascript">
/* <![CDATA[ */
	jQuery(function(){
		jQuery('#review_form_wrapper').hide();
		jQuery('a.show_review_form').fancybox({
			'transitionIn'	:	'elastic',
			'transitionOut'	:	'elastic',
			'speedIn'		:	600, 
			'speedOut'		:	200, 
			'overlayShow'	:	true
Example #27
0
					if ( !jigoshop_customer::get_country() ) :
						echo '<p>'.__('Please fill in your details above to see available payment methods.', 'jigoshop').'</p>';
					else :
						echo '<p>'.__('Sorry, it seems that there are no available payment methods for your state. Please contact us if you require assistance or wish to make alternate arrangements.', 'jigoshop').'</p>';
					endif;
					
				endif;
			?>
		</ul>
		<?php endif; ?>

		<div class="form-row">
		
			<noscript><?php _e('Since your browser does not support JavaScript, or it is disabled, please ensure you click the <em>Update Totals</em> button before placing your order. You may be charged more than the amount stated above if you fail to do so.', 'jigoshop'); ?><br/><input type="submit" class="button-alt" name="update_totals" value="<?php _e('Update totals', 'jigoshop'); ?>" /></noscript>
		
			<?php jigoshop::nonce_field('process_checkout')?>
			<input type="submit" class="button-alt" name="place_order" id="place_order" value="<?php _e('Place order', 'jigoshop'); ?>" />
			
			<?php do_action( 'jigoshop_review_order_before_submit' ); ?>
			
			<?php if (get_option('jigoshop_terms_page_id')>0) : ?>
			<p class="form-row terms">
				<label for="terms" class="checkbox"><?php _e('I accept the', 'jigoshop'); ?> <a href="<?php echo get_permalink(get_option('jigoshop_terms_page_id')); ?>" target="_blank"><?php _e('terms &amp; conditions', 'jigoshop'); ?></a></label>
				<input type="checkbox" class="input-checkbox" name="terms" <?php if (isset($_POST['terms'])) echo 'checked="checked"'; ?> id="terms" />
			</p>
			<?php endif; ?>
			
			<?php do_action( 'jigoshop_review_order_after_submit' ); ?>
			
		</div>
	/** Generates a URL so that a customer can cancel their (unpaid - pending) order */
	function get_cancel_order_url() {
		return jigoshop::nonce_url( 'cancel_order', add_query_arg('cancel_order', 'true', add_query_arg('order', $this->order_key, add_query_arg('order_id', $this->id, home_url()))));
	}
Example #29
0
function jigoshop_order_tracking( $atts ) {
	
	extract(shortcode_atts(array(
	), $atts));
	
	global $post;
	
	if ($_POST) :
		
		$order = &new jigoshop_order();
		
		if (isset($_POST['orderid']) && $_POST['orderid'] > 0) $order->id = (int) $_POST['orderid']; else $order->id = 0;
		if (isset($_POST['order_email']) && $_POST['order_email']) $order_email = trim($_POST['order_email']); else $order_email = '';
		
		if ( !jigoshop::verify_nonce('order_tracking') ):
		
			echo '<p>'.__('You have taken too long. Please refresh the page and retry.', 'jigoshop').'</p>';
				
		elseif ($order->id && $order_email && $order->get_order( $order->id )) :

			if ($order->billing_email == $order_email) :
		
				echo '<p>'.sprintf( __('Order #%s which was made %s has the status &ldquo;%s&rdquo;', 'jigoshop'), $order->id, human_time_diff(strtotime($order->order_date), current_time('timestamp')).__(' ago', 'jigoshop'), $order->status );
			
				if ($order->status == 'completed') echo __(' and was completed ', 'jigoshop').human_time_diff(strtotime($order->completed_date), current_time('timestamp')).__(' ago', 'jigoshop');
			
				echo '.</p>';

				?>
				<h2><?php _e('Order Details', 'jigoshop'); ?></h2>
				<table class="shop_table">
					<thead>
						<tr>
							<th><?php _e('Title', 'jigoshop'); ?></th>
							<th><?php _e('SKU', 'jigoshop'); ?></th>
							<th><?php _e('Price', 'jigoshop'); ?></th>
							<th><?php _e('Quantity', 'jigoshop'); ?></th>
						</tr>
					</thead>
					<tfoot>
						<tr>
							<td colspan="3"><?php _e('Subtotal', 'jigoshop'); ?></td>
							<td><?php echo $order->get_subtotal_to_display(); ?></td>
						</tr>
						<?php if ($order->order_shipping>0) : ?><tr>
							<td colspan="3"><?php _e('Shipping', 'jigoshop'); ?></td>
							<td><?php echo $order->get_shipping_to_display(); ?></small></td>
						</tr><?php endif; ?>
						<?php if ($order->get_total_tax()>0) : ?><tr>
							<td colspan="3"><?php _e('Tax', 'jigoshop'); ?></td>
							<td><?php echo jigoshop_price($order->get_total_tax()); ?></td>
						</tr><?php endif; ?>
						<?php if ($order->order_discount>0) : ?><tr class="discount">
							<td colspan="3"><?php _e('Discount', 'jigoshop'); ?></td>
							<td>-<?php echo jigoshop_price($order->order_discount); ?></td>
						</tr><?php endif; ?>
						<tr>
							<td colspan="3"><strong><?php _e('Grand Total', 'jigoshop'); ?></strong></td>
							<td><strong><?php echo jigoshop_price($order->order_total); ?></strong></td>
						</tr>
					</tfoot>
					<tbody>
						<?php
						foreach($order->items as $order_item) : 
						
							$_product = &new jigoshop_product( $order_item['id'] );
							echo '<tr>';
							echo '<td>'.$_product->get_title().'</td>';
							echo '<td>'.$_product->sku.'</td>';
							echo '<td>'.jigoshop_price($_product->get_price()).'</td>';
							echo '<td>'.$order_item['qty'].'</td>';
							
							echo '</tr>';
								
						endforeach;
						?>
					</tbody>
				</table>
				
				<div style="width: 49%; float:left;">
					<h2><?php _e('Billing Address', 'jigoshop'); ?></h2>
					<p><?php
					$address = $order->billing_first_name.' '.$order->billing_last_name.'<br/>';
					if ($order->billing_company) $address .= $order->billing_company.'<br/>';
					$address .= $order->formatted_billing_address;
					echo $address;
					?></p>
				</div>
				<div style="width: 49%; float:right;">
					<h2><?php _e('Shipping Address', 'jigoshop'); ?></h2>
					<p><?php
					$address = $order->shipping_first_name.' '.$order->shipping_last_name.'<br/>';
					if ($order->shipping_company) $address .= $order->shipping_company.'<br/>';
					$address .= $order->formatted_shipping_address;
					echo $address;
					?></p>
				</div>
				<div class="clear"></div>
				<?php
				
			else :
				echo '<p>'.__('Sorry, we could not find that order id in our database. <a href="'.get_permalink($post->ID).'">Want to retry?</a>', 'jigoshop').'</p>';
			endif;
		else :
			echo '<p>'.__('Sorry, we could not find that order id in our database. <a href="'.get_permalink($post->ID).'">Want to retry?</a>', 'jigoshop').'</p>';
		endif;	
	
	else :
	
		?>
		<form action="<?php echo get_permalink($post->ID); ?>" method="post" class="track_order">
			
			<p><?php _e('To track your order please enter your Order ID in the box below and press return. This was given to you on your receipt and in the confirmation email you should have received.', 'jigoshop'); ?></p>
			
			<p class="form-row form-row-first"><label for="orderid"><?php _e('Order ID', 'jigoshop'); ?></label> <input class="input-text" type="text" name="orderid" id="orderid" placeholder="<?php _e('Found in your order confirmation email.', 'jigoshop'); ?>" /></p>
			<p class="form-row form-row-last"><label for="order_email"><?php _e('Billing Email', 'jigoshop'); ?></label> <input class="input-text" type="text" name="order_email" id="order_email" placeholder="<?php _e('Email you used during checkout.', 'jigoshop'); ?>" /></p>
			<div class="clear"></div>
			<p class="form-row"><input type="submit" class="button" name="track" value="<?php _e('Track"', 'jigoshop'); ?>" /></p>
			<?php jigoshop::nonce_field('order_tracking') ?>
		</form>
		<?php
		
	endif;	
	
}
Example #30
0
<?php

/**
 * @var $options Jigoshop_Options Options container.
 * @var $recent_orders int Number of recent orders to show.
 */
jigoshop::show_messages();
if (is_user_logged_in()) {
    ?>
<p><?php 
    echo sprintf(__('Hello, <strong>%s</strong>. From your account dashboard you can view your recent orders, manage your shipping and billing addresses and <a href="%s">change your password</a>.', 'jigoshop'), $current_user->display_name, apply_filters('jigoshop_get_change_password_page_id', get_permalink(jigoshop_get_page_id('change_password'))));
    ?>
</p>

<?php 
    do_action('jigoshop_before_my_account');
    ?>

<?php 
    if ($downloads = jigoshop_customer::get_downloadable_products()) {
        ?>
	<h2><?php 
        _e('Available downloads', 'jigoshop');
        ?>
</h2>
	<ul class="digital-downloads">
		<?php 
        foreach ($downloads as $download) {
            ?>
			<li><?php 
            if (is_numeric($download['downloads_remaining'])) {