WooCommerce conversion and update

This commit is contained in:
Mike Jolley 2011-08-10 18:11:11 +01:00
parent 8e8613b116
commit 0425a68eca
149 changed files with 10398 additions and 23580 deletions

View File

@ -2,11 +2,11 @@
/**
* Functions used for the attributes section in WordPress Admin
*
* The attributes section lets users add custom attributes to assign to products - they can also be used in the layered nav widgets.
* The attributes section lets users add custom attributes to assign to products - they can also be used in the layered nav widget.
*
* @author Jigowatt
* @author WooThemes
* @category Admin
* @package JigoShop
* @package WooCommerce
*/
/**
@ -14,11 +14,8 @@
*
* Shows the created attributes and lets you add new ones.
* The added attributes are stored in the database and can be used for layered navigation.
*
* @since 1.0
* @usedby jigoshop_admin_menu2()
*/
function jigoshop_attributes() {
function woocommerce_attributes() {
global $wpdb;
@ -30,9 +27,9 @@ function jigoshop_attributes() {
if ($attribute_name && $attribute_type && !taxonomy_exists('product_attribute_'.strtolower(sanitize_title($attribute_name)))) :
$wpdb->insert( $wpdb->prefix . "jigoshop_attribute_taxonomies", array( 'attribute_name' => $attribute_name, 'attribute_type' => $attribute_type ), array( '%s', '%s' ) );
$wpdb->insert( $wpdb->prefix . "woocommerce_attribute_taxonomies", array( 'attribute_name' => $attribute_name, 'attribute_type' => $attribute_type ), array( '%s', '%s' ) );
update_option('jigowatt_update_rewrite_rules', '1');
update_option('woocommerce_update_rewrite_rules', '1');
wp_safe_redirect( get_admin_url() . 'admin.php?page=attributes' );
exit;
@ -47,7 +44,7 @@ function jigoshop_attributes() {
$attribute_type = $_POST['attribute_type'];
$wpdb->update( $wpdb->prefix . "jigoshop_attribute_taxonomies", array( 'attribute_type' => $attribute_type ), array( 'attribute_id' => $_GET['edit'] ), array( '%s' ) );
$wpdb->update( $wpdb->prefix . "woocommerce_attribute_taxonomies", array( 'attribute_type' => $attribute_type ), array( 'attribute_id' => $_GET['edit'] ), array( '%s' ) );
endif;
@ -60,9 +57,9 @@ function jigoshop_attributes() {
if ($delete>0) :
$att_name = $wpdb->get_var("SELECT attribute_name FROM " . $wpdb->prefix . "jigoshop_attribute_taxonomies WHERE attribute_id = '$delete'");
$att_name = $wpdb->get_var("SELECT attribute_name FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies WHERE attribute_id = '$delete'");
if ($att_name && $wpdb->query("DELETE FROM " . $wpdb->prefix . "jigoshop_attribute_taxonomies WHERE attribute_id = '$delete'")) :
if ($att_name && $wpdb->query("DELETE FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies WHERE attribute_id = '$delete'")) :
$taxonomy = 'product_attribute_'.strtolower(sanitize_title($att_name));
@ -85,9 +82,9 @@ function jigoshop_attributes() {
endif;
if (isset($_GET['edit']) && $_GET['edit'] > 0) :
jigoshop_edit_attribute();
woocommerce_edit_attribute();
else :
jigoshop_add_attribute();
woocommerce_add_attribute();
endif;
}
@ -96,40 +93,37 @@ function jigoshop_attributes() {
* Edit Attribute admin panel
*
* Shows the interface for changing an attributes type between select, multiselect and text
*
* @since 1.0
* @usedby jigoshop_attributes()
*/
function jigoshop_edit_attribute() {
function woocommerce_edit_attribute() {
global $wpdb;
$edit = absint($_GET['edit']);
$att_type = $wpdb->get_var("SELECT attribute_type FROM " . $wpdb->prefix . "jigoshop_attribute_taxonomies WHERE attribute_id = '$edit'");
$att_type = $wpdb->get_var("SELECT attribute_type FROM " . $wpdb->prefix . "woocommerce_attribute_taxonomies WHERE attribute_id = '$edit'");
?>
<div class="wrap jigoshop">
<div class="icon32 icon32-attributes" id="icon-jigoshop"><br/></div>
<h2><?php _e('Attributes','jigoshop') ?></h2>
<div class="wrap woocommerce">
<div class="icon32 icon32-attributes" id="icon-woocommerce"><br/></div>
<h2><?php _e('Attributes', 'woothemes') ?></h2>
<br class="clear" />
<div id="col-container">
<div id="col-left">
<div class="col-wrap">
<div class="form-wrap">
<h3><?php _e('Edit Attribute','jigoshop') ?></h3>
<p><?php _e('Attribute taxonomy names cannot be changed; you may only change an attributes type.','jigoshop') ?></p>
<h3><?php _e('Edit Attribute', 'woothemes') ?></h3>
<p><?php _e('Attribute taxonomy names cannot be changed; you may only change an attributes type.', 'woothemes') ?></p>
<form action="admin.php?page=attributes&amp;edit=<?php echo $edit; ?>" method="post">
<div class="form-field">
<label for="attribute_type"><?php _e('Attribute type', 'jigoshop'); ?></label>
<label for="attribute_type"><?php _e('Attribute type', 'woothemes'); ?></label>
<select name="attribute_type" id="attribute_type" style="width: 100%;">
<option value="select" <?php if ($att_type=='select') echo 'selected="selected"'; ?>><?php _e('Select','jigoshop') ?></option>
<option value="multiselect" <?php if ($att_type=='multiselect') echo 'selected="selected"'; ?>><?php _e('Multiselect','jigoshop') ?></option>
<option value="text" <?php if ($att_type=='text') echo 'selected="selected"'; ?>><?php _e('Text','jigoshop') ?></option>
<option value="select" <?php if ($att_type=='select') echo 'selected="selected"'; ?>><?php _e('Select', 'woothemes') ?></option>
<option value="multiselect" <?php if ($att_type=='multiselect') echo 'selected="selected"'; ?>><?php _e('Multiselect', 'woothemes') ?></option>
<option value="text" <?php if ($att_type=='text') echo 'selected="selected"'; ?>><?php _e('Text', 'woothemes') ?></option>
</select>
</div>
<p class="submit"><input type="submit" name="save_attribute" id="submit" class="button" value="<?php _e('Save Attribute', 'jigoshop'); ?>"></p>
<p class="submit"><input type="submit" name="save_attribute" id="submit" class="button" value="<?php _e('Save Attribute', 'woothemes'); ?>"></p>
</form>
</div>
</div>
@ -144,15 +138,12 @@ function jigoshop_edit_attribute() {
* Add Attribute admin panel
*
* Shows the interface for adding new attributes
*
* @since 1.0
* @usedby jigoshop_attributes()
*/
function jigoshop_add_attribute() {
function woocommerce_add_attribute() {
?>
<div class="wrap jigoshop">
<div class="icon32 icon32-attributes" id="icon-jigoshop"><br/></div>
<h2><?php _e('Attributes','jigoshop') ?></h2>
<div class="wrap woocommerce">
<div class="icon32 icon32-attributes" id="icon-woocommerce"><br/></div>
<h2><?php _e('Attributes', 'woothemes') ?></h2>
<br class="clear" />
<div id="col-container">
<div id="col-right">
@ -160,21 +151,21 @@ function jigoshop_add_attribute() {
<table class="widefat fixed" style="width:100%">
<thead>
<tr>
<th scope="col"><?php _e('Name','jigoshop') ?></th>
<th scope="col"><?php _e('Type','jigoshop') ?></th>
<th scope="col"><?php _e('Terms','jigoshop') ?></th>
<th scope="col"><?php _e('Name', 'woothemes') ?></th>
<th scope="col"><?php _e('Type', 'woothemes') ?></th>
<th scope="col"><?php _e('Terms', 'woothemes') ?></th>
</tr>
</thead>
<tbody>
<?php
$attribute_taxonomies = jigoshop::$attribute_taxonomies;
$attribute_taxonomies = woocommerce::$attribute_taxonomies;
if ( $attribute_taxonomies ) :
foreach ($attribute_taxonomies as $tax) :
?><tr>
<td><a href="edit-tags.php?taxonomy=product_attribute_<?php echo strtolower(sanitize_title($tax->attribute_name)); ?>&amp;post_type=product"><?php echo $tax->attribute_name; ?></a>
<div class="row-actions"><span class="edit"><a href="<?php echo add_query_arg('edit', $tax->attribute_id, 'admin.php?page=attributes') ?>"><?php _e('Edit', 'jigoshop'); ?></a> | </span><span class="delete"><a class="delete" href="<?php echo add_query_arg('delete', $tax->attribute_id, 'admin.php?page=attributes') ?>"><?php _e('Delete', 'jigoshop'); ?></a></span></div>
<div class="row-actions"><span class="edit"><a href="<?php echo add_query_arg('edit', $tax->attribute_id, 'admin.php?page=attributes') ?>"><?php _e('Edit', 'woothemes'); ?></a> | </span><span class="delete"><a class="delete" href="<?php echo add_query_arg('delete', $tax->attribute_id, 'admin.php?page=attributes') ?>"><?php _e('Delete', 'woothemes'); ?></a></span></div>
</td>
<td><?php echo ucwords($tax->attribute_type); ?></td>
<td><?php
@ -196,7 +187,7 @@ function jigoshop_add_attribute() {
</tr><?php
endforeach;
else :
?><tr><td colspan="5"><?php _e('No attributes currently exist.','jigoshop') ?></td></tr><?php
?><tr><td colspan="5"><?php _e('No attributes currently exist.', 'woothemes') ?></td></tr><?php
endif;
?>
</tbody>
@ -206,28 +197,28 @@ function jigoshop_add_attribute() {
<div id="col-left">
<div class="col-wrap">
<div class="form-wrap">
<h3><?php _e('Add New Attribute','jigoshop') ?></h3>
<p><?php _e('Attributes let you define extra product data, such as size or colour. You can use these attributes in the shop sidebar using the "layered nav" widgets. Please note: you cannot rename an attribute later on.','jigoshop') ?></p>
<h3><?php _e('Add New Attribute', 'woothemes') ?></h3>
<p><?php _e('Attributes let you define extra product data, such as size or colour. You can use these attributes in the shop sidebar using the "layered nav" widgets. Please note: you cannot rename an attribute later on.', 'woothemes') ?></p>
<form action="admin.php?page=attributes" method="post">
<div style="width:47%; float:left; margin:0 1% 0 0;">
<div class="form-field">
<label for="attribute_name"><?php _e('Attribute Name', 'jigoshop'); ?></label>
<label for="attribute_name"><?php _e('Attribute Name', 'woothemes'); ?></label>
<input name="attribute_name" id="attribute_name" type="text" value="" />
</div>
</div>
<div style="width:47%; float:left; margin:0 1% 0 0;">
<div class="form-field">
<label for="attribute_type"><?php _e('Attribute type', 'jigoshop'); ?></label>
<label for="attribute_type"><?php _e('Attribute type', 'woothemes'); ?></label>
<select name="attribute_type" id="attribute_type" style="width: 100%;">
<option value="select"><?php _e('Select','jigoshop') ?></option>
<option value="multiselect"><?php _e('Multiselect','jigoshop') ?></option>
<option value="text"><?php _e('Text','jigoshop') ?></option>
<option value="select"><?php _e('Select', 'woothemes') ?></option>
<option value="multiselect"><?php _e('Multiselect', 'woothemes') ?></option>
<option value="text"><?php _e('Text', 'woothemes') ?></option>
</select>
</div>
</div>
<div class="clear"></div>
<p class="submit"><input type="submit" name="add_new_attribute" id="submit" class="button" value="<?php _e('Add Attribute', 'jigoshop'); ?>"></p>
<p class="submit"><input type="submit" name="add_new_attribute" id="submit" class="button" value="<?php _e('Add Attribute', 'woothemes'); ?>"></p>
</form>
</div>
</div>
@ -237,7 +228,7 @@ function jigoshop_add_attribute() {
/* <![CDATA[ */
jQuery('a.delete').click(function(){
var answer = confirm ("<?php _e('Are you sure you want to delete this?', 'jigoshop'); ?>");
var answer = confirm ("<?php _e('Are you sure you want to delete this?', 'woothemes'); ?>");
if (answer) return true;
return false;
});

View File

@ -1,40 +1,39 @@
<?php
/**
* Functions used for displaying the jigoshop dashboard
* Functions used for displaying the WooCommerce store dashboard
*
* @author Jigowatt
* @author WooThemes
* @category Admin
* @package JigoShop
* @package WooCommerce
*/
/**
* Function for showing the dashboard
*
* The dashboard shows widget for things such as:
* The dashboard shows widgets for things such as:
* - Products
* - Sales
* - Recent reviews
*
* @since 1.0
* @usedby jigoshop_admin_menu()
* - Inventory notifications
* - WooCommerce news and updates
*/
function jigoshop_dashboard() {
function woocommerce_dashboard() {
?>
<div class="wrap jigoshop">
<div class="icon32 jigoshop_icon"><br/></div>
<h2><?php _e('Jigoshop Dashboard','jigoshop'); ?></h2>
<div id="jigoshop_dashboard">
<div class="wrap woocommerce">
<div class="icon32 woocommerce_icon"><br/></div>
<h2><?php _e('WooCommerce Dashboard', 'woothemes'); ?></h2>
<div id="woocommerce_dashboard">
<div id="dashboard-widgets" class="metabox-holder">
<div class="postbox-container" style="width:49%;">
<div id="jigoshop_right_now" class="jigoshop_right_now postbox">
<h3><?php _e('Right Now', 'jigoshop') ?></h3>
<div id="woocommerce_right_now" class="woocommerce_right_now postbox">
<h3><?php _e('Right Now', 'woothemes') ?></h3>
<div class="inside">
<div class="table table_content">
<p class="sub"><?php _e('Shop Content', 'jigoshop'); ?></p>
<p class="sub"><?php _e('Shop Content', 'woothemes'); ?></p>
<table>
<tbody>
<tr class="first">
@ -43,55 +42,55 @@ function jigoshop_dashboard() {
$num = number_format_i18n( $num_posts->publish );
echo $num;
?></a></td>
<td class="t"><a href="edit.php?post_type=product"><?php _e('Products', 'jigoshop'); ?></a></td>
<td class="t"><a href="edit.php?post_type=product"><?php _e('Products', 'woothemes'); ?></a></td>
</tr>
<tr>
<td class="first b"><a href="edit-tags.php?taxonomy=product_cat&post_type=product"><?php
echo wp_count_terms('product_cat');
?></a></td>
<td class="t"><a href="edit-tags.php?taxonomy=product_cat&post_type=product"><?php _e('Product Categories', 'jigoshop'); ?></a></td>
<td class="t"><a href="edit-tags.php?taxonomy=product_cat&post_type=product"><?php _e('Product Categories', 'woothemes'); ?></a></td>
</tr>
<tr>
<td class="first b"><a href="edit-tags.php?taxonomy=product_tag&post_type=product"><?php
echo wp_count_terms('product_tag');
?></a></td>
<td class="t"><a href="edit-tags.php?taxonomy=product_tag&post_type=product"><?php _e('Product Tag', 'jigoshop'); ?></a></td>
<td class="t"><a href="edit-tags.php?taxonomy=product_tag&post_type=product"><?php _e('Product Tag', 'woothemes'); ?></a></td>
</tr>
<tr>
<td class="first b"><a href="admin.php?page=attributes"><?php
echo sizeof(jigoshop::$attribute_taxonomies);
echo sizeof(woocommerce::$attribute_taxonomies);
?></a></td>
<td class="t"><a href="admin.php?page=attributes"><?php _e('Attribute taxonomies', 'jigoshop'); ?></a></td>
<td class="t"><a href="admin.php?page=attributes"><?php _e('Attribute taxonomies', 'woothemes'); ?></a></td>
</tr>
</tbody>
</table>
</div>
<div class="table table_discussion">
<p class="sub"><?php _e('Orders', 'jigoshop'); ?></p>
<p class="sub"><?php _e('Orders', 'woothemes'); ?></p>
<table>
<tbody>
<?php $jigoshop_orders = &new jigoshop_orders(); ?>
<?php $woocommerce_orders = &new woocommerce_orders(); ?>
<tr class="first">
<td class="b"><a href="edit.php?post_type=shop_order&shop_order_status=pending"><span class="total-count"><?php echo $jigoshop_orders->pending_count; ?></span></a></td>
<td class="last t"><a class="pending" href="edit.php?post_type=shop_order&shop_order_status=pending"><?php _e('Pending', 'jigoshop'); ?></a></td>
<td class="b"><a href="edit.php?post_type=shop_order&shop_order_status=pending"><span class="total-count"><?php echo $woocommerce_orders->pending_count; ?></span></a></td>
<td class="last t"><a class="pending" href="edit.php?post_type=shop_order&shop_order_status=pending"><?php _e('Pending', 'woothemes'); ?></a></td>
</tr>
<tr>
<td class="b"><a href="edit.php?post_type=shop_order&shop_order_status=on-hold"><span class="total-count"><?php echo $jigoshop_orders->on_hold_count; ?></span></a></td>
<td class="last t"><a class="onhold" href="edit.php?post_type=shop_order&shop_order_status=on-hold"><?php _e('On-Hold', 'jigoshop'); ?></a></td>
<td class="b"><a href="edit.php?post_type=shop_order&shop_order_status=on-hold"><span class="total-count"><?php echo $woocommerce_orders->on_hold_count; ?></span></a></td>
<td class="last t"><a class="onhold" href="edit.php?post_type=shop_order&shop_order_status=on-hold"><?php _e('On-Hold', 'woothemes'); ?></a></td>
</tr>
<tr>
<td class="b"><a href="edit.php?post_type=shop_order&shop_order_status=processing"><span class="total-count"><?php echo $jigoshop_orders->processing_count; ?></span></a></td>
<td class="last t"><a class="processing" href="edit.php?post_type=shop_order&shop_order_status=processing"><?php _e('Processing', 'jigoshop'); ?></a></td>
<td class="b"><a href="edit.php?post_type=shop_order&shop_order_status=processing"><span class="total-count"><?php echo $woocommerce_orders->processing_count; ?></span></a></td>
<td class="last t"><a class="processing" href="edit.php?post_type=shop_order&shop_order_status=processing"><?php _e('Processing', 'woothemes'); ?></a></td>
</tr>
<tr>
<td class="b"><a href="edit.php?post_type=shop_order&shop_order_status=completed"><span class="total-count"><?php echo $jigoshop_orders->completed_count; ?></span></a></td>
<td class="last t"><a class="complete" href="edit.php?post_type=shop_order&shop_order_status=completed"><?php _e('Completed', 'jigoshop'); ?></a></td>
<td class="b"><a href="edit.php?post_type=shop_order&shop_order_status=completed"><span class="total-count"><?php echo $woocommerce_orders->completed_count; ?></span></a></td>
<td class="last t"><a class="complete" href="edit.php?post_type=shop_order&shop_order_status=completed"><?php _e('Completed', 'woothemes'); ?></a></td>
</tr>
</tbody>
</table>
</div>
<div class="versions">
<p id="wp-version-message"><?php _e('You are using', 'jigoshop'); ?> <strong>JigoShop <?php echo JIGOSHOP_VERSION; ?>.</strong></p>
<p id="wp-version-message"><?php _e('You are using', 'woothemes'); ?> <strong>WooCommerce <?php echo WOOCOMMERCE_VERSION; ?>.</strong></p>
</div>
<div class="clear"></div>
</div>
@ -99,7 +98,7 @@ function jigoshop_dashboard() {
</div><!-- postbox end -->
<div class="postbox">
<h3 class="hndle" id="poststuff"><span><?php _e('Recent Orders', 'jigoshop') ?></span></h3>
<h3 class="hndle" id="poststuff"><span><?php _e('Recent Orders', 'woothemes') ?></span></h3>
<div class="inside">
<?php
$args = array(
@ -114,12 +113,12 @@ function jigoshop_dashboard() {
echo '<ul class="recent-orders">';
foreach ($orders as $order) :
$this_order = &new jigoshop_order( $order->ID );
$this_order = &new woocommerce_order( $order->ID );
echo '
<li>
<span class="order-status '.sanitize_title($this_order->status).'">'.ucwords($this_order->status).'</span> <a href="'.admin_url('post.php?post='.$order->ID).'&action=edit">'.date_i18n('l jS \of F Y h:i:s A', strtotime($this_order->order_date)).'</a><br />
<small>'.sizeof($this_order->items).' '._n('item', 'items', sizeof($this_order->items), 'jigoshop').' <span class="order-cost">'.__('Total: ', 'jigoshop').jigoshop_price($this_order->order_total).'</span></small>
<small>'.sizeof($this_order->items).' '._n('item', 'items', sizeof($this_order->items), 'woothemes').' <span class="order-cost">'.__('Total: ', 'woothemes').woocommerce_price($this_order->order_total).'</span></small>
</li>';
endforeach;
@ -129,17 +128,17 @@ function jigoshop_dashboard() {
</div>
</div><!-- postbox end -->
<?php if (get_option('jigoshop_manage_stock')=='yes') : ?>
<div class="postbox jigoshop_right_now">
<h3 class="hndle" id="poststuff"><span><?php _e('Stock Report', 'jigoshop') ?></span></h3>
<?php if (get_option('woocommerce_manage_stock')=='yes') : ?>
<div class="postbox woocommerce_right_now">
<h3 class="hndle" id="poststuff"><span><?php _e('Stock Report', 'woothemes') ?></span></h3>
<div class="inside">
<?php
$lowstockamount = get_option('jigoshop_notify_low_stock_amount');
$lowstockamount = get_option('woocommerce_notify_low_stock_amount');
if (!is_numeric($lowstockamount)) $lowstockamount = 1;
$nostockamount = get_option('jigoshop_notify_no_stock_amount');
$nostockamount = get_option('woocommerce_notify_no_stock_amount');
if (!is_numeric($nostockamount)) $nostockamount = 1;
$outofstock = array();
@ -153,7 +152,7 @@ function jigoshop_dashboard() {
$my_query = new WP_Query($args);
if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post();
$_product = &new jigoshop_product( $my_query->post->ID );
$_product = &new woocommerce_product( $my_query->post->ID );
if (!$_product->managing_stock()) continue;
$thisitem = '<tr class="first">
@ -172,15 +171,15 @@ function jigoshop_dashboard() {
wp_reset_query();
if (sizeof($lowinstock)==0) :
$lowinstock[] = '<tr><td colspan="2">'.__('No products are low in stock.', 'jigoshop').'</td></tr>';
$lowinstock[] = '<tr><td colspan="2">'.__('No products are low in stock.', 'woothemes').'</td></tr>';
endif;
if (sizeof($outofstock)==0) :
$outofstock[] = '<tr><td colspan="2">'.__('No products are out of stock.', 'jigoshop').'</td></tr>';
$outofstock[] = '<tr><td colspan="2">'.__('No products are out of stock.', 'woothemes').'</td></tr>';
endif;
?>
<div class="table table_content">
<p class="sub"><?php _e('Low Stock', 'jigoshop'); ?></p>
<p class="sub"><?php _e('Low Stock', 'woothemes'); ?></p>
<table>
<tbody>
<?php echo implode('', $lowinstock); ?>
@ -188,7 +187,7 @@ function jigoshop_dashboard() {
</table>
</div>
<div class="table table_discussion">
<p class="sub"><?php _e('Out of Stock/Backorders', 'jigoshop'); ?></p>
<p class="sub"><?php _e('Out of Stock/Backorders', 'woothemes'); ?></p>
<table>
<tbody>
<?php echo implode('', $outofstock); ?>
@ -212,11 +211,11 @@ function jigoshop_dashboard() {
if (isset($_GET['month'])) $current_month_offset = (int) $_GET['month'];
?>
<div class="postbox stats" id="jigoshop-stats">
<div class="postbox stats" id="woocommerce-stats">
<h3 class="hndle" id="poststuff">
<?php if ($current_month_offset!=date('m')) : ?><a href="admin.php?page=jigoshop&amp;month=<?php echo $current_month_offset+1; ?>" class="next">Next Month &rarr;</a><?php endif; ?>
<a href="admin.php?page=jigoshop&amp;month=<?php echo $current_month_offset-1; ?>" class="previous">&larr; Previous Month</a>
<span><?php _e('Monthly Sales', 'jigoshop') ?></span></h3>
<?php if ($current_month_offset!=date('m')) : ?><a href="admin.php?page=woocommerce&amp;month=<?php echo $current_month_offset+1; ?>" class="next">Next Month &rarr;</a><?php endif; ?>
<a href="admin.php?page=woocommerce&amp;month=<?php echo $current_month_offset-1; ?>" class="previous">&larr; Previous Month</a>
<span><?php _e('Monthly Sales', 'woothemes') ?></span></h3>
<div class="inside">
<div id="placeholder" style="width:100%; height:300px; position:relative;"></div>
<script type="text/javascript">
@ -304,7 +303,7 @@ function jigoshop_dashboard() {
if ($orders) :
foreach ($orders as $order) :
$order_data = &new jigoshop_order($order->ID);
$order_data = &new woocommerce_order($order->ID);
if ($order_data->status=='cancelled' || $order_data->status=='refunded') continue;
@ -403,7 +402,7 @@ function jigoshop_dashboard() {
} else {
var y = item.datapoint[1].toFixed(2);
showTooltip(item.pageX, item.pageY, item.series.label + " - <?php echo get_jigoshop_currency_symbol(); ?>" + y);
showTooltip(item.pageX, item.pageY, item.series.label + " - <?php echo get_woocommerce_currency_symbol(); ?>" + y);
}
@ -423,8 +422,8 @@ function jigoshop_dashboard() {
</div><!-- postbox end -->
<div class="postbox">
<h3 class="hndle" id="poststuff"><span><?php _e('Recent Product Reviews', 'jigoshop') ?></span></h3>
<div class="inside jigoshop-reviews-widget">
<h3 class="hndle" id="poststuff"><span><?php _e('Recent Product Reviews', 'woothemes') ?></span></h3>
<div class="inside woocommerce-reviews-widget">
<?php
global $wpdb;
$comments = $wpdb->get_results("SELECT *, SUBSTRING(comment_content,1,100) AS comment_excerpt
@ -448,7 +447,7 @@ function jigoshop_dashboard() {
$rating = get_comment_meta( $comment->comment_ID, 'rating', true );
echo '<div class="star-rating" title="'.$rating.'">
<span style="width:'.($rating*16).'px">'.$rating.' '.__('out of 5', 'jigoshop').'</span></div>';
<span style="width:'.($rating*16).'px">'.$rating.' '.__('out of 5', 'woothemes').'</span></div>';
echo '<h4 class="meta"><a href="'.get_permalink($comment->ID).'#comment-'.$comment->comment_ID .'">'.$comment->post_title.'</a> reviewed by ' .strip_tags($comment->comment_author) .'</h4>';
echo '<blockquote>'.strip_tags($comment->comment_excerpt).' [...]</blockquote></li>';
@ -456,21 +455,21 @@ function jigoshop_dashboard() {
endforeach;
echo '</ul>';
else :
echo '<p>'.__('There are no product reviews yet.', 'jigoshop').'</p>';
echo '<p>'.__('There are no product reviews yet.', 'woothemes').'</p>';
endif;
?>
</div>
</div><!-- postbox end -->
<div class="postbox">
<h3 class="hndle" id="poststuff"><span><?php _e('Latest News', 'jigoshop') ?></span></h3>
<div class="inside jigoshop-rss-widget">
<h3 class="hndle" id="poststuff"><span><?php _e('Latest News', 'woothemes') ?></span></h3>
<div class="inside woocommerce-rss-widget">
<?php
if (file_exists(ABSPATH.WPINC.'/class-simplepie.php')) {
include_once(ABSPATH.WPINC.'/class-simplepie.php');
$rss = fetch_feed('http://jigoshop.com/feed');
$rss = fetch_feed('http://woocommerce.com/feed');
if (!is_wp_error( $rss ) ) :
@ -490,9 +489,9 @@ function jigoshop_dashboard() {
$date = $item->get_date('U');
if ( ( abs( time() - $date) ) < 86400 ) : // 1 Day
$human_date = sprintf(__('%s ago','jigoshop'), human_time_diff($date));
$human_date = sprintf(__('%s ago', 'woothemes'), human_time_diff($date));
else :
$human_date = date(__('F jS Y','jigoshop'), $date);
$human_date = date(__('F jS Y', 'woothemes'), $date);
endif;
echo '<li><a href="'.$link.'">'.$title.'</a> &ndash; <span class="rss-date">'.$human_date.'</span></li>';
@ -502,11 +501,11 @@ function jigoshop_dashboard() {
echo '</ul>';
else :
echo '<ul><li>'.__('No items found.','jigoshop').'</li></ul>';
echo '<ul><li>'.__('No items found.', 'woothemes').'</li></ul>';
endif;
else :
echo '<ul><li>'.__('No items found.','jigoshop').'</li></ul>';
echo '<ul><li>'.__('No items found.', 'woothemes').'</li></ul>';
endif;
}
@ -515,41 +514,26 @@ function jigoshop_dashboard() {
</div><!-- postbox end -->
<div class="postbox">
<h3 class="hndle" id="poststuff"><span><?php _e('Useful Links', 'jigoshop') ?></span></h3>
<div class="inside jigoshop-links-widget">
<h3 class="hndle" id="poststuff"><span><?php _e('Useful Links', 'woothemes') ?></span></h3>
<div class="inside woocommerce-links-widget">
<ul class="links">
<li><a href="http://jigoshop.com/"><?php _e('Jigoshop', 'jigoshop'); ?></a> &ndash; <?php _e('Learn more about the Jigoshop plugin', 'jigoshop'); ?></li>
<li><a href="http://jigoshop.com/tour/"><?php _e('Tour', 'jigoshop'); ?></a> &ndash; <?php _e('Take a tour of the plugin', 'jigoshop'); ?></li>
<li><a href="http://jigoshop.com/user-guide/"><?php _e('Documentation', 'jigoshop'); ?></a> &ndash; <?php _e('Stuck? Read the plugin\'s documentation.', 'jigoshop'); ?></li>
<li><a href="http://jigoshop.com/forums/"><?php _e('Forums', 'jigoshop'); ?></a> &ndash; <?php _e('Help from the community or our dedicated support team.', 'jigoshop'); ?></li>
<li><a href="http://jigoshop.com/extend/extensions/"><?php _e('Jigoshop Extensions', 'jigoshop'); ?></a> &ndash; <?php _e('Extend Jigoshop with extra plugins and modules.', 'jigoshop'); ?></li>
<li><a href="http://jigoshop.com/extend/themes/"><?php _e('Jigoshop Themes', 'jigoshop'); ?></a> &ndash; <?php _e('Extend Jigoshop with themes.', 'jigoshop'); ?></li>
<li><a href="http://twitter.com/#!/jigoshop"><?php _e('@Jigoshop', 'jigoshop'); ?></a> &ndash; <?php _e('Follow us on Twitter.', 'jigoshop'); ?></li>
<li><a href="https://github.com/mikejolley/Jigoshop"><?php _e('Jigoshop on Github', 'jigoshop'); ?></a> &ndash; <?php _e('Help extend Jigoshop.', 'jigoshop'); ?></li>
<li><a href="http://wordpress.org/extend/plugins/jigoshop/"><?php _e('Jigoshop on WordPress.org', 'jigoshop'); ?></a> &ndash; <?php _e('Leave us a rating!', 'jigoshop'); ?></li>
<li><a href="http://www.woothemes.com/"><?php _e('WooThemes', 'woothemes'); ?></a> &ndash; <?php _e('Premium WordPress Themes', 'woothemes'); ?></li>
<li><a href="https://github.com/mikejolley/woocommerce"><?php _e('WooCommerce on Github', 'woothemes'); ?></a> &ndash; <?php _e('Help extend and develop WooCommerce.', 'woothemes'); ?></li>
<li><a href="http://wordpress.org/extend/plugins/woocommerce/"><?php _e('WooCommerce on WordPress.org', 'woothemes'); ?></a> &ndash; <?php _e('Leave us a rating if you like it!', 'woothemes'); ?></li>
</ul>
<div class="social">
<h4 class="first"><?php _e('Show your support &amp; Help promote Jigoshop!', 'jigoshop'); ?></h4>
<form action="https://www.paypal.com/cgi-bin/webscr" method="post" style="margin: 0 0 1em 0;">
<input type="hidden" name="cmd" value="_s-xclick">
<input type="hidden" name="hosted_button_id" value="TKRER2WH7UAD6">
<input type="image" src="https://www.paypalobjects.com/en_GB/i/btn/btn_donate_SM.gif" border="0" name="submit" alt="PayPal - The safer, easier way to pay online." style="margin:0; padding:0; ">
<img alt="" border="0" src="https://www.paypalobjects.com/en_GB/i/scr/pixel.gif" width="1" height="1">
</form>
<h4 class="first"><?php _e('Show your support for WooCommerce!', 'woothemes'); ?></h4>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fjigoshop.com&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=segoe+ui&amp;height=24" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:24px;" allowTransparency="true"></iframe>
<iframe src="http://www.facebook.com/plugins/like.php?href=http%3A%2F%2Fwoocommerce.com&amp;send=false&amp;layout=standard&amp;width=450&amp;show_faces=false&amp;action=like&amp;colorscheme=light&amp;font=segoe+ui&amp;height=24" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:24px;" allowTransparency="true"></iframe>
<p><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://jigoshop.com/" data-text="Jigoshop: A WordPress eCommerce solution that works" data-count="horizontal" data-via="jigoshop" data-related="Jigowatt:Creators">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></p>
<p><a href="http://twitter.com/share" class="twitter-share-button" data-url="http://woocommerce.com/" data-text="WooCommerce: A WordPress eCommerce solution that works" data-count="horizontal" data-via="woocommerce" data-related="WooThemes:Creators">Tweet</a><script type="text/javascript" src="http://platform.twitter.com/widgets.js"></script></p>
<p><g:plusone size="medium" href="http://jigoshop.com/"></g:plusone><script type="text/javascript" src="https://apis.google.com/js/plusone.js">{lang: 'en-GB'}</script></p>
<p><g:plusone size="medium" href="http://woocommerce.com/"></g:plusone><script type="text/javascript" src="https://apis.google.com/js/plusone.js">{lang: 'en-GB'}</script></p>
<h4><?php _e('Jigoshop is bought to you by&hellip;', 'jigoshop'); ?></h4>
<h4><?php _e('WooCommerce is bought to you by&hellip;', 'woothemes'); ?></h4>
<p><a href="http://jigowatt.co.uk/"><img src="<?php echo jigoshop::plugin_url(); ?>/assets/images/jigowatt.png" alt="Jigowatt" /></a></p>
<p>From design to deployment Jigowatt delivers expert solutions to enterprise customers using Magento & WordPress open source platforms.</p>
<p><a href="http://woocommerce.co.uk/"><img src="<?php echo woocommerce::plugin_url(); ?>/assets/images/woocommerce.png" alt="WooThemes" /></a></p>
</div>
<div class="clear"></div>

87
admin/admin-import.php Normal file
View File

@ -0,0 +1,87 @@
<?php
/**
* Functions for handling WordPress import to make it compatable with WooCommerce
*
* WordPress import should work - however, it fails to import custom product attribute taxonomies.
* This code grabs the file before it is imported and ensures the taxonomies are created.
*
* @author WooThemes
* @category Admin
* @package WooCommerce
*/
function woocommerce_import_start() {
global $wpdb;
$id = (int) $_POST['import_id'];
$file = get_attached_file( $id );
$parser = new WXR_Parser();
$import_data = $parser->parse( $file );
if (isset($import_data['posts'])) :
$posts = $import_data['posts'];
if ($posts && sizeof($posts)>0) foreach ($posts as $post) :
if ($post['post_type']=='product') :
if ($post['terms'] && sizeof($post['terms'])>0) :
foreach ($post['terms'] as $term) :
$domain = $term['domain'];
if (strstr($domain, 'product_attribute_')) :
// Make sure it exists!
if (!taxonomy_exists( $domain )) :
$nicename = ucfirst(str_replace('product_attribute_', '', $domain));
// Create the taxonomy
$wpdb->insert( $wpdb->prefix . "woocommerce_attribute_taxonomies", array( 'attribute_name' => $nicename, 'attribute_type' => 'text' ), array( '%s', '%s' ) );
// Register the taxonomy now so that the import works!
register_taxonomy( $domain,
array('product'),
array(
'hierarchical' => true,
'labels' => array(
'name' => $nicename,
'singular_name' => $nicename,
'search_items' => __( 'Search ', 'woothemes') . $nicename,
'all_items' => __( 'All ', 'woothemes') . $nicename,
'parent_item' => __( 'Parent ', 'woothemes') . $nicename,
'parent_item_colon' => __( 'Parent ', 'woothemes') . $nicename . ':',
'edit_item' => __( 'Edit ', 'woothemes') . $nicename,
'update_item' => __( 'Update ', 'woothemes') . $nicename,
'add_new_item' => __( 'Add New ', 'woothemes') . $nicename,
'new_item_name' => __( 'New ', 'woothemes') . $nicename
),
'show_ui' => false,
'query_var' => true,
'rewrite' => array( 'slug' => strtolower(sanitize_title($nicename)), 'with_front' => false, 'hierarchical' => true ),
)
);
update_option('woocommerce_update_rewrite_rules', '1');
endif;
endif;
endforeach;
endif;
endif;
endforeach;
endif;
}
add_action('import_start', 'woocommerce_import_start');

View File

@ -1,29 +1,25 @@
<?php
/**
* JigoShop Admin
* WooCommerce Admin
*
* Main admin file which loads all settings panels and sets up the menus.
* Main admin file which loads all settings panels and sets up admin menus.
*
* @author Jigowatt
* @author WooThemes
* @category Admin
* @package JigoShop
* @package WooCommerce
*/
include_once( 'admin-settings.php' );
include_once( 'admin-install.php' );
require_once ( 'jigoshop-install.php' );
require_once ( 'jigoshop-admin-dashboard.php' );
require_once ( 'jigoshop-write-panels.php' );
require_once ( 'jigoshop-admin-settings.php' );
require_once ( 'jigoshop-admin-attributes.php' );
require_once ( 'jigoshop-admin-post-types.php' );
function jigoshop_admin_init () {
require_once ( 'jigoshop-admin-settings-options.php' );
function woocommerce_admin_init() {
include_once( 'admin-attributes.php' );
include_once( 'admin-dashboard.php' );
include_once( 'admin-import.php' );
include_once( 'admin-post-types.php' );
include_once( 'writepanels/writepanels-init.php' );
}
add_action('admin_init', 'jigoshop_admin_init');
add_action('admin_init', 'woocommerce_admin_init');
/**
* Admin Menus
@ -32,61 +28,59 @@ add_action('admin_init', 'jigoshop_admin_init');
*
* @since 1.0
*/
function jigoshop_admin_menu() {
function woocommerce_admin_menu() {
global $menu;
$menu[] = array( '', 'read', 'separator-jigoshop', '', 'wp-menu-separator' );
$menu[] = array( '', 'read', 'separator-woocommerce', '', 'wp-menu-separator' );
add_menu_page(__('Jigoshop'), __('Jigoshop'), 'manage_options', 'jigoshop' , 'jigoshop_dashboard', jigoshop::plugin_url() . '/assets/images/icons/menu_icons.png', 56);
add_submenu_page('jigoshop', __('Dashboard', 'jigoshop'), __('Dashboard', 'jigoshop'), 'manage_options', 'jigoshop', 'jigoshop_dashboard');
add_submenu_page('jigoshop', __('General Settings', 'jigoshop'), __('Settings', 'jigoshop') , 'manage_options', 'settings', 'jigoshop_settings');
add_submenu_page('jigoshop', __('System Info','jigoshop'), __('System Info','jigoshop'), 'manage_options', 'sysinfo', 'jigoshop_system_info');
add_submenu_page('edit.php?post_type=product', __('Attributes','jigoshop'), __('Attributes','jigoshop'), 'manage_options', 'attributes', 'jigoshop_attributes');
add_menu_page(__('WooCommerce'), __('WooCommerce'), 'manage_options', 'woocommerce' , 'woocommerce_dashboard', woocommerce::plugin_url() . '/assets/images/icons/menu_icons.png', 56);
add_submenu_page('woocommerce', __('Dashboard', 'woothemes'), __('Dashboard', 'woothemes'), 'manage_options', 'woocommerce', 'woocommerce_dashboard');
add_submenu_page('woocommerce', __('General Settings', 'woothemes'), __('Settings', 'woothemes') , 'manage_options', 'settings', 'woocommerce_settings');
add_submenu_page('woocommerce', __('System Info', 'woothemes'), __('System Info', 'woothemes'), 'manage_options', 'sysinfo', 'woocommerce_system_info');
add_submenu_page('edit.php?post_type=product', __('Attributes', 'woothemes'), __('Attributes', 'woothemes'), 'manage_options', 'attributes', 'woocommerce_attributes');
}
function jigoshop_admin_menu_order( $menu_order ) {
function woocommerce_admin_menu_order( $menu_order ) {
// Initialize our custom order array
$jigoshop_menu_order = array();
$woocommerce_menu_order = array();
// Get the index of our custom separator
$jigoshop_separator = array_search( 'separator-jigoshop', $menu_order );
$woocommerce_separator = array_search( 'separator-woocommerce', $menu_order );
// Loop through menu order and do some rearranging
foreach ( $menu_order as $index => $item ) :
if ( ( ( 'jigoshop' ) == $item ) ) :
$jigoshop_menu_order[] = 'separator-jigoshop';
unset( $menu_order[$jigoshop_separator] );
if ( ( ( 'woocommerce' ) == $item ) ) :
$woocommerce_menu_order[] = 'separator-woocommerce';
unset( $menu_order[$woocommerce_separator] );
endif;
if ( !in_array( $item, array( 'separator-jigoshop' ) ) ) :
$jigoshop_menu_order[] = $item;
if ( !in_array( $item, array( 'separator-woocommerce' ) ) ) :
$woocommerce_menu_order[] = $item;
endif;
endforeach;
// Return order
return $jigoshop_menu_order;
return $woocommerce_menu_order;
}
function jigoshop_admin_custom_menu_order() {
function woocommerce_admin_custom_menu_order() {
if ( !current_user_can( 'manage_options' ) ) return false;
return true;
}
add_action('admin_menu', 'jigoshop_admin_menu');
add_action('menu_order', 'jigoshop_admin_menu_order');
add_action('custom_menu_order', 'jigoshop_admin_custom_menu_order');
add_action('admin_menu', 'woocommerce_admin_menu');
add_action('menu_order', 'woocommerce_admin_menu_order');
add_action('custom_menu_order', 'woocommerce_admin_custom_menu_order');
/**
* Admin Head
*
* Outputs some styles in the admin <head> to show icons on the jigoshop admin pages
*
* @since 1.0
* Outputs some styles in the admin <head> to show icons on the woocommerce admin pages
*/
function jigoshop_admin_head() {
function woocommerce_admin_head() {
?>
<style type="text/css">
@ -99,57 +93,54 @@ function jigoshop_admin_head() {
</style>
<?php
}
add_action('admin_head', 'jigoshop_admin_head');
add_action('admin_head', 'woocommerce_admin_head');
/**
* System info
*
* Shows the system info panel which contains version data and debug info
*
* @since 1.0
* @usedby jigoshop_settings()
*/
function jigoshop_system_info() {
function woocommerce_system_info() {
?>
<div class="wrap jigoshop">
<div class="icon32 icon32-jigoshop-debug" id="icon-jigoshop"><br/></div>
<h2><?php _e('System Information','jigoshop') ?></h2>
<div class="wrap woocommerce">
<div class="icon32 icon32-woocommerce-debug" id="icon-woocommerce"><br/></div>
<h2><?php _e('System Information', 'woothemes') ?></h2>
<div id="tabs-wrap">
<ul class="tabs">
<li><a href="#versions"><?php _e('Environment', 'jigoshop'); ?></a></li>
<li><a href="#debugging"><?php _e('Debugging', 'jigoshop'); ?></a></li>
<li><a href="#versions"><?php _e('Environment', 'woothemes'); ?></a></li>
<li><a href="#debugging"><?php _e('Debugging', 'woothemes'); ?></a></li>
</ul>
<div id="versions" class="panel">
<table class="widefat fixed" style="width:850px;">
<thead>
<tr>
<th scope="col" width="200px"><?php _e('Versions','jigoshop')?></th>
<th scope="col" width="200px"><?php _e('Versions', 'woothemes')?></th>
<th scope="col">&nbsp;</th>
</tr>
</thead>
<tbody>
<tr>
<td class="titledesc"><?php _e('Jigoshop Version','jigoshop')?></td>
<td class="forminp"><?php echo jigoshop::get_var('version'); ?></td>
<td class="titledesc"><?php _e('WooCommerce Version', 'woothemes')?></td>
<td class="forminp"><?php echo woocommerce::get_var('version'); ?></td>
</tr>
<tr>
<td class="titledesc"><?php _e('WordPress Version','jigoshop')?></td>
<td class="titledesc"><?php _e('WordPress Version', 'woothemes')?></td>
<td class="forminp"><?php if (is_multisite()) echo 'WPMU'; else echo 'WP'; ?> <?php echo bloginfo('version'); ?></td>
</tr>
</tbody>
<thead>
<tr>
<th scope="col" width="200px"><?php _e('Server','jigoshop')?></th>
<th scope="col" width="200px"><?php _e('Server', 'woothemes')?></th>
<th scope="col">&nbsp;</th>
</tr>
</thead>
<tbody>
<tr>
<td class="titledesc"><?php _e('PHP Version','jigoshop')?></td>
<td class="titledesc"><?php _e('PHP Version', 'woothemes')?></td>
<td class="forminp"><?php if(function_exists('phpversion')) echo phpversion(); ?></td>
</tr>
<tr>
<td class="titledesc"><?php _e('Server Software','jigoshop')?></td>
<td class="titledesc"><?php _e('Server Software', 'woothemes')?></td>
<td class="forminp"><?php echo $_SERVER['SERVER_SOFTWARE']; ?></td>
</tr>
</tbody>
@ -159,38 +150,38 @@ function jigoshop_system_info() {
<table class="widefat fixed" style="width:850px;">
<tbody>
<tr>
<th scope="col" width="200px"><?php _e('Debug Information','jigoshop')?></th>
<th scope="col" width="200px"><?php _e('Debug Information', 'woothemes')?></th>
<th scope="col">&nbsp;</th>
</tr>
<tr>
<td class="titledesc"><?php _e('UPLOAD_MAX_FILESIZE','jigoshop')?></td>
<td class="titledesc"><?php _e('UPLOAD_MAX_FILESIZE', 'woothemes')?></td>
<td class="forminp"><?php
if(function_exists('phpversion')) echo (jigoshop_let_to_num(ini_get('upload_max_filesize'))/(1024*1024))."MB";
if(function_exists('phpversion')) echo (woocommerce_let_to_num(ini_get('upload_max_filesize'))/(1024*1024))."MB";
?></td>
</tr>
<tr>
<td class="titledesc"><?php _e('POST_MAX_SIZE','jigoshop')?></td>
<td class="titledesc"><?php _e('POST_MAX_SIZE', 'woothemes')?></td>
<td class="forminp"><?php
if(function_exists('phpversion')) echo (jigoshop_let_to_num(ini_get('post_max_size'))/(1024*1024))."MB";
if(function_exists('phpversion')) echo (woocommerce_let_to_num(ini_get('post_max_size'))/(1024*1024))."MB";
?></td>
</tr>
<tr>
<td class="titledesc"><?php _e('WordPress Memory Limit','jigoshop')?></td>
<td class="titledesc"><?php _e('WordPress Memory Limit', 'woothemes')?></td>
<td class="forminp"><?php
echo (jigoshop_let_to_num(WP_MEMORY_LIMIT)/(1024*1024))."MB";
echo (woocommerce_let_to_num(WP_MEMORY_LIMIT)/(1024*1024))."MB";
?></td>
</tr>
<tr>
<td class="titledesc"><?php _e('WP_DEBUG','jigoshop')?></td>
<td class="forminp"><?php if (WP_DEBUG) echo __('On', 'jigoshop'); else __('Off', 'jigoshop'); ?></td>
<td class="titledesc"><?php _e('WP_DEBUG', 'woothemes')?></td>
<td class="forminp"><?php if (WP_DEBUG) echo __('On', 'woothemes'); else __('Off', 'woothemes'); ?></td>
</tr>
<tr>
<td class="titledesc"><?php _e('DISPLAY_ERRORS','jigoshop')?></td>
<td class="titledesc"><?php _e('DISPLAY_ERRORS', 'woothemes')?></td>
<td class="forminp"><?php if(function_exists('phpversion')) echo ini_get('display_errors'); ?></td>
</tr>
<tr>
<td class="titledesc"><?php _e('FSOCKOPEN','jigoshop')?></td>
<td class="forminp"><?php if(function_exists('fsockopen')) echo '<span style="color:green">' . __('Your server supports fsockopen.', 'jigoshop'). '</span>'; else echo '<span style="color:red">' . __('Your server does not support fsockopen.', 'jigoshop'). '</span>'; ?></td>
<td class="titledesc"><?php _e('FSOCKOPEN', 'woothemes')?></td>
<td class="forminp"><?php if(function_exists('fsockopen')) echo '<span style="color:green">' . __('Your server supports fsockopen.', 'woothemes'). '</span>'; else echo '<span style="color:red">' . __('Your server does not support fsockopen.', 'woothemes'). '</span>'; ?></td>
</tr>
</tbody>
</table>
@ -215,13 +206,16 @@ function jigoshop_system_info() {
<?php
}
function jigoshop_feature_product () {
/**
* Feature a product from admin
*/
function woocommerce_feature_product() {
if( !is_admin() ) die;
if( !current_user_can('edit_posts') ) wp_die( __('You do not have sufficient permissions to access this page.') );
if( !check_admin_referer()) wp_die( __('You have taken too long. Please go back and retry.', 'jigoshop') );
if( !check_admin_referer()) wp_die( __('You have taken too long. Please go back and retry.', 'woothemes') );
$post_id = isset($_GET['product_id']) && (int)$_GET['product_id'] ? (int)$_GET['product_id'] : '';
@ -232,7 +226,7 @@ function jigoshop_feature_product () {
if($post->post_type !== 'product') die;
$product = new jigoshop_product($post->ID);
$product = new woocommerce_product($post->ID);
if ($product->is_featured()) update_post_meta($post->ID, 'featured', 'no');
else update_post_meta($post->ID, 'featured', 'yes');
@ -241,12 +235,12 @@ function jigoshop_feature_product () {
wp_safe_redirect( $sendback );
}
add_action('wp_ajax_jigoshop-feature-product', 'jigoshop_feature_product');
add_action('wp_ajax_woocommerce-feature-product', 'woocommerce_feature_product');
/**
* Returns proper post_type
*/
function jigoshop_get_current_post_type() {
function woocommerce_get_current_post_type() {
global $post, $typenow, $current_screen;
@ -267,26 +261,22 @@ function jigoshop_get_current_post_type() {
}
/**
* Categories ordering
* Categories ordering scripts
*/
/**
* Load needed scripts to order categories
*/
function jigoshop_categories_scripts () {
function woocommerce_categories_scripts () {
if( !isset($_GET['taxonomy']) || $_GET['taxonomy'] !== 'product_cat') return;
wp_register_script('jigoshop-categories-ordering', jigoshop::plugin_url() . '/assets/js/categories-ordering.js', array('jquery-ui-sortable'));
wp_print_scripts('jigoshop-categories-ordering');
wp_register_script('woocommerce-categories-ordering', woocommerce::plugin_url() . '/assets/js/categories-ordering.js', array('jquery-ui-sortable'));
wp_print_scripts('woocommerce-categories-ordering');
}
add_action('admin_footer-edit-tags.php', 'jigoshop_categories_scripts');
add_action('admin_footer-edit-tags.php', 'woocommerce_categories_scripts');
/**
* Ajax request handling for categories ordering
*/
function jigoshop_categories_ordering () {
function woocommerce_categories_ordering() {
global $wpdb;
@ -295,7 +285,7 @@ function jigoshop_categories_ordering () {
if( ! $id || ! $term = get_term_by('id', $id, 'product_cat') ) die(0);
jigoshop_order_categories ( $term, $next_id);
woocommerce_order_categories( $term, $next_id );
$children = get_terms('product_cat', "child_of=$id&menu_order=ASC&hide_empty=0");
if( $term && sizeof($children) ) {
@ -304,4 +294,4 @@ function jigoshop_categories_ordering () {
}
}
add_action('wp_ajax_jigoshop-categories-ordering', 'jigoshop_categories_ordering');
add_action('wp_ajax_woocommerce-categories-ordering', 'woocommerce_categories_ordering');

View File

@ -1,74 +1,65 @@
<?php
/**
* JigoShop Install
* WooCommerce Install
*
* Plugin install script which adds default pages, taxonomies, and database tables
*
* @author Jigowatt
* @author WooThemes
* @category Admin
* @package JigoShop
* @package WooCommerce
*/
/**
* Install jigoshop
* Install woocommerce
*
* Calls each function to install bits, and clears the cron jobs and rewrite rules
*
* @since 1.0
* Calls each function to install things, and clears the cron jobs and rewrite rules
*/
function install_jigoshop() {
function install_woocommerce() {
// Get options and define post types before we start
require_once ( 'jigoshop-admin-settings-options.php' );
jigoshop_post_type();
// Define post types before we start
woocommerce_post_type();
// Do install
jigoshop_default_options();
jigoshop_create_pages();
jigoshop_tables_install();
jigoshop_post_type();
jigoshop_default_taxonomies();
woocommerce_default_options();
woocommerce_create_pages();
woocommerce_tables_install();
woocommerce_default_taxonomies();
// Clear cron
wp_clear_scheduled_hook('jigoshop_update_sale_prices_schedule_check');
update_option('jigoshop_update_sale_prices', 'no');
wp_clear_scheduled_hook('woocommerce_update_sale_prices_schedule_check');
update_option('woocommerce_update_sale_prices', 'no');
// Flush Rules
global $wp_rewrite;
$wp_rewrite->flush_rules();
// Update version
update_option( "jigoshop_db_version", JIGOSHOP_VERSION );
update_option( "woocommerce_db_version", WOOCOMMERCE_VERSION );
}
/**
* Default options
*
* Sets up the default options used on the settings page
*
* @since 1.0
*/
function jigoshop_default_options() {
function woocommerce_default_options() {
global $options_settings;
foreach ($options_settings as $value) {
if (isset($value['std'])) add_option($value['id'], $value['std']);
}
add_option('jigoshop_shop_slug', 'shop');
add_option('woocommerce_shop_slug', 'shop');
}
/**
* Create pages
*
* Creates pages that the plugin relies on, storing page id's in variables.
*
* @since 1.0
*/
function jigoshop_create_pages() {
function woocommerce_create_pages() {
global $wpdb;
$slug = esc_sql( _x('shop', 'page_slug', 'jigoshop') );
$slug = esc_sql( _x('shop', 'page_slug', 'woothemes') );
$page_found = $wpdb->get_var("SELECT ID FROM " . $wpdb->posts . " WHERE post_name = '$slug' LIMIT 1");
if(!$page_found) {
@ -78,19 +69,19 @@ function jigoshop_create_pages() {
'post_type' => 'page',
'post_author' => 1,
'post_name' => $slug,
'post_title' => __('Shop', 'jigoshop'),
'post_title' => __('Shop', 'woothemes'),
'post_content' => '',
'comment_status' => 'closed'
);
$page_id = wp_insert_post($page_data);
update_option('jigoshop_shop_page_id', $page_id);
update_option('woocommerce_shop_page_id', $page_id);
} else {
update_option('jigoshop_shop_page_id', $page_found);
update_option('woocommerce_shop_page_id', $page_found);
}
$slug = esc_sql( _x('cart', 'page_slug', 'jigoshop') );
$slug = esc_sql( _x('cart', 'page_slug', 'woothemes') );
$page_found = $wpdb->get_var("SELECT ID FROM " . $wpdb->posts . " WHERE post_name = '$slug' LIMIT 1");
if(!$page_found) {
@ -100,19 +91,19 @@ function jigoshop_create_pages() {
'post_type' => 'page',
'post_author' => 1,
'post_name' => $slug,
'post_title' => __('Cart', 'jigoshop'),
'post_content' => '[jigoshop_cart]',
'post_title' => __('Cart', 'woothemes'),
'post_content' => '[woocommerce_cart]',
'comment_status' => 'closed'
);
$page_id = wp_insert_post($page_data);
update_option('jigoshop_cart_page_id', $page_id);
update_option('woocommerce_cart_page_id', $page_id);
} else {
update_option('jigoshop_cart_page_id', $page_found);
update_option('woocommerce_cart_page_id', $page_found);
}
$slug = esc_sql( _x('checkout', 'page_slug', 'jigoshop') );
$slug = esc_sql( _x('checkout', 'page_slug', 'woothemes') );
$page_found = $wpdb->get_var("SELECT ID FROM " . $wpdb->posts . " WHERE post_name = '$slug' LIMIT 1");
if(!$page_found) {
@ -122,19 +113,19 @@ function jigoshop_create_pages() {
'post_type' => 'page',
'post_author' => 1,
'post_name' => $slug,
'post_title' => __('Checkout', 'jigoshop'),
'post_content' => '[jigoshop_checkout]',
'post_title' => __('Checkout', 'woothemes'),
'post_content' => '[woocommerce_checkout]',
'comment_status' => 'closed'
);
$page_id = wp_insert_post($page_data);
update_option('jigoshop_checkout_page_id', $page_id);
update_option('woocommerce_checkout_page_id', $page_id);
} else {
update_option('jigoshop_checkout_page_id', $page_found);
update_option('woocommerce_checkout_page_id', $page_found);
}
$slug = esc_sql( _x('order-tracking', 'page_slug', 'jigoshop') );
$slug = esc_sql( _x('order-tracking', 'page_slug', 'woothemes') );
$page_found = $wpdb->get_var("SELECT ID FROM " . $wpdb->posts . " WHERE post_name = '$slug' LIMIT 1");
if(!$page_found) {
@ -144,14 +135,14 @@ function jigoshop_create_pages() {
'post_type' => 'page',
'post_author' => 1,
'post_name' => $slug,
'post_title' => __('Track your order', 'jigoshop'),
'post_content' => '[jigoshop_order_tracking]',
'post_title' => __('Track your order', 'woothemes'),
'post_content' => '[woocommerce_order_tracking]',
'comment_status' => 'closed'
);
$page_id = wp_insert_post($page_data);
}
$slug = esc_sql( _x('my-account', 'page_slug', 'jigoshop') );
$slug = esc_sql( _x('my-account', 'page_slug', 'woothemes') );
$page_found = $wpdb->get_var("SELECT ID FROM " . $wpdb->posts . " WHERE post_name = '$slug' LIMIT 1");
if(!$page_found) {
@ -161,19 +152,19 @@ function jigoshop_create_pages() {
'post_type' => 'page',
'post_author' => 1,
'post_name' => $slug,
'post_title' => __('My Account', 'jigoshop'),
'post_content' => '[jigoshop_my_account]',
'post_title' => __('My Account', 'woothemes'),
'post_content' => '[woocommerce_my_account]',
'comment_status' => 'closed'
);
$page_id = wp_insert_post($page_data);
update_option('jigoshop_myaccount_page_id', $page_id);
update_option('woocommerce_myaccount_page_id', $page_id);
} else {
update_option('jigoshop_myaccount_page_id', $page_found);
update_option('woocommerce_myaccount_page_id', $page_found);
}
$slug = esc_sql( _x('edit-address', 'page_slug', 'jigoshop') );
$slug = esc_sql( _x('edit-address', 'page_slug', 'woothemes') );
$page_found = $wpdb->get_var("SELECT ID FROM " . $wpdb->posts . " WHERE post_name = '$slug' LIMIT 1");
if(!$page_found) {
@ -181,22 +172,22 @@ function jigoshop_create_pages() {
$page_data = array(
'post_status' => 'publish',
'post_type' => 'page',
'post_parent' => get_option('jigoshop_myaccount_page_id'),
'post_parent' => get_option('woocommerce_myaccount_page_id'),
'post_author' => 1,
'post_name' => $slug,
'post_title' => __('Edit My Address', 'jigoshop'),
'post_content' => '[jigoshop_edit_address]',
'post_title' => __('Edit My Address', 'woothemes'),
'post_content' => '[woocommerce_edit_address]',
'comment_status' => 'closed'
);
$page_id = wp_insert_post($page_data);
update_option('jigoshop_edit_address_page_id', $page_id);
update_option('woocommerce_edit_address_page_id', $page_id);
} else {
update_option('jigoshop_edit_address_page_id', $page_found);
update_option('woocommerce_edit_address_page_id', $page_found);
}
$slug = esc_sql( _x('view-order', 'page_slug', 'jigoshop') );
$slug = esc_sql( _x('view-order', 'page_slug', 'woothemes') );
$page_found = $wpdb->get_var("SELECT ID FROM " . $wpdb->posts . " WHERE post_name = '$slug' LIMIT 1");
if(!$page_found) {
@ -204,22 +195,22 @@ function jigoshop_create_pages() {
$page_data = array(
'post_status' => 'publish',
'post_type' => 'page',
'post_parent' => get_option('jigoshop_myaccount_page_id'),
'post_parent' => get_option('woocommerce_myaccount_page_id'),
'post_author' => 1,
'post_name' => $slug,
'post_title' => __('View Order', 'jigoshop'),
'post_content' => '[jigoshop_view_order]',
'post_title' => __('View Order', 'woothemes'),
'post_content' => '[woocommerce_view_order]',
'comment_status' => 'closed'
);
$page_id = wp_insert_post($page_data);
update_option('jigoshop_view_order_page_id', $page_id);
update_option('woocommerce_view_order_page_id', $page_id);
} else {
update_option('jigoshop_view_order_page_id', $page_found);
update_option('woocommerce_view_order_page_id', $page_found);
}
$slug = esc_sql( _x('change-password', 'page_slug', 'jigoshop') );
$slug = esc_sql( _x('change-password', 'page_slug', 'woothemes') );
$page_found = $wpdb->get_var("SELECT ID FROM " . $wpdb->posts . " WHERE post_name = '$slug' LIMIT 1");
if(!$page_found) {
@ -227,22 +218,22 @@ function jigoshop_create_pages() {
$page_data = array(
'post_status' => 'publish',
'post_type' => 'page',
'post_parent' => get_option('jigoshop_myaccount_page_id'),
'post_parent' => get_option('woocommerce_myaccount_page_id'),
'post_author' => 1,
'post_name' => $slug,
'post_title' => __('Change Password', 'jigoshop'),
'post_content' => '[jigoshop_change_password]',
'post_title' => __('Change Password', 'woothemes'),
'post_content' => '[woocommerce_change_password]',
'comment_status' => 'closed'
);
$page_id = wp_insert_post($page_data);
update_option('jigoshop_change_password_page_id', $page_id);
update_option('woocommerce_change_password_page_id', $page_id);
} else {
update_option('jigoshop_change_password_page_id', $page_found);
update_option('woocommerce_change_password_page_id', $page_found);
}
$slug = esc_sql( _x('pay', 'page_slug', 'jigoshop') );
$slug = esc_sql( _x('pay', 'page_slug', 'woothemes') );
$page_found = $wpdb->get_var("SELECT ID FROM " . $wpdb->posts . " WHERE post_name = '$slug' LIMIT 1");
if(!$page_found) {
@ -250,23 +241,23 @@ function jigoshop_create_pages() {
$page_data = array(
'post_status' => 'publish',
'post_type' => 'page',
'post_parent' => get_option('jigoshop_checkout_page_id'),
'post_parent' => get_option('woocommerce_checkout_page_id'),
'post_author' => 1,
'post_name' => $slug,
'post_title' => __('Checkout &rarr; Pay', 'jigoshop'),
'post_content' => '[jigoshop_pay]',
'post_title' => __('Checkout &rarr; Pay', 'woothemes'),
'post_content' => '[woocommerce_pay]',
'comment_status' => 'closed'
);
$page_id = wp_insert_post($page_data);
update_option('jigoshop_pay_page_id', $page_id);
update_option('woocommerce_pay_page_id', $page_id);
} else {
update_option('jigoshop_pay_page_id', $page_found);
update_option('woocommerce_pay_page_id', $page_found);
}
// Thank you Page
$slug = esc_sql( _x('thanks', 'page_slug', 'jigoshop') );
$slug = esc_sql( _x('thanks', 'page_slug', 'woothemes') );
$page_found = $wpdb->get_var("SELECT ID FROM " . $wpdb->posts . " WHERE post_name = '$slug' LIMIT 1");
if(!$page_found) {
@ -274,19 +265,19 @@ function jigoshop_create_pages() {
$page_data = array(
'post_status' => 'publish',
'post_type' => 'page',
'post_parent' => get_option('jigoshop_checkout_page_id'),
'post_parent' => get_option('woocommerce_checkout_page_id'),
'post_author' => 1,
'post_name' => $slug,
'post_title' => __('Thank you', 'jigoshop'),
'post_content' => '[jigoshop_thankyou]',
'post_title' => __('Thank you', 'woothemes'),
'post_content' => '[woocommerce_thankyou]',
'comment_status' => 'closed'
);
$page_id = wp_insert_post($page_data);
update_option('jigoshop_thanks_page_id', $page_id);
update_option('woocommerce_thanks_page_id', $page_id);
} else {
update_option('jigoshop_thanks_page_id', $page_found);
update_option('woocommerce_thanks_page_id', $page_found);
}
}
@ -295,28 +286,24 @@ function jigoshop_create_pages() {
* Table Install
*
* Sets up the database tables which the plugin needs to function.
*
* @since 1.0
*/
function jigoshop_tables_install() {
function woocommerce_tables_install() {
global $wpdb;
//$wpdb->show_errors();
$collate = '';
$collate = '';
if($wpdb->supports_collation()) {
if(!empty($wpdb->charset)) $collate = "DEFAULT CHARACTER SET $wpdb->charset";
if(!empty($wpdb->collate)) $collate .= " COLLATE $wpdb->collate";
}
$sql = "CREATE TABLE IF NOT EXISTS ". $wpdb->prefix . "jigoshop_attribute_taxonomies" ." (
$sql = "CREATE TABLE IF NOT EXISTS ". $wpdb->prefix . "woocommerce_attribute_taxonomies" ." (
`attribute_id` mediumint(9) NOT NULL AUTO_INCREMENT,
`attribute_name` varchar(200) NOT NULL,
`attribute_type` varchar(200) NOT NULL,
PRIMARY KEY id (`attribute_id`)) $collate;";
$wpdb->query($sql);
$sql = "CREATE TABLE IF NOT EXISTS ". $wpdb->prefix . "jigoshop_downloadable_product_permissions" ." (
$sql = "CREATE TABLE IF NOT EXISTS ". $wpdb->prefix . "woocommerce_downloadable_product_permissions" ." (
`product_id` mediumint(9) NOT NULL,
`user_email` varchar(200) NOT NULL,
`user_id` mediumint(9) NULL,
@ -325,9 +312,9 @@ function jigoshop_tables_install() {
PRIMARY KEY id (`product_id`, `order_key`)) $collate;";
$wpdb->query($sql);
$sql = "CREATE TABLE IF NOT EXISTS ". $wpdb->prefix . "jigoshop_termmeta" ." (
$sql = "CREATE TABLE IF NOT EXISTS ". $wpdb->prefix . "woocommerce_termmeta" ." (
`meta_id` bigint(20) NOT NULL AUTO_INCREMENT,
`jigoshop_term_id` bigint(20) NOT NULL,
`woocommerce_term_id` bigint(20) NOT NULL,
`meta_key` varchar(255) NULL,
`meta_value` longtext NULL,
PRIMARY KEY id (`meta_id`)) $collate;";
@ -339,15 +326,13 @@ function jigoshop_tables_install() {
* Default taxonomies
*
* Adds the default terms for taxonomies - product types and order statuses. Modify at your own risk.
*
* @since 1.0
*/
function jigoshop_default_taxonomies() {
function woocommerce_default_taxonomies() {
$product_types = array(
'simple',
'grouped',
'configurable',
'variable',
'downloadable',
'virtual'
);

View File

@ -4,31 +4,31 @@
*
* These functions control columns in admin, and other admin interface bits
*
* @author Jigowatt
* @author WooThemes
* @category Admin
* @package JigoShop
* @package WooCommerce
*/
/**
* Custom columns
**/
function jigoshop_edit_variation_columns($columns){
function woocommerce_edit_variation_columns($columns){
$columns = array();
$columns["cb"] = "<input type=\"checkbox\" />";
$columns["thumb"] = __("Thumb", 'jigoshop');
$columns["id"] = __("ID", 'jigoshop');
$columns["title"] = __("Name", 'jigoshop');
$columns["parent"] = __("Parent Product", 'jigoshop');
$columns["thumb"] = __("Thumb", 'woothemes');
$columns["id"] = __("ID", 'woothemes');
$columns["title"] = __("Name", 'woothemes');
$columns["parent"] = __("Parent Product", 'woothemes');
return $columns;
}
add_filter('manage_edit-product_variation_columns', 'jigoshop_edit_variation_columns');
add_filter('manage_edit-product_variation_columns', 'woocommerce_edit_variation_columns');
function jigoshop_custom_variation_columns($column) {
function woocommerce_custom_variation_columns($column) {
global $post;
$product = &new jigoshop_product($post->ID);
$product = &new woocommerce_product($post->ID);
switch ($column) {
case "thumb" :
@ -47,36 +47,36 @@ function jigoshop_custom_variation_columns($column) {
break;
}
}
add_action('manage_product_variation_posts_custom_column', 'jigoshop_custom_variation_columns', 2);
add_action('manage_product_variation_posts_custom_column', 'woocommerce_custom_variation_columns', 2);
function jigoshop_edit_product_columns($columns){
function woocommerce_edit_product_columns($columns){
$columns = array();
$columns["cb"] = "<input type=\"checkbox\" />";
$columns["thumb"] = __("Thumb", 'jigoshop');
$columns["title"] = __("Name", 'jigoshop');
$columns["product_type"] = __("Type", 'jigoshop');
$columns["sku"] = __("ID/SKU", 'jigoshop');
$columns["product_cat"] = __("Category", 'jigoshop');
$columns["product_tags"] = __("Tags", 'jigoshop');
$columns["visibility"] = __("Visibility", 'jigoshop');
$columns["featured"] = __("Featured", 'jigoshop');
$columns["thumb"] = __("Thumb", 'woothemes');
$columns["title"] = __("Name", 'woothemes');
$columns["product_type"] = __("Type", 'woothemes');
$columns["sku"] = __("ID/SKU", 'woothemes');
$columns["product_cat"] = __("Category", 'woothemes');
$columns["product_tags"] = __("Tags", 'woothemes');
$columns["visibility"] = __("Visibility", 'woothemes');
$columns["featured"] = __("Featured", 'woothemes');
if (get_option('jigoshop_manage_stock')=='yes') :
$columns["is_in_stock"] = __("In Stock?", 'jigoshop');
$columns["inventory"] = __("Inventory", 'jigoshop');
if (get_option('woocommerce_manage_stock')=='yes') :
$columns["is_in_stock"] = __("In Stock?", 'woothemes');
$columns["inventory"] = __("Inventory", 'woothemes');
endif;
$columns["price"] = __("Price", 'jigoshop');
$columns["price"] = __("Price", 'woothemes');
return $columns;
}
add_filter('manage_edit-product_columns', 'jigoshop_edit_product_columns');
add_filter('manage_edit-product_columns', 'woocommerce_edit_product_columns');
function jigoshop_custom_product_columns($column) {
function woocommerce_custom_product_columns($column) {
global $post;
$product = &new jigoshop_product($post->ID);
$product = &new woocommerce_product($post->ID);
switch ($column) {
case "thumb" :
@ -104,10 +104,10 @@ function jigoshop_custom_product_columns($column) {
endif;
break;
case "featured" :
$url = wp_nonce_url( admin_url('admin-ajax.php?action=jigoshop-feature-product&product_id=' . $post->ID) );
echo '<a href="'.$url.'" title="'.__('Change','jigoshop') .'">';
if ($product->is_featured()) echo '<a href="'.$url.'"><img src="'.jigoshop::plugin_url().'/assets/images/success.gif" alt="yes" />';
else echo '<img src="'.jigoshop::plugin_url().'/assets/images/success-off.gif" alt="no" />';
$url = wp_nonce_url( admin_url('admin-ajax.php?action=woocommerce-feature-product&product_id=' . $post->ID) );
echo '<a href="'.$url.'" title="'.__('Change', 'woothemes') .'">';
if ($product->is_featured()) echo '<a href="'.$url.'"><img src="'.woocommerce::plugin_url().'/assets/images/success.gif" alt="yes" />';
else echo '<img src="'.woocommerce::plugin_url().'/assets/images/success-off.gif" alt="no" />';
echo '</a>';
break;
case "visibility" :
@ -118,7 +118,7 @@ function jigoshop_custom_product_columns($column) {
endif;
break;
case "is_in_stock" :
if ( !$product->is_type( 'grouped' ) && $product->is_in_stock() ) echo '<img src="'.jigoshop::plugin_url().'/assets/images/success.gif" alt="yes" />';
if ( !$product->is_type( 'grouped' ) && $product->is_in_stock() ) echo '<img src="'.woocommerce::plugin_url().'/assets/images/success.gif" alt="yes" />';
else echo '<span class="na">&ndash;</span>';
break;
case "inventory" :
@ -136,43 +136,43 @@ function jigoshop_custom_product_columns($column) {
break;
}
}
add_action('manage_product_posts_custom_column', 'jigoshop_custom_product_columns', 2);
add_action('manage_product_posts_custom_column', 'woocommerce_custom_product_columns', 2);
function jigoshop_edit_order_columns($columns){
function woocommerce_edit_order_columns($columns){
$columns = array();
//$columns["cb"] = "<input type=\"checkbox\" />";
$columns["order_status"] = __("Status", 'jigoshop');
$columns["order_status"] = __("Status", 'woothemes');
$columns["order_title"] = __("Order", 'jigoshop');
$columns["order_title"] = __("Order", 'woothemes');
$columns["customer"] = __("Customer", 'jigoshop');
$columns["billing_address"] = __("Billing Address", 'jigoshop');
$columns["shipping_address"] = __("Shipping Address", 'jigoshop');
$columns["customer"] = __("Customer", 'woothemes');
$columns["billing_address"] = __("Billing Address", 'woothemes');
$columns["shipping_address"] = __("Shipping Address", 'woothemes');
$columns["billing_and_shipping"] = __("Billing & Shipping", 'jigoshop');
$columns["billing_and_shipping"] = __("Billing & Shipping", 'woothemes');
$columns["total_cost"] = __("Order Cost", 'jigoshop');
$columns["total_cost"] = __("Order Cost", 'woothemes');
return $columns;
}
add_filter('manage_edit-shop_order_columns', 'jigoshop_edit_order_columns');
add_filter('manage_edit-shop_order_columns', 'woocommerce_edit_order_columns');
function jigoshop_custom_order_columns($column) {
function woocommerce_custom_order_columns($column) {
global $post;
$order = &new jigoshop_order( $post->ID );
$order = &new woocommerce_order( $post->ID );
switch ($column) {
case "order_status" :
echo sprintf( __('<mark class="%s">%s</mark>', 'jigoshop'), sanitize_title($order->status), $order->status );
echo sprintf( __('<mark class="%s">%s</mark>', 'woothemes'), sanitize_title($order->status), $order->status );
break;
case "order_title" :
echo '<a href="'.admin_url('post.php?post='.$post->ID.'&action=edit').'">'.sprintf( __('Order #%s', 'jigoshop'), $post->ID ).'</a>';
echo '<a href="'.admin_url('post.php?post='.$post->ID.'&action=edit').'">'.sprintf( __('Order #%s', 'woothemes'), $post->ID ).'</a>';
echo '<time title="'.date_i18n('c', strtotime($post->post_date)).'">'.date_i18n('F j, Y, g:i a', strtotime($post->post_date)).'</time>';
@ -183,7 +183,7 @@ function jigoshop_custom_order_columns($column) {
?>
<dl>
<dt><?php _e('User:', 'jigoshop'); ?></dt>
<dt><?php _e('User:', 'woothemes'); ?></dt>
<dd><?php
if (isset($user_info) && $user_info) :
@ -195,12 +195,12 @@ function jigoshop_custom_order_columns($column) {
echo '</strong></a>';
else :
_e('Guest', 'jigoshop');
_e('Guest', 'woothemes');
endif;
?></dd>
<?php if ($order->billing_email) : ?><dt><?php _e('Billing Email:', 'jigoshop'); ?></dt>
<?php if ($order->billing_email) : ?><dt><?php _e('Billing Email:', 'woothemes'); ?></dt>
<dd><a href="mailto:<?php echo $order->billing_email; ?>"><?php echo $order->billing_email; ?></a></dd><?php endif; ?>
<?php if ($order->billing_phone) : ?><dt><?php _e('Billing Tel:', 'jigoshop'); ?></dt>
<?php if ($order->billing_phone) : ?><dt><?php _e('Billing Tel:', 'woothemes'); ?></dt>
<dd><?php echo $order->billing_phone; ?></dd><?php endif; ?>
</dl>
<?php
@ -224,9 +224,9 @@ function jigoshop_custom_order_columns($column) {
case "billing_and_shipping" :
?>
<dl>
<dt><?php _e('Payment:', 'jigoshop'); ?></dt>
<dt><?php _e('Payment:', 'woothemes'); ?></dt>
<dd><?php echo $order->payment_method; ?></dd>
<dt><?php _e('Shipping:', 'jigoshop'); ?></dt>
<dt><?php _e('Shipping:', 'woothemes'); ?></dt>
<dd><?php echo $order->shipping_method; ?></dd>
</dl>
<?php
@ -235,39 +235,38 @@ function jigoshop_custom_order_columns($column) {
?>
<table cellpadding="0" cellspacing="0" class="cost">
<tr>
<th><?php _e('Subtotal', 'jigoshop'); ?></th>
<td><?php echo jigoshop_price($order->order_subtotal); ?></td>
<th><?php _e('Subtotal', 'woothemes'); ?></th>
<td><?php echo woocommerce_price($order->order_subtotal); ?></td>
</tr>
<?php if ($order->order_shipping>0) : ?><tr>
<th><?php _e('Shipping', 'jigoshop'); ?></th>
<td><?php echo jigoshop_price($order->order_shipping); ?></td>
<th><?php _e('Shipping', 'woothemes'); ?></th>
<td><?php echo woocommerce_price($order->order_shipping); ?></td>
</tr><?php endif; ?>
<?php if ($order->get_total_tax()>0) : ?><tr>
<th><?php _e('Tax', 'jigoshop'); ?></th>
<td><?php echo jigoshop_price($order->get_total_tax()); ?></td>
<th><?php _e('Tax', 'woothemes'); ?></th>
<td><?php echo woocommerce_price($order->get_total_tax()); ?></td>
</tr><?php endif; ?>
<?php if ($order->order_discount>0) : ?><tr>
<th><?php _e('Discount', 'jigoshop'); ?></th>
<td><?php echo jigoshop_price($order->order_discount); ?></td>
<th><?php _e('Discount', 'woothemes'); ?></th>
<td><?php echo woocommerce_price($order->order_discount); ?></td>
</tr><?php endif; ?>
<tr>
<th><?php _e('Total', 'jigoshop'); ?></th>
<td><?php echo jigoshop_price($order->order_total); ?></td>
<th><?php _e('Total', 'woothemes'); ?></th>
<td><?php echo woocommerce_price($order->order_total); ?></td>
</tr>
</table>
<?php
break;
}
}
add_action('manage_shop_order_posts_custom_column', 'jigoshop_custom_order_columns', 2);
add_action('manage_shop_order_posts_custom_column', 'woocommerce_custom_order_columns', 2);
/**
* Order page filters
**/
function jigoshop_custom_order_views( $views ) {
function woocommerce_custom_order_views( $views ) {
$jigoshop_orders = &new jigoshop_orders();
$woocommerce_orders = &new woocommerce_orders();
$pending = (isset($_GET['shop_order_status']) && $_GET['shop_order_status']=='pending') ? 'current' : '';
$onhold = (isset($_GET['shop_order_status']) && $_GET['shop_order_status']=='on-hold') ? 'current' : '';
@ -276,12 +275,12 @@ function jigoshop_custom_order_views( $views ) {
$cancelled = (isset($_GET['shop_order_status']) && $_GET['shop_order_status']=='cancelled') ? 'current' : '';
$refunded = (isset($_GET['shop_order_status']) && $_GET['shop_order_status']=='refunded') ? 'current' : '';
$views['pending'] = '<a class="'.$pending.'" href="?post_type=shop_order&amp;shop_order_status=pending">Pending <span class="count">('.$jigoshop_orders->pending_count.')</span></a>';
$views['onhold'] = '<a class="'.$onhold.'" href="?post_type=shop_order&amp;shop_order_status=on-hold">On-Hold <span class="count">('.$jigoshop_orders->on_hold_count.')</span></a>';
$views['processing'] = '<a class="'.$processing.'" href="?post_type=shop_order&amp;shop_order_status=processing">Processing <span class="count">('.$jigoshop_orders->processing_count.')</span></a>';
$views['completed'] = '<a class="'.$completed.'" href="?post_type=shop_order&amp;shop_order_status=completed">Completed <span class="count">('.$jigoshop_orders->completed_count.')</span></a>';
$views['cancelled'] = '<a class="'.$cancelled.'" href="?post_type=shop_order&amp;shop_order_status=cancelled">Cancelled <span class="count">('.$jigoshop_orders->cancelled_count.')</span></a>';
$views['refunded'] = '<a class="'.$refunded.'" href="?post_type=shop_order&amp;shop_order_status=refunded">Refunded <span class="count">('.$jigoshop_orders->refunded_count.')</span></a>';
$views['pending'] = '<a class="'.$pending.'" href="?post_type=shop_order&amp;shop_order_status=pending">Pending <span class="count">('.$woocommerce_orders->pending_count.')</span></a>';
$views['onhold'] = '<a class="'.$onhold.'" href="?post_type=shop_order&amp;shop_order_status=on-hold">On-Hold <span class="count">('.$woocommerce_orders->on_hold_count.')</span></a>';
$views['processing'] = '<a class="'.$processing.'" href="?post_type=shop_order&amp;shop_order_status=processing">Processing <span class="count">('.$woocommerce_orders->processing_count.')</span></a>';
$views['completed'] = '<a class="'.$completed.'" href="?post_type=shop_order&amp;shop_order_status=completed">Completed <span class="count">('.$woocommerce_orders->completed_count.')</span></a>';
$views['cancelled'] = '<a class="'.$cancelled.'" href="?post_type=shop_order&amp;shop_order_status=cancelled">Cancelled <span class="count">('.$woocommerce_orders->cancelled_count.')</span></a>';
$views['refunded'] = '<a class="'.$refunded.'" href="?post_type=shop_order&amp;shop_order_status=refunded">Refunded <span class="count">('.$woocommerce_orders->refunded_count.')</span></a>';
if ($pending || $onhold || $processing || $completed || $cancelled || $refunded) :
@ -300,44 +299,44 @@ function jigoshop_custom_order_views( $views ) {
return $views;
}
add_filter('views_edit-shop_order', 'jigoshop_custom_order_views');
add_filter('views_edit-shop_order', 'woocommerce_custom_order_views');
/**
* Order page actions
**/
function jigoshop_remove_row_actions( $actions ) {
function woocommerce_remove_row_actions( $actions ) {
if( get_post_type() === 'shop_order' ) :
unset( $actions['view'] );
unset( $actions['inline hide-if-no-js'] );
endif;
return $actions;
}
add_filter( 'post_row_actions', 'jigoshop_remove_row_actions', 10, 1 );
add_filter( 'post_row_actions', 'woocommerce_remove_row_actions', 10, 1 );
/**
* Order page views
**/
function jigoshop_bulk_actions( $actions ) {
function woocommerce_bulk_actions( $actions ) {
return array();
}
add_filter( 'bulk_actions-edit-shop_order', 'jigoshop_bulk_actions' );
add_filter( 'bulk_actions-edit-shop_order', 'woocommerce_bulk_actions' );
/**
* Order messages
**/
function jigoshop_post_updated_messages( $messages ) {
function woocommerce_post_updated_messages( $messages ) {
if( get_post_type() === 'shop_order' ) :
$messages['post'][1] = sprintf( __('Order updated.', 'jigoshop') );
$messages['post'][4] = sprintf( __('Order updated.', 'jigoshop') );
$messages['post'][6] = sprintf( __('Order published.', 'jigoshop') );
$messages['post'][1] = sprintf( __('Order updated.', 'woothemes') );
$messages['post'][4] = sprintf( __('Order updated.', 'woothemes') );
$messages['post'][6] = sprintf( __('Order published.', 'woothemes') );
$messages['post'][8] = sprintf( __('Order submitted.', 'jigoshop') );
$messages['post'][10] = sprintf( __('Order draft updated.', 'jigoshop') );
$messages['post'][8] = sprintf( __('Order submitted.', 'woothemes') );
$messages['post'][10] = sprintf( __('Order draft updated.', 'woothemes') );
endif;
return $messages;
}
add_filter( 'post_updated_messages', 'jigoshop_post_updated_messages' );
add_filter( 'post_updated_messages', 'woocommerce_post_updated_messages' );

1082
admin/admin-settings.php Normal file

File diff suppressed because it is too large Load Diff

View File

@ -1,583 +0,0 @@
<?php
/**
* options_settings
*
* This variable contains all the options used on the jigpshop settings page
*
* @since 1.0
* @category Admin
* @usedby jigoshop_settings(), jigoshop_default_options()
*/
global $options_settings;
$options_settings = apply_filters('jigoshop_options_settings', array(
array( 'type' => 'tab', 'tabname' => __('General', 'jigoshop') ),
array( 'name' => __('General Options', 'jigoshop'), 'type' => 'title', 'desc' => '' ),
array(
'name' => __('Demo store','jigoshop'),
'desc' => '',
'tip' => __('Enable this option to show a banner at the top of the page stating its a demo store.','jigoshop'),
'id' => 'jigoshop_demo_store',
'css' => 'min-width:100px;',
'std' => 'no',
'type' => 'select',
'options' => array(
'yes' => __('Yes', 'jigoshop'),
'no' => __('No', 'jigoshop')
)
),
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',
'css' => 'min-width:100px;',
'std' => 'yes',
'type' => 'select',
'options' => array(
'yes' => __('Yes', 'jigoshop'),
'no' => __('No', 'jigoshop')
)
),
array(
'name' => __('Enable weight field','jigoshop'),
'desc' => '',
'tip' => '',
'id' => 'jigoshop_enable_weight',
'css' => 'min-width:100px;',
'std' => 'yes',
'type' => 'select',
'options' => array(
'yes' => __('Yes', 'jigoshop'),
'no' => __('No', 'jigoshop')
)
),
array(
'name' => __('Weight Unit', 'jigoshop'),
'desc' => __("This controls what unit you will define weights in.", 'jigoshop'),
'tip' => '',
'id' => 'jigoshop_weight_unit',
'css' => 'min-width:200px;',
'std' => 'GBP',
'type' => 'select',
'options' => array(
'kg' => __('kg', 'jigoshop'),
'lbs' => __('lbs', 'jigoshop')
)
),
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',
'css' => '',
'std' => 'GB',
'type' => 'single_select_country'
),
array(
'name' => __('Allowed Countries','jigoshop'),
'desc' => '',
'tip' => __('These are countries that you are willing to ship to.','jigoshop'),
'id' => 'jigoshop_allowed_countries',
'css' => 'min-width:100px;',
'std' => 'all',
'type' => 'select',
'options' => array(
'all' => __('All Countries', 'jigoshop'),
'specific' => __('Specific Countries', 'jigoshop')
)
),
array(
'name' => __('Specific Countries','jigoshop'),
'desc' => '',
'tip' => '',
'id' => 'jigoshop_specific_allowed_countries',
'css' => '',
'std' => '',
'type' => 'multi_select_countries'
),
array(
'name' => __('Enable guest checkout?','jigoshop'),
'desc' => '',
'tip' => __('Without guest checkout, all users will require an account in order to checkout.','jigoshop'),
'id' => 'jigoshop_enable_guest_checkout',
'css' => 'min-width:100px;',
'std' => 'yes',
'type' => 'select',
'options' => array(
'yes' => __('Yes', 'jigoshop'),
'no' => __('No', 'jigoshop')
)
),
array(
'name' => __('Force SSL on checkout?','jigoshop'),
'desc' => '',
'tip' => __('Forcing SSL is recommended','jigoshop'),
'id' => 'jigoshop_force_ssl_checkout',
'css' => 'min-width:100px;',
'std' => 'no',
'type' => 'select',
'options' => array(
'yes' => __('Yes', 'jigoshop'),
'no' => __('No', 'jigoshop')
)
),
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',
'css' => 'width:300px;',
'type' => 'text',
'std' => ''
),
array(
'name' => __('Disable Jigoshop frontend.css','jigoshop'),
'desc' => '',
'tip' => __('Useful if you want to disable Jigoshop styles and theme it yourself via your theme.','jigoshop'),
'id' => 'jigoshop_disable_css',
'css' => 'min-width:100px;',
'std' => 'no',
'type' => 'select',
'options' => array(
'no' => __('No', 'jigoshop'),
'yes' => __('Yes', 'jigoshop')
)
),
array( 'type' => 'tabend'),
array( 'type' => 'tab', 'tabname' => __('Pages', 'jigoshop') ),
array( 'name' => __('Shop page configuration', 'jigoshop'), 'type' => 'title', 'desc' => '' ),
array(
'name' => __('Cart Page','jigoshop'),
'desc' => __('Your page should contain [jigoshop_cart]','jigoshop'),
'tip' => '',
'id' => 'jigoshop_cart_page_id',
'css' => 'min-width:50px;',
'type' => 'single_select_page',
'std' => ''
),
array(
'name' => __('Checkout Page','jigoshop'),
'desc' => __('Your page should contain [jigoshop_checkout]','jigoshop'),
'tip' => '',
'id' => 'jigoshop_checkout_page_id',
'css' => 'min-width:50px;',
'type' => 'single_select_page',
'std' => ''
),
array(
'name' => __('Pay Page','jigoshop'),
'desc' => __('Your page should contain [jigoshop_pay] and usually have "Checkout" as the parent.','jigoshop'),
'tip' => '',
'id' => 'jigoshop_pay_page_id',
'css' => 'min-width:50px;',
'type' => 'single_select_page',
'std' => ''
),
array(
'name' => __('Thanks Page','jigoshop'),
'desc' => __('Your page should contain [jigoshop_thankyou] and usually have "Checkout" as the parent.','jigoshop'),
'tip' => '',
'id' => 'jigoshop_thanks_page_id',
'css' => 'min-width:50px;',
'type' => 'single_select_page',
'std' => ''
),
array(
'name' => __('My Account Page','jigoshop'),
'desc' => __('Your page should contain [jigoshop_my_account]','jigoshop'),
'tip' => '',
'id' => 'jigoshop_myaccount_page_id',
'css' => 'min-width:50px;',
'type' => 'single_select_page',
'std' => ''
),
array(
'name' => __('Edit Address Page','jigoshop'),
'desc' => __('Your page should contain [jigoshop_edit_address] and usually have "My Account" as the parent.','jigoshop'),
'tip' => '',
'id' => 'jigoshop_edit_address_page_id',
'css' => 'min-width:50px;',
'type' => 'single_select_page',
'std' => ''
),
array(
'name' => __('View Order Page','jigoshop'),
'desc' => __('Your page should contain [jigoshop_view_order] and usually have "My Account" as the parent.','jigoshop'),
'tip' => '',
'id' => 'jigoshop_view_order_page_id',
'css' => 'min-width:50px;',
'type' => 'single_select_page',
'std' => ''
),
array(
'name' => __('Change Password Page','jigoshop'),
'desc' => __('Your page should contain [jigoshop_change_password] and usually have "My Account" as the parent.','jigoshop'),
'tip' => '',
'id' => 'jigoshop_change_password_page_id',
'css' => 'min-width:50px;',
'type' => 'single_select_page',
'std' => ''
),
array( 'type' => 'tabend'),
array( 'type' => 'tab', 'tabname' => __('Catalog', 'jigoshop') ),
array( 'name' => __('Catalog Options', 'jigoshop'), 'type' => 'title','desc' => '', 'id' => '' ),
array(
'name' => __('Products Base Page','jigoshop'),
'desc' => sprintf( __("IMPORTANT: You must <a target='_blank' href='%s'>re-save your permalinks</a> for this change to take effect.",'jigoshop'), 'options-permalink.php' ),
'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',
'css' => 'min-width:50px;',
'type' => 'single_select_page',
'std' => ''
),
array(
'name' => __('Prepend shop categories/tags with base page?','jigoshop'),
'desc' => sprintf( __("IMPORTANT: You must <a target='_blank' href='%s'>re-save your permalinks</a> for this change to take effect.",'jigoshop'), 'options-permalink.php' ),
'tip' => __('If set to yes, categories will show up as your_base_page/shop_category instead of just shop_category.', 'jigoshop'),
'id' => 'jigoshop_prepend_shop_page_to_urls',
'css' => 'min-width:100px;',
'std' => 'no',
'type' => 'select',
'options' => array(
'no' => __('No', 'jigoshop'),
'yes' => __('Yes', 'jigoshop')
)
),
array(
'name' => __('Terms page ID', 'jigoshop'),
'desc' => __('If you define a "Terms" page the customer will be asked if they accept them when checking out.', 'jigoshop'),
'tip' => '',
'id' => 'jigoshop_terms_page_id',
'css' => 'min-width:50px;',
'std' => '',
'type' => 'single_select_page',
'args' => 'show_option_none=' . __('None', 'jigoshop'),
),
array( 'name' => __('Pricing Options', 'jigoshop'), 'type' => 'title','desc' => '', 'id' => '' ),
array(
'name' => __('Currency', 'jigoshop'),
'desc' => sprintf( __("This controls what currency prices are listed at in the catalog, and which currency PayPal, and other gateways, will take payments in. See the list of supported <a target='_new' href='%s'>PayPal currencies</a>.", 'jigoshop'), 'https://www.paypal.com/cgi-bin/webscr?cmd=p/sell/mc/mc_intro-outside' ),
'tip' => '',
'id' => 'jigoshop_currency',
'css' => 'min-width:200px;',
'std' => 'GBP',
'type' => 'select',
'options' => apply_filters('jigoshop_currencies', array(
'USD' => __('US Dollars (&#36;)', 'jigoshop'),
'EUR' => __('Euros (&euro;)', 'jigoshop'),
'GBP' => __('Pounds Sterling (&pound;)', 'jigoshop'),
'AUD' => __('Australian Dollars (&#36;)', 'jigoshop'),
'BRL' => __('Brazilian Real (&#36;)', 'jigoshop'),
'CAD' => __('Canadian Dollars (&#36;)', 'jigoshop'),
'CZK' => __('Czech Koruna', 'jigoshop'),
'DKK' => __('Danish Krone', 'jigoshop'),
'HKD' => __('Hong Kong Dollar (&#36;)', 'jigoshop'),
'HUF' => __('Hungarian Forint', 'jigoshop'),
'ILS' => __('Israeli Shekel', 'jigoshop'),
'JPY' => __('Japanese Yen (&yen;)', 'jigoshop'),
'MYR' => __('Malaysian Ringgits', 'jigoshop'),
'MXN' => __('Mexican Peso (&#36;)', 'jigoshop'),
'NZD' => __('New Zealand Dollar (&#36;)', 'jigoshop'),
'NOK' => __('Norwegian Krone', 'jigoshop'),
'PHP' => __('Philippine Pesos', 'jigoshop'),
'PLN' => __('Polish Zloty', 'jigoshop'),
'SGD' => __('Singapore Dollar (&#36;)', 'jigoshop'),
'SEK' => __('Swedish Krona', 'jigoshop'),
'CHF' => __('Swiss Franc', 'jigoshop'),
'TWD' => __('Taiwan New Dollars', 'jigoshop'),
'THB' => __('Thai Baht', 'jigoshop')
)
)
),
array(
'name' => __('Currency Position', 'jigoshop'),
'desc' => __("This controls the position of the currency symbol.", 'jigoshop'),
'tip' => '',
'id' => 'jigoshop_currency_pos',
'css' => 'min-width:200px;',
'std' => 'left',
'type' => 'select',
'options' => array(
'left' => __('Left', 'jigoshop'),
'right' => __('Right', 'jigoshop'),
'left_space' => __('Left (with space)', 'jigoshop'),
'right_space' => __('Right (with space)', 'jigoshop')
)
),
array(
'name' => __('Thousand separator', 'jigoshop'),
'desc' => __('This sets the thousand separator of displayed prices.', 'jigoshop'),
'tip' => '',
'id' => 'jigoshop_price_thousand_sep',
'css' => 'width:30px;',
'std' => ',',
'type' => 'text',
),
array(
'name' => __('Decimal separator', 'jigoshop'),
'desc' => __('This sets the decimal separator of displayed prices.', 'jigoshop'),
'tip' => '',
'id' => 'jigoshop_price_decimal_sep',
'css' => 'width:30px;',
'std' => '.',
'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',
'css' => 'width:30px;',
'std' => '2',
'type' => 'text',
),
array( 'type' => 'tabend'),
array( 'type' => 'tab', 'tabname' => __('Coupons', 'jigoshop') ),
array( 'name' => __('Coupon Codes', 'jigoshop'), 'type' => 'title', 'desc' => '' ),
array(
'name' => __('Coupons','jigoshop'),
'desc' => 'All fields are required.',
'tip' => 'Coupons allow you to give customers special offers and discounts. Leave product IDs blank to apply to all products/items in the cart.',
'id' => 'jigoshop_coupons',
'css' => 'min-width:50px;',
'type' => 'coupons',
'std' => ''
),
array( 'type' => 'tabend'),
array( 'type' => 'tab', 'tabname' => __('Inventory', 'jigoshop') ),
array( 'name' => __('Inventory Options', 'jigoshop'), 'type' => 'title','desc' => '', 'id' => '' ),
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',
'css' => 'min-width:100px;',
'std' => 'yes',
'type' => 'select',
'options' => array(
'yes' => __('Yes', 'jigoshop'),
'no' => __('No', 'jigoshop')
)
),
array(
'name' => __('Low stock notification','jigoshop'),
'desc' => '',
'tip' => __('Set the minimum threshold for this below.', 'jigoshop'),
'id' => 'jigoshop_notify_low_stock',
'css' => 'min-width:100px;',
'std' => 'yes',
'type' => 'select',
'options' => array(
'yes' => __('Yes', 'jigoshop'),
'no' => __('No', 'jigoshop')
)
),
array(
'name' => __('Low stock threshold','jigoshop'),
'desc' => '',
'tip' => '',
'id' => 'jigoshop_notify_low_stock_amount',
'css' => 'min-width:50px;',
'type' => 'text',
'std' => '2'
),
array(
'name' => __('Out-of-stock notification','jigoshop'),
'desc' => '',
'tip' => __('Set the minimum threshold for this below.', 'jigoshop'),
'id' => 'jigoshop_notify_no_stock',
'css' => 'min-width:100px;',
'std' => 'yes',
'type' => 'select',
'options' => array(
'yes' => __('Yes', 'jigoshop'),
'no' => __('No', 'jigoshop')
)
),
array(
'name' => __('Out of stock threshold','jigoshop'),
'desc' => '',
'tip' => '',
'id' => 'jigoshop_notify_no_stock_amount',
'css' => 'min-width:50px;',
'type' => 'text',
'std' => '0'
),
array( 'type' => 'tabend'),
array( 'type' => 'tab', 'tabname' => __('Shipping', 'jigoshop') ),
array( 'name' => __('Shipping Options', 'jigoshop'), 'type' => 'title','desc' => '', 'id' => '' ),
array(
'name' => __('Calculate Shipping','jigoshop'),
'desc' => __('Only set this to no if you are not shipping items, or items have shipping costs included.','jigoshop'),
'tip' => __('If you are not calculating shipping then you can ignore all other tax options.', 'jigoshop'),
'id' => 'jigoshop_calc_shipping',
'css' => 'min-width:100px;',
'std' => 'yes',
'type' => 'select',
'options' => array(
'yes' => __('Yes', 'jigoshop'),
'no' => __('No', 'jigoshop')
)
),
array(
'name' => __('Enable shipping calculator on cart','jigoshop'),
'desc' => '',
'tip' => '',
'id' => 'jigoshop_enable_shipping_calc',
'css' => 'min-width:100px;',
'std' => 'yes',
'type' => 'select',
'options' => array(
'yes' => __('Yes', 'jigoshop'),
'no' => __('No', 'jigoshop')
)
),
array(
'name' => __('Only ship to billing address?','jigoshop'),
'desc' => '',
'tip' => '',
'id' => 'jigoshop_ship_to_billing_address_only',
'css' => 'min-width:100px;',
'std' => 'no',
'type' => 'select',
'options' => array(
'yes' => __('Yes', 'jigoshop'),
'no' => __('No', 'jigoshop')
)
),
array( 'type' => 'shipping_options'),
array( 'type' => 'tabend'),
array( 'type' => 'tab', 'tabname' => __('Tax', 'jigoshop') ),
array( 'name' => __('Tax Options', 'jigoshop'), 'type' => 'title','desc' => '', 'id' => '' ),
array(
'name' => __('Calculate Taxes','jigoshop'),
'desc' => __('Only set this to no 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',
'css' => 'min-width:100px;',
'std' => 'yes',
'type' => 'select',
'options' => array(
'yes' => __('Yes', 'jigoshop'),
'no' => __('No', 'jigoshop')
)
),
array(
'name' => __('Catalog Prices include tax?','jigoshop'),
'desc' => '',
'tip' => __('If prices include tax then tax calculations will work backwards.','jigoshop'),
'id' => 'jigoshop_prices_include_tax',
'css' => 'min-width:100px;',
'std' => 'yes',
'type' => 'select',
'options' => array(
'yes' => __('Yes', 'jigoshop'),
'no' => __('No', 'jigoshop')
)
),
array(
'name' => __('Cart totals display...','jigoshop'),
'desc' => '',
'tip' => __('Should the subtotal be shown including or excluding tax on the frontend?','jigoshop'),
'id' => 'jigoshop_display_totals_tax',
'css' => 'min-width:100px;',
'std' => 'excluding',
'type' => 'select',
'options' => array(
'including' => __('price including tax', 'jigoshop'),
'excluding' => __('price excluding tax', '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',
'css' => 'width:100%; height: 75px;',
'type' => 'textarea',
'std' => "Reduced Rate\nZero Rate"
),
array(
'name' => __('Tax rates','jigoshop'),
'desc' => 'All fields are required.',
'tip' => 'To avoid rounding errors, insert tax rates with 4 decimal places.',
'id' => 'jigoshop_tax_rates',
'css' => 'min-width:50px;',
'type' => 'tax_rates',
'std' => ''
),
array( 'type' => 'tabend'),
array( 'type' => 'tab', 'tabname' => __('Payment Gateways', 'jigoshop') ),
array( 'type' => 'gateway_options'),
array( 'type' => 'tabend')
) );

View File

@ -1,516 +0,0 @@
<?php
/**
* Functions for the settings page in admin.
*
* The settings page contains options for the JigoShop plugin - this file contains functions to display
* and save the list of options.
*
* @author Jigowatt
* @category Admin
* @package JigoShop
*/
/**
* Update options
*
* Updates the options on the jigoshop settings page.
*
* @since 1.0
* @usedby jigoshop_settings()
*
* @param array $options List of options to go through and save
*/
function jigoshop_update_options($options) {
if(isset($_POST['submitted']) && $_POST['submitted'] == 'yes') {
foreach ($options as $value) {
if (isset($value['id']) && $value['id']=='jigoshop_tax_rates') :
$tax_classes = array();
$tax_countries = array();
$tax_rate = array();
$tax_rates = array();
$tax_shipping = array();
if (isset($_POST['tax_class'])) $tax_classes = $_POST['tax_class'];
if (isset($_POST['tax_country'])) $tax_countries = $_POST['tax_country'];
if (isset($_POST['tax_rate'])) $tax_rate = $_POST['tax_rate'];
if (isset($_POST['tax_shipping'])) $tax_shipping = $_POST['tax_shipping'];
for ($i=0; $i<sizeof($tax_classes); $i++) :
if (isset($tax_classes[$i]) && isset($tax_countries[$i]) && isset($tax_rate[$i]) && $tax_rate[$i] && is_numeric($tax_rate[$i])) :
$country = jigowatt_clean($tax_countries[$i]);
$state = '*';
$rate = number_format(jigowatt_clean($tax_rate[$i]), 4);
$class = jigowatt_clean($tax_classes[$i]);
if (isset($tax_shipping[$i]) && $tax_shipping[$i]) $shipping = 'yes'; else $shipping = 'no';
// Get state from country input if defined
if (strstr($country, ':')) :
$cr = explode(':', $country);
$country = current($cr);
$state = end($cr);
endif;
$tax_rates[] = array(
'country' => $country,
'state' => $state,
'rate' => $rate,
'shipping' => $shipping,
'class' => $class
);
endif;
endfor;
update_option($value['id'], $tax_rates);
elseif (isset($value['id']) && $value['id']=='jigoshop_coupons') :
$coupon_code = array();
$coupon_type = array();
$coupon_amount = array();
$product_ids = array();
$coupons = array();
$individual = array();
if (isset($_POST['coupon_code'])) $coupon_code = $_POST['coupon_code'];
if (isset($_POST['coupon_type'])) $coupon_type = $_POST['coupon_type'];
if (isset($_POST['coupon_amount'])) $coupon_amount = $_POST['coupon_amount'];
if (isset($_POST['product_ids'])) $product_ids = $_POST['product_ids'];
if (isset($_POST['individual'])) $individual = $_POST['individual'];
for ($i=0; $i<sizeof($coupon_code); $i++) :
if ( isset($coupon_code[$i]) && isset($coupon_type[$i]) && isset($coupon_amount[$i]) ) :
$code = jigowatt_clean($coupon_code[$i]);
$type = jigowatt_clean($coupon_type[$i]);
$amount = jigowatt_clean($coupon_amount[$i]);
if (isset($product_ids[$i]) && $product_ids[$i]) $products = array_map('trim', explode(',', $product_ids[$i])); else $products = array();
if (isset($individual[$i]) && $individual[$i]) $individual_use = 'yes'; else $individual_use = 'no';
if ($code && $type && $amount) :
$coupons[$code] = array(
'code' => $code,
'amount' => $amount,
'type' => $type,
'products' => $products,
'individual_use' => $individual_use
);
endif;
endif;
endfor;
update_option($value['id'], $coupons);
elseif (isset($value['type']) && $value['type']=='multi_select_countries') :
// Get countries array
if (isset($_POST[$value['id']])) $selected_countries = $_POST[$value['id']]; else $selected_countries = array();
update_option($value['id'], $selected_countries);
/* price separators get a special treatment as they should allow a spaces (don't trim) */
elseif ( isset($value['id']) && ( $value['id'] == 'jigoshop_price_thousand_sep' || $value['id'] == 'jigoshop_price_decimal_sep' ) ):
if( isset( $_POST[ $value['id'] ] ) ) {
update_option($value['id'], $_POST[$value['id']] );
} else {
@delete_option($value['id']);
}
else :
if(isset($value['id']) && isset($_POST[$value['id']])) {
update_option($value['id'], jigowatt_clean($_POST[$value['id']]));
} else {
@delete_option($value['id']);
}
endif;
}
do_action('jigoshop_update_options');
echo '<div id="message" class="updated fade"><p><strong>'.__('Your settings have been saved.','jigoshop').'</strong></p></div>';
}
}
/**
* Admin fields
*
* Loops though the jigoshop options array and outputs each field.
*
* @since 1.0
* @usedby jigoshop_settings()
*
* @param array $options List of options to go through and save
*/
function jigoshop_admin_fields($options) {
?>
<div id="tabs-wrap">
<p class="submit"><input name="save" type="submit" value="<?php _e('Save changes','jigoshop') ?>" /></p>
<?php
$counter = 1;
echo '<ul class="tabs">';
foreach ($options as $value) {
if ( 'tab' == $value['type'] ) :
echo '<li><a href="#'.$value['type'].$counter.'">'.$value['tabname'].'</a></li>'. "\n";
$counter = $counter + 1;
endif;
}
echo '</ul>';
$counter = 1;
foreach ($options as $value) :
switch($value['type']) :
case 'string':
?>
<tr>
<td class="titledesc"><?php echo $value['name']; ?></td>
<td class="forminp"><?php echo $value['desc']; ?></td>
</tr>
<?php
break;
case 'tab':
echo '<div id="'.$value['type'].$counter.'" class="panel">';
echo '<table class="widefat fixed" style="width:850px; margin-bottom:20px;">'. "\n\n";
break;
case 'title':
?><thead><tr><th scope="col" width="200px"><?php echo $value['name'] ?></th><th scope="col" class="desc"><?php if (isset($value['desc'])) echo $value['desc'] ?>&nbsp;</th></tr></thead><?php
break;
case 'text':
?><tr>
<td class="titledesc"><?php if ($value['tip']) { ?><a href="#" tip="<?php echo $value['tip'] ?>" class="tips" tabindex="99"></a><?php } ?><?php echo $value['name'] ?>:</td>
<td class="forminp"><input name="<?php echo $value['id'] ?>" id="<?php echo $value['id'] ?>" type="<?php echo $value['type'] ?>" style="<?php echo $value['css'] ?>" value="<?php if ( get_option( $value['id']) !== false && get_option( $value['id']) !== null ) echo stripslashes(get_option($value['id'])); else echo $value['std'] ?>" /><br /><small><?php echo $value['desc'] ?></small></td>
</tr><?php
break;
case 'select':
?><tr>
<td class="titledesc"><?php if ($value['tip']) { ?><a href="#" tip="<?php echo $value['tip'] ?>" class="tips" tabindex="99"></a><?php } ?><?php echo $value['name'] ?>:</td>
<td class="forminp"><select name="<?php echo $value['id'] ?>" id="<?php echo $value['id'] ?>" style="<?php echo $value['css'] ?>">
<?php
foreach ($value['options'] as $key => $val) {
?>
<option value="<?php echo $key ?>" <?php if (get_option($value['id']) == $key) { ?> selected="selected" <?php } ?>><?php echo ucfirst($val) ?></option>
<?php
}
?>
</select><br /><small><?php echo $value['desc'] ?></small>
</td>
</tr><?php
break;
case 'textarea':
?><tr>
<td class="titledesc"><?php if ($value['tip']) { ?><a href="#" tip="<?php echo $value['tip'] ?>" class="tips" tabindex="99"></a><?php } ?><?php echo $value['name'] ?>:</td>
<td class="forminp">
<textarea <?php if ( isset($value['args']) ) echo $value['args'] . ' '; ?>name="<?php echo $value['id'] ?>" id="<?php echo $value['id'] ?>" style="<?php echo $value['css'] ?>"><?php if (get_option($value['id'])) echo stripslashes(get_option($value['id'])); else echo $value['std']; ?></textarea>
<br /><small><?php echo $value['desc'] ?></small>
</td>
</tr><?php
break;
case 'tabend':
echo '</table></div>';
$counter = $counter + 1;
break;
case 'single_select_page' :
$page_setting = (int) get_option($value['id']);
$args = array( 'name' => $value['id'],
'id' => $value['id']. '" style="width: 200px;',
'sort_column' => 'menu_order',
'sort_order' => 'ASC',
'selected' => $page_setting);
if( isset($value['args']) ) $args = wp_parse_args($value['args'], $args);
?><tr class="single_select_page">
<td class="titledesc"><?php if ($value['tip']) { ?><a href="#" tip="<?php echo $value['tip'] ?>" class="tips" tabindex="99"></a><?php } ?><?php echo $value['name'] ?>:</td>
<td class="forminp">
<?php wp_dropdown_pages($args); ?>
<br /><small><?php echo $value['desc'] ?></small>
</td>
</tr><?php
break;
case 'single_select_country' :
$countries = jigoshop_countries::$countries;
$country_setting = (string) get_option($value['id']);
if (strstr($country_setting, ':')) :
$country = current(explode(':', $country_setting));
$state = end(explode(':', $country_setting));
else :
$country = $country_setting;
$state = '*';
endif;
?><tr class="multi_select_countries">
<td class="titledesc"><?php if ($value['tip']) { ?><a href="#" tip="<?php echo $value['tip'] ?>" class="tips" tabindex="99"></a><?php } ?><?php echo $value['name'] ?>:</td>
<td class="forminp"><select name="<?php echo $value['id'] ?>" title="Country" style="width: 150px;">
<?php echo jigoshop_countries::country_dropdown_options($country, $state); ?>
</select>
</td>
</tr><?php
break;
case 'multi_select_countries' :
$countries = jigoshop_countries::$countries;
asort($countries);
$selections = (array) get_option($value['id']);
?><tr class="multi_select_countries">
<td class="titledesc"><?php if ($value['tip']) { ?><a href="#" tip="<?php echo $value['tip'] ?>" class="tips" tabindex="99"></a><?php } ?><?php echo $value['name'] ?>:</td>
<td class="forminp">
<div class="multi_select_countries"><ul><?php
if ($countries) foreach ($countries as $key=>$val) :
echo '<li><label><input type="checkbox" name="'. $value['id'] .'[]" value="'. $key .'" ';
if (in_array($key, $selections)) echo 'checked="checked"';
echo ' />'. $val .'</label></li>';
endforeach;
?></ul></div>
</td>
</tr><?php
break;
case 'coupons' :
$coupons = new jigoshop_coupons();
$coupon_codes = $coupons->get_coupons();
?><tr>
<td class="titledesc"><?php if ($value['tip']) { ?><a href="#" tip="<?php echo $value['tip'] ?>" class="tips" tabindex="99"></a><?php } ?><?php echo $value['name'] ?>:</td>
<td class="forminp" id="coupon_codes">
<table class="coupon_rows" cellspacing="0">
<thead>
<tr>
<th><?php _e('Coupon Code', 'jigoshop'); ?></th>
<th><?php _e('Coupon Type', 'jigoshop'); ?></th>
<th><?php _e('Coupon Amount', 'jigoshop'); ?></th>
<th><?php _e('Product ids', 'jigoshop'); ?></th>
<th><?php _e('Individual use', 'jigoshop'); ?></th>
<th><?php _e('Delete', 'jigoshop'); ?></th>
</tr>
</thead>
<tbody>
<?php
$i = -1;
if ($coupon_codes && is_array($coupon_codes) && sizeof($coupon_codes)>0) foreach( $coupon_codes as $coupon ) : $i++;
echo '<tr class="coupon_row"><td><input type="text" value="'.$coupon['code'].'" name="coupon_code['.$i.']" title="'.__('Coupon Code', 'jigoshop').'" placeholder="'.__('Coupon Code', 'jigoshop').'" class="text" /></td><td><select name="coupon_type['.$i.']" title="Coupon Type">';
$discount_types = array(
'fixed_cart' => __('Cart Discount', 'jigoshop'),
'percent' => __('Cart % Discount', 'jigoshop'),
'fixed_product' => __('Product Discount', 'jigoshop')
);
foreach ($discount_types as $type => $label) :
$selected = ($coupon['type']==$type) ? 'selected="selected"' : '';
echo '<option value="'.$type.'" '.$selected.'>'.$label.'</option>';
endforeach;
echo '</select></td><td><input type="text" value="'.$coupon['amount'].'" name="coupon_amount['.$i.']" title="'.__('Coupon Amount', 'jigoshop').'" placeholder="'.__('Coupon Amount', 'jigoshop').'" class="text" /></td><td><input type="text" value="'.implode(', ', $coupon['products']).'" name="product_ids['.$i.']" placeholder="'.__('1, 2, 3', 'jigoshop').'" class="text" /></td><td><label><input type="checkbox" name="individual['.$i.']" ';
if (isset($coupon['individual_use']) && $coupon['individual_use']=='yes') echo 'checked="checked"';
echo ' /> '.__('Individual use only', 'jigoshop').'</label></td><td><a href="#" class="remove button">&times;</a></td></tr>';
endforeach;
?>
</tbody>
</table>
<p><a href="#" class="add button"><?php _e('+ Add Coupon', 'jigoshop'); ?></a></p>
</td>
</tr>
<script type="text/javascript">
/* <![CDATA[ */
jQuery(function() {
jQuery('#coupon_codes a.add').live('click', function(){
var size = jQuery('#coupon_codes table.coupon_rows tbody .coupon_row').size();
// Make sure tbody exists
var tbody_size = jQuery('#coupon_codes table.coupon_rows tbody').size();
if (tbody_size==0) jQuery('#coupon_codes table.coupon_rows').append('<tbody></tbody>');
// Add the row
jQuery('<tr class="coupon_row">\
<td><input type="text" value="" name="coupon_code[' + size + ']" title="<?php _e('Coupon Code', 'jigoshop'); ?>" placeholder="<?php _e('Coupon Code', 'jigoshop'); ?>" class="text" /></td>\
<td><select name="coupon_type[' + size + ']" title="Coupon Type">\
<option value="percent"><?php _e('% Discount', 'jigoshop'); ?></option>\
<option value="fixed_product"><?php _e('Product Discount', 'jigoshop');?></option>\
<option value="fixed_cart"><?php _e('Cart Discount', 'jigoshop'); ?></option>\
</select></td>\
<td><input type="text" value="" name="coupon_amount[' + size + ']" title="<?php _e('Coupon Amount', 'jigoshop'); ?>" placeholder="<?php _e('Coupon Amount', 'jigoshop'); ?>" class="text" /></td>\
<td><input type="text" value="" name="product_ids[' + size + ']" placeholder="<?php _e('1, 2, 3', 'jigoshop'); ?>" class="text" /></td>\
<td><label><input type="checkbox" name="individual[' + size + ']" /> <?php _e('Individual use only', 'jigoshop'); ?></label></td>\
<td><a href="#" class="remove button">&times;</a></td></tr>').appendTo('#coupon_codes table.coupon_rows tbody');
return false;
});
jQuery('#coupon_codes a.remove').live('click', function(){
var answer = confirm("<?php _e('Delete this coupon?', 'jigoshop'); ?>")
if (answer) {
jQuery('input', jQuery(this).parent().parent()).val('');
jQuery(this).parent().parent().hide();
}
return false;
});
});
/* ]]> */
</script>
<?php
break;
case 'tax_rates' :
$_tax = new jigoshop_tax();
$tax_classes = $_tax->get_tax_classes();
$tax_rates = get_option('jigoshop_tax_rates');
?><tr>
<td class="titledesc"><?php if ($value['tip']) { ?><a href="#" tip="<?php echo $value['tip'] ?>" class="tips" tabindex="99"></a><?php } ?><?php echo $value['name'] ?>:</td>
<td class="forminp" id="tax_rates">
<div class="taxrows">
<?php
$i = -1;
if ($tax_rates && is_array($tax_rates) && sizeof($tax_rates)>0) foreach( $tax_rates as $rate ) : $i++;
echo '<p class="taxrow"><select name="tax_class['.$i.']" title="Tax Class"><option value="">'.__('Standard Rate', 'jigoshop').'</option>';
if ($tax_classes) foreach ($tax_classes as $class) :
echo '<option value="'.sanitize_title($class).'"';
if ($rate['class']==sanitize_title($class)) echo 'selected="selected"';
echo '>'.$class.'</option>';
endforeach;
echo '</select><select name="tax_country['.$i.']" title="Country">';
jigoshop_countries::country_dropdown_options($rate['country'], $rate['state']);
echo '</select><input type="text" class="text" value="'.$rate['rate'].'" name="tax_rate['.$i.']" title="'.__('Rate', 'jigoshop').'" placeholder="'.__('Rate', 'jigoshop').'" maxlength="8" />% <label><input type="checkbox" name="tax_shipping['.$i.']" ';
if (isset($rate['shipping']) && $rate['shipping']=='yes') echo 'checked="checked"';
echo ' /> '.__('Apply to shipping', 'jigoshop').'</label><a href="#" class="remove button">&times;</a></p>';
endforeach;
?>
</div>
<p><a href="#" class="add button"><?php _e('+ Add Tax Rule', 'jigoshop'); ?></a></p>
</td>
</tr>
<script type="text/javascript">
/* <![CDATA[ */
jQuery(function() {
jQuery('#tax_rates a.add').live('click', function(){
var size = jQuery('.taxrows .taxrow').size();
// Add the row
jQuery('<p class="taxrow"> \
<select name="tax_class[' + size + ']" title="Tax Class"> \
<option value=""><?php _e('Standard Rate', 'jigoshop'); ?></option><?php
$tax_classes = $_tax->get_tax_classes();
if ($tax_classes) foreach ($tax_classes as $class) :
echo '<option value="'.sanitize_title($class).'">'.$class.'</option>';
endforeach;
?></select><select name="tax_country[' + size + ']" title="Country"><?php
jigoshop_countries::country_dropdown_options('','',true);
?></select><input type="text" class="text" name="tax_rate[' + size + ']" title="<?php _e('Rate', 'jigoshop'); ?>" placeholder="<?php _e('Rate', 'jigoshop'); ?>" maxlength="8" />%\
<label><input type="checkbox" name="tax_shipping[' + size + ']" /> <?php _e('Apply to shipping', 'jigoshop'); ?></label>\
<a href="#" class="remove button">&times;</a>\
</p>').appendTo('#tax_rates div.taxrows');
return false;
});
jQuery('#tax_rates a.remove').live('click', function(){
var answer = confirm("<?php _e('Delete this rule?', 'jigoshop'); ?>");
if (answer) {
jQuery('input', jQuery(this).parent()).val('');
jQuery(this).parent().hide();
}
return false;
});
});
/* ]]> */
</script>
<?php
break;
case "shipping_options" :
foreach (jigoshop_shipping::$shipping_methods as $method) :
$method->admin_options();
endforeach;
break;
case "gateway_options" :
foreach (jigoshop_payment_gateways::payment_gateways() as $gateway) :
$gateway->admin_options();
endforeach;
break;
endswitch;
endforeach;
?>
<p class="submit"><input name="save" type="submit" value="<?php _e('Save changes','jigoshop') ?>" /></p>
</div>
<script type="text/javascript">
jQuery(function() {
// Tabs
jQuery('ul.tabs').show();
jQuery('ul.tabs li:first').addClass('active');
jQuery('div.panel:not(div.panel:first)').hide();
jQuery('ul.tabs a').click(function(){
jQuery('ul.tabs li').removeClass('active');
jQuery(this).parent().addClass('active');
jQuery('div.panel').hide();
jQuery( jQuery(this).attr('href') ).show();
jQuery.cookie('jigoshop_settings_tab_index', jQuery(this).parent().index('ul.tabs li'))
return false;
});
<?php if (isset($_COOKIE['jigoshop_settings_tab_index']) && $_COOKIE['jigoshop_settings_tab_index'] > 0) : ?>
jQuery('ul.tabs li:eq(<?php echo $_COOKIE['jigoshop_settings_tab_index']; ?>) a').click();
<?php endif; ?>
// Countries
jQuery('select#jigoshop_allowed_countries').change(function(){
if (jQuery(this).val()=="specific") {
jQuery(this).parent().parent().next('tr.multi_select_countries').show();
} else {
jQuery(this).parent().parent().next('tr.multi_select_countries').hide();
}
}).change();
});
</script>
<?php
}
/**
* Settings page
*
* Handles the display of the settings page in admin.
*
* @since 1.0
* @usedby jigoshop_admin_menu2()
*/
function jigoshop_settings() {
global $options_settings;
jigoshop_update_options($options_settings);
?>
<script type="text/javascript" src="<?php echo jigoshop::plugin_url(); ?>/assets/js/easyTooltip.js"></script>
<div class="wrap jigoshop">
<div class="icon32 icon32-jigoshop-settings" id="icon-jigoshop"><br/></div>
<h2><?php _e('General Settings','jigoshop'); ?></h2>
<form method="post" id="mainform" action="">
<?php jigoshop_admin_fields($options_settings); ?>
<input name="submitted" type="hidden" value="yes" />
</form>
</div>
<?php
}

View File

@ -1,192 +0,0 @@
<?php
/**
* JigoShop Write Panels
*
* Sets up the write panels used by products and orders (custom post types)
*
* @author Jigowatt
* @category Admin Write Panels
* @package JigoShop
*/
include('write-panels/product-data.php');
include('write-panels/product-data-save.php');
include('write-panels/product-type.php');
include('write-panels/order-data.php');
include('write-panels/order-data-save.php');
/**
* Init the meta boxes
*
* Inits the write panels for both products and orders. Also removes unused default write panels.
*
* @since 1.0
*/
add_action( 'add_meta_boxes', 'jigoshop_meta_boxes' );
function jigoshop_meta_boxes() {
add_meta_box( 'jigoshop-product-data', __('Product Data', 'jigoshop'), 'jigoshop_product_data_box', 'product', 'normal', 'high' );
add_meta_box( 'jigoshop-product-type-options', __('Product Type Options', 'jigoshop'), 'jigoshop_product_type_options_box', 'product', 'normal', 'high' );
add_meta_box( 'jigoshop-order-data', __('Order Data', 'jigoshop'), 'jigoshop_order_data_meta_box', 'shop_order', 'normal', 'high' );
add_meta_box( 'jigoshop-order-items', __('Order Items <small>&ndash; Note: if you edit quantities or remove items from the order you will need to manually change the item\'s stock levels.</small>', 'jigoshop'), 'jigoshop_order_items_meta_box', 'shop_order', 'normal', 'high');
add_meta_box( 'jigoshop-order-totals', __('Order Totals', 'jigoshop'), 'jigoshop_order_totals_meta_box', 'shop_order', 'side', 'default');
add_meta_box( 'jigoshop-order-actions', __('Order Actions', 'jigoshop'), 'jigoshop_order_actions_meta_box', 'shop_order', 'side', 'default');
remove_meta_box( 'commentstatusdiv', 'shop_order' , 'normal' );
remove_meta_box( 'slugdiv', 'shop_order' , 'normal' );
}
/**
* Save meta boxes
*
* Runs when a post is saved and does an action which the write panel save scripts can hook into.
*
* @since 1.0
*/
add_action( 'save_post', 'jigoshop_meta_boxes_save', 1, 2 );
function jigoshop_meta_boxes_save( $post_id, $post ) {
global $wpdb;
if ( !$_POST ) return $post_id;
if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) return $post_id;
if ( !isset($_POST['jigoshop_meta_nonce']) || (isset($_POST['jigoshop_meta_nonce']) && !wp_verify_nonce( $_POST['jigoshop_meta_nonce'], 'jigoshop_save_data' ))) return $post_id;
if ( !current_user_can( 'edit_post', $post_id )) return $post_id;
if ( $post->post_type != 'product' && $post->post_type != 'shop_order' ) return $post_id;
do_action( 'jigoshop_process_'.$post->post_type.'_meta', $post_id, $post );
}
/**
* Product data
*
* Forces certain product data based on the product's type, e.g. grouped products cannot have a parent.
*
* @since 1.0
*/
add_filter('wp_insert_post_data', 'jigoshop_product_data');
function jigoshop_product_data( $data ) {
global $post;
if ($data['post_type']=='product' && isset($_POST['product-type'])) {
$product_type = stripslashes( $_POST['product-type'] );
switch($product_type) :
case "grouped" :
case "variable" :
$data['post_parent'] = 0;
break;
endswitch;
}
return $data;
}
/**
* Order data
*
* Forces the order posts to have a title in a certain format (containing the date)
*
* @since 1.0
*/
add_filter('wp_insert_post_data', 'jigoshop_order_data');
function jigoshop_order_data( $data ) {
global $post;
if ($data['post_type']=='shop_order' && isset($data['post_date'])) {
$order_title = 'Order';
if ($data['post_date']) $order_title.= ' &ndash; '.date('F j, Y @ h:i A', strtotime($data['post_date']));
$data['post_title'] = $order_title;
}
return $data;
}
/**
* Save errors
*
* Stores error messages in a variable so they can be displayed on the edit post screen after saving.
*
* @since 1.0
*/
add_action( 'admin_notices', 'jigoshop_meta_boxes_save_errors' );
function jigoshop_meta_boxes_save_errors() {
$jigoshop_errors = maybe_unserialize(get_option('jigoshop_errors'));
if ($jigoshop_errors && sizeof($jigoshop_errors)>0) :
echo '<div id="jigoshop_errors" class="error fade">';
foreach ($jigoshop_errors as $error) :
echo '<p>'.$error.'</p>';
endforeach;
echo '</div>';
update_option('jigoshop_errors', '');
endif;
}
/**
* Enqueue scripts
*
* Enqueue JavaScript used by the meta panels.
*
* @since 1.0
*/
function jigoshop_write_panel_scripts() {
$post_type = jigoshop_get_current_post_type();
if( $post_type !== 'product' && $post_type !== 'shop_order' ) return;
wp_register_script('jigoshop-date', jigoshop::plugin_url() . '/assets/js/date.js');
wp_register_script('jigoshop-datepicker', jigoshop::plugin_url() . '/assets/js/datepicker.js', array('jquery', 'jigoshop-date'));
wp_enqueue_script('jigoshop-datepicker');
wp_register_script('jigoshop-writepanel', jigoshop::plugin_url() . '/assets/js/write-panels.js', array('jquery'));
wp_enqueue_script('jigoshop-writepanel');
wp_enqueue_script('media-upload');
wp_enqueue_script('thickbox');
wp_enqueue_style('thickbox');
$params = array(
'remove_item_notice' => __("Remove this item? If you have previously reduced this item's stock, or this order was submitted by a customer, will need to manually restore the item's stock.", 'jigoshop'),
'cart_total' => __("Calc totals based on order items, discount amount, and shipping?", 'jigoshop'),
'copy_billing' => __("Copy billing information to shipping information? This will remove any currently entered shipping information.", 'jigoshop'),
'prices_include_tax' => get_option('jigoshop_prices_include_tax'),
'ID' => __('ID', 'jigoshop'),
'item_name' => __('Item Name', 'jigoshop'),
'quantity' => __('Quantity e.g. 2', 'jigoshop'),
'cost_unit' => __('Cost per unit e.g. 2.99', 'jigoshop'),
'tax_rate' => __('Tax Rate e.g. 20.0000', 'jigoshop'),
'meta_name' => __('Meta Name', 'jigoshop'),
'meta_value' => __('Meta Value', 'jigoshop'),
'plugin_url' => jigoshop::plugin_url(),
'ajax_url' => admin_url('admin-ajax.php'),
'add_order_item_nonce' => wp_create_nonce("add-order-item")
);
wp_localize_script( 'jigoshop-writepanel', 'params', $params );
}
add_action('admin_print_scripts-post.php', 'jigoshop_write_panel_scripts');
add_action('admin_print_scripts-post-new.php', 'jigoshop_write_panel_scripts');
/**
* Meta scripts
*
* Outputs JavaScript used by the meta panels.
*
* @since 1.0
*/
function jigoshop_meta_scripts() {
?>
<script type="text/javascript">
jQuery(function(){
<?php do_action('product_write_panel_js'); ?>
});
</script>
<?php
}

View File

@ -1,44 +0,0 @@
<?php
/**
* Grouped Product Type
*
* Functions specific to grouped products (for the write panels)
*
* @author Jigowatt
* @category Admin Write Panel Product Types
* @package JigoShop
*/
/**
* Product Options
*
* Product Options for the grouped product type
*
* @since 1.0
*/
function grouped_product_type_options() {
?>
<div id="grouped_product_options">
<?php
_e('Grouped products have no specific options &mdash; you can add simple products to this grouped product by editing them and setting their <code>parent product</code> option.', 'jigoshop');
?>
</div>
<?php
}
add_action('jigoshop_product_type_options_box', 'grouped_product_type_options');
/**
* Product Type selector
*
* Adds this product type to the product type selector in the product options meta box
*
* @since 1.0
*
* @param string $product_type Passed the current product type so that if it keeps its selected state
*/
function grouped_product_type_selector( $product_type ) {
echo '<option value="grouped" '; if ($product_type=='grouped') echo 'selected="selected"'; echo '>'.__('Grouped','jigoshop').'</option>';
}
add_action('product_type_selector', 'grouped_product_type_selector');

View File

@ -1,44 +0,0 @@
<?php
/**
* Virtual Product Type
*
* Functions specific to virtual products (for the write panels)
*
* @author Jigowatt
* @category Admin Write Panel Product Types
* @package JigoShop
*/
/**
* Product Options
*
* Product Options for the virtual product type
*
* @since 1.0
*/
function virtual_product_type_options() {
?>
<div id="virtual_product_options">
<?php
_e('Virtual products have no specific options.', 'jigoshop');
?>
</div>
<?php
}
add_action('jigoshop_product_type_options_box', 'virtual_product_type_options');
/**
* Product Type selector
*
* Adds this product type to the product type selector in the product options meta box
*
* @since 1.0
*
* @param string $product_type Passed the current product type so that if it keeps its selected state
*/
function virtual_product_type_selector( $product_type ) {
echo '<option value="virtual" '; if ($product_type=='virtual') echo 'selected="selected"'; echo '>'.__('Virtual','jigoshop').'</option>';
}
add_action('product_type_selector', 'virtual_product_type_selector');

View File

@ -0,0 +1,603 @@
<?php
/**
* Order Data
*
* Functions for displaying the order data meta box
*
* @author WooThemes
* @category Admin Write Panels
* @package WooCommerce
*/
/**
* Order data meta box
*
* Displays the meta box
*/
function woocommerce_order_data_meta_box($post) {
global $post, $wpdb, $thepostid;
add_action('admin_footer', 'woocommerce_meta_scripts');
wp_nonce_field( 'woocommerce_save_data', 'woocommerce_meta_nonce' );
$data = (array) maybe_unserialize( get_post_meta($post->ID, 'order_data', true) );
if (!isset($data['billing_first_name'])) $data['billing_first_name'] = '';
if (!isset($data['billing_last_name'])) $data['billing_last_name'] = '';
if (!isset($data['billing_company'])) $data['billing_company'] = '';
if (!isset($data['billing_address_1'])) $data['billing_address_1'] = '';
if (!isset($data['billing_address_2'])) $data['billing_address_2'] = '';
if (!isset($data['billing_city'])) $data['billing_city'] = '';
if (!isset($data['billing_postcode'])) $data['billing_postcode'] = '';
if (!isset($data['billing_country'])) $data['billing_country'] = '';
if (!isset($data['billing_state'])) $data['billing_state'] = '';
if (!isset($data['billing_email'])) $data['billing_email'] = '';
if (!isset($data['billing_phone'])) $data['billing_phone'] = '';
if (!isset($data['shipping_first_name'])) $data['shipping_first_name'] = '';
if (!isset($data['shipping_last_name'])) $data['shipping_last_name'] = '';
if (!isset($data['shipping_company'])) $data['shipping_company'] = '';
if (!isset($data['shipping_address_1'])) $data['shipping_address_1'] = '';
if (!isset($data['shipping_address_2'])) $data['shipping_address_2'] = '';
if (!isset($data['shipping_city'])) $data['shipping_city'] = '';
if (!isset($data['shipping_postcode'])) $data['shipping_postcode'] = '';
if (!isset($data['shipping_country'])) $data['shipping_country'] = '';
if (!isset($data['shipping_state'])) $data['shipping_state'] = '';
$data['customer_user'] = (int) get_post_meta($post->ID, 'customer_user', true);
$order_status = wp_get_post_terms($post->ID, 'shop_order_status');
if ($order_status) :
$order_status = current($order_status);
$data['order_status'] = $order_status->slug;
else :
$data['order_status'] = 'pending';
endif;
if (!isset($post->post_title) || empty($post->post_title)) :
$order_title = 'Order';
else :
$order_title = $post->post_title;
endif;
?>
<style type="text/css">
#titlediv, #major-publishing-actions, #minor-publishing-actions { display:none }
</style>
<div class="panel-wrap woocommerce">
<input name="post_title" type="hidden" value="<?php echo $order_title; ?>" />
<input name="post_status" type="hidden" value="publish" />
<ul class="product_data_tabs tabs" style="display:none;">
<li class="active"><a href="#order_data"><?php _e('Order', 'woothemes'); ?></a></li>
<li><a href="#order_customer_billing_data"><?php _e('Customer Billing Address', 'woothemes'); ?></a></li>
<li><a href="#order_customer_shipping_data"><?php _e('Customer Shipping Address', 'woothemes'); ?></a></li>
</ul>
<div id="order_data" class="panel woocommerce_options_panel">
<p class="form-field"><label for="order_status"><?php _e('Order status:', 'woothemes') ?></label>
<select id="order_status" name="order_status">
<?php
$statuses = (array) get_terms('shop_order_status', array('hide_empty' => 0, 'orderby' => 'id'));
foreach ($statuses as $status) :
echo '<option value="'.$status->slug.'" ';
if ($status->slug==$data['order_status']) echo 'selected="selected"';
echo '>'.$status->name.'</option>';
endforeach;
?>
</select></p>
<p class="form-field"><label for="customer_user"><?php _e('Customer:', 'woothemes') ?></label>
<select id="customer_user" name="customer_user">
<option value=""><?php _e('Guest', 'woothemes') ?></option>
<?php
$users = $wpdb->get_col( $wpdb->prepare("SELECT $wpdb->users.ID FROM $wpdb->users ORDER BY %s ASC", 'display_name' ));
foreach ( $users as $user_id ) :
$user = get_userdata( $user_id );
echo '<option value="'.$user->ID.'" ';
if ($user->ID==$data['customer_user']) echo 'selected="selected"';
echo '>' . $user->display_name . ' ('.$user->user_email.')</option>';
endforeach;
?>
</select></p>
<p class="form-field"><label for="excerpt"><?php _e('Customer Note:', 'woothemes') ?></label>
<textarea rows="1" cols="40" name="excerpt" tabindex="6" id="excerpt" placeholder="<?php _e('Customer\'s notes about the order', 'woothemes'); ?>"><?php echo $post->post_excerpt; ?></textarea></p>
</div>
<div id="order_customer_billing_data" class="panel woocommerce_options_panel"><?php
// First Name
$field = array( 'id' => 'billing_first_name', 'label' => 'First Name:' );
echo '<p class="form-field"><label for="'.$field['id'].'">'.$field['label'].'</label>
<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$data[$field['id']].'" /></p>';
// Last Name
$field = array( 'id' => 'billing_last_name', 'label' => 'Last Name:' );
echo '<p class="form-field"><label for="'.$field['id'].'">'.$field['label'].'</label>
<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$data[$field['id']].'" /></p>';
// Company
$field = array( 'id' => 'billing_company', 'label' => 'Company:' );
echo '<p class="form-field"><label for="'.$field['id'].'">'.$field['label'].'</label>
<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$data[$field['id']].'" /></p>';
// Address 1
$field = array( 'id' => 'billing_address_1', 'label' => 'Address 1:' );
echo '<p class="form-field"><label for="'.$field['id'].'">'.$field['label'].'</label>
<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$data[$field['id']].'" /></p>';
// Address 2
$field = array( 'id' => 'billing_address_2', 'label' => 'Address 2:' );
echo '<p class="form-field"><label for="'.$field['id'].'">'.$field['label'].'</label>
<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$data[$field['id']].'" /></p>';
// City
$field = array( 'id' => 'billing_city', 'label' => 'City:' );
echo '<p class="form-field"><label for="'.$field['id'].'">'.$field['label'].'</label>
<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$data[$field['id']].'" /></p>';
// Postcode
$field = array( 'id' => 'billing_postcode', 'label' => 'Postcode:' );
echo '<p class="form-field"><label for="'.$field['id'].'">'.$field['label'].'</label>
<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$data[$field['id']].'" /></p>';
// Country
$field = array( 'id' => 'billing_country', 'label' => 'Country:' );
echo '<p class="form-field"><label for="'.$field['id'].'">'.$field['label'].'</label>
<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$data[$field['id']].'" /></p>';
// State
$field = array( 'id' => 'billing_state', 'label' => 'State/County:' );
echo '<p class="form-field"><label for="'.$field['id'].'">'.$field['label'].'</label>
<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$data[$field['id']].'" /></p>';
// Email
$field = array( 'id' => 'billing_email', 'label' => 'Email Address:' );
echo '<p class="form-field"><label for="'.$field['id'].'">'.$field['label'].'</label>
<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$data[$field['id']].'" /></p>';
// Tel
$field = array( 'id' => 'billing_phone', 'label' => 'Tel:' );
echo '<p class="form-field"><label for="'.$field['id'].'">'.$field['label'].'</label>
<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$data[$field['id']].'" /></p>';
?>
</div>
<div id="order_customer_shipping_data" class="panel woocommerce_options_panel">
<p class="form-field"><button class="button billing-same-as-shipping"><?php _e('Copy billing address to shipping address', 'woothemes'); ?></button></p>
<?php
// First Name
$field = array( 'id' => 'shipping_first_name', 'label' => 'First Name:' );
echo '<p class="form-field"><label for="'.$field['id'].'">'.$field['label'].'</label>
<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$data[$field['id']].'" /></p>';
// Last Name
$field = array( 'id' => 'shipping_last_name', 'label' => 'Last Name:' );
echo '<p class="form-field"><label for="'.$field['id'].'">'.$field['label'].'</label>
<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$data[$field['id']].'" /></p>';
// Company
$field = array( 'id' => 'shipping_company', 'label' => 'Company:' );
echo '<p class="form-field"><label for="'.$field['id'].'">'.$field['label'].'</label>
<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$data[$field['id']].'" /></p>';
// Address 1
$field = array( 'id' => 'shipping_address_1', 'label' => 'Address 1:' );
echo '<p class="form-field"><label for="'.$field['id'].'">'.$field['label'].'</label>
<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$data[$field['id']].'" /></p>';
// Address 2
$field = array( 'id' => 'shipping_address_2', 'label' => 'Address 2:' );
echo '<p class="form-field"><label for="'.$field['id'].'">'.$field['label'].'</label>
<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$data[$field['id']].'" /></p>';
// City
$field = array( 'id' => 'shipping_city', 'label' => 'City:' );
echo '<p class="form-field"><label for="'.$field['id'].'">'.$field['label'].'</label>
<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$data[$field['id']].'" /></p>';
// Postcode
$field = array( 'id' => 'shipping_postcode', 'label' => 'Postcode:' );
echo '<p class="form-field"><label for="'.$field['id'].'">'.$field['label'].'</label>
<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$data[$field['id']].'" /></p>';
// Country
$field = array( 'id' => 'shipping_country', 'label' => 'Country:' );
echo '<p class="form-field"><label for="'.$field['id'].'">'.$field['label'].'</label>
<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$data[$field['id']].'" /></p>';
// State
$field = array( 'id' => 'shipping_state', 'label' => 'State/County:' );
echo '<p class="form-field"><label for="'.$field['id'].'">'.$field['label'].'</label>
<input type="text" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$data[$field['id']].'" /></p>';
?>
</div>
</div>
<?php
}
/**
* Order items meta box
*
* Displays the order items meta box - for showing individual items in the order
*/
function woocommerce_order_items_meta_box($post) {
$order_items = (array) maybe_unserialize( get_post_meta($post->ID, 'order_items', true) );
?>
<div class="woocommerce_order_items_wrapper">
<table cellpadding="0" cellspacing="0" class="woocommerce_order_items">
<thead>
<tr>
<th class="product-id"><?php _e('ID', 'woothemes'); ?></th>
<th class="variation-id"><?php _e('Variation ID', 'woothemes'); ?></th>
<th class="product-sku"><?php _e('SKU', 'woothemes'); ?></th>
<th class="name"><?php _e('Name', 'woothemes'); ?></th>
<th class="variation"><?php _e('Variation', 'woothemes'); ?></th>
<th class="meta"><?php _e('Order Item Meta', 'woothemes'); ?></th>
<?php do_action('woocommerce_admin_order_item_headers'); ?>
<th class="quantity"><?php _e('Quantity', 'woothemes'); ?></th>
<th class="cost"><?php _e('Cost', 'woothemes'); ?></th>
<th class="tax"><?php _e('Tax Rate', 'woothemes'); ?></th>
<th class="center" width="1%"><?php _e('Remove', 'woothemes'); ?></th>
</tr>
</thead>
<tbody id="order_items_list">
<?php if (sizeof($order_items)>0 && isset($order_items[0]['id'])) foreach ($order_items as $item) :
if (isset($item['variation_id']) && $item['variation_id'] > 0) :
$_product = &new woocommerce_product_variation( $item['variation_id'] );
else :
$_product = &new woocommerce_product( $item['id'] );
endif;
?>
<tr class="item">
<td class="product-id"><?php echo $item['id']; ?></td>
<td class="variation-id"><?php if ($item['variation_id']) echo $item['variation_id']; else echo '-'; ?></td>
<td class="product-sku"><?php if ($_product->sku) echo $_product->sku; ?></td>
<td class="name"><a href="<?php echo admin_url('post.php?post='. $_product->id .'&action=edit'); ?>"><?php echo $item['name']; ?></a></td>
<td class="variation"><?php
if (isset($_product->variation_data)) :
echo woocommerce_get_formatted_variation( $_product->variation_data, true );
else :
echo '-';
endif;
?></td>
<td>
<table class="meta" cellspacing="0">
<tfoot>
<tr>
<td colspan="3"><button class="add_meta button"><?php _e('Add meta', 'woothemes'); ?></button></td>
</tr>
</tfoot>
<tbody></tbody>
</table>
</td>
<?php do_action('woocommerce_admin_order_item_values', $_product, $item); ?>
<td class="quantity"><input type="text" name="item_quantity[]" placeholder="<?php _e('Quantity e.g. 2', 'woothemes'); ?>" value="<?php echo $item['qty']; ?>" /></td>
<td class="cost"><input type="text" name="item_cost[]" placeholder="<?php _e('Cost per unit ex. tax e.g. 2.99', 'woothemes'); ?>" value="<?php echo $item['cost']; ?>" /></td>
<td class="tax"><input type="text" name="item_tax_rate[]" placeholder="<?php _e('Tax Rate e.g. 20.0000', 'woothemes'); ?>" value="<?php echo $item['taxrate']; ?>" /></td>
<td class="center">
<input type="hidden" name="item_id[]" value="<?php echo $item['id']; ?>" />
<input type="hidden" name="item_name[]" value="<?php echo $item['name']; ?>" />
<button type="button" class="remove_row button">&times;</button>
</td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</div>
<p class="buttons">
<select name="item_id" class="item_id">
<?php
$args = array(
'post_type' => 'product',
'posts_per_page' => -1,
'post_status' => 'publish',
'post_parent' => 0,
'order' => 'ASC',
'orderby' => 'title'
);
$products = get_posts( $args );
if ($products) foreach ($products as $product) :
$sku = get_post_meta($product->ID, 'SKU', true);
if ($sku) $sku = ' SKU: '.$sku;
echo '<option value="'.$product->ID.'">'.$product->post_title.$sku.' (#'.$product->ID.''.$sku.')</option>';
$args_get_children = array(
'post_type' => array( 'product_variation', 'product' ),
'posts_per_page' => -1,
'order' => 'ASC',
'orderby' => 'title',
'post_parent' => $product->ID
);
if ( $children_products =& get_children( $args_get_children ) ) :
foreach ($children_products as $child) :
echo '<option value="'.$child->ID.'">&nbsp;&nbsp;&mdash;&nbsp;'.$child->post_title.'</option>';
endforeach;
endif;
endforeach;
?>
</select>
<button type="button" class="button button-primary add_shop_order_item"><?php _e('Add item', 'woothemes'); ?></button>
</p>
<p class="buttons buttons-alt">
<button type="button" class="button button calc_totals"><?php _e('Calculate totals', 'woothemes'); ?></button>
</p>
<div class="clear"></div>
<?php
}
/**
* Order actions meta box
*
* Displays the order actions meta box - buttons for managing order stock and sending the customer an invoice.
*/
function woocommerce_order_actions_meta_box($post) {
?>
<ul class="order_actions">
<li><input type="submit" class="button button-primary" name="save" value="<?php _e('Save Order', 'woothemes'); ?>" /> <?php _e('- Save/update the order.', 'woothemes'); ?></li>
<li><input type="submit" class="button" name="reduce_stock" value="<?php _e('Reduce stock', 'woothemes'); ?>" /> <?php _e('- Reduces stock for each item in the order; useful after manually creating an order or manually marking an order as complete/processing after payment.', 'woothemes'); ?></li>
<li><input type="submit" class="button" name="restore_stock" value="<?php _e('Restore stock', 'woothemes'); ?>" /> <?php _e('- Restores stock for each item in the order; useful after refunding or canceling the entire order.', 'woothemes'); ?></li>
<li><input type="submit" class="button" name="invoice" value="<?php _e('Email invoice', 'woothemes'); ?>" /> <?php _e('- Emails the customer order details and a payment link.', 'woothemes'); ?></li>
<li>
<?php
if ( current_user_can( "delete_post", $post->ID ) ) {
if ( !EMPTY_TRASH_DAYS )
$delete_text = __('Delete Permanently');
else
$delete_text = __('Move to Trash');
?>
<a class="submitdelete deletion" href="<?php echo get_delete_post_link($post->ID); ?>"><?php echo $delete_text; ?></a><?php
} ?>
</li>
</ul>
<?php
}
/**
* Order totals meta box
*
* Displays the order totals meta box
*/
function woocommerce_order_totals_meta_box($post) {
$data = maybe_unserialize( get_post_meta($post->ID, 'order_data', true) );
if (!isset($data['shipping_method'])) $data['shipping_method'] = '';
if (!isset($data['payment_method'])) $data['payment_method'] = '';
if (!isset($data['order_subtotal'])) $data['order_subtotal'] = '';
if (!isset($data['order_shipping'])) $data['order_shipping'] = '';
if (!isset($data['order_discount'])) $data['order_discount'] = '';
if (!isset($data['order_tax'])) $data['order_tax'] = '';
if (!isset($data['order_total'])) $data['order_total'] = '';
if (!isset($data['order_shipping_tax'])) $data['order_shipping_tax'] = '';
?>
<dl class="totals">
<dt><?php _e('Subtotal:', 'woothemes'); ?></dt>
<dd><input type="text" id="order_subtotal" name="order_subtotal" placeholder="0.00 <?php _e('(ex. tax)', 'woothemes'); ?>" value="<?php echo $data['order_subtotal']; ?>" class="first" /></dd>
<dt><?php _e('Shipping &amp; Handling:', 'woothemes'); ?></dt>
<dd><input type="text" id="order_shipping" name="order_shipping" placeholder="0.00 <?php _e('(ex. tax)', 'woothemes'); ?>" value="<?php echo $data['order_shipping']; ?>" class="first" /> <input type="text" name="shipping_method" id="shipping_method" value="<?php echo $data['shipping_method']; ?>" class="last" placeholder="<?php _e('Shipping method...', 'woothemes'); ?>" /></dd>
<dt><?php _e('Order shipping tax:', 'woothemes'); ?></dt>
<dd><input type="text" id="order_shipping_tax" name="order_shipping_tax" placeholder="0.00" value="<?php echo $data['order_shipping_tax']; ?>" class="first" /></dd>
<dt><?php _e('Tax:', 'woothemes'); ?></dt>
<dd><input type="text" id="order_tax" name="order_tax" placeholder="0.00" value="<?php echo $data['order_tax']; ?>" class="first" /></dd>
<dt><?php _e('Discount:', 'woothemes'); ?></dt>
<dd><input type="text" id="order_discount" name="order_discount" placeholder="0.00" value="<?php echo $data['order_discount']; ?>" /></dd>
<dt><?php _e('Total:', 'woothemes'); ?></dt>
<dd><input type="text" id="order_total" name="order_total" placeholder="0.00" value="<?php echo $data['order_total']; ?>" class="first" /> <input type="text" name="payment_method" id="payment_method" value="<?php echo $data['payment_method']; ?>" class="last" placeholder="<?php _e('Payment method...', 'woothemes'); ?>" /></dd>
</dl>
<div class="clear"></div>
<?php
}
/**
* Order Data Save
*
* Function for processing and storing all order data.
*/
add_action('woocommerce_process_shop_order_meta', 'woocommerce_process_shop_order_meta', 1, 2);
function woocommerce_process_shop_order_meta( $post_id, $post ) {
global $wpdb;
$woocommerce_errors = array();
$order = &new woocommerce_order($post_id);
// Get old data + attributes
$data = (array) maybe_unserialize( get_post_meta($post_id, 'order_data', true) );
// Add/Replace data to array
$data['billing_first_name'] = stripslashes( $_POST['billing_first_name'] );
$data['billing_last_name'] = stripslashes( $_POST['billing_last_name'] );
$data['billing_company'] = stripslashes( $_POST['billing_company'] );
$data['billing_address_1'] = stripslashes( $_POST['billing_address_1'] );
$data['billing_address_2'] = stripslashes( $_POST['billing_address_2'] );
$data['billing_city'] = stripslashes( $_POST['billing_city'] );
$data['billing_postcode'] = stripslashes( $_POST['billing_postcode'] );
$data['billing_country'] = stripslashes( $_POST['billing_country'] );
$data['billing_state'] = stripslashes( $_POST['billing_state'] );
$data['billing_email'] = stripslashes( $_POST['billing_email'] );
$data['billing_phone'] = stripslashes( $_POST['billing_phone'] );
$data['shipping_first_name'] = stripslashes( $_POST['shipping_first_name'] );
$data['shipping_last_name'] = stripslashes( $_POST['shipping_last_name'] );
$data['shipping_company'] = stripslashes( $_POST['shipping_company'] );
$data['shipping_address_1'] = stripslashes( $_POST['shipping_address_1'] );
$data['shipping_address_2'] = stripslashes( $_POST['shipping_address_2'] );
$data['shipping_city'] = stripslashes( $_POST['shipping_city'] );
$data['shipping_postcode'] = stripslashes( $_POST['shipping_postcode'] );
$data['shipping_country'] = stripslashes( $_POST['shipping_country'] );
$data['shipping_state'] = stripslashes( $_POST['shipping_state'] );
$data['shipping_method'] = stripslashes( $_POST['shipping_method'] );
$data['payment_method'] = stripslashes( $_POST['payment_method'] );
$data['order_subtotal'] = stripslashes( $_POST['order_subtotal'] );
$data['order_shipping'] = stripslashes( $_POST['order_shipping'] );
$data['order_discount'] = stripslashes( $_POST['order_discount'] );
$data['order_tax'] = stripslashes( $_POST['order_tax'] );
$data['order_shipping_tax'] = stripslashes( $_POST['order_shipping_tax'] );
$data['order_total'] = stripslashes( $_POST['order_total'] );
// Customer
update_post_meta( $post_id, 'customer_user', (int) $_POST['customer_user'] );
// Order status
$order->update_status( $_POST['order_status'] );
// Order items
$order_items = array();
if (isset($_POST['item_id'])) :
$item_id = $_POST['item_id'];
$item_variation= $_POST['item_variation'];
$item_name = $_POST['item_name'];
$item_quantity = $_POST['item_quantity'];
$item_cost = $_POST['item_cost'];
$item_tax_rate = $_POST['item_tax_rate'];
for ($i=0; $i<sizeof($item_id); $i++) :
if (!isset($item_id[$i])) continue;
if (!isset($item_name[$i])) continue;
if (!isset($item_quantity[$i])) continue;
if (!isset($item_cost[$i])) continue;
if (!isset($item_tax_rate[$i])) continue;
$order_items[] = apply_filters('update_order_item', array(
'id' => htmlspecialchars(stripslashes($item_id[$i])),
'variation_id' => (int) $item_variation[$i],
'name' => htmlspecialchars(stripslashes($item_name[$i])),
'qty' => (int) $item_quantity[$i],
'cost' => number_format(woocommerce_clean($item_cost[$i]), 2),
'taxrate' => number_format(woocommerce_clean($item_tax_rate[$i]), 4)
));
endfor;
endif;
// Save
update_post_meta( $post_id, 'order_data', $data );
update_post_meta( $post_id, 'order_items', $order_items );
// Handle button actions
if (isset($_POST['reduce_stock']) && $_POST['reduce_stock'] && sizeof($order_items)>0) :
$order->add_order_note( __('Manually reducing stock.', 'woothemes') );
foreach ($order_items as $order_item) :
$_product = $order->get_product_from_item( $order_item );
if ($_product->exists) :
if ($_product->managing_stock()) :
$old_stock = $_product->stock;
$new_quantity = $_product->reduce_stock( $order_item['qty'] );
$order->add_order_note( sprintf( __('Item #%s stock reduced from %s to %s.', 'woothemes'), $order_item['id'], $old_stock, $new_quantity) );
if ($new_quantity<0) :
do_action('woocommerce_product_on_backorder_notification', $order_item['id'], $values['quantity']);
endif;
// stock status notifications
if (get_option('woocommerce_notify_no_stock_amount') && get_option('woocommerce_notify_no_stock_amount')>=$new_quantity) :
do_action('woocommerce_no_stock_notification', $order_item['id']);
elseif (get_option('woocommerce_notify_low_stock_amount') && get_option('woocommerce_notify_low_stock_amount')>=$new_quantity) :
do_action('woocommerce_low_stock_notification', $order_item['id']);
endif;
endif;
else :
$order->add_order_note( sprintf( __('Item %s %s not found, skipping.', 'woothemes'), $order_item['id'], $order_item['name'] ) );
endif;
endforeach;
$order->add_order_note( __('Manual stock reduction complete.', 'woothemes') );
elseif (isset($_POST['restore_stock']) && $_POST['restore_stock'] && sizeof($order_items)>0) :
$order->add_order_note( __('Manually restoring stock.', 'woothemes') );
foreach ($order_items as $order_item) :
$_product = $order->get_product_from_item( $order_item );
if ($_product->exists) :
if ($_product->managing_stock()) :
$old_stock = $_product->stock;
$new_quantity = $_product->increase_stock( $order_item['qty'] );
$order->add_order_note( sprintf( __('Item #%s stock increased from %s to %s.', 'woothemes'), $order_item['id'], $old_stock, $new_quantity) );
endif;
else :
$order->add_order_note( sprintf( __('Item %s %s not found, skipping.', 'woothemes'), $order_item['id'], $order_item['name'] ) );
endif;
endforeach;
$order->add_order_note( __('Manual stock restore complete.', 'woothemes') );
elseif (isset($_POST['invoice']) && $_POST['invoice']) :
// Mail link to customer
woocommerce_pay_for_order_customer_notification( $order->id );
endif;
// Error Handling
if (sizeof($woocommerce_errors)>0) update_option('woocommerce_errors', $woocommerce_errors);
}

View File

@ -4,56 +4,50 @@
*
* Functions specific to downloadable products (for the write panels)
*
* @author Jigowatt
* @category Admin Write Panel Product Types
* @package JigoShop
* @author WooThemes
* @category Admin Write Panels
* @package WooCommerce
*/
/**
* Product Options
*
* Product Options for the downloadable product type
*
* @since 1.0
*/
function downloadable_product_type_options() {
global $post;
?>
<div id="downloadable_product_options" class="panel jigoshop_options_panel">
<div id="downloadable_product_options" class="panel woocommerce_options_panel">
<?php
// File URL
$file_path = get_post_meta($post->ID, 'file_path', true);
$field = array( 'id' => 'file_path', 'label' => __('File path', 'jigoshop') );
$field = array( 'id' => 'file_path', 'label' => __('File path', 'woothemes') );
echo '<p class="form-field">
<label for="'.$field['id'].'">'.$field['label'].':</label>
<span style="float:left">'.ABSPATH.'</span><input type="text" class="short" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$file_path.'" placeholder="'.__('path to file on your server', 'jigoshop').'" /></p>';
<span style="float:left">'.ABSPATH.'</span><input type="text" class="short" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$file_path.'" placeholder="'.__('path to file on your server', 'woothemes').'" /></p>';
// Download Limit
$download_limit = get_post_meta($post->ID, 'download_limit', true);
$field = array( 'id' => 'download_limit', 'label' => __('Download Limit', 'jigoshop') );
$field = array( 'id' => 'download_limit', 'label' => __('Download Limit', 'woothemes') );
echo '<p class="form-field">
<label for="'.$field['id'].'">'.$field['label'].':</label>
<input type="text" class="short" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$download_limit.'" /> <span class="description">' . __('Leave blank for unlimited re-downloads.', 'jigoshop') . '</span></p>';
<input type="text" class="short" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$download_limit.'" /> <span class="description">' . __('Leave blank for unlimited re-downloads.', 'woothemes') . '</span></p>';
?>
</div>
<?php
}
add_action('jigoshop_product_type_options_box', 'downloadable_product_type_options');
add_action('woocommerce_product_type_options_box', 'downloadable_product_type_options');
/**
* Product Type selector
*
* Adds this product type to the product type selector in the product options meta box
*
* @since 1.0
*
* @param string $product_type Passed the current product type so that if it keeps its selected state
*/
function downloadable_product_type_selector( $product_type ) {
echo '<option value="downloadable" '; if ($product_type=='downloadable') echo 'selected="selected"'; echo '>'.__('Downloadable','jigoshop').'</option>';
echo '<option value="downloadable" '; if ($product_type=='downloadable') echo 'selected="selected"'; echo '>'.__('Downloadable', 'woothemes').'</option>';
}
add_action('product_type_selector', 'downloadable_product_type_selector');
@ -62,11 +56,6 @@ add_action('product_type_selector', 'downloadable_product_type_selector');
* Process meta
*
* Processes this product types options when a post is saved
*
* @since 1.0
*
* @param array $data The $data being saved
* @param int $post_id The post id of the post being saved
*/
function filter_product_meta_downloadable( $data, $post_id ) {

View File

@ -4,17 +4,15 @@
*
* Functions specific to variable products (for the write panels)
*
* @author Jigowatt
* @category Admin Write Panel Product Types
* @package JigoShop
* @author WooThemes
* @category Admin Write Panels
* @package WooCommerce
*/
/**
* Product Options
*
* Product Options for the variable product type
*
* @since 1.0
*/
function variable_product_type_options() {
global $post;
@ -24,7 +22,7 @@ function variable_product_type_options() {
?>
<div id="variable_product_options" class="panel">
<div class="jigoshop_configurations">
<div class="woocommerce_configurations">
<?php
$args = array(
'post_type' => 'product_variation',
@ -44,12 +42,12 @@ function variable_product_type_options() {
$image = wp_get_attachment_url( $variation_data['_thumbnail_id'][0] );
endif;
if (!$image) $image = jigoshop::plugin_url().'/assets/images/placeholder.png';
if (!$image) $image = woocommerce::plugin_url().'/assets/images/placeholder.png';
?>
<div class="jigoshop_configuration">
<div class="woocommerce_configuration">
<p>
<button type="button" class="remove_variation button" rel="<?php echo $variation->ID; ?>"><?php _e('Remove', 'jigoshop'); ?></button>
<strong>#<?php echo $variation->ID; ?> &mdash; <?php _e('Variation:', 'jigoshop'); ?></strong>
<button type="button" class="remove_variation button" rel="<?php echo $variation->ID; ?>"><?php _e('Remove', 'woothemes'); ?></button>
<strong>#<?php echo $variation->ID; ?> &mdash; <?php _e('Variation:', 'woothemes'); ?></strong>
<?php
foreach ($attributes as $attribute) :
@ -60,7 +58,7 @@ function variable_product_type_options() {
if (!is_array($options)) $options = explode(',', $options);
echo '<select name="tax_' . sanitize_title($attribute['name']).'['.$loop.']"><option value="">'.__('Any ', 'jigoshop').$attribute['name'].'&hellip;</option>';
echo '<select name="tax_' . sanitize_title($attribute['name']).'['.$loop.']"><option value="">'.__('Any ', 'woothemes').$attribute['name'].'&hellip;</option>';
foreach($options as $option) :
$option = trim($option);
@ -75,39 +73,37 @@ function variable_product_type_options() {
?>
<input type="hidden" name="variable_post_id[<?php echo $loop; ?>]" value="<?php echo $variation->ID; ?>" />
</p>
<table cellpadding="0" cellspacing="0" class="jigoshop_variable_attributes">
<table cellpadding="0" cellspacing="0" class="woocommerce_variable_attributes">
<tbody>
<tr>
<td class="upload_image"><img src="<?php echo $image ?>" width="60px" height="60px" /><input type="hidden" name="upload_image_id[<?php echo $loop; ?>]" class="upload_image_id" value="<?php if (isset($variation_data['_thumbnail_id'][0])) echo $variation_data['_thumbnail_id'][0]; ?>" /><input type="button" rel="<?php echo $variation->ID; ?>" class="upload_image_button button" value="<?php _e('Product Image', 'jigoshop'); ?>" /></td>
<td><label><?php _e('SKU:', 'jigoshop'); ?></label><input type="text" size="5" name="variable_sku[<?php echo $loop; ?>]" value="<?php if (isset($variation_data['SKU'][0])) echo $variation_data['SKU'][0]; ?>" /></td>
<td><label><?php _e('Weight', 'jigoshop').' ('.get_option('jigoshop_weight_unit').'):'; ?></label><input type="text" size="5" name="variable_weight[<?php echo $loop; ?>]" value="<?php if (isset($variation_data['weight'][0])) echo $variation_data['weight'][0]; ?>" /></td>
<td><label><?php _e('Stock Qty:', 'jigoshop'); ?></label><input type="text" size="5" name="variable_stock[<?php echo $loop; ?>]" value="<?php if (isset($variation_data['stock'][0])) echo $variation_data['stock'][0]; ?>" /></td>
<td><label><?php _e('Price:', 'jigoshop'); ?></label><input type="text" size="5" name="variable_price[<?php echo $loop; ?>]" placeholder="<?php _e('e.g. 29.99', 'jigoshop'); ?>" value="<?php if (isset($variation_data['price'][0])) echo $variation_data['price'][0]; ?>" /></td>
<td><label><?php _e('Sale Price:', 'jigoshop'); ?></label><input type="text" size="5" name="variable_sale_price[<?php echo $loop; ?>]" placeholder="<?php _e('e.g. 29.99', 'jigoshop'); ?>" value="<?php if (isset($variation_data['sale_price'][0])) echo $variation_data['sale_price'][0]; ?>" /></td>
<td><label><?php _e('Enabled', 'jigoshop'); ?></label><input type="checkbox" class="checkbox" name="variable_enabled[<?php echo $loop; ?>]" <?php checked($variation->post_status, 'publish'); ?> /></td>
<td class="upload_image"><img src="<?php echo $image ?>" width="60px" height="60px" /><input type="hidden" name="upload_image_id[<?php echo $loop; ?>]" class="upload_image_id" value="<?php if (isset($variation_data['_thumbnail_id'][0])) echo $variation_data['_thumbnail_id'][0]; ?>" /><input type="button" rel="<?php echo $variation->ID; ?>" class="upload_image_button button" value="<?php _e('Product Image', 'woothemes'); ?>" /></td>
<td><label><?php _e('SKU:', 'woothemes'); ?></label><input type="text" size="5" name="variable_sku[<?php echo $loop; ?>]" value="<?php if (isset($variation_data['SKU'][0])) echo $variation_data['SKU'][0]; ?>" /></td>
<td><label><?php _e('Weight', 'woothemes').' ('.get_option('woocommerce_weight_unit').'):'; ?></label><input type="text" size="5" name="variable_weight[<?php echo $loop; ?>]" value="<?php if (isset($variation_data['weight'][0])) echo $variation_data['weight'][0]; ?>" /></td>
<td><label><?php _e('Stock Qty:', 'woothemes'); ?></label><input type="text" size="5" name="variable_stock[<?php echo $loop; ?>]" value="<?php if (isset($variation_data['stock'][0])) echo $variation_data['stock'][0]; ?>" /></td>
<td><label><?php _e('Price:', 'woothemes'); ?></label><input type="text" size="5" name="variable_price[<?php echo $loop; ?>]" placeholder="<?php _e('e.g. 29.99', 'woothemes'); ?>" value="<?php if (isset($variation_data['price'][0])) echo $variation_data['price'][0]; ?>" /></td>
<td><label><?php _e('Sale Price:', 'woothemes'); ?></label><input type="text" size="5" name="variable_sale_price[<?php echo $loop; ?>]" placeholder="<?php _e('e.g. 29.99', 'woothemes'); ?>" value="<?php if (isset($variation_data['sale_price'][0])) echo $variation_data['sale_price'][0]; ?>" /></td>
<td><label><?php _e('Enabled', 'woothemes'); ?></label><input type="checkbox" class="checkbox" name="variable_enabled[<?php echo $loop; ?>]" <?php checked($variation->post_status, 'publish'); ?> /></td>
</tr>
</tbody>
</table>
</div>
<?php $loop++; endforeach; ?>
</div>
<p class="description"><?php _e('Add (optional) pricing/inventory for product variations. You must save your product attributes in the "Product Data" panel to make them available for selection.', 'jigoshop'); ?></p>
<p class="description"><?php _e('Add (optional) pricing/inventory for product variations. You must save your product attributes in the "Product Data" panel to make them available for selection.', 'woothemes'); ?></p>
<button type="button" class="button button-primary add_configuration"><?php _e('Add Configuration', 'jigoshop'); ?></button>
<button type="button" class="button button-primary add_configuration"><?php _e('Add Configuration', 'woothemes'); ?></button>
<div class="clear"></div>
</div>
<?php
}
add_action('jigoshop_product_type_options_box', 'variable_product_type_options');
add_action('woocommerce_product_type_options_box', 'variable_product_type_options');
/**
* Product Type Javascript
*
* Javascript for the variable product type
*
* @since 1.0
*/
function variable_product_write_panel_js() {
global $post;
@ -119,10 +115,10 @@ function variable_product_write_panel_js() {
jQuery('button.add_configuration').live('click', function(){
jQuery('.jigoshop_configurations').block({ message: null, overlayCSS: { background: '#fff url(<?php echo jigoshop::plugin_url(); ?>/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.6 } });
jQuery('.woocommerce_configurations').block({ message: null, overlayCSS: { background: '#fff url(<?php echo woocommerce::plugin_url(); ?>/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.6 } });
var data = {
action: 'jigoshop_add_variation',
action: 'woocommerce_add_variation',
post_id: <?php echo $post->ID; ?>,
security: '<?php echo wp_create_nonce("add-variation"); ?>'
};
@ -131,12 +127,12 @@ function variable_product_write_panel_js() {
var variation_id = parseInt(response);
var loop = jQuery('.jigoshop_configuration').size();
var loop = jQuery('.woocommerce_configuration').size();
jQuery('.jigoshop_configurations').append('<div class="jigoshop_configuration">\
jQuery('.woocommerce_configurations').append('<div class="woocommerce_configuration">\
<p>\
<button type="button" class="remove_variation button"><?php _e('Remove', 'jigoshop'); ?></button>\
<strong><?php _e('Variation:', 'jigoshop'); ?></strong>\
<button type="button" class="remove_variation button"><?php _e('Remove', 'woothemes'); ?></button>\
<strong><?php _e('Variation:', 'woothemes'); ?></strong>\
<?php
if ($attributes) foreach ($attributes as $attribute) :
@ -145,7 +141,7 @@ function variable_product_write_panel_js() {
$options = $attribute['value'];
if (!is_array($options)) $options = explode(',', $options);
echo '<select name="tax_' . sanitize_title($attribute['name']).'[\' + loop + \']"><option value="">'.__('Any ', 'jigoshop').$attribute['name'].'&hellip;</option>';
echo '<select name="tax_' . sanitize_title($attribute['name']).'[\' + loop + \']"><option value="">'.__('Any ', 'woothemes').$attribute['name'].'&hellip;</option>';
foreach($options as $option) :
echo '<option value="'.trim($option).'">'.ucfirst(trim($option)).'</option>';
@ -155,22 +151,22 @@ function variable_product_write_panel_js() {
endforeach;
?><input type="hidden" name="variable_post_id[' + loop + ']" value="' + variation_id + '" /></p>\
<table cellpadding="0" cellspacing="0" class="jigoshop_variable_attributes">\
<table cellpadding="0" cellspacing="0" class="woocommerce_variable_attributes">\
<tbody>\
<tr>\
<td class="upload_image"><img src="<?php echo jigoshop::plugin_url().'/assets/images/placeholder.png' ?>" width="60px" height="60px" /><input type="hidden" name="upload_image_id[' + loop + ']" class="upload_image_id" /><input type="button" class="upload_image_button button" rel="" value="<?php _e('Product Image', 'jigoshop'); ?>" /></td>\
<td><label><?php _e('SKU:', 'jigoshop'); ?></label><input type="text" size="5" name="variable_sku[' + loop + ']" /></td>\
<td><label><?php _e('Weight', 'jigoshop').' ('.get_option('jigoshop_weight_unit').'):'; ?></label><input type="text" size="5" name="variable_weight[' + loop + ']" /></td>\
<td><label><?php _e('Stock Qty:', 'jigoshop'); ?></label><input type="text" size="5" name="variable_stock[' + loop + ']" /></td>\
<td><label><?php _e('Price:', 'jigoshop'); ?></label><input type="text" size="5" name="variable_price[' + loop + ']" placeholder="<?php _e('e.g. 29.99', 'jigoshop'); ?>" /></td>\
<td><label><?php _e('Sale Price:', 'jigoshop'); ?></label><input type="text" size="5" name="variable_sale_price[' + loop + ']" placeholder="<?php _e('e.g. 29.99', 'jigoshop'); ?>" /></td>\
<td><label><?php _e('Enabled', 'jigoshop'); ?></label><input type="checkbox" class="checkbox" name="variable_enabled[' + loop + ']" checked="checked" /></td>\
<td class="upload_image"><img src="<?php echo woocommerce::plugin_url().'/assets/images/placeholder.png' ?>" width="60px" height="60px" /><input type="hidden" name="upload_image_id[' + loop + ']" class="upload_image_id" /><input type="button" class="upload_image_button button" rel="" value="<?php _e('Product Image', 'woothemes'); ?>" /></td>\
<td><label><?php _e('SKU:', 'woothemes'); ?></label><input type="text" size="5" name="variable_sku[' + loop + ']" /></td>\
<td><label><?php _e('Weight', 'woothemes').' ('.get_option('woocommerce_weight_unit').'):'; ?></label><input type="text" size="5" name="variable_weight[' + loop + ']" /></td>\
<td><label><?php _e('Stock Qty:', 'woothemes'); ?></label><input type="text" size="5" name="variable_stock[' + loop + ']" /></td>\
<td><label><?php _e('Price:', 'woothemes'); ?></label><input type="text" size="5" name="variable_price[' + loop + ']" placeholder="<?php _e('e.g. 29.99', 'woothemes'); ?>" /></td>\
<td><label><?php _e('Sale Price:', 'woothemes'); ?></label><input type="text" size="5" name="variable_sale_price[' + loop + ']" placeholder="<?php _e('e.g. 29.99', 'woothemes'); ?>" /></td>\
<td><label><?php _e('Enabled', 'woothemes'); ?></label><input type="checkbox" class="checkbox" name="variable_enabled[' + loop + ']" checked="checked" /></td>\
</tr>\
</tbody>\
</table>\
</div>');
jQuery('.jigoshop_configurations').unblock();
jQuery('.woocommerce_configurations').unblock();
});
@ -179,7 +175,7 @@ function variable_product_write_panel_js() {
});
jQuery('button.remove_variation').live('click', function(){
var answer = confirm('<?php _e('Are you sure you want to remove this variation?', 'jigoshop'); ?>');
var answer = confirm('<?php _e('Are you sure you want to remove this variation?', 'woothemes'); ?>');
if (answer){
var el = jQuery(this).parent().parent();
@ -188,10 +184,10 @@ function variable_product_write_panel_js() {
if (variation>0) {
jQuery(el).block({ message: null, overlayCSS: { background: '#fff url(<?php echo jigoshop::plugin_url(); ?>/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.6 } });
jQuery(el).block({ message: null, overlayCSS: { background: '#fff url(<?php echo woocommerce::plugin_url(); ?>/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.6 } });
var data = {
action: 'jigoshop_remove_variation',
action: 'woocommerce_remove_variation',
variation_id: variation,
security: '<?php echo wp_create_nonce("delete-variation"); ?>'
};
@ -255,12 +251,10 @@ add_action('product_write_panel_js', 'variable_product_write_panel_js');
/**
* Delete variation via ajax function
*
* @since 1.0
*/
add_action('wp_ajax_jigoshop_remove_variation', 'jigoshop_remove_variation');
add_action('wp_ajax_woocommerce_remove_variation', 'woocommerce_remove_variation');
function jigoshop_remove_variation() {
function woocommerce_remove_variation() {
check_ajax_referer( 'delete-variation', 'security' );
$variation_id = intval( $_POST['variation_id'] );
@ -272,12 +266,10 @@ function jigoshop_remove_variation() {
/**
* Add variation via ajax function
*
* @since 1.0
*/
add_action('wp_ajax_jigoshop_add_variation', 'jigoshop_add_variation');
add_action('wp_ajax_woocommerce_add_variation', 'woocommerce_add_variation');
function jigoshop_add_variation() {
function woocommerce_add_variation() {
check_ajax_referer( 'add-variation', 'security' );
@ -305,14 +297,10 @@ function jigoshop_add_variation() {
* Product Type selector
*
* Adds this product type to the product type selector in the product options meta box
*
* @since 1.0
*
* @param string $product_type Passed the current product type so that if it keeps its selected state
*/
function variable_product_type_selector( $product_type ) {
echo '<option value="variable" '; if ($product_type=='variable') echo 'selected="selected"'; echo '>'.__('Variable','jigoshop').'</option>';
echo '<option value="variable" '; if ($product_type=='variable') echo 'selected="selected"'; echo '>'.__('Variable', 'woothemes').'</option>';
}
add_action('product_type_selector', 'variable_product_type_selector');
@ -321,11 +309,6 @@ add_action('product_type_selector', 'variable_product_type_selector');
* Process meta
*
* Processes this product types options when a post is saved
*
* @since 1.0
*
* @param array $data The $data being saved
* @param int $post_id The post id of the post being saved
*/
function process_product_meta_variable( $data, $post_id ) {

View File

@ -0,0 +1,84 @@
<?php
/**
* Product Type
*
* Function for displaying the product type meta (specific) meta boxes
*
* @author WooThemes
* @category Admin Write Panels
* @package WooCommerce
*/
include_once('writepanel-product-type-downloadable.php');
include_once('writepanel-product-type-variable.php');
/**
* Product type meta box
*
* Display the product type meta box which contains a hook for product types to hook into and show their options
*
* @since 1.0
*/
function woocommerce_product_type_options_box() {
global $post;
?>
<div id="simple_product_options" class="panel woocommerce_options_panel">
<?php
_e('Simple products have no specific options.', 'woothemes');
?>
</div>
<?php
do_action('woocommerce_product_type_options_box');
}
/**
* Virtual Product Type - Product Options
*
* Product Options for the virtual product type
*/
function virtual_product_type_options() {
?>
<div id="virtual_product_options">
<?php
_e('Virtual products have no specific options.', 'woothemes');
?>
</div>
<?php
}
add_action('woocommerce_product_type_options_box', 'virtual_product_type_options');
/**
* Grouped Product Type - Product Options
*
* Product Options for the grouped product type
*
* @since 1.0
*/
function grouped_product_type_options() {
?>
<div id="grouped_product_options">
<?php
_e('Grouped products have no specific options &mdash; you can add simple products to this grouped product by editing them and setting their <code>parent product</code> option.', 'woothemes');
?>
</div>
<?php
}
add_action('woocommerce_product_type_options_box', 'grouped_product_type_options');
/**
* Product Type selectors
*
* Adds a product type to the product type selector in the product options meta box
*/
add_action('product_type_selector', 'virtual_product_type_selector');
add_action('product_type_selector', 'grouped_product_type_selector');
function virtual_product_type_selector( $product_type ) {
echo '<option value="virtual" '; if ($product_type=='virtual') echo 'selected="selected"'; echo '>'.__('Virtual', 'woothemes').'</option>';
}
function grouped_product_type_selector( $product_type ) {
echo '<option value="grouped" '; if ($product_type=='grouped') echo 'selected="selected"'; echo '>'.__('Grouped', 'woothemes').'</option>';
}

View File

@ -0,0 +1,569 @@
<?php
/**
* Product Data
*
* Function for displaying the product data meta boxes
*
* @author WooThemes
* @category Admin Write Panels
* @package WooCommerce
*/
/**
* Product data box
*
* Displays the product data box, tabbed, with several panels covering price, stock etc
*/
function woocommerce_product_data_box() {
global $post, $wpdb, $thepostid;
add_action('admin_footer', 'woocommerce_meta_scripts');
wp_nonce_field( 'woocommerce_save_data', 'woocommerce_meta_nonce' );
$data = (array) maybe_unserialize( get_post_meta($post->ID, 'product_data', true) );
$featured = (string) get_post_meta( $post->ID, 'featured', true );
$visibility = (string) get_post_meta( $post->ID, 'visibility', true);
if (!isset($data['weight'])) $data['weight'] = '';
if (!isset($data['regular_price'])) $data['regular_price'] = '';
if (!isset($data['sale_price'])) $data['sale_price'] = '';
$thepostid = $post->ID;
?>
<div class="panel-wrap product_data">
<ul class="product_data_tabs tabs" style="display:none;">
<li class="active"><a href="#general_product_data"><?php _e('General', 'woothemes'); ?></a></li>
<li class="pricing_tab"><a href="#pricing_product_data"><?php _e('Pricing', 'woothemes'); ?></a></li>
<?php if (get_option('woocommerce_manage_stock')=='yes') : ?><li class="inventory_tab"><a href="#inventory_product_data"><?php _e('Inventory', 'woothemes'); ?></a></li><?php endif; ?>
<li><a href="#woocommerce_attributes"><?php _e('Attributes', 'woothemes'); ?></a></li>
<?php do_action('product_write_panel_tabs'); ?>
</ul>
<div id="general_product_data" class="panel woocommerce_options_panel"><?php
// Product Type
if ($terms = wp_get_object_terms( $thepostid, 'product_type' )) $product_type = current($terms)->slug; else $product_type = 'simple';
$field = array( 'id' => 'product-type', 'label' => __('Product Type', 'woothemes') );
echo '<p class="form-field"><label for="'.$field['id'].'">'.$field['label'].' <em class="req" title="'.__('Required', 'woothemes') . '">*</em></label><select id="'.$field['id'].'" name="'.$field['id'].'">';
echo '<option value="simple" '; if ($product_type=='simple') echo 'selected="selected"'; echo '>'.__('Simple', 'woothemes').'</option>';
do_action('product_type_selector', $product_type);
echo '</select></p>';
// List Grouped products
$posts_in = (array) get_objects_in_term( get_term_by( 'slug', 'grouped', 'product_type' )->term_id, 'product_type' );
$posts_in = array_unique($posts_in);
$field = array( 'id' => 'parent_id', 'label' => __('Parent post', 'woothemes') );
echo '<p class="form-field parent_id_field"><label for="'.$field['id'].'">'.$field['label'].'</label><select id="'.$field['id'].'" name="'.$field['id'].'"><option value="">'.__('Choose a grouped product&hellip;', 'woothemes').'</option>';
if (sizeof($posts_in)>0) :
$args = array(
'post_type' => 'product',
'post_status' => 'publish',
'numberposts' => -1,
'orderby' => 'title',
'order' => 'asc',
'post_parent' => 0,
'include' => $posts_in,
);
$grouped_products = get_posts($args);
$loop = 0;
if ($grouped_products) : foreach ($grouped_products as $product) :
if ($product->ID==$post->ID) continue;
echo '<option value="'.$product->ID.'" ';
if ($post->post_parent==$product->ID) echo 'selected="selected"';
echo '>'.$product->post_title.'</option>';
endforeach; endif;
endif;
echo '</select></p>';
// Ordering
$menu_order = $post->menu_order;
$field = array( 'id' => 'menu_order', 'label' => _x('Post Order', 'ordering', 'woothemes') );
echo '<p class="form-field menu_order_field">
<label for="'.$field['id'].'">'.$field['label'].':</label>
<input type="text" class="short" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$menu_order.'" /></p>';
// Summary
echo '<p class="form-field"><label for="excerpt">' . __('Summary', 'woothemes') . ':</label>
<textarea name="excerpt" id="excerpt" placeholder="' . __('Add a summary for your product &ndash; this is a quick description to encourage users to view the product.', 'woothemes') . '">'.esc_html( $post->post_excerpt ).'</textarea></p>';
// SKU
$field = array( 'id' => 'sku', 'label' => __('SKU', 'woothemes') );
$SKU = get_post_meta($thepostid, 'SKU', true);
if( get_option('woocommerce_enable_sku', true) !== 'no' ) :
echo '<p class="form-field">
<label for="'.$field['id'].'">'.$field['label'].':</label>
<input type="text" class="short" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$SKU.'" /> <span class="description">' . __('Leave blank to use product ID', 'woothemes') . '</span></p>';
else:
echo '<input type="hidden" name="'.$field['id'].'" value="'.$SKU.'" />';
endif;
// Weight
$field = array( 'id' => 'weight', 'label' => __('Weight', 'woothemes') . ' ('.get_option('woocommerce_weight_unit').'):' );
if( get_option('woocommerce_enable_weight', true) !== 'no' ) :
echo '<p class="form-field">
<label for="'.$field['id'].'">'.$field['label'].'</label>
<input type="text" class="short" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$data[$field['id']].'" placeholder="0.00" /></p>';
else:
echo '<input type="hidden" name="'.$field['id'].'" value="'.$data[$field['id']].'" />';
endif;
// Featured
$field = array( 'id' => 'featured', 'label' => __('Featured?', 'woothemes') );
echo '<p class="form-field"><label for="'.$field['id'].'">'.$field['label'].'</label><select name="'.$field['id'].'">';
echo '<option value="no" '; if (isset($featured) && $featured=='no') echo 'selected="selected"'; echo '>' . __('No', 'woothemes') . '</option>';
echo '<option value="yes" '; if (isset($featured) && $featured=='yes') echo 'selected="selected"'; echo '>' . __('Yes', 'woothemes') . '</option>';
echo '</select></p>';
// Visibility
$field = array( 'id' => 'visibility', 'label' => __('Visibility', 'woothemes') );
echo '<p class="form-field"><label for="'.$field['id'].'">'.$field['label'].':</label><select name="'.$field['id'].'">';
echo '<option value="visible" '; if (isset($visibility) && $visibility=='visible') echo 'selected="selected"'; echo '>' . __('Catalog &amp; Search', 'woothemes') . '</option>';
echo '<option value="catalog" '; if (isset($visibility) && $visibility=='catalog') echo 'selected="selected"'; echo '>' . __('Catalog', 'woothemes') . '</option>';
echo '<option value="search" '; if (isset($visibility) && $visibility=='search') echo 'selected="selected"'; echo '>' . __('Search', 'woothemes') . '</option>';
echo '<option value="hidden" '; if (isset($visibility) && $visibility=='hidden') echo 'selected="selected"'; echo '>' . __('Hidden', 'woothemes') . '</option>';
echo '</select></p>';
?>
</div>
<div id="pricing_product_data" class="panel woocommerce_options_panel">
<?php
// Price
$field = array( 'id' => 'regular_price', 'label' => __('Regular Price', 'woothemes') . ' ('.get_woocommerce_currency_symbol().'):' );
echo ' <p class="form-field">
<label for="'.$field['id'].'">'.$field['label'].'</label>
<input type="text" class="short" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$data[$field['id']].'" placeholder="0.00" /></p>';
// Special Price
$field = array( 'id' => 'sale_price', 'label' => __('Sale Price', 'woothemes') . ' ('.get_woocommerce_currency_symbol().'):' );
echo ' <p class="form-field">
<label for="'.$field['id'].'">'.$field['label'].'</label>
<input type="text" class="short" name="'.$field['id'].'" id="'.$field['id'].'" value="'.$data[$field['id']].'" placeholder="0.00" /></p>';
// Special Price date range
$field = array( 'id' => 'sale_price_dates', 'label' => __('Sale Price Dates', 'woothemes') );
$sale_price_dates_from = get_post_meta($thepostid, 'sale_price_dates_from', true);
$sale_price_dates_to = get_post_meta($thepostid, 'sale_price_dates_to', true);
echo ' <p class="form-field">
<label for="'.$field['id'].'_from">'.$field['label'].':</label>
<input type="text" class="short date-pick" name="'.$field['id'].'_from" id="'.$field['id'].'_from" value="';
if ($sale_price_dates_from) echo date('Y-m-d', $sale_price_dates_from);
echo '" placeholder="' . __('From&hellip;', 'woothemes') . '" maxlength="10" />
<input type="text" class="short date-pick" name="'.$field['id'].'_to" id="'.$field['id'].'_to" value="';
if ($sale_price_dates_to) echo date('Y-m-d', $sale_price_dates_to);
echo '" placeholder="' . __('To&hellip;', 'woothemes') . '" maxlength="10" />
<span class="description">' . __('Date format', 'woothemes') . ': <code>YYYY-MM-DD</code></span>
</p>';
// Tax
$_tax = new woocommerce_tax();
$field = array( 'id' => 'tax_status', 'label' => __('Tax Status', 'woothemes') );
echo '<p class="form-field"><label for="'.$field['id'].'">'.$field['label'].':</label><select name="'.$field['id'].'">';
echo '<option value="taxable" '; if (isset($data[$field['id']]) && $data[$field['id']]=='taxable') echo 'selected="selected"'; echo '>' . __('Taxable', 'woothemes') . '</option>';
echo '<option value="shipping" '; if (isset($data[$field['id']]) && $data[$field['id']]=='shipping') echo 'selected="selected"'; echo '>' . __('Shipping only', 'woothemes') . '</option>';
echo '<option value="none" '; if (isset($data[$field['id']]) && $data[$field['id']]=='none') echo 'selected="selected"'; echo '>' . __('None', 'woothemes') . '</option>';
echo '</select></p>';
$field = array( 'id' => 'tax_class', 'label' => __('Tax Class', 'woothemes') );
echo '<p class="form-field"><label for="'.$field['id'].'">'.$field['label'].':</label><select name="'.$field['id'].'">';
echo '<option value="" '; if (isset($data[$field['id']]) && $data[$field['id']]=='') echo 'selected="selected"'; echo '>'.__('Standard', 'woothemes').'</option>';
$tax_classes = $_tax->get_tax_classes();
if ($tax_classes) foreach ($tax_classes as $class) :
echo '<option value="'.sanitize_title($class).'" '; if (isset($data[$field['id']]) && $data[$field['id']]==sanitize_title($class)) echo 'selected="selected"'; echo '>'.$class.'</option>';
endforeach;
echo '</select></p>';
?>
</div>
<?php if (get_option('woocommerce_manage_stock')=='yes') : ?>
<div id="inventory_product_data" class="panel woocommerce_options_panel">
<?php
// manage stock
$field = array( 'id' => 'manage_stock', 'label' => __('Manage stock?', 'woothemes') );
echo '<p class="form-field"><label for="'.$field['id'].'">'.$field['label'].' <em class="req" title="' .__('Required', 'woothemes') . '">*</em></label><input type="checkbox" class="checkbox" name="'.$field['id'].'" id="'.$field['id'].'"';
if (isset($data[$field['id']]) && $data[$field['id']]=='yes') echo 'checked="checked"';
echo ' /></p>';
// Stock status
$field = array( 'id' => 'stock_status', 'label' => 'Stock status:' );
echo '<p class="form-field"><label for="'.$field['id'].'">'.$field['label'].' <em class="req" title="'.__('Required', 'woothemes') . '">*</em></label><select name="'.$field['id'].'">';
echo '<option value="instock" '; if (isset($data[$field['id']]) && $data[$field['id']]=='instock') echo 'selected="selected"'; echo '>In stock</option>';
echo '<option value="outofstock" '; if (isset($data[$field['id']]) && $data[$field['id']]=='outofstock') echo 'selected="selected"'; echo '>Out of stock</option>';
echo '</select></p>';
echo '<div class="stock_fields">';
// Stock
$field = array( 'id' => 'stock', 'label' => __('Stock Qty', 'woothemes') );
echo ' <p class="form-field">
<label for="'.$field['id'].'">'.$field['label'].': <em class="req" title="'.__('Required', 'woothemes') . '">*</em></label>
<input type="text" class="short" name="'.$field['id'].'" id="'.$field['id'].'" value="';
$stock = get_post_meta($post->ID, 'stock', true);
if (!$stock) $stock = 0;
echo $stock;
echo '" />
</p>';
// Backorders?
$field = array( 'id' => 'backorders', 'label' => __('Allow Backorders?', 'woothemes') );
echo '<p class="form-field"><label for="'.$field['id'].'">'.$field['label'].' <em class="req" title="'.__('Required', 'woothemes') . '">*</em></label><select name="'.$field['id'].'">';
echo '<option value="no" '; if (isset($data[$field['id']]) && $data[$field['id']]=='no') echo 'selected="selected"'; echo '>' . __('Do not allow', 'woothemes') . '</option>';
echo '<option value="notify" '; if (isset($data[$field['id']]) && $data[$field['id']]=='notify') echo 'selected="selected"'; echo '>' . __('Allow, but notify customer', 'woothemes') . '</option>';
echo '<option value="yes" '; if (isset($data[$field['id']]) && $data[$field['id']]=='yes') echo 'selected="selected"'; echo '>' . __('Allow', 'woothemes') . '</option>';
echo '</select></p>';
echo '</div>';
?>
</div>
<?php endif; ?>
<div id="woocommerce_attributes" class="panel">
<div class="woocommerce_attributes_wrapper">
<table cellpadding="0" cellspacing="0" class="woocommerce_attributes">
<thead>
<tr>
<th class="center" width="60"><?php _e('Order', 'woothemes'); ?></th>
<th width="180"><?php _e('Name', 'woothemes'); ?></th>
<th><?php _e('Value', 'woothemes'); ?></th>
<th class="center" width="1%"><?php _e('Visible?', 'woothemes'); ?></th>
<th class="center" width="1%"><?php _e('Variation?', 'woothemes'); ?></th>
<th class="center" width="1%"><?php _e('Remove', 'woothemes'); ?></th>
</tr>
</thead>
<tbody id="attributes_list">
<?php
$attribute_taxonomies = woocommerce::$attribute_taxonomies;
$attributes = maybe_unserialize( get_post_meta($post->ID, 'product_attributes', true) );
$i = -1;
// Taxonomies
if ( $attribute_taxonomies ) :
foreach ($attribute_taxonomies as $tax) : $i++;
$attribute_nicename = strtolower(sanitize_title($tax->attribute_name));
if (isset($attributes[$attribute_nicename])) $attribute = $attributes[$attribute_nicename];
if (isset($attribute['visible']) && $attribute['visible']=='yes') $checked = 'checked="checked"'; else $checked = '';
if (isset($attribute['variation']) && $attribute['variation']=='yes') $checked2 = 'checked="checked"'; else $checked2 = '';
$values = wp_get_post_terms( $thepostid, 'product_attribute_'.strtolower(sanitize_title($tax->attribute_name)) );
$value = array();
if (!is_wp_error($values) && $values) :
foreach ($values as $v) :
$value[] = $v->slug;
endforeach;
endif;
?><tr class="taxonomy <?php echo strtolower(sanitize_title($tax->attribute_name)); ?>" rel="<?php if (isset($attribute['position'])) echo $attribute['position']; else echo '0'; ?>" <?php if (!$value || sizeof($value)==0) echo 'style="display:none"'; ?>>
<td class="center">
<button type="button" class="move_up button">&uarr;</button><button type="button" class="move_down button">&darr;</button>
<input type="hidden" name="attribute_position[<?php echo $i; ?>]" class="attribute_position" value="<?php if (isset($attribute['position'])) echo $attribute['position']; else echo '0'; ?>" />
</td>
<td class="name">
<?php echo $tax->attribute_name; ?>
<input type="hidden" name="attribute_names[<?php echo $i; ?>]" value="<?php echo $tax->attribute_name; ?>" />
<input type="hidden" name="attribute_is_taxonomy[<?php echo $i; ?>]" value="1" />
</td>
<td>
<?php if ($tax->attribute_type=="select" || $tax->attribute_type=="multiselect") : ?>
<select <?php if ($tax->attribute_type=="multiselect") echo 'multiple="multiple" class="multiselect" name="attribute_values['.$i.'][]"'; else echo 'name="attribute_values['.$i.']"'; ?>>
<?php if ($tax->attribute_type=="select") : ?><option value=""><?php _e('Choose an option&hellip;', 'woothemes'); ?></option><?php endif; ?>
<?php
if (taxonomy_exists('product_attribute_'.strtolower(sanitize_title($tax->attribute_name)))) :
$terms = get_terms( 'product_attribute_'.strtolower(sanitize_title($tax->attribute_name)), 'orderby=name&hide_empty=0' );
if ($terms) :
foreach ($terms as $term) :
echo '<option value="'.$term->slug.'" ';
if (in_array($term->slug, $value)) echo 'selected="selected"';
echo '>'.$term->name.'</option>';
endforeach;
endif;
endif;
?>
</select>
<?php elseif ($tax->attribute_type=="text") : ?>
<input type="text" name="attribute_values[<?php echo $i; ?>]" value="<?php if (isset($attribute['value'])) echo $attribute['value']; ?>" placeholder="<?php _e('Comma separate terms', 'woothemes'); ?>" />
<?php endif; ?>
</td>
<td class="center"><input type="checkbox" <?php echo $checked; ?> name="attribute_visibility[<?php echo $i; ?>]" value="1" /></td>
<td class="center"><input type="checkbox" <?php echo $checked2; ?> name="attribute_variation[<?php echo $i; ?>]" value="1" /></td>
<td class="center"><button type="button" class="hide_row button">&times;</button></td>
</tr><?php
endforeach;
endif;
// Attributes
if ($attributes && sizeof($attributes)>0) foreach ($attributes as $attribute) :
if (isset($attribute['is_taxonomy']) && $attribute['is_taxonomy']=='yes') continue;
$i++;
if (isset($attribute['visible']) && $attribute['visible']=='yes') $checked = 'checked="checked"'; else $checked = '';
if (isset($attribute['variation']) && $attribute['variation']=='yes') $checked2 = 'checked="checked"'; else $checked2 = '';
?><tr rel="<?php if (isset($attribute['position'])) echo $attribute['position']; else echo '0'; ?>">
<td class="center">
<button type="button" class="move_up button">&uarr;</button><button type="button" class="move_down button">&darr;</button>
<input type="hidden" name="attribute_position[<?php echo $i; ?>]" class="attribute_position" value="<?php if (isset($attribute['position'])) echo $attribute['position']; else echo '0'; ?>" />
</td>
<td>
<input type="text" name="attribute_names[<?php echo $i; ?>]" value="<?php echo $attribute['name']; ?>" />
<input type="hidden" name="attribute_is_taxonomy[<?php echo $i; ?>]" value="0" />
</td>
<td><input type="text" name="attribute_values[<?php echo $i; ?>]" value="<?php echo $attribute['value']; ?>" /></td>
<td class="center"><input type="checkbox" <?php echo $checked; ?> name="attribute_visibility[<?php echo $i; ?>]" value="1" /></td>
<td class="center"><input type="checkbox" <?php echo $checked2; ?> name="attribute_variation[<?php echo $i; ?>]" value="1" /></td>
<td class="center"><button type="button" class="remove_row button">&times;</button></td>
</tr><?php
endforeach;
?>
</tbody>
</table>
</div>
<button type="button" class="button button-primary add_attribute"><?php _e('Add', 'woothemes'); ?></button>
<select name="attribute_taxonomy" class="attribute_taxonomy">
<option value=""><?php _e('Custom product attribute', 'woothemes'); ?></option>
<?php
if ( $attribute_taxonomies ) :
foreach ($attribute_taxonomies as $tax) :
echo '<option value="'.strtolower(sanitize_title($tax->attribute_name)).'">'.$tax->attribute_name.'</option>';
endforeach;
endif;
?>
</select>
<div class="clear"></div>
</div>
<?php do_action('product_write_panels'); ?>
</div>
<?php
}
/**
* Product Data Save
*
* Function for processing and storing all product data.
*/
add_action('woocommerce_process_product_meta', 'woocommerce_process_product_meta', 1, 2);
function woocommerce_process_product_meta( $post_id, $post ) {
global $wpdb;
$woocommerce_errors = array();
// Get old data + attributes
$data = (array) maybe_unserialize( get_post_meta($post_id, 'product_data', true) );
$attributes = (array) maybe_unserialize( get_post_meta($post_id, 'product_attributes', true) );
// Add/Replace data to array
$data['regular_price'] = stripslashes( $_POST['regular_price'] );
$data['sale_price'] = stripslashes( $_POST['sale_price'] );
$data['weight'] = stripslashes( $_POST['weight'] );
$data['tax_status'] = stripslashes( $_POST['tax_status'] );
$data['tax_class'] = stripslashes( $_POST['tax_class'] );
if (isset($_POST['stock_status'])) $data['stock_status'] = stripslashes( $_POST['stock_status'] );
// Attributes
$attributes = array();
//var_dump($_POST['attribute_values']);
if (isset($_POST['attribute_names'])) :
$attribute_names = $_POST['attribute_names'];
$attribute_values = $_POST['attribute_values'];
if (isset($_POST['attribute_visibility'])) $attribute_visibility = $_POST['attribute_visibility'];
if (isset($_POST['attribute_variation'])) $attribute_variation = $_POST['attribute_variation'];
$attribute_is_taxonomy = $_POST['attribute_is_taxonomy'];
$attribute_position = $_POST['attribute_position'];
for ($i=0; $i<sizeof($attribute_names); $i++) :
if (!($attribute_names[$i])) continue;
if (isset($attribute_visibility[$i])) $visible = 'yes'; else $visible = 'no';
if (isset($attribute_variation[$i])) $variation = 'yes'; else $variation = 'no';
if ($attribute_is_taxonomy[$i]) $is_taxonomy = 'yes'; else $is_taxonomy = 'no';
if (is_array($attribute_values[$i])) :
$attribute_values[$i] = array_map('htmlspecialchars', array_map('stripslashes', $attribute_values[$i]));
else :
$attribute_values[$i] = trim(htmlspecialchars(stripslashes($attribute_values[$i])));
endif;
if (empty($attribute_values[$i]) || ( is_array($attribute_values[$i]) && sizeof($attribute_values[$i])==0) ) :
if ($is_taxonomy=='yes' && taxonomy_exists('product_attribute_'.strtolower(sanitize_title($attribute_names[$i])))) :
wp_set_object_terms( $post_id, 0, 'product_attribute_'.strtolower(sanitize_title($attribute_names[$i])) );
endif;
continue;
endif;
$attributes[ strtolower(sanitize_title( $attribute_names[$i] )) ] = array(
'name' => htmlspecialchars(stripslashes($attribute_names[$i])),
'value' => $attribute_values[$i],
'position' => $attribute_position[$i],
'visible' => $visible,
'variation' => $variation,
'is_taxonomy' => $is_taxonomy
);
if ($is_taxonomy=='yes') :
// Update post terms
$tax = $attribute_names[$i];
$value = $attribute_values[$i];
if (taxonomy_exists('product_attribute_'.strtolower(sanitize_title($tax)))) :
wp_set_object_terms( $post_id, $value, 'product_attribute_'.strtolower(sanitize_title($tax)) );
endif;
endif;
endfor;
endif;
if (!function_exists('attributes_cmp')) {
function attributes_cmp($a, $b) {
if ($a['position'] == $b['position']) {
return 0;
}
return ($a['position'] < $b['position']) ? -1 : 1;
}
}
uasort($attributes, 'attributes_cmp');
// Product type
$product_type = sanitize_title( stripslashes( $_POST['product-type'] ) );
if( !$product_type ) $product_type = 'simple';
wp_set_object_terms($post_id, $product_type, 'product_type');
// visibility
$visibility = stripslashes( $_POST['visibility'] );
update_post_meta( $post_id, 'visibility', $visibility );
// Featured
$featured = stripslashes( $_POST['featured'] );
update_post_meta( $post_id, 'featured', $featured );
// Unique SKU
$SKU = get_post_meta($post_id, 'SKU', true);
$new_sku = stripslashes( $_POST['sku'] );
if ($new_sku!==$SKU) :
if ($new_sku && !empty($new_sku)) :
if ($wpdb->get_var("SELECT * FROM $wpdb->postmeta WHERE meta_key='SKU' AND meta_value='".$new_sku."';") || $wpdb->get_var("SELECT * FROM $wpdb->posts WHERE ID='".$new_sku."' AND ID!=".$post_id.";")) :
$woocommerce_errors[] = __('Product SKU must be unique.', 'woothemes');
else :
update_post_meta( $post_id, 'SKU', $new_sku );
endif;
else :
update_post_meta( $post_id, 'SKU', '' );
endif;
endif;
// Sales and prices
if ($product_type!=='grouped') :
$date_from = (isset($_POST['sale_price_dates_from'])) ? $_POST['sale_price_dates_from'] : '';
$date_to = (isset($_POST['sale_price_dates_to'])) ? $_POST['sale_price_dates_to'] : '';
// Dates
if ($date_from) :
update_post_meta( $post_id, 'sale_price_dates_from', strtotime($date_from) );
else :
update_post_meta( $post_id, 'sale_price_dates_from', '' );
endif;
if ($date_to) :
update_post_meta( $post_id, 'sale_price_dates_to', strtotime($date_to) );
else :
update_post_meta( $post_id, 'sale_price_dates_to', '' );
endif;
if ($date_to && !$date_from) :
update_post_meta( $post_id, 'sale_price_dates_from', strtotime('NOW') );
endif;
// Update price if on sale
if ($data['sale_price'] && $date_to == '' && $date_from == '') :
update_post_meta( $post_id, 'price', $data['sale_price'] );
else :
update_post_meta( $post_id, 'price', $data['regular_price'] );
endif;
if ($date_from && strtotime($date_from) < strtotime('NOW')) :
update_post_meta( $post_id, 'price', $data['sale_price'] );
endif;
if ($date_to && strtotime($date_to) < strtotime('NOW')) :
update_post_meta( $post_id, 'price', $data['regular_price'] );
update_post_meta( $post_id, 'sale_price_dates_from', '');
update_post_meta( $post_id, 'sale_price_dates_to', '');
endif;
else :
$data['sale_price'] = '';
$data['regular_price'] = '';
update_post_meta( $post_id, 'sale_price_dates_from', '' );
update_post_meta( $post_id, 'sale_price_dates_to', '' );
update_post_meta( $post_id, 'price', '' );
endif;
// Stock Data
if (get_option('woocommerce_manage_stock')=='yes') :
// Manage Stock Checkbox
if ($product_type!=='grouped' && isset($_POST['manage_stock']) && $_POST['manage_stock']) :
update_post_meta( $post_id, 'stock', $_POST['stock'] );
$data['manage_stock'] = 'yes';
$data['backorders'] = stripslashes( $_POST['backorders'] );
else :
update_post_meta( $post_id, 'stock', '0' );
$data['manage_stock'] = 'no';
$data['backorders'] = 'no';
endif;
endif;
// Apply filters to data
$data = apply_filters( 'process_product_meta', $data, $post_id );
// Apply filter to data for product type
$data = apply_filters( 'filter_product_meta_' . $product_type, $data, $post_id );
// Do action for product type
do_action( 'process_product_meta_' . $product_type, $data, $post_id );
// Save
update_post_meta( $post_id, 'product_attributes', $attributes );
update_post_meta( $post_id, 'product_data', $data );
update_option('woocommerce_errors', $woocommerce_errors);
}

View File

@ -0,0 +1,176 @@
<?php
/**
* WooCommerce Write Panels
*
* Sets up the write panels used by products and orders (custom post types)
*
* @author WooThemes
* @category Admin Write Panels
* @package WooCommerce
*/
require_once('writepanel-product_data.php');
require_once('writepanel-product-types.php');
require_once('writepanel-order_data.php');
/**
* Init the meta boxes
*
* Inits the write panels for both products and orders. Also removes unused default write panels.
*/
add_action( 'add_meta_boxes', 'woocommerce_meta_boxes' );
function woocommerce_meta_boxes() {
add_meta_box( 'woocommerce-product-data', __('Product Data', 'woothemes'), 'woocommerce_product_data_box', 'product', 'normal', 'high' );
add_meta_box( 'woocommerce-product-type-options', __('Product Type Options', 'woothemes'), 'woocommerce_product_type_options_box', 'product', 'normal', 'high' );
add_meta_box( 'woocommerce-order-data', __('Order Data', 'woothemes'), 'woocommerce_order_data_meta_box', 'shop_order', 'normal', 'high' );
add_meta_box( 'woocommerce-order-items', __('Order Items <small>&ndash; Note: if you edit quantities or remove items from the order you will need to manually change the item\'s stock levels.</small>', 'woothemes'), 'woocommerce_order_items_meta_box', 'shop_order', 'normal', 'high');
add_meta_box( 'woocommerce-order-totals', __('Order Totals', 'woothemes'), 'woocommerce_order_totals_meta_box', 'shop_order', 'side', 'default');
add_meta_box( 'woocommerce-order-actions', __('Order Actions', 'woothemes'), 'woocommerce_order_actions_meta_box', 'shop_order', 'side', 'default');
remove_meta_box( 'commentstatusdiv', 'shop_order' , 'normal' );
remove_meta_box( 'slugdiv', 'shop_order' , 'normal' );
}
/**
* Save meta boxes
*
* Runs when a post is saved and does an action which the write panel save scripts can hook into.
*/
add_action( 'save_post', 'woocommerce_meta_boxes_save', 1, 2 );
function woocommerce_meta_boxes_save( $post_id, $post ) {
global $wpdb;
if ( !$_POST ) return $post_id;
if ( defined('DOING_AUTOSAVE') && DOING_AUTOSAVE ) return $post_id;
if ( !isset($_POST['woocommerce_meta_nonce']) || (isset($_POST['woocommerce_meta_nonce']) && !wp_verify_nonce( $_POST['woocommerce_meta_nonce'], 'woocommerce_save_data' ))) return $post_id;
if ( !current_user_can( 'edit_post', $post_id )) return $post_id;
if ( $post->post_type != 'product' && $post->post_type != 'shop_order' ) return $post_id;
do_action( 'woocommerce_process_'.$post->post_type.'_meta', $post_id, $post );
}
/**
* Product data
*
* Forces certain product data based on the product's type, e.g. grouped products cannot have a parent.
*/
add_filter('wp_insert_post_data', 'woocommerce_product_data');
function woocommerce_product_data( $data ) {
global $post;
if ($data['post_type']=='product' && isset($_POST['product-type'])) {
$product_type = stripslashes( $_POST['product-type'] );
switch($product_type) :
case "grouped" :
case "variable" :
$data['post_parent'] = 0;
break;
endswitch;
}
return $data;
}
/**
* Order data
*
* Forces the order posts to have a title in a certain format (containing the date)
*/
add_filter('wp_insert_post_data', 'woocommerce_order_data');
function woocommerce_order_data( $data ) {
global $post;
if ($data['post_type']=='shop_order' && isset($data['post_date'])) {
$order_title = 'Order';
if ($data['post_date']) $order_title.= ' &ndash; '.date('F j, Y @ h:i A', strtotime($data['post_date']));
$data['post_title'] = $order_title;
}
return $data;
}
/**
* Save errors
*
* Stores error messages in a variable so they can be displayed on the edit post screen after saving.
*/
add_action( 'admin_notices', 'woocommerce_meta_boxes_save_errors' );
function woocommerce_meta_boxes_save_errors() {
$woocommerce_errors = maybe_unserialize(get_option('woocommerce_errors'));
if ($woocommerce_errors && sizeof($woocommerce_errors)>0) :
echo '<div id="woocommerce_errors" class="error fade">';
foreach ($woocommerce_errors as $error) :
echo '<p>'.$error.'</p>';
endforeach;
echo '</div>';
update_option('woocommerce_errors', '');
endif;
}
/**
* Enqueue scripts
*
* Enqueue JavaScript used by the meta panels.
*/
function woocommerce_write_panel_scripts() {
$post_type = woocommerce_get_current_post_type();
if( $post_type !== 'product' && $post_type !== 'shop_order' ) return;
wp_register_script('woocommerce-date', woocommerce::plugin_url() . '/assets/js/date.js');
wp_register_script('woocommerce-datepicker', woocommerce::plugin_url() . '/assets/js/datepicker.js', array('jquery', 'woocommerce-date'));
wp_enqueue_script('woocommerce-datepicker');
wp_register_script('woocommerce-writepanel', woocommerce::plugin_url() . '/assets/js/write-panels.js', array('jquery'));
wp_enqueue_script('woocommerce-writepanel');
wp_enqueue_script('media-upload');
wp_enqueue_script('thickbox');
wp_enqueue_style('thickbox');
$params = array(
'remove_item_notice' => __("Remove this item? If you have previously reduced this item's stock, or this order was submitted by a customer, will need to manually restore the item's stock.", 'woothemes'),
'cart_total' => __("Calc totals based on order items, discount amount, and shipping?", 'woothemes'),
'copy_billing' => __("Copy billing information to shipping information? This will remove any currently entered shipping information.", 'woothemes'),
'prices_include_tax' => get_option('woocommerce_prices_include_tax'),
'ID' => __('ID', 'woothemes'),
'item_name' => __('Item Name', 'woothemes'),
'quantity' => __('Quantity e.g. 2', 'woothemes'),
'cost_unit' => __('Cost per unit e.g. 2.99', 'woothemes'),
'tax_rate' => __('Tax Rate e.g. 20.0000', 'woothemes'),
'meta_name' => __('Meta Name', 'woothemes'),
'meta_value' => __('Meta Value', 'woothemes'),
'plugin_url' => woocommerce::plugin_url(),
'ajax_url' => admin_url('admin-ajax.php'),
'add_order_item_nonce' => wp_create_nonce("add-order-item")
);
wp_localize_script( 'woocommerce-writepanel', 'params', $params );
}
add_action('admin_print_scripts-post.php', 'woocommerce_write_panel_scripts');
add_action('admin_print_scripts-post-new.php', 'woocommerce_write_panel_scripts');
/**
* Meta scripts
*
* Outputs JavaScript used by the meta panels.
*/
function woocommerce_meta_scripts() {
?>
<script type="text/javascript">
jQuery(function(){
<?php do_action('product_write_panel_js'); ?>
});
</script>
<?php
}

View File

@ -1,11 +1,11 @@
#toplevel_page_jigoshop .wp-menu-image {
#toplevel_page_woocommerce .wp-menu-image {
background: url(../images/icons/menu_icons.png) no-repeat 0px -32px !important;
}
#toplevel_page_jigoshop:hover .wp-menu-image,
#toplevel_page_jigoshop.wp-has-current-submenu .wp-menu-image {
#toplevel_page_woocommerce:hover .wp-menu-image,
#toplevel_page_woocommerce.wp-has-current-submenu .wp-menu-image {
background: url(../images/icons/menu_icons.png) no-repeat 0px 0px !important;
}
#toplevel_page_jigoshop .wp-menu-image img {
#toplevel_page_woocommerce .wp-menu-image img {
display: none;
}
@ -17,17 +17,17 @@
background: url(../images/icons/menu_icons.png) no-repeat -35px 0px !important;
}
#menu-posts-shoporder .wp-menu-image {
#menu-posts-shop_order .wp-menu-image {
background: url(../images/icons/menu_icons.png) no-repeat -70px -32px !important;
}
#menu-posts-shoporder:hover .wp-menu-image,
#menu-posts-shoporder.wp-has-current-submenu .wp-menu-image {
#menu-posts-shop_order:hover .wp-menu-image,
#menu-posts-shop_order.wp-has-current-submenu .wp-menu-image {
background: url(../images/icons/menu_icons.png) no-repeat -70px 0px !important;
}
#icon-jigoshop, .jigoshop_icon, .icon32-posts-product, .icon32-posts-shoporder {
background-image: url(../images/icons/jigoshop-icons.png) !important;
#icon-woocommerce, .woocommerce_icon, .icon32-posts-product, .icon32-posts-shoporder {
background-image: url(../images/icons/woocommerce-icons.png) !important;
background-position: -11px -5px;
}
.icon32-posts-product {
@ -42,10 +42,10 @@
.icon32-attributes {
background-position: -185px -5px !important;
}
.icon32-jigoshop-settings {
.icon32-woocommerce-settings {
background-position: -359px -5px !important;
}
.icon32-jigoshop-debug {
.icon32-woocommerce-debug {
background-position: -417px -5px !important;
}
@ -61,7 +61,7 @@
line-height: 1.6em;
}
}
#jigoshop-order-items {
#woocommerce-order-items {
.inside {
margin: 0;
padding: 0;
@ -119,9 +119,9 @@ dl.totals {
}
}
}
.jigoshop_order_items_wrapper {
.woocommerce_order_items_wrapper {
margin: 0;
table.jigoshop_order_items {
table.woocommerce_order_items {
width: 100%;
background: #fff;
thead th {
@ -163,7 +163,7 @@ dl.totals {
}
}
}
.jigoshop-order-panel {
.woocommerce-order-panel {
overflow: hidden;
zoom: 1;
.panel {
@ -360,17 +360,17 @@ table.wp-list-table .column-featured, table.wp-list-table .column-sellable, tabl
}
/* Dashboard */
#jigoshop_dashboard {
#woocommerce_dashboard {
padding: 0 5px;
}
#jigoshop_dashboard div.postbox div.inside {
#woocommerce_dashboard div.postbox div.inside {
margin: 10px;
position: relative;
}
#jigoshop_dashboard div.postbox h3 {
#woocommerce_dashboard div.postbox h3 {
cursor: default !important;
}
#jigoshop_dashboard div.postbox a {
#woocommerce_dashboard div.postbox a {
text-decoration: none;
}
@ -415,15 +415,15 @@ ul.recent-orders {
}
}
.jigoshop_right_now p.sub,
.jigoshop_right_now .table, .jigoshop_right_now .versions {
.woocommerce_right_now p.sub,
.woocommerce_right_now .table, .woocommerce_right_now .versions {
margin: -12px;
}
.jigoshop_right_now .inside {
.woocommerce_right_now .inside {
font-size: 12px;
padding-top: 20px;
}
.jigoshop_right_now p.sub {
.woocommerce_right_now p.sub {
font-style: italic;
font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
padding: 5px 10px 15px;
@ -433,70 +433,70 @@ ul.recent-orders {
top: -17px;
left: 15px;
}
.jigoshop_right_now .table {
.woocommerce_right_now .table {
margin: 0 -9px;
padding: 0 10px;
position: relative;
}
.jigoshop_right_now .table_content {
.woocommerce_right_now .table_content {
float: left;
border-top: #ececec 1px solid;
width: 45%;
}
.jigoshop_right_now .table_discussion {
.woocommerce_right_now .table_discussion {
float: right;
border-top: #ececec 1px solid;
width: 45%;
}
.jigoshop_right_now table td {
.woocommerce_right_now table td {
padding: 3px 0;
white-space: nowrap;
}
.jigoshop_right_now table tr.first td {
.woocommerce_right_now table tr.first td {
border-top: none;
}
.jigoshop_right_now td.b {
.woocommerce_right_now td.b {
padding-right: 6px;
text-align: right;
font-family: Georgia, "Times New Roman", "Bitstream Charter", Times, serif;
font-size: 14px;
width: 1%;
}
.jigoshop_right_now td.b a {
.woocommerce_right_now td.b a {
font-size: 18px;
}
.jigoshop_right_now td.b a:hover {
.woocommerce_right_now td.b a:hover {
color: #d54e21;
}
.jigoshop_right_now .t {
.woocommerce_right_now .t {
font-size: 12px;
padding-right: 12px;
padding-top: 6px;
color: #777;
}
.jigoshop_right_now .t a {
.woocommerce_right_now .t a {
white-space: nowrap;
}
.jigoshop_right_now .onhold {
.woocommerce_right_now .onhold {
color: red;
}
.jigoshop_right_now .pending {
.woocommerce_right_now .pending {
color: #e66f00;
}
.jigoshop_right_now .complete {
.woocommerce_right_now .complete {
color: green;
}
.jigoshop_right_now .versions {
.woocommerce_right_now .versions {
padding: 4px 15px 12px;
clear: both;
}
.jigoshop-rss-widget ul li, .jigoshop-links-widget ul li {
.woocommerce-rss-widget ul li, .woocommerce-links-widget ul li {
line-height: 1.5em;
margin-bottom: 12px;
}
.jigoshop-links-widget {
.woocommerce-links-widget {
ul.links {
float: left;
width: 49%;
@ -521,7 +521,7 @@ ul.recent-orders {
}
}
.jigoshop-reviews-widget {
.woocommerce-reviews-widget {
li {
line-height: 1.5em;
margin-bottom: 12px;
@ -556,7 +556,7 @@ ul.recent-orders {
}
/* Settings */
.jigoshop table.widefat {
.woocommerce table.widefat {
width: 850px;
margin-top: 0.5em !important;
.button {
@ -580,14 +580,14 @@ ul.recent-orders {
}
}
.jigoshop table.widefat th.desc {
.woocommerce table.widefat th.desc {
font-weight: normal;
color: #2958aa;
}
.jigoshop table.widefat td small {
.woocommerce table.widefat td small {
color: #999;
}
.jigoshop #tabs-wrap {
.woocommerce #tabs-wrap {
background: #ececec;
width: 850px;
padding: 7px 9px;
@ -596,42 +596,42 @@ ul.recent-orders {
margin-bottom: 2em !important;
zoom: 1;
}
.jigoshop #tabs-wrap ul.tabs {
.woocommerce #tabs-wrap ul.tabs {
padding: 0;
}
.jigoshop #tabs-wrap table {
.woocommerce #tabs-wrap table {
margin: 0 0 5px !important;
border: 1px solid #e1e1e1;
border-top: 0;
}
.jigoshop #tabs-wrap table thead tr th {
.woocommerce #tabs-wrap table thead tr th {
border-top: 4px solid #e1e1e1;
}
.jigoshop #tabs-wrap table thead:first-child tr th {
.woocommerce #tabs-wrap table thead:first-child tr th {
border-top: 0;
}
.jigoshop #tabs-wrap table thead th {
.woocommerce #tabs-wrap table thead th {
background: #fff;
}
.jigoshop #tabs-wrap table select {
.woocommerce #tabs-wrap table select {
white-space: nowrap;
}
.jigoshop #tabs-wrap .submit {
.woocommerce #tabs-wrap .submit {
float: right;
margin: 0 !important;
padding: 0 !important;
}
.jigoshop #tabs-wrap table.shippingrows {
.woocommerce #tabs-wrap table.shippingrows {
border: 0;
width: 100%;
}
.jigoshop #tabs-wrap table.shippingrows td,.jigoshop #tabs-wrap table.shippingrows th {
.woocommerce #tabs-wrap table.shippingrows td,.woocommerce #tabs-wrap table.shippingrows th {
padding: 4px 4px 4px 0 !important;
border: 0 !important;
vertical-align: middle;
}
.jigoshop #tabs-wrap table.shippingrows td a.remove {
.woocommerce #tabs-wrap table.shippingrows td a.remove {
margin: 0 !important;
}
@ -649,7 +649,7 @@ p.taxrow label {
}
}
.jigoshop table.widefat {
.woocommerce table.widefat {
table.coupon_rows {
border: 0 !important;
width: 100%;
@ -695,32 +695,32 @@ a.tips {
-khtml-border-radius:8px;
border-radius:8px;
}
.jigoshop #tabs-wrap table a.remove {
.woocommerce #tabs-wrap table a.remove {
margin-left: 4px;
}
.jigoshop #tabs-wrap table p {
.woocommerce #tabs-wrap table p {
margin: 0 0 4px !important;
overflow: hidden;
zoom: 1;
}
.jigoshop #tabs-wrap table p a.add {
.woocommerce #tabs-wrap table p a.add {
float: left;
}
/* Write Panels */
#jigoshop-product-data ul.product_data_tabs, .jigoshop ul.tabs {
#woocommerce-product-data ul.product_data_tabs, .woocommerce ul.tabs {
background: #ececec;
padding: 7px 9px 0;
overflow: hidden;
zoom: 1;
line-height: 1em;
}
#jigoshop-product-data ul.product_data_tabs li, .jigoshop ul.tabs li {
#woocommerce-product-data ul.product_data_tabs li, .woocommerce ul.tabs li {
float: left;
padding: 0;
margin: 0 5px 0 0;
}
#jigoshop-product-data ul.product_data_tabs li a, .jigoshop ul.tabs li a {
#woocommerce-product-data ul.product_data_tabs li a, .woocommerce ul.tabs li a {
padding: 0;
margin: 0;
border: 0;
@ -739,28 +739,28 @@ a.tips {
border-top-left-radius: 3px;
border-top-right-radius: 3px;
}
#jigoshop-product-data ul.product_data_tabs li.active a, .jigoshop ul.tabs li.active a {
#woocommerce-product-data ul.product_data_tabs li.active a, .woocommerce ul.tabs li.active a {
background: #fff;
border-color: #e1e1e1;
color: #333;
}
#jigoshop-product-data .inside, #jigoshop-product-type-options .inside, #jigoshop-order-data .inside {
#woocommerce-product-data .inside, #woocommerce-product-type-options .inside, #woocommerce-order-data .inside {
padding: 0;
margin: 0;
}
.jigoshop_options_panel, .panel {
.woocommerce_options_panel, .panel {
padding: 9px 9px 9px 9px;
color: #555;
}
.jigoshop_page_settings .jigoshop_options_panel, .panel {
.woocommerce_page_settings .woocommerce_options_panel, .panel {
padding: 0;
}
#jigoshop-product-type-options .panel, #jigoshop-product-specs .inside {
#woocommerce-product-type-options .panel, #woocommerce-product-specs .inside {
padding: 9px;
margin: 0;
}
.jigoshop_options_panel p, #jigoshop-product-type-options .panel p {
.woocommerce_options_panel p, #woocommerce-product-type-options .panel p {
overflow: hidden;
zoom: 1;
margin: 0 0 9px;
@ -768,91 +768,91 @@ a.tips {
padding: 7px 9px;
line-height: 24px;
}
.jigoshop_options_panel label {
.woocommerce_options_panel label {
float: left;
width: 150px;
padding: 0;
}
.jigoshop_options_panel label .req {
.woocommerce_options_panel label .req {
font-weight: bold;
font-style: normal;
color: red;
}
.jigoshop_options_panel .description {
.woocommerce_options_panel .description {
padding: 0;
margin: 0 0 0 7px;
}
.jigoshop_options_panel .description-block {
.woocommerce_options_panel .description-block {
margin-left: 0;
display: block;
}
.jigoshop_options_panel textarea, .jigoshop_options_panel input, .jigoshop_options_panel select {
.woocommerce_options_panel textarea, .woocommerce_options_panel input, .woocommerce_options_panel select {
margin: 0;
}
.jigoshop_options_panel textarea {
.woocommerce_options_panel textarea {
width: 50% !important;
float: left;
}
.jigoshop_options_panel input {
.woocommerce_options_panel input {
width: 50%;
float: left;
}
.jigoshop_options_panel .checkbox, table.jigoshop_variable_attributes .checkbox {
.woocommerce_options_panel .checkbox, table.woocommerce_variable_attributes .checkbox {
vertical-align: middle;
margin: 7px 0;
}
.jigoshop_options_panel select {
.woocommerce_options_panel select {
float: left;
}
.jigoshop_options_panel .short {
.woocommerce_options_panel .short {
width: 20%;
}
#jigoshop_attributes {
#woocommerce_attributes {
padding: 12px;
}
.jigoshop_attributes_wrapper, .jigoshop_variable_attributes_wrapper {
.woocommerce_attributes_wrapper, .woocommerce_variable_attributes_wrapper {
margin-bottom: 7px;
border: 1px solid #ececec;
}
table.jigoshop_attributes, table.jigoshop_variable_attributes {
table.woocommerce_attributes, table.woocommerce_variable_attributes {
width: 100%;
}
table.jigoshop_attributes thead th, table.jigoshop_variable_attributes thead th {
table.woocommerce_attributes thead th, table.woocommerce_variable_attributes thead th {
background: #ececec;
padding: 7px 9px;
font-size: 11px;
text-align: left;
}
table.jigoshop_attributes td, table.jigoshop_variable_attributes td {
table.woocommerce_attributes td, table.woocommerce_variable_attributes td {
padding: 2px 9px;
text-align: left;
vertical-align: middle;
border-bottom: 1px dotted #ececec;
}
table.jigoshop_attributes td input, table.jigoshop_variable_attributes td input, table.jigoshop_variable_attributes td textarea {
table.woocommerce_attributes td input, table.woocommerce_variable_attributes td input, table.woocommerce_variable_attributes td textarea {
width: 100%;
}
table.jigoshop_attributes td select {
table.woocommerce_attributes td select {
width: 100%;
}
table.jigoshop_attributes td select.multiselect {
table.woocommerce_attributes td select.multiselect {
height: 8em !important;
}
table.jigoshop_attributes td input, table.jigoshop_variable_attributes td input, table.jigoshop_variable_attributes td textarea {
table.woocommerce_attributes td input, table.woocommerce_variable_attributes td input, table.woocommerce_variable_attributes td textarea {
font-size: 14px;
padding: 4px;
color: #555;
}
table.jigoshop_attributes .taxonomy td.name {
table.woocommerce_attributes .taxonomy td.name {
padding: 10px 15px;
font-size: 14px;
color: #555;
}
table.jigoshop_attributes .center {
table.woocommerce_attributes .center {
text-align: center;
}
#jigoshop_attributes select.attribute_taxonomy, button.add_attribute, button.add_variable_attribute, button.add_configuration {
#woocommerce_attributes select.attribute_taxonomy, button.add_attribute, button.add_variable_attribute, button.add_configuration {
float: right;
}
@ -889,7 +889,7 @@ div.multi_select_products_wrapper {
vertical-align: middle;
}
#jigoshop-product-data a.dp-choose-date {
#woocommerce-product-data a.dp-choose-date {
float: left;
width: 16px;
height: 16px;
@ -900,11 +900,11 @@ div.multi_select_products_wrapper {
overflow: hidden;
background: url(../images/calendar.png) no-repeat;
}
#jigoshop-product-data a.dp-choose-date.dp-disabled {
#woocommerce-product-data a.dp-choose-date.dp-disabled {
background-position: 0 -20px;
cursor: default;
}
#jigoshop-product-data input.dp-applied {
#woocommerce-product-data input.dp-applied {
width: 140px;
float: left;
}
@ -923,7 +923,7 @@ div.multi_select_products_wrapper {
margin: 0;
}
}
.jigoshop_configuration {
.woocommerce_configuration {
background: #ececec;
border: 1px solid #ececec;
margin: 0 0 8px;
@ -972,4 +972,130 @@ div.multi_select_products_wrapper {
outline: 1px dotted #A0C443;
height: 60px;
background: #000;
}
/* Datepicker */
table.jCalendar {
border: 1px solid #000;
background: #aaa;
border-collapse: separate;
border-spacing: 2px;
width: 190px;
}
table.jCalendar th {
background: #333;
color: #fff;
font-weight: bold;
padding: 3px 5px;
}
table.jCalendar td {
background: #ccc;
color: #000;
padding: 3px 5px;
text-align: center;
font-size: 10px !important;
}
table.jCalendar td.other-month {
background: #ddd;
color: #aaa;
}
table.jCalendar td.today {
background: #666;
color: #fff;
}
table.jCalendar td.selected {
background: #f66;
color: #fff;
}
table.jCalendar td.selected.dp-hover {
background: #f33;
color: #fff;
}
table.jCalendar td.dp-hover,
table.jCalendar tr.activeWeekHover td {
background: #fff;
color: #000;
}
table.jCalendar tr.selectedWeek td {
background: #f66;
color: #fff;
}
table.jCalendar td.disabled, table.jCalendar td.disabled.dp-hover {
background: #bbb;
color: #888;
}
table.jCalendar td.unselectable,
table.jCalendar td.unselectable:hover,
table.jCalendar td.unselectable.dp-hover {
background: #bbb;
color: #888;
}
div.dp-popup {
position: relative;
background: #ccc;
font-size: 10px !important;
font-family: arial, sans-serif;
padding: 2px;
width: 190px;
line-height: 1.2em;
}
div#dp-popup {
position: absolute;
z-index: 199;
}
div.dp-popup h2 {
font-size: 12px !important;
text-align: center;
margin: 2px 0;
padding: 0;
}
a#dp-close {
font-size: 11px !important;
padding: 4px 0;
text-align: center;
display: block;
}
a#dp-close:hover {
text-decoration: underline;
}
div.dp-popup a {
color: #000;
text-decoration: none;
padding: 3px 2px 0;
}
div.dp-popup div.dp-nav-prev {
position: absolute;
top: 2px;
left: 4px;
width: 100px;
}
div.dp-popup div.dp-nav-prev a {
float: left;
}
/* Opera needs the rules to be this specific otherwise it doesn't change the cursor back to pointer after you have disabled and re-enabled a link */
div.dp-popup div.dp-nav-prev a, div.dp-popup div.dp-nav-next a {
cursor: pointer;
}
div.dp-popup div.dp-nav-prev a.disabled, div.dp-popup div.dp-nav-next a.disabled {
cursor: default;
}
div.dp-popup div.dp-nav-next {
position: absolute;
top: 2px;
right: 4px;
width: 100px;
}
div.dp-popup div.dp-nav-next a {
float: right;
}
div.dp-popup a.disabled {
cursor: default;
color: #aaa;
}
div.dp-popup td {
cursor: pointer;
}
div.dp-popup td.disabled {
cursor: default;
}

View File

@ -1,129 +0,0 @@
table.jCalendar {
border: 1px solid #000;
background: #aaa;
border-collapse: separate;
border-spacing: 2px;
width: 190px;
}
table.jCalendar th {
background: #333;
color: #fff;
font-weight: bold;
padding: 3px 5px;
}
table.jCalendar td {
background: #ccc;
color: #000;
padding: 3px 5px;
text-align: center;
font-size: 10px !important;
}
table.jCalendar td.other-month {
background: #ddd;
color: #aaa;
}
table.jCalendar td.today {
background: #666;
color: #fff;
}
table.jCalendar td.selected {
background: #f66;
color: #fff;
}
table.jCalendar td.selected.dp-hover {
background: #f33;
color: #fff;
}
table.jCalendar td.dp-hover,
table.jCalendar tr.activeWeekHover td {
background: #fff;
color: #000;
}
table.jCalendar tr.selectedWeek td {
background: #f66;
color: #fff;
}
table.jCalendar td.disabled, table.jCalendar td.disabled.dp-hover {
background: #bbb;
color: #888;
}
table.jCalendar td.unselectable,
table.jCalendar td.unselectable:hover,
table.jCalendar td.unselectable.dp-hover {
background: #bbb;
color: #888;
}
/* For the popup */
/* NOTE - you will probably want to style a.dp-choose-date - see how I did it in demo.css */
div.dp-popup {
position: relative;
background: #ccc;
font-size: 10px !important;
font-family: arial, sans-serif;
padding: 2px;
width: 190px;
line-height: 1.2em;
}
div#dp-popup {
position: absolute;
z-index: 199;
}
div.dp-popup h2 {
font-size: 12px !important;
text-align: center;
margin: 2px 0;
padding: 0;
}
a#dp-close {
font-size: 11px !important;
padding: 4px 0;
text-align: center;
display: block;
}
a#dp-close:hover {
text-decoration: underline;
}
div.dp-popup a {
color: #000;
text-decoration: none;
padding: 3px 2px 0;
}
div.dp-popup div.dp-nav-prev {
position: absolute;
top: 2px;
left: 4px;
width: 100px;
}
div.dp-popup div.dp-nav-prev a {
float: left;
}
/* Opera needs the rules to be this specific otherwise it doesn't change the cursor back to pointer after you have disabled and re-enabled a link */
div.dp-popup div.dp-nav-prev a, div.dp-popup div.dp-nav-next a {
cursor: pointer;
}
div.dp-popup div.dp-nav-prev a.disabled, div.dp-popup div.dp-nav-next a.disabled {
cursor: default;
}
div.dp-popup div.dp-nav-next {
position: absolute;
top: 2px;
right: 4px;
width: 100px;
}
div.dp-popup div.dp-nav-next a {
float: right;
}
div.dp-popup a.disabled {
cursor: default;
color: #aaa;
}
div.dp-popup td {
cursor: pointer;
}
div.dp-popup td.disabled {
cursor: default;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,19 +1,19 @@
/* Interaction states
----------------------------------*/
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6 url(../images/ui/ui-bg_glass_75_e6e6e6_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #555555; }
.ui-state-default, .ui-widget-content .ui-state-default, .ui-widget-header .ui-state-default { border: 1px solid #d3d3d3; background: #e6e6e6; font-weight: normal; color: #555555; }
.ui-state-default a, .ui-state-default a:link, .ui-state-default a:visited { color: #555555; text-decoration: none; }
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada url(../images/ui/ui-bg_glass_75_dadada_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
.ui-state-hover, .ui-widget-content .ui-state-hover, .ui-widget-header .ui-state-hover, .ui-state-focus, .ui-widget-content .ui-state-focus, .ui-widget-header .ui-state-focus { border: 1px solid #999999; background: #dadada; font-weight: normal; color: #212121; }
.ui-state-hover a, .ui-state-hover a:hover { color: #212121; text-decoration: none; }
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff url(../images/ui/ui-bg_glass_65_ffffff_1x400.png) 50% 50% repeat-x; font-weight: normal; color: #212121; }
.ui-state-active, .ui-widget-content .ui-state-active, .ui-widget-header .ui-state-active { border: 1px solid #aaaaaa; background: #ffffff; font-weight: normal; color: #212121; }
.ui-state-active a, .ui-state-active a:link, .ui-state-active a:visited { color: #212121; text-decoration: none; }
.ui-widget :active { outline: none; }
/* Interaction Cues
----------------------------------*/
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee url(../images/ui/ui-bg_glass_55_fbf9ee_1x400.png) 50% 50% repeat-x; color: #363636; }
.ui-state-highlight, .ui-widget-content .ui-state-highlight, .ui-widget-header .ui-state-highlight {border: 1px solid #fcefa1; background: #fbf9ee; color: #363636; }
.ui-state-highlight a, .ui-widget-content .ui-state-highlight a,.ui-widget-header .ui-state-highlight a { color: #363636; }
.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec url(../images/ui/ui-bg_inset-soft_95_fef1ec_1x100.png) 50% bottom repeat-x; color: #cd0a0a; }
.ui-state-error, .ui-widget-content .ui-state-error, .ui-widget-header .ui-state-error {border: 1px solid #cd0a0a; background: #fef1ec; color: #cd0a0a; }
.ui-state-error a, .ui-widget-content .ui-state-error a, .ui-widget-header .ui-state-error a { color: #cd0a0a; }
.ui-state-error-text, .ui-widget-content .ui-state-error-text, .ui-widget-header .ui-state-error-text { color: #cd0a0a; }
.ui-priority-primary, .ui-widget-content .ui-priority-primary, .ui-widget-header .ui-priority-primary { font-weight: bold; }
@ -28,8 +28,8 @@
.ui-slider .ui-slider-handle { position: absolute; z-index: 2; width: 1.2em; height: 1.2em; cursor: default; }
.ui-slider .ui-slider-range { position: absolute; z-index: 1; font-size: .7em; display: block; border: 0; background-position: 0 0; }
.price_slider_wrapper .ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff url(../images/ui/ui-bg_glass_75_ffffff_1x400.png) 50% 50% repeat-x; color: #222222; }
.price_slider_wrapper .ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc url(../images/ui/ui-bg_highlight-soft_75_cccccc_1x100.png) 50% 50% repeat-x; color: #222222; font-weight: bold; }
.price_slider_wrapper .ui-widget-content { border: 1px solid #aaaaaa; background: #ffffff; color: #222222; }
.price_slider_wrapper .ui-widget-header { border: 1px solid #aaaaaa; background: #cccccc; color: #222222; font-weight: bold; }
.ui-slider-horizontal { height: .8em; }
.ui-slider-horizontal .ui-slider-handle { top: -.3em; margin-left: -.6em; }

150
assets/css/woocommerce.css Normal file
View File

@ -0,0 +1,150 @@
.clear{clear:both;}
.nobr{white-space:nowrap;}
.info{background:#F7F5C6;padding:10px 20px;border:1px solid #EEEAC1;color:#747165;box-shadow:inset 0 0 0 1px #ffffcc;-webkit-box-shadow:inset 0 0 0 1px #ffffcc;-moz-box-shadow:inset 0 0 0 1px #ffffcc;}.info a{color:#93864E;}
div.woocommerce_error,div.woocommerce_message{border:1px solid;margin:10px 0px;padding:10px 10px 10px 32px;background-repeat:no-repeat;background-position:10px center;}div.woocommerce_error a.button,div.woocommerce_message a.button{margin-top:0;float:right;}
div.woocommerce_error{color:#D8000C;background-color:#ffd4d4;background-image:url('../images/error.gif');}
div.woocommerce_message{color:#4F8A10;background-color:#DFF2BF;background-image:url('../images/success.gif');}
p small{color:#999;}
p.demo_store{position:fixed;top:0;width:100%;font-size:12px;text-align:center;background:#f7f5c6;background:-webkit-gradient(linear, left top, left bottom, from(#f7f5c6), to(#eeeac1));background:-webkit-linear-gradient(#f7f5c6, #eeeac1);background:-moz-linear-gradient(center top, #f7f5c6 0%, #eeeac1 100%);background:-moz-gradient(center top, #f7f5c6 0%, #eeeac1 100%);padding:8px 0;border:1px solid #EEEAC1;color:#747165;z-index:999999;box-shadow:inset 0 0 0 3px rgba(255, 255, 255, 0.3);-webkit-box-shadow:inset 0 0 0 3px rgba(255, 255, 255, 0.3);-moz-box-shadow:inset 0 0 0 3px rgba(255, 255, 255, 0.3);}
small.note{display:block;color:#999;font-size:11px;line-height:21px;margin-top:10px;}
#breadcrumb{overflow:hidden;zoom:1;margin:0 0 1em !important;padding:0;font-size:0.92em;color:#999 !important;}#breadcrumb a{color:#999 !important;}
div.product{position:relative;}div.product .product_title{clear:none;}
div.product p.price{color:green;font-size:1.3em;}div.product p.price del{font-size:14px;color:#ccc;}
div.product p.stock{font-size:0.92em;float:left;padding:2px 0 0 0;}
div.product div.images{float:left;width:314px;margin-bottom:10px;}div.product div.images img{border:1px solid #ddd;background:#f5f5f5;padding:6px;display:block;}
div.product div.images div.thumbnails{padding-top:10px;overflow:hidden;zoom:1;}div.product div.images div.thumbnails a{margin-right:10px;margin-bottom:10px;float:left;}div.product div.images div.thumbnails a img{padding:3px;}
div.product div.images div.thumbnails a.last{margin-right:0;}
div.product div.images div.thumbnails a.first{clear:both;}
div.product div.summary{float:right;width:300px;}
div.product div.social{text-align:right;margin:0 0 1em;}div.product div.social span{margin:0 0 0 2px;}div.product div.social span span{margin:0;}
div.product div.social span .stButton .chicklets{padding-left:16px;width:0;}
div.product div.social iframe{float:left;margin-top:3px;}
div.product #tabs{clear:both;padding:1em 0 0 0;margin:0 0 1em 0;}div.product #tabs ul.tabs{-webkit-border-top-left-radius:3px;-webkit-border-top-right-radius:3px;-moz-border-radius-topleft:3px;-moz-border-radius-topright:3px;border-top-left-radius:3px;border-top-right-radius:3px;background:#ddd;overflow:hidden;zoom:1;margin:0 !important;padding:4px 4px 0;list-style:none outside !important;}div.product #tabs ul.tabs li{float:left;margin:0 4px 0 0;font-size:0.92em;}
div.product #tabs ul.tabs a{float:left;padding:6px 12px;background:#eee;text-decoration:none;-webkit-border-top-left-radius:2px;-webkit-border-top-right-radius:2px;-moz-border-radius-topleft:2px;-moz-border-radius-topright:2px;border-top-left-radius:2px;border-top-right-radius:2px;}
div.product #tabs ul.tabs li.active a{background:#fff;color:#555;}
div.product #tabs .panel{border:1px solid #ddd;border-top:0;padding:15px 15px 0;-webkit-border-bottom-left-radius:3px;-webkit-border-bottom-right-radius:3px;-moz-border-radius-bottomleft:3px;-moz-border-radius-bottomright:3px;border-bottom-left-radius:3px;border-bottom-right-radius:3px;}
.stock{color:green;float:left;}
.out-of-stock{color:red;}
p.cart{float:right;}
form.cart{margin-bottom:24px;float:right;width:300px;}form.cart div.quantity{float:left;margin:0 4px 0 0;}
form.cart table{font-size:12px;border-width:0 0 1px 0 !important;}form.cart table td{padding:4px 4px 4px 0 !important;}
form.cart table div.quantity{float:none;margin:0;width:72px;}
form.cart table small.stock{display:block;float:none;}
form.cart .variations label{font-weight:bold;}
form.cart .variations select{width:100%;float:left;}
form.cart .button{vertical-align:middle;float:left;margin:2px 0 !important;}
span.onsale{background:green;color:#fff;min-height:32px;min-width:32px;padding:4px;font-size:12px;position:absolute;text-align:center;line-height:32px;top:0;right:320px;margin:-6px 0 0 0;-webkit-border-radius:20px;-moz-border-radius:20px;border-radius:20px;}
.products ul,ul.products{margin:0 0 14px !important;padding:0 !important;list-style:none;float:left;}
.products{clear:both;}.products li{float:left;margin:0 10px 20px 0;padding:0 !important;position:relative;width:150px;}.products li .onsale{top:0;right:0;left:auto;margin:-6px -6px 0 0;}
.products li a{text-decoration:none;}
.products li a img{width:150px !important;height:150px !important;display:block;margin:0 0 8px !important;border:1px solid #ddd;}
.products li a:hover img{border:1px solid #bbb;}
.products li strong{color:#555;display:block;}
.products li .price{color:green;display:block;font-weight:normal;float:right;text-align:right;}.products li .price del{font-size:10px;line-height:10px;margin:-2px 0 0 0;display:block;color:#ccc;}
.products li .price .from{font-size:10px;line-height:10px;margin:-2px 0 0 0;display:block;color:#ccc;}
.products li.first{clear:both;}
.products li.last{margin-right:0;}
table.shop_attributes{border:0 !important;border-top:1px dotted #ccc !important;}table.shop_attributes th{width:150px;font-weight:bold;padding:8px;color:black !important;border-bottom:1px dotted #ccc;margin:0 !important;line-height:1.5em;}
table.shop_attributes td{font-style:italic;padding:0 !important;border-bottom:1px dotted #ccc;margin:0 !important;line-height:1.5em;}table.shop_attributes td p{margin:0 !important;padding:8px;}
table.shop_attributes .alt td,table.shop_attributes .alt th{background:#f9f9f9;}
a.button,button.button,input.button,#review_form #submit{color:#fff !important;background:#ff9c07;padding:6px;line-height:1em !important;margin:4px 2px 0 0;float:left;font-size:12px !important;width:auto !important;vertical-align:middle !important;text-align:center;text-decoration:none;border:none;cursor:pointer;font-family:inherit;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;}
a.button:hover,button.button:hover,input.button:hover,#review_form #submit:hover{background:#ff9933;text-decoration:none;}
.cart .button,.cart input.button{float:none;}
.button-alt{color:#fff !important;background:#069bcd;padding:6px;line-height:1em !important;margin:4px 2px 0 0;float:left;font-size:12px !important;width:auto !important;vertical-align:middle !important;text-align:center;text-decoration:none;border:none;cursor:pointer;font-family:inherit;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;}
.button-alt:hover{background:#0588b5;}
#reviews h2 small{float:right;color:#999;font-size:15px;line-height:21px;margin:10px 0 0 0;}#reviews h2 small a{text-decoration:none;color:#999;}
#reviews h3{margin:0;}
#reviews #respond{margin:0;border:0;padding:0;}
#reviews #comment{height:75px;}
#reviews #comments .add_review{overflow:hidden;zoom:1;}
#reviews #comments h2{clear:none;}
#reviews #comments ol.commentlist{overflow:hidden;zoom:1;margin:0 !important;}#reviews #comments ol.commentlist li{padding:00;margin:0 0 20px;border:0;position:relative;}#reviews #comments ol.commentlist li .meta{color:#999;font-size:0.75em;}
#reviews #comments ol.commentlist li img{float:left;position:absolute;top:0;left:0;padding:3px;width:32px;height:auto;border:1px solid #ddd;background:#fff;margin:0;line-height:1;}
#reviews #comments ol.commentlist li .comment-text{margin:0 0 0 50px;border:1px solid #ddd;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;padding:11px 11px 0;}#reviews #comments ol.commentlist li .comment-text p{margin:0 0 11px;}
#reviews #comments ol.commentlist li .comment-text p.meta{font-size:0.86em;}
.star-rating{float:right;width:80px;height:16px;background:url(../images/star.png) repeat-x left 0;}.star-rating span{background:url(../images/star.png) repeat-x left -32px;height:0;padding-top:16px;overflow:hidden;float:left;}
.hreview-aggregate .star-rating{margin:10px 0 0 0;}
#review_form #respond{overflow:hidden;zoom:1;border:1px solid #E7E7E7;margin:0 !important;padding:10px 20px 20px;}#review_form #respond p{margin:0 0 10px !important;}
p.stars{overflow:hidden;zoom:1;}p.stars span{width:80px;height:16px;position:relative;float:left;background:url(../images/star.png) repeat-x left 0;}p.stars span a{float:left;position:absolute;left:0;top:0;width:16px;height:0;padding-top:16px;overflow:hidden;}
p.stars span a:hover,p.stars span a:focus{background:url(../images/star.png) repeat-x left -16px;}
p.stars span a.active{background:url(../images/star.png) repeat-x left -32px;}
p.stars span a.star-1{width:16px;z-index:10;}
p.stars span a.star-2{width:32px;z-index:9;}
p.stars span a.star-3{width:48px;z-index:8;}
p.stars span a.star-4{width:64px;z-index:7;}
p.stars span a.star-5{width:80px;z-index:6;}
table.shop_table{border:1px solid #E7E7E7;margin:0px -1px 24px 0px;text-align:left;width:100%;border-collapse:separate;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;}table.shop_table th{color:#888;font-size:12px;font-weight:bold;line-height:18px;padding:9px 12px !important;}
table.shop_table td{border-top:1px solid #E7E7E7;padding:6px 12px !important;vertical-align:middle;}table.shop_table td a.button{margin:0 3px;}
table.shop_table tfoot td{font-weight:bold;}
table.my_account_orders{font-size:0.85em;}table.my_account_orders th,table.my_account_orders td{padding:4px 8px !important;vertical-align:top;}
table.my_account_orders .button{white-space:nowrap;margin:4px 0;}
ul.cart_list,ul.product_list_widget{list-style:none outside !important;padding:0 !important;margin:0 !important;}ul.cart_list li,ul.product_list_widget li{padding:4px 0 !important;margin:0 !important;overflow:hidden;zoom:1;}ul.cart_list li a,ul.product_list_widget li a{display:block;font-weight:bold;}
ul.cart_list li img,ul.product_list_widget li img{float:left;margin-right:4px;border:1px solid #ddd;}
.widget_shopping_cart .total{border-top:3px double #ddd;padding:4px 0 0;margin:0 !important;}.widget_shopping_cart .total strong{min-width:40px;display:inline-block;}
.widget_shopping_cart .buttons{overflow:hidden;zoom:1;}
a.remove{display:block;height:16px;width:16px;text-indent:-9999px;background:url(../images/remove.png) #cccccc;}
a.remove:hover{background-color:#f93;}
.cart th,.cart td{vertical-align:middle;}
td.actions{text-align:right;}td.actions .coupon{float:left;}td.actions .coupon label{display:none;}
td.actions .coupon .input-text{width:80px !important;float:left;margin:1px 6px 0 0 !important;}
td.actions .button-alt{float:right;margin:2px 0 0 6px;}
td.product-name dl.variation{margin:0;}td.product-name dl.variation dt{font-weight:bold;display:inline;margin:0 4px 0 0;padding:0;}
td.product-name dl.variation dd{display:inline;margin:0 12px 0 0;padding:0;}
td.quantity{min-width:80px;}
.quantity input{margin-left:0;margin-right:0;}
.quantity input.qty{border:1px solid #ccc;width:20px;display:inline;padding:1px 5px 2px;line-height:1em !important;vertical-align:middle;}
.quantity input.plus,.quantity input.minus{background:#ccc;padding:4px;vertical-align:middle;line-height:1em !important;border:none;width:20px;color:#fff !important;cursor:pointer;}
.quantity input.minus{-webkit-border-top-left-radius:5px;-webkit-border-bottom-left-radius:5px;-moz-border-radius-topleft:5px;-moz-border-radius-bottomleft:5px;border-top-left-radius:5px;border-bottom-left-radius:5px;}
.quantity input.plus{-webkit-border-top-right-radius:5px;-webkit-border-bottom-right-radius:5px;-moz-border-radius-topright:5px;-moz-border-radius-bottomright:5px;border-top-right-radius:5px;border-bottom-right-radius:5px;}
.quantity input.minus:hover,.quantity input.plus:hover{background:#f93;}
.cart input{width:100px;margin:0 !important;vertical-align:middle;line-height:1em !important;}
.col2-set{overflow:hidden;zoom:1;width:100%;}.col2-set .col-1{float:left;width:48%;}
.col2-set .col-2{float:right;width:48%;}
.cart-collaterals{overflow:hidden;zoom:1;width:100%;}.cart-collaterals .related{width:310px;float:left;}
.cart-collaterals .cross-sells{width:314px;float:left;}
.cart-collaterals .shipping_calculator{float:right;width:225px;clear:right;text-align:right;overflow:hidden;zoom:1;margin:20px 0 0 0;}.cart-collaterals .shipping_calculator .button{width:225px !important;float:none !important;display:block;}
.cart-collaterals .shipping_calculator .col2-set .col-1,.cart-collaterals .shipping_calculator .col2-set .col-2{width:47%;}
.cart-collaterals .cart_totals{float:right;width:225px;text-align:right;}.cart-collaterals .cart_totals p{margin:0 !important;}
.cart-collaterals .cart_totals table{border-collapse:separate;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;margin:0 0 6px !important;padding:0;}.cart-collaterals .cart_totals table tr:first-child th,.cart-collaterals .cart_totals table tr:first-child td{border-top:0 !important;}
.cart-collaterals .cart_totals table td,.cart-collaterals .cart_totals table th{padding:6px 12px !important;}
.cart-collaterals .cart_totals table small{display:block;color:#999;}
.cart-collaterals .cart_totals .discount td{color:green;}
.cart-collaterals .cart_totals tr td,.cart-collaterals .cart_totals tr th{border-top:1px solid #E7E7E7;padding:6px 24px;}
.cart-collaterals .cart_totals a.button-alt{width:193px;display:block;font-size:0.92em;}
.form-row{overflow:hidden;zoom:1;padding:3px;margin:0 0 6px !important;}.form-row label{display:block;}
.form-row label.hidden{visibility:hidden;}
.form-row select{width:100%;cursor:pointer;margin:0 !important;}
.form-row .required{color:#c00;font-weight:bold;}
.form-row .input-checkbox{display:inline;margin:-2px 8px 0 0;text-align:center;vertical-align:middle;}
.form-row label.checkbox{display:inline;}
form .form-row,#content .form-row{}form .form-row input.input-text,#content .form-row input.input-text,form .form-row textarea,#content .form-row textarea{-webkit-box-sizing:border-box;-moz-box-sizing:border-box;box-sizing:border-box;box-shadow:inset 0 1px 4px 0 rgba(0, 0, 0, 0.1);-webkit-box-shadow:inset 0 1px 4px 0 rgba(0, 0, 0, 0.1);-moz-box-shadow:inset 0 1px 4px 0 rgba(0, 0, 0, 0.1);border:1px solid #ccc;width:100%;padding:6px;margin:0;outline:0;background:#fff none;font-size:14px;line-height:1em;}
form .form-row textarea,#content .form-row textarea{height:3.5em;line-height:1.5em;display:block;-moz-box-shadow:none;-webkit-box-shadow:none;box-shadow:none;}
form .form-row input.input-text:focus,#content .form-row input.input-text:focus,form .form-row textarea:focus,#content .form-row textarea:focus{box-shadow:inset 0 0 0 3px #faf9dc;-webkit-box-shadow:inset 0 0 0 3px #faf9dc;-moz-box-shadow:inset 0 0 0 3px #faf9dc;}
.form-row-first,.form-row-last{float:left;width:47%;overflow:visible;}
.form-row-last{float:right;}
form.login{border:1px solid #ccc;padding:20px;border:1px solid #E7E7E7;margin:20px 0 20px 0px;text-align:left;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;}
#payment{background:#F9F9F9;-webkit-border-radius:5px;-moz-border-radius:5px;border-radius:5px;}#payment ul.payment_methods{overflow:hidden;zoom:1;text-align:left;padding:1em;border-bottom:1px solid #eee;margin:0 !important;list-style:none outside;}#payment ul.payment_methods li{line-height:2em;text-align:left;margin:0 !important;font-weight:normal;}#payment ul.payment_methods li input{margin:0 1em 0 0 !important;}
#payment ul.payment_methods li img{vertical-align:middle;margin:-2px 0 0 0.5em;position:relative;}
#payment div.form-row{padding:1em;border-top:1px solid #fff;}
#payment #place_order{float:right;margin:0;}
#payment .terms{padding:0 1em 0 !important;text-align:right;}
#payment div.payment_box{position:relative;width:96%;background:#f5f5f5;border:1px solid #eee;box-shadow:inset 0 1px 1px rgba(255, 255, 255, 0.5) #888888;-webkit-box-shadow:inset 0 1px 1px rgba(255, 255, 255, 0.5) #888888;-moz-box-shadow:inset 0 1px 1px rgba(255, 255, 255, 0.5) #888888;padding:1em 2% 0;margin:1em 0 1em 0;font-size:0.92em;}#payment div.payment_box #cc-expire-month,#payment div.payment_box #cc-expire-year{width:48%;float:left;}
#payment div.payment_box #cc-expire-year{float:right;}
#payment div.payment_box span.help{font-size:11px;color:#999;line-height:13px;font-weight:normal;}
#payment div.payment_box p,#payment div.payment_box .form-row{margin:0 0 1em;}
#payment div.payment_box:after{content:"";display:block;border:8px solid #eee;border-right-color:transparent;border-left-color:transparent;border-top-color:transparent;position:absolute;top:-4px;left:0;margin:-1em 0 0 2em;}
div.shipping-address{padding:0;clear:left;}
#shiptobilling{float:right;line-height:1.62em !important;margin:0 0 0 0 !important;padding:0;}#shiptobilling label{font-size:0.6875em;}
.checkout .col-2 h3{float:left;clear:none;}
.checkout .col-2 .notes{clear:left;}
.checkout .col-2 .form-row-first{clear:left;}
.order_details{overflow:hidden;zoom:1;margin:0 0 1.5em;list-style:none;}.order_details li{float:left;margin-right:2em;text-transform:uppercase;font-size:0.715em;line-height:1em;border-right:1px dashed #ccc;padding-right:2em;}.order_details li strong{display:block;font-size:1.4em;text-transform:none;line-height:1.5em;color:#333;}
.order_details li.method{border:none;}
.addresses .title{overflow:hidden;zoom:1;}.addresses .title h3{float:left;}
.addresses .title .edit{float:right;}
.widget_price_filter .price_slider_wrapper .button{float:right;margin:0 !important;}
.widget_price_filter .price_slider_wrapper .price_slider{margin:1em .6em .6em;}.widget_price_filter .price_slider_wrapper .price_slider .ui-slider-handle{outline:0 !important;}
.widget_price_filter .price_slider_wrapper .price_slider_amount{overflow:hidden;line-height:2em;}
.widget_layered_nav ul{margin:0 !important;padding:0 !important;border:0 !important;list-style:none outside !important;}.widget_layered_nav ul li{overflow:hidden;zoom:1;padding:0 0 1px;}.widget_layered_nav ul li a,.widget_layered_nav ul li span{padding:1px 0;float:left;}
.widget_layered_nav ul li.chosen a{padding:0 6px 0 18px;border:1px solid #3399cc;background:#3399cc url(../images/cross_white.png) no-repeat 6px center;box-shadow:inset 0 1px 1px rgba(255, 255, 255, 0.5) #888888;-webkit-box-shadow:inset 0 1px 1px rgba(255, 255, 255, 0.5) #888888;-moz-box-shadow:inset 0 1px 1px rgba(255, 255, 255, 0.5) #888888;color:#fff;-webkit-border-radius:3px;-moz-border-radius:3px;border-radius:3px;}
.widget_layered_nav ul small.count{float:right;margin-left:6px;font-size:1em;padding:1px 0;color:#999;}

View File

@ -95,7 +95,7 @@ transition:@selector @animation @duration;
color:#93864E;
}
}
div.jigoshop_error, div.jigoshop_message {
div.woocommerce_error, div.woocommerce_message {
border: 1px solid;
margin: 10px 0px;
padding:10px 10px 10px 32px;
@ -107,12 +107,12 @@ div.jigoshop_error, div.jigoshop_message {
float: right;
}
}
div.jigoshop_error {
div.woocommerce_error {
color: #D8000C;
background-color: #ffd4d4;
background-image: url('../images/error.gif');
}
div.jigoshop_message {
div.woocommerce_message {
color: #4F8A10;
background-color: #DFF2BF;
background-image:url('../images/success.gif');

Binary file not shown.

Before

Width:  |  Height:  |  Size: 338 B

After

Width:  |  Height:  |  Size: 256 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 655 B

After

Width:  |  Height:  |  Size: 600 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 245 B

After

Width:  |  Height:  |  Size: 141 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 714 B

After

Width:  |  Height:  |  Size: 658 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 KiB

After

Width:  |  Height:  |  Size: 1.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 8.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 106 B

After

Width:  |  Height:  |  Size: 101 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 347 B

After

Width:  |  Height:  |  Size: 330 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 324 B

After

Width:  |  Height:  |  Size: 322 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 B

After

Width:  |  Height:  |  Size: 106 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 B

After

Width:  |  Height:  |  Size: 99 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 70 B

After

Width:  |  Height:  |  Size: 68 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 203 B

After

Width:  |  Height:  |  Size: 174 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 176 B

After

Width:  |  Height:  |  Size: 143 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.7 KiB

After

Width:  |  Height:  |  Size: 1.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 911 B

After

Width:  |  Height:  |  Size: 835 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.7 KiB

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 324 B

After

Width:  |  Height:  |  Size: 245 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.2 KiB

After

Width:  |  Height:  |  Size: 5.1 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 274 B

After

Width:  |  Height:  |  Size: 130 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 756 B

After

Width:  |  Height:  |  Size: 673 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 744 B

After

Width:  |  Height:  |  Size: 639 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 180 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 105 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 111 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 107 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 101 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 123 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.3 KiB

View File

@ -161,7 +161,7 @@ jQuery(function(){
jQuery('.variations').block({ message: null, overlayCSS: { background: '#fff url(' + params.plugin_url + '/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.6 } });
var data = {
action: 'jigoshop_get_variation',
action: 'woocommerce_get_variation',
variation_data: jQuery('form.variations_form').serialize(),
security: params.get_variation_nonce
};
@ -329,7 +329,7 @@ if (params.is_checkout==1) {
url: params.checkout_url,
data: jQuery(form).serialize(),
success: function( code ) {
jQuery('.jigoshop_error, .jigoshop_message').remove();
jQuery('.woocommerce_error, .woocommerce_message').remove();
try {
success = jQuery.parseJSON( code );
window.location = decodeURI(success.redirect);

View File

@ -129,7 +129,7 @@ if( jQuery.isFunction(jQuery.fn.sortable) ){
jQuery(document).ready(function($){$('table.widefat.wp-list-table tbody th, table.widefat tbody td').css('cursor','move');$("table.widefat.wp-list-table tbody").sortable({items:'tr:not(.inline-edit-row)',cursor:'move',axis:'y',containment:'table.widefat',placeholder:'product-cat-placeholder',scrollSensitivity:40,helper:function(e,ui){ui.children().each(function(){jQuery(this).width(jQuery(this).width());});return ui;},start:function(event,ui){if(!ui.item.hasClass('alternate'))ui.item.css('background-color','#ffffff');ui.item.children('td,th').css('border-bottom-width','0');ui.item.css('outline','1px solid #aaa');},stop:function(event,ui){ui.item.removeAttr('style');ui.item.children('td,th').css('border-bottom-width','1px');},update:function(event,ui){var termid=ui.item.find('.check-column input').val();var termparent=ui.item.find('.parent').html();var prevtermid=ui.item.prev().find('.check-column input').val();var nexttermid=ui.item.next().find('.check-column input').val();var prevtermparent=undefined;if(prevtermid!=undefined){var prevtermparent=ui.item.prev().find('.parent').html();if(prevtermparent!=termparent)prevtermid=undefined;}
var nexttermparent=undefined;if(nexttermid!=undefined){nexttermparent=ui.item.next().find('.parent').html();if(nexttermparent!=termparent)nexttermid=undefined;}
if((prevtermid==undefined&&nexttermid==undefined)||(nexttermid==undefined&&nexttermparent==prevtermid)||(nexttermid!=undefined&&prevtermparent==termid)){$("table.widefat tbody").sortable('cancel');return;}
ui.item.find('.check-column input').hide().after('<img alt="processing" src="images/wpspin_light.gif" class="waiting" style="margin-left: 6px;" />');$.post(ajaxurl,{action:'jigoshop-categories-ordering',id:termid,nextid:nexttermid},function(response){if(response=='children')window.location.reload();else{ui.item.find('.check-column input').show().siblings('img').remove();}});$('table.widefat tbody tr').each(function(){var i=jQuery('table.widefat tbody tr').index(this);if(i%2==0)jQuery(this).addClass('alternate');else jQuery(this).removeClass('alternate');});}});});
ui.item.find('.check-column input').hide().after('<img alt="processing" src="images/wpspin_light.gif" class="waiting" style="margin-left: 6px;" />');$.post(ajaxurl,{action:'woocommerce-categories-ordering',id:termid,nextid:nexttermid},function(response){if(response=='children')window.location.reload();else{ui.item.find('.check-column input').show().siblings('img').remove();}});$('table.widefat tbody tr').each(function(){var i=jQuery('table.widefat tbody tr').index(this);if(i%2==0)jQuery(this).addClass('alternate');else jQuery(this).removeClass('alternate');});}});});
}
/**

View File

@ -101,18 +101,18 @@ jQuery( function($){
if (item_id) {
jQuery('table.jigoshop_order_items').block({ message: null, overlayCSS: { background: '#fff url(' + params.plugin_url + '/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.6 } });
jQuery('table.woocommerce_order_items').block({ message: null, overlayCSS: { background: '#fff url(' + params.plugin_url + '/assets/images/ajax-loader.gif) no-repeat center', opacity: 0.6 } });
var data = {
action: 'jigoshop_add_order_item',
action: 'woocommerce_add_order_item',
item_to_add: jQuery('select.item_id').val(),
security: params.add_order_item_nonce
};
jQuery.post( params.ajax_url, data, function(response) {
jQuery('table.jigoshop_order_items tbody#order_items_list').append( response );
jQuery('table.jigoshop_order_items').unblock();
jQuery('table.woocommerce_order_items tbody#order_items_list').append( response );
jQuery('table.woocommerce_order_items').unblock();
jQuery('select.item_id').css('border-color', '').val('');
});
@ -152,7 +152,7 @@ jQuery( function($){
var select_val = jQuery(this).val();
// Hide options
$('#jigoshop-product-type-options .inside > div').hide();
$('#woocommerce-product-type-options .inside > div').hide();
$('#'+select_val+'_product_options').show();
// Show option
@ -173,7 +173,7 @@ jQuery( function($){
jQuery('.menu_order_field, .parent_id_field').show();
}
$('body').trigger('jigoshop-product-type-change', select_val, $(this) );
$('body').trigger('woocommerce-product-type-change', select_val, $(this) );
}).change();
@ -215,17 +215,17 @@ jQuery( function($){
// ATTRIBUTE TABLES
// Initial order
var jigoshop_attributes_table_items = jQuery('#attributes_list').children('tr').get();
jigoshop_attributes_table_items.sort(function(a, b) {
var woocommerce_attributes_table_items = jQuery('#attributes_list').children('tr').get();
woocommerce_attributes_table_items.sort(function(a, b) {
var compA = jQuery(a).attr('rel');
var compB = jQuery(b).attr('rel');
return (compA < compB) ? -1 : (compA > compB) ? 1 : 0;
})
jQuery(jigoshop_attributes_table_items).each( function(idx, itm) { jQuery('#attributes_list').append(itm); } );
jQuery(woocommerce_attributes_table_items).each( function(idx, itm) { jQuery('#attributes_list').append(itm); } );
// Show
function show_attribute_table() {
jQuery('table.jigoshop_attributes, table.jigoshop_variable_attributes').each(function(){
jQuery('table.woocommerce_attributes, table.woocommerce_variable_attributes').each(function(){
if (jQuery('tbody tr', this).size()==0)
jQuery(this).parent().hide();
else
@ -241,20 +241,20 @@ jQuery( function($){
// Add rows
jQuery('button.add_attribute').click(function(){
var size = jQuery('table.jigoshop_attributes tbody tr').size();
var size = jQuery('table.woocommerce_attributes tbody tr').size();
var attribute_type = jQuery('select.attribute_taxonomy').val();
if (!attribute_type) {
// Add custom attribute row
jQuery('table.jigoshop_attributes tbody').append('<tr><td class="center"><button type="button" class="button move_up">&uarr;</button><button type="button" class="move_down button">&darr;</button><input type="hidden" name="attribute_position[' + size + ']" class="attribute_position" value="' + size + '" /></td><td><input type="text" name="attribute_names[' + size + ']" /><input type="hidden" name="attribute_is_taxonomy[' + size + ']" value="0" /></td><td><input type="text" name="attribute_values[' + size + ']" /></td><td class="center"><input type="checkbox" checked="checked" name="attribute_visibility[' + size + ']" value="1" /></td><td class="center"><input type="checkbox" name="attribute_variation[' + size + ']" value="1" /></td><td class="center"><button type="button" class="remove_row button">&times;</button></td></tr>');
jQuery('table.woocommerce_attributes tbody').append('<tr><td class="center"><button type="button" class="button move_up">&uarr;</button><button type="button" class="move_down button">&darr;</button><input type="hidden" name="attribute_position[' + size + ']" class="attribute_position" value="' + size + '" /></td><td><input type="text" name="attribute_names[' + size + ']" /><input type="hidden" name="attribute_is_taxonomy[' + size + ']" value="0" /></td><td><input type="text" name="attribute_values[' + size + ']" /></td><td class="center"><input type="checkbox" checked="checked" name="attribute_visibility[' + size + ']" value="1" /></td><td class="center"><input type="checkbox" name="attribute_variation[' + size + ']" value="1" /></td><td class="center"><button type="button" class="remove_row button">&times;</button></td></tr>');
} else {
// Reveal taxonomy row
var thisrow = jQuery('table.jigoshop_attributes tbody tr.' + attribute_type);
jQuery('table.jigoshop_attributes tbody').append( jQuery(thisrow) );
var thisrow = jQuery('table.woocommerce_attributes tbody tr.' + attribute_type);
jQuery('table.woocommerce_attributes tbody').append( jQuery(thisrow) );
jQuery(thisrow).show();
row_indexes();

View File

@ -1,16 +1,16 @@
<?php
/**
* Jigoshop cart
* @class jigoshop_cart
* WooCommerce cart
*
* The JigoShop cart class stores cart data and active coupons as well as handling customer sessions and some cart related urls.
* The WooCommerce cart class stores cart data and active coupons as well as handling customer sessions and some cart related urls.
* The cart class also has a price calculation function which calls upon other classes to calcualte totals.
*
* @author Jigowatt
* @category Classes
* @package JigoShop
* @class woocommerce_cart
* @package WooCommerce
* @category Class
* @author WooThemes
*/
class jigoshop_cart {
class woocommerce_cart {
private static $_instance;
public static $cart_contents_total;
@ -63,9 +63,9 @@ class jigoshop_cart {
foreach ($cart as $values) :
if ($values['variation_id']>0) :
$_product = &new jigoshop_product_variation($values['variation_id']);
$_product = &new woocommerce_product_variation($values['variation_id']);
else :
$_product = &new jigoshop_product($values['product_id']);
$_product = &new woocommerce_product($values['product_id']);
endif;
if ($_product->exists) :
@ -142,7 +142,7 @@ class jigoshop_cart {
$cart_item_key = sizeof(self::$cart_contents);
$data = &new jigoshop_product( $product_id );
$data = &new woocommerce_product( $product_id );
self::$cart_contents[$cart_item_key] = array(
'product_id' => $product_id,
@ -202,13 +202,13 @@ class jigoshop_cart {
/** gets the url to the cart page */
function get_cart_url() {
$cart_page_id = get_option('jigoshop_cart_page_id');
$cart_page_id = get_option('woocommerce_cart_page_id');
if ($cart_page_id) return get_permalink($cart_page_id);
}
/** gets the url to the checkout page */
function get_checkout_url() {
$checkout_page_id = get_option('jigoshop_checkout_page_id');
$checkout_page_id = get_option('woocommerce_checkout_page_id');
if ($checkout_page_id) :
if (is_ssl()) return str_replace('http:', 'https:', get_permalink($checkout_page_id));
return get_permalink($checkout_page_id);
@ -217,14 +217,14 @@ class jigoshop_cart {
/** gets the url to remove an item from the cart */
function get_remove_url( $cart_item_key ) {
$cart_page_id = get_option('jigoshop_cart_page_id');
if ($cart_page_id) return jigoshop::nonce_url( 'cart', add_query_arg('remove_item', $cart_item_key, get_permalink($cart_page_id)));
$cart_page_id = get_option('woocommerce_cart_page_id');
if ($cart_page_id) return woocommerce::nonce_url( 'cart', add_query_arg('remove_item', $cart_item_key, get_permalink($cart_page_id)));
}
/** looks through the cart to see if shipping is actually required */
function needs_shipping() {
if (!jigoshop_shipping::$enabled) return false;
if (!woocommerce_shipping::$enabled) return false;
if (!is_array(self::$cart_contents)) return false;
$needs_shipping = false;
@ -242,7 +242,7 @@ class jigoshop_cart {
/** Sees if we need a shipping address */
function ship_to_billing_address_only() {
$ship_to_billing_address_only = get_option('jigoshop_ship_to_billing_address_only');
$ship_to_billing_address_only = get_option('woocommerce_ship_to_billing_address_only');
if ($ship_to_billing_address_only=='yes') return true;
@ -264,12 +264,12 @@ class jigoshop_cart {
if ($_product->is_in_stock() && $_product->has_enough_stock( $values['quantity'] )) :
// :)
else :
$error->add( 'out-of-stock', sprintf(__('Sorry, we do not have enough "%s" in stock to fulfill your order. Please edit your cart and try again. We apologise for any inconvenience caused.', 'jigoshop'), $_product->get_title() ) );
$error->add( 'out-of-stock', sprintf(__('Sorry, we do not have enough "%s" in stock to fulfill your order. Please edit your cart and try again. We apologise for any inconvenience caused.', 'woothemes'), $_product->get_title() ) );
return $error;
endif;
else :
if (!$_product->is_in_stock()) :
$error->add( 'out-of-stock', sprintf(__('Sorry, we do not have enough "%s" in stock to fulfill your order. Please edit your cart and try again. We apologise for any inconvenience caused.', 'jigoshop'), $_product->get_title() ) );
$error->add( 'out-of-stock', sprintf(__('Sorry, we do not have enough "%s" in stock to fulfill your order. Please edit your cart and try again. We apologise for any inconvenience caused.', 'woothemes'), $_product->get_title() ) );
return $error;
endif;
endif;
@ -280,7 +280,7 @@ class jigoshop_cart {
/** calculate totals for the items in the cart */
public static function calculate_totals() {
$_tax = &new jigoshop_tax();
$_tax = &new woocommerce_tax();
self::$total = 0;
self::$cart_contents_total = 0;
@ -305,13 +305,13 @@ class jigoshop_cart {
$total_item_price = $_product->get_price() * $values['quantity'] * 100; // Into pounds
if ( get_option('jigoshop_calc_taxes')=='yes') :
if ( get_option('woocommerce_calc_taxes')=='yes') :
if ( $_product->is_taxable() ) :
$rate = $_tax->get_rate( $_product->data['tax_class'] );
if (get_option('jigoshop_prices_include_tax')=='yes') :
if (get_option('woocommerce_prices_include_tax')=='yes') :
$tax_amount = $_tax->calc_tax( $total_item_price, $rate, true );
@ -321,7 +321,7 @@ class jigoshop_cart {
endif;
if (get_option('jigoshop_prices_include_tax')=='yes' && jigoshop_customer::is_customer_outside_base() && defined('JIGOSHOP_CHECKOUT') && JIGOSHOP_CHECKOUT ) :
if (get_option('woocommerce_prices_include_tax')=='yes' && woocommerce_customer::is_customer_outside_base() && defined('WOOCOMMERCE_CHECKOUT') && WOOCOMMERCE_CHECKOUT ) :
/**
* Our prices include tax so we need to take the base tax rate into consideration of our shop's country
@ -355,7 +355,7 @@ class jigoshop_cart {
// Product Discounts
if (self::$applied_coupons) foreach (self::$applied_coupons as $code) :
$coupon = jigoshop_coupons::get_coupon($code);
$coupon = woocommerce_coupons::get_coupon($code);
if ($coupon['type']=='fixed_product' && in_array($values['product_id'], $coupon['products'])) :
self::$discount_total = self::$discount_total + ( $coupon['amount'] * $values['quantity'] );
endif;
@ -365,11 +365,11 @@ class jigoshop_cart {
endforeach; endif;
// Cart Shipping
if (self::needs_shipping()) jigoshop_shipping::calculate_shipping(); else jigoshop_shipping::reset_shipping();
if (self::needs_shipping()) woocommerce_shipping::calculate_shipping(); else woocommerce_shipping::reset_shipping();
self::$shipping_total = jigoshop_shipping::$shipping_total;
self::$shipping_total = woocommerce_shipping::$shipping_total;
self::$shipping_tax_total = jigoshop_shipping::$shipping_tax;
self::$shipping_tax_total = woocommerce_shipping::$shipping_tax;
self::$tax_total = self::$cart_contents_tax;
@ -379,8 +379,8 @@ class jigoshop_cart {
// Cart Discounts
if (self::$applied_coupons) foreach (self::$applied_coupons as $code) :
$coupon = jigoshop_coupons::get_coupon($code);
if (jigoshop_coupons::is_valid($code)) :
$coupon = woocommerce_coupons::get_coupon($code);
if (woocommerce_coupons::is_valid($code)) :
if ($coupon['type']=='fixed_cart') :
self::$discount_total = self::$discount_total + $coupon['amount'];
@ -392,10 +392,10 @@ class jigoshop_cart {
endforeach;
// Total
if (get_option('jigoshop_prices_include_tax')=='yes') :
self::$total = self::$subtotal + self::$shipping_tax_total - self::$discount_total + jigoshop_shipping::$shipping_total;
if (get_option('woocommerce_prices_include_tax')=='yes') :
self::$total = self::$subtotal + self::$shipping_tax_total - self::$discount_total + woocommerce_shipping::$shipping_total;
else :
self::$total = self::$subtotal + self::$tax_total + self::$shipping_tax_total - self::$discount_total + jigoshop_shipping::$shipping_total;
self::$total = self::$subtotal + self::$tax_total + self::$shipping_tax_total - self::$discount_total + woocommerce_shipping::$shipping_total;
endif;
if (self::$total < 0) self::$total = 0;
@ -403,48 +403,48 @@ class jigoshop_cart {
/** gets the total (after calculation) */
function get_total() {
return jigoshop_price(self::$total);
return woocommerce_price(self::$total);
}
/** gets the cart contens total (after calculation) */
function get_cart_total() {
return jigoshop_price(self::$cart_contents_total);
return woocommerce_price(self::$cart_contents_total);
}
/** gets the sub total (after calculation) */
function get_cart_subtotal() {
if (get_option('jigoshop_display_totals_tax')=='excluding' || ( defined('JIGOSHOP_CHECKOUT') && JIGOSHOP_CHECKOUT )) :
if (get_option('woocommerce_display_totals_tax')=='excluding' || ( defined('WOOCOMMERCE_CHECKOUT') && WOOCOMMERCE_CHECKOUT )) :
if (get_option('jigoshop_prices_include_tax')=='yes') :
if (get_option('woocommerce_prices_include_tax')=='yes') :
$return = jigoshop_price(self::$subtotal - self::$tax_total);
$return = woocommerce_price(self::$subtotal - self::$tax_total);
else :
$return = jigoshop_price(self::$subtotal);
$return = woocommerce_price(self::$subtotal);
endif;
if (self::$tax_total>0) :
$return .= __(' <small>(ex. tax)</small>', 'jigoshop');
$return .= __(' <small>(ex. tax)</small>', 'woothemes');
endif;
return $return;
else :
if (get_option('jigoshop_prices_include_tax')=='yes') :
if (get_option('woocommerce_prices_include_tax')=='yes') :
$return = jigoshop_price(self::$subtotal);
$return = woocommerce_price(self::$subtotal);
else :
$return = jigoshop_price(self::$subtotal + self::$tax_total);
$return = woocommerce_price(self::$subtotal + self::$tax_total);
endif;
if (self::$tax_total>0) :
$return .= __(' <small>(inc. tax)</small>', 'jigoshop');
$return .= __(' <small>(inc. tax)</small>', 'woothemes');
endif;
return $return;
@ -455,43 +455,43 @@ class jigoshop_cart {
/** gets the cart tax (after calculation) */
function get_cart_tax() {
$cart_total_tax = self::$tax_total + self::$shipping_tax_total;
if ($cart_total_tax > 0) return jigoshop_price( $cart_total_tax );
if ($cart_total_tax > 0) return woocommerce_price( $cart_total_tax );
return false;
}
/** gets the shipping total (after calculation) */
function get_cart_shipping_total() {
if (isset(jigoshop_shipping::$shipping_label)) :
if (jigoshop_shipping::$shipping_total>0) :
if (isset(woocommerce_shipping::$shipping_label)) :
if (woocommerce_shipping::$shipping_total>0) :
if (get_option('jigoshop_display_totals_tax')=='excluding') :
if (get_option('woocommerce_display_totals_tax')=='excluding') :
$return = jigoshop_price(jigoshop_shipping::$shipping_total);
$return = woocommerce_price(woocommerce_shipping::$shipping_total);
if (self::$shipping_tax_total>0) :
$return .= __(' <small>(ex. tax)</small>', 'jigoshop');
$return .= __(' <small>(ex. tax)</small>', 'woothemes');
endif;
return $return;
else :
$return = jigoshop_price(jigoshop_shipping::$shipping_total + jigoshop_shipping::$shipping_tax);
$return = woocommerce_price(woocommerce_shipping::$shipping_total + woocommerce_shipping::$shipping_tax);
if (self::$shipping_tax_total>0) :
$return .= __(' <small>(inc. tax)</small>', 'jigoshop');
$return .= __(' <small>(inc. tax)</small>', 'woothemes');
endif;
return $return;
endif;
else :
return __('Free!', 'jigoshop');
return __('Free!', 'woothemes');
endif;
endif;
}
/** gets title of the chosen shipping method */
function get_cart_shipping_title() {
if (isset(jigoshop_shipping::$shipping_label)) :
return __('via ','jigoshop') . jigoshop_shipping::$shipping_label;
if (isset(woocommerce_shipping::$shipping_label)) :
return __('via ', 'woothemes') . woocommerce_shipping::$shipping_label;
endif;
return false;
}
@ -504,17 +504,17 @@ class jigoshop_cart {
*/
function add_discount( $coupon_code ) {
if ($the_coupon = jigoshop_coupons::get_coupon($coupon_code)) :
if ($the_coupon = woocommerce_coupons::get_coupon($coupon_code)) :
// Check if applied
if (jigoshop_cart::has_discount($coupon_code)) :
jigoshop::add_error( __('Discount code already applied!', 'jigoshop') );
if (woocommerce_cart::has_discount($coupon_code)) :
woocommerce::add_error( __('Discount code already applied!', 'woothemes') );
return false;
endif;
// Check it can be used with cart
if (!jigoshop_coupons::is_valid($coupon_code)) :
jigoshop::add_error( __('Invalid coupon.', 'jigoshop') );
if (!woocommerce_coupons::is_valid($coupon_code)) :
woocommerce::add_error( __('Invalid coupon.', 'woothemes') );
return false;
endif;
@ -524,7 +524,7 @@ class jigoshop_cart {
endif;
foreach (self::$applied_coupons as $coupon) :
$coupon = jigoshop_coupons::get_coupon($coupon);
$coupon = woocommerce_coupons::get_coupon($coupon);
if ($coupon['individual_use']=='yes') :
self::$applied_coupons = array();
endif;
@ -532,11 +532,11 @@ class jigoshop_cart {
self::$applied_coupons[] = $coupon_code;
self::set_session();
jigoshop::add_message( __('Discount code applied successfully.', 'jigoshop') );
woocommerce::add_message( __('Discount code applied successfully.', 'woothemes') );
return true;
else :
jigoshop::add_error( __('Coupon does not exist!', 'jigoshop') );
woocommerce::add_error( __('Coupon does not exist!', 'woothemes') );
return false;
endif;
return false;
@ -551,7 +551,7 @@ class jigoshop_cart {
/** gets the total discount amount */
function get_total_discount() {
if (self::$discount_total) return jigoshop_price(self::$discount_total); else return false;
if (self::$discount_total) return woocommerce_price(self::$discount_total); else return false;
}
/** clears the cart/coupon data and re-calcs totals */

View File

@ -1,15 +1,15 @@
<?php
/**
* Checkout
* @class jigoshop_checkout
*
* The JigoShop checkout class handles the checkout process, collecting user data and processing the payment.
* The WooCommerce checkout class handles the checkout process, collecting user data and processing the payment.
*
* @author Jigowatt
* @category Classes
* @package JigoShop
* @class woocommerce_checkout
* @package WooCommerce
* @category Class
* @author WooThemes
*/
class jigoshop_checkout {
class woocommerce_checkout {
var $posted;
var $billing_fields;
@ -22,37 +22,37 @@ class jigoshop_checkout {
/** constructor */
protected function __construct () {
add_action('jigoshop_checkout_billing',array(&$this,'checkout_form_billing'));
add_action('jigoshop_checkout_shipping',array(&$this,'checkout_form_shipping'));
add_action('woocommerce_checkout_billing',array(&$this,'checkout_form_billing'));
add_action('woocommerce_checkout_shipping',array(&$this,'checkout_form_shipping'));
$this->must_create_account = true;
if (get_option('jigoshop_enable_guest_checkout')=='yes' || is_user_logged_in()) $this->must_create_account = false;
if (get_option('woocommerce_enable_guest_checkout')=='yes' || is_user_logged_in()) $this->must_create_account = false;
$this->billing_fields = array(
array( 'name'=>'billing-first_name', 'label' => __('First Name', 'jigoshop'), 'placeholder' => __('First Name', 'jigoshop'), 'required' => true, 'class' => array('form-row-first') ),
array( 'name'=>'billing-last_name', 'label' => __('Last Name', 'jigoshop'), 'placeholder' => __('Last Name', 'jigoshop'), 'required' => true, 'class' => array('form-row-last') ),
array( 'name'=>'billing-company', 'label' => __('Company', 'jigoshop'), 'placeholder' => __('Company', 'jigoshop') ),
array( 'name'=>'billing-address', 'label' => __('Address', 'jigoshop'), 'placeholder' => __('Address 1', 'jigoshop'), 'required' => true, 'class' => array('form-row-first') ),
array( 'name'=>'billing-address-2', 'label' => __('Address 2', 'jigoshop'), 'placeholder' => __('Address 2', 'jigoshop'), 'class' => array('form-row-last'), 'label_class' => array('hidden') ),
array( 'name'=>'billing-city', 'label' => __('City', 'jigoshop'), 'placeholder' => __('City', 'jigoshop'), 'required' => true, 'class' => array('form-row-first') ),
array( 'validate' => 'postcode', 'format' => 'postcode', 'name'=>'billing-postcode', 'label' => __('Postcode', 'jigoshop'), 'placeholder' => __('Postcode', 'jigoshop'), 'required' => true, 'class' => array('form-row-last') ),
array( 'type'=> 'country', 'name'=>'billing-country', 'label' => __('Country', 'jigoshop'), 'required' => true, 'class' => array('form-row-first'), 'rel' => 'billing-state' ),
array( 'type'=> 'state', 'name'=>'billing-state', 'label' => __('State/County', 'jigoshop'), 'required' => true, 'class' => array('form-row-last'), 'rel' => 'billing-country' ),
array( 'name'=>'billing-email', 'validate' => 'email', 'label' => __('Email Address', 'jigoshop'), 'placeholder' => __('you@yourdomain.com', 'jigoshop'), 'required' => true, 'class' => array('form-row-first') ),
array( 'name'=>'billing-phone', 'validate' => 'phone', 'label' => __('Phone', 'jigoshop'), 'placeholder' => __('Phone number', 'jigoshop'), 'required' => true, 'class' => array('form-row-last') )
array( 'name'=>'billing-first_name', 'label' => __('First Name', 'woothemes'), 'placeholder' => __('First Name', 'woothemes'), 'required' => true, 'class' => array('form-row-first') ),
array( 'name'=>'billing-last_name', 'label' => __('Last Name', 'woothemes'), 'placeholder' => __('Last Name', 'woothemes'), 'required' => true, 'class' => array('form-row-last') ),
array( 'name'=>'billing-company', 'label' => __('Company', 'woothemes'), 'placeholder' => __('Company', 'woothemes') ),
array( 'name'=>'billing-address', 'label' => __('Address', 'woothemes'), 'placeholder' => __('Address 1', 'woothemes'), 'required' => true, 'class' => array('form-row-first') ),
array( 'name'=>'billing-address-2', 'label' => __('Address 2', 'woothemes'), 'placeholder' => __('Address 2', 'woothemes'), 'class' => array('form-row-last'), 'label_class' => array('hidden') ),
array( 'name'=>'billing-city', 'label' => __('City', 'woothemes'), 'placeholder' => __('City', 'woothemes'), 'required' => true, 'class' => array('form-row-first') ),
array( 'validate' => 'postcode', 'format' => 'postcode', 'name'=>'billing-postcode', 'label' => __('Postcode', 'woothemes'), 'placeholder' => __('Postcode', 'woothemes'), 'required' => true, 'class' => array('form-row-last') ),
array( 'type'=> 'country', 'name'=>'billing-country', 'label' => __('Country', 'woothemes'), 'required' => true, 'class' => array('form-row-first'), 'rel' => 'billing-state' ),
array( 'type'=> 'state', 'name'=>'billing-state', 'label' => __('State/County', 'woothemes'), 'required' => true, 'class' => array('form-row-last'), 'rel' => 'billing-country' ),
array( 'name'=>'billing-email', 'validate' => 'email', 'label' => __('Email Address', 'woothemes'), 'placeholder' => __('you@yourdomain.com', 'woothemes'), 'required' => true, 'class' => array('form-row-first') ),
array( 'name'=>'billing-phone', 'validate' => 'phone', 'label' => __('Phone', 'woothemes'), 'placeholder' => __('Phone number', 'woothemes'), 'required' => true, 'class' => array('form-row-last') )
);
$this->shipping_fields = array(
array( 'name'=>'shipping-first_name', 'label' => __('First Name', 'jigoshop'), 'placeholder' => __('First Name', 'jigoshop'), 'required' => true, 'class' => array('form-row-first') ),
array( 'name'=>'shipping-last_name', 'label' => __('Last Name', 'jigoshop'), 'placeholder' => __('Last Name', 'jigoshop'), 'required' => true, 'class' => array('form-row-last') ),
array( 'name'=>'shipping-company', 'label' => __('Company', 'jigoshop'), 'placeholder' => __('Company', 'jigoshop') ),
array( 'name'=>'shipping-address', 'label' => __('Address', 'jigoshop'), 'placeholder' => __('Address 1', 'jigoshop'), 'required' => true, 'class' => array('form-row-first') ),
array( 'name'=>'shipping-address-2', 'label' => __('Address 2', 'jigoshop'), 'placeholder' => __('Address 2', 'jigoshop'), 'class' => array('form-row-last'), 'label_class' => array('hidden') ),
array( 'name'=>'shipping-city', 'label' => __('City', 'jigoshop'), 'placeholder' => __('City', 'jigoshop'), 'required' => true, 'class' => array('form-row-first') ),
array( 'validate' => 'postcode', 'format' => 'postcode', 'name'=>'shipping-postcode', 'label' => __('Postcode', 'jigoshop'), 'placeholder' => __('Postcode', 'jigoshop'), 'required' => true, 'class' => array('form-row-last') ),
array( 'type'=> 'country', 'name'=>'shipping-country', 'label' => __('Country', 'jigoshop'), 'required' => true, 'class' => array('form-row-first'), 'rel' => 'shipping-state' ),
array( 'type'=> 'state', 'name'=>'shipping-state', 'label' => __('State/County', 'jigoshop'), 'required' => true, 'class' => array('form-row-last'), 'rel' => 'shipping-country' )
array( 'name'=>'shipping-first_name', 'label' => __('First Name', 'woothemes'), 'placeholder' => __('First Name', 'woothemes'), 'required' => true, 'class' => array('form-row-first') ),
array( 'name'=>'shipping-last_name', 'label' => __('Last Name', 'woothemes'), 'placeholder' => __('Last Name', 'woothemes'), 'required' => true, 'class' => array('form-row-last') ),
array( 'name'=>'shipping-company', 'label' => __('Company', 'woothemes'), 'placeholder' => __('Company', 'woothemes') ),
array( 'name'=>'shipping-address', 'label' => __('Address', 'woothemes'), 'placeholder' => __('Address 1', 'woothemes'), 'required' => true, 'class' => array('form-row-first') ),
array( 'name'=>'shipping-address-2', 'label' => __('Address 2', 'woothemes'), 'placeholder' => __('Address 2', 'woothemes'), 'class' => array('form-row-last'), 'label_class' => array('hidden') ),
array( 'name'=>'shipping-city', 'label' => __('City', 'woothemes'), 'placeholder' => __('City', 'woothemes'), 'required' => true, 'class' => array('form-row-first') ),
array( 'validate' => 'postcode', 'format' => 'postcode', 'name'=>'shipping-postcode', 'label' => __('Postcode', 'woothemes'), 'placeholder' => __('Postcode', 'woothemes'), 'required' => true, 'class' => array('form-row-last') ),
array( 'type'=> 'country', 'name'=>'shipping-country', 'label' => __('Country', 'woothemes'), 'required' => true, 'class' => array('form-row-first'), 'rel' => 'shipping-state' ),
array( 'type'=> 'state', 'name'=>'shipping-state', 'label' => __('State/County', 'woothemes'), 'required' => true, 'class' => array('form-row-last'), 'rel' => 'shipping-country' )
);
}
@ -68,13 +68,13 @@ class jigoshop_checkout {
/** Output the billing information form */
function checkout_form_billing() {
if (jigoshop_cart::ship_to_billing_address_only()) :
if (woocommerce_cart::ship_to_billing_address_only()) :
echo '<h3>'.__('Billing &amp Shipping', 'jigoshop').'</h3>';
echo '<h3>'.__('Billing &amp Shipping', 'woothemes').'</h3>';
else :
echo '<h3>'.__('Billing Address', 'jigoshop').'</h3>';
echo '<h3>'.__('Billing Address', 'woothemes').'</h3>';
endif;
@ -86,21 +86,21 @@ class jigoshop_checkout {
// Registration Form
if (!is_user_logged_in()) :
if (get_option('jigoshop_enable_guest_checkout')=='yes') :
if (get_option('woocommerce_enable_guest_checkout')=='yes') :
echo '<p class="form-row"><input class="input-checkbox" id="createaccount" ';
if ($this->get_value('createaccount')) echo 'checked="checked" ';
echo 'type="checkbox" name="createaccount" /> <label for="createaccount" class="checkbox">'.__('Create an account?', 'jigoshop').'</label></p>';
echo 'type="checkbox" name="createaccount" /> <label for="createaccount" class="checkbox">'.__('Create an account?', 'woothemes').'</label></p>';
endif;
echo '<div class="create-account">';
$this->checkout_form_field( array( 'type' => 'text', 'name' => 'account-username', 'label' => __('Account username', 'jigoshop'), 'placeholder' => __('Username', 'jigoshop') ) );
$this->checkout_form_field( array( 'type' => 'password', 'name' => 'account-password', 'label' => __('Account password', 'jigoshop'), 'placeholder' => __('Password', 'jigoshop'),'class' => array('form-row-first')) );
$this->checkout_form_field( array( 'type' => 'password', 'name' => 'account-password-2', 'label' => __('Account password', 'jigoshop'), 'placeholder' => __('Password', 'jigoshop'),'class' => array('form-row-last'), 'label_class' => array('hidden')) );
$this->checkout_form_field( array( 'type' => 'text', 'name' => 'account-username', 'label' => __('Account username', 'woothemes'), 'placeholder' => __('Username', 'woothemes') ) );
$this->checkout_form_field( array( 'type' => 'password', 'name' => 'account-password', 'label' => __('Account password', 'woothemes'), 'placeholder' => __('Password', 'woothemes'),'class' => array('form-row-first')) );
$this->checkout_form_field( array( 'type' => 'password', 'name' => 'account-password-2', 'label' => __('Account password', 'woothemes'), 'placeholder' => __('Password', 'woothemes'),'class' => array('form-row-last'), 'label_class' => array('hidden')) );
echo '<p><small>'.__('Save time in the future and check the status of your order by creating an account.', 'jigoshop').'</small></p></div>';
echo '<p><small>'.__('Save time in the future and check the status of your order by creating an account.', 'woothemes').'</small></p></div>';
endif;
@ -110,15 +110,15 @@ class jigoshop_checkout {
function checkout_form_shipping() {
// Shipping Details
if (jigoshop_cart::needs_shipping() && !jigoshop_cart::ship_to_billing_address_only()) :
if (woocommerce_cart::needs_shipping() && !woocommerce_cart::ship_to_billing_address_only()) :
echo '<p class="form-row" id="shiptobilling"><input class="input-checkbox" ';
if (!$_POST) $shiptobilling = apply_filters('shiptobilling_default', 1); else $shiptobilling = $this->get_value('shiptobilling');
if ($shiptobilling) echo 'checked="checked" ';
echo 'type="checkbox" name="shiptobilling" /> <label for="shiptobilling" class="checkbox">'.__('Ship to same address?', 'jigoshop').'</label></p>';
echo 'type="checkbox" name="shiptobilling" /> <label for="shiptobilling" class="checkbox">'.__('Ship to same address?', 'woothemes').'</label></p>';
echo '<h3>'.__('Shipping Address', 'jigoshop').'</h3>';
echo '<h3>'.__('Shipping Address', 'woothemes').'</h3>';
echo'<div class="shipping-address">';
@ -128,13 +128,13 @@ class jigoshop_checkout {
echo'</div>';
elseif (jigoshop_cart::ship_to_billing_address_only()) :
elseif (woocommerce_cart::ship_to_billing_address_only()) :
echo '<h3>'.__('Notes/Comments', 'jigoshop').'</h3>';
echo '<h3>'.__('Notes/Comments', 'woothemes').'</h3>';
endif;
$this->checkout_form_field( array( 'type' => 'textarea', 'class' => array('notes'), 'name' => 'order_comments', 'label' => __('Order Notes', 'jigoshop'), 'placeholder' => __('Notes about your order, e.g. special notes for delivery.', 'jigoshop') ) );
$this->checkout_form_field( array( 'type' => 'textarea', 'class' => array('notes'), 'name' => 'order_comments', 'label' => __('Order Notes', 'woothemes'), 'placeholder' => __('Notes about your order, e.g. special notes for delivery.', 'woothemes') ) );
}
@ -171,13 +171,13 @@ class jigoshop_checkout {
$field = '<p class="form-row '.implode(' ', $args['class']).'">
<label for="'.$args['name'].'" class="'.implode(' ', $args['label_class']).'">'.$args['label'].$required.'</label>
<select name="'.$args['name'].'" id="'.$args['name'].'" class="country_to_state" rel="'.$args['rel'].'">
<option value="">'.__('Select a country&hellip;', 'jigoshop').'</option>';
<option value="">'.__('Select a country&hellip;', 'woothemes').'</option>';
foreach(jigoshop_countries::get_allowed_countries() as $key=>$value) :
foreach(woocommerce_countries::get_allowed_countries() as $key=>$value) :
$field .= '<option value="'.$key.'"';
if ($this->get_value($args['name'])==$key) $field .= 'selected="selected"';
elseif (!$this->get_value($args['name']) && jigoshop_customer::get_country()==$key) $field .= 'selected="selected"';
$field .= '>'.__($value, 'jigoshop').'</option>';
elseif (!$this->get_value($args['name']) && woocommerce_customer::get_country()==$key) $field .= 'selected="selected"';
$field .= '>'.__($value, 'woothemes').'</option>';
endforeach;
$field .= '</select></p>'.$after;
@ -189,25 +189,25 @@ class jigoshop_checkout {
<label for="'.$args['name'].'" class="'.implode(' ', $args['label_class']).'">'.$args['label'].$required.'</label>';
$current_cc = $this->get_value($args['rel']);
if (!$current_cc) $current_cc = jigoshop_customer::get_country();
if (!$current_cc) $current_cc = woocommerce_customer::get_country();
$current_r = $this->get_value($args['name']);
if (!$current_r) $current_r = jigoshop_customer::get_state();
if (!$current_r) $current_r = woocommerce_customer::get_state();
$states = jigoshop_countries::$states;
$states = woocommerce_countries::$states;
if (isset( $states[$current_cc][$current_r] )) :
// Dropdown
$field .= '<select name="'.$args['name'].'" id="'.$args['name'].'"><option value="">'.__('Select a state&hellip;', 'jigoshop').'</option>';
$field .= '<select name="'.$args['name'].'" id="'.$args['name'].'"><option value="">'.__('Select a state&hellip;', 'woothemes').'</option>';
foreach($states[$current_cc] as $key=>$value) :
$field .= '<option value="'.$key.'"';
if ($current_r==$key) $field .= 'selected="selected"';
$field .= '>'.__($value, 'jigoshop').'</option>';
$field .= '>'.__($value, 'woothemes').'</option>';
endforeach;
$field .= '</select>';
else :
// Input
$field .= '<input type="text" class="input-text" value="'.$current_r.'" placeholder="'.__('State/County', 'jigoshop').'" name="'.$args['name'].'" id="'.$args['name'].'" />';
$field .= '<input type="text" class="input-text" value="'.$current_r.'" placeholder="'.__('State/County', 'woothemes').'" name="'.$args['name'].'" id="'.$args['name'].'" />';
endif;
$field .= '</p>'.$after;
@ -239,33 +239,35 @@ class jigoshop_checkout {
global $wpdb;
do_action('woocommerce_before_checkout_process');
if (isset($_POST) && $_POST && !isset($_POST['login'])) :
jigoshop_cart::calculate_totals();
woocommerce_cart::calculate_totals();
jigoshop::verify_nonce('process_checkout');
woocommerce::verify_nonce('process_checkout');
if (sizeof(jigoshop_cart::$cart_contents)==0) :
jigoshop::add_error( sprintf(__('Sorry, your session has expired. <a href="%s">Return to homepage &rarr;</a>','jigoshop'), home_url()) );
if (sizeof(woocommerce_cart::$cart_contents)==0) :
woocommerce::add_error( sprintf(__('Sorry, your session has expired. <a href="%s">Return to homepage &rarr;</a>', 'woothemes'), home_url()) );
endif;
// Checkout fields
$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['shipping_method'] = isset($_POST['shipping_method']) ? jigowatt_clean($_POST['shipping_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['createaccount'] = isset($_POST['createaccount']) ? jigowatt_clean($_POST['createaccount']) : '';
$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']) : '';
$this->posted['shiptobilling'] = isset($_POST['shiptobilling']) ? woocommerce_clean($_POST['shiptobilling']) : '';
$this->posted['payment_method'] = isset($_POST['payment_method']) ? woocommerce_clean($_POST['payment_method']) : '';
$this->posted['shipping_method'] = isset($_POST['shipping_method']) ? woocommerce_clean($_POST['shipping_method']) : '';
$this->posted['order_comments'] = isset($_POST['order_comments']) ? woocommerce_clean($_POST['order_comments']) : '';
$this->posted['terms'] = isset($_POST['terms']) ? woocommerce_clean($_POST['terms']) : '';
$this->posted['createaccount'] = isset($_POST['createaccount']) ? woocommerce_clean($_POST['createaccount']) : '';
$this->posted['account-username'] = isset($_POST['account-username']) ? woocommerce_clean($_POST['account-username']) : '';
$this->posted['account-password'] = isset($_POST['account-password']) ? woocommerce_clean($_POST['account-password']) : '';
$this->posted['account-password-2'] = isset($_POST['account-password-2']) ? woocommerce_clean($_POST['account-password-2']) : '';
if (jigoshop_cart::ship_to_billing_address_only()) $this->posted['shiptobilling'] = 'true';
if (woocommerce_cart::ship_to_billing_address_only()) $this->posted['shiptobilling'] = 'true';
// Billing Information
foreach ($this->billing_fields as $field) :
$this->posted[$field['name']] = isset($_POST[$field['name']]) ? jigowatt_clean($_POST[$field['name']]) : '';
$this->posted[$field['name']] = isset($_POST[$field['name']]) ? woocommerce_clean($_POST[$field['name']]) : '';
// Format
if (isset($field['format'])) switch ( $field['format'] ) :
@ -273,20 +275,20 @@ class jigoshop_checkout {
endswitch;
// Required
if ( isset($field['required']) && $field['required'] && empty($this->posted[$field['name']]) ) jigoshop::add_error( $field['label'] . __(' (billing) is a required field.','jigoshop') );
if ( isset($field['required']) && $field['required'] && empty($this->posted[$field['name']]) ) woocommerce::add_error( $field['label'] . __(' (billing) is a required field.', 'woothemes') );
// 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') ); endif;
if (!woocommerce_validation::is_phone( $this->posted[$field['name']] )) : woocommerce::add_error( $field['label'] . __(' (billing) is not a valid number.', 'woothemes') ); endif;
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') ); endif;
if (!woocommerce_validation::is_email( $this->posted[$field['name']] )) : woocommerce::add_error( $field['label'] . __(' (billing) is not a valid email address.', 'woothemes') ); endif;
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') );
if (!woocommerce_validation::is_postcode( $this->posted[$field['name']], $_POST['billing-country'] )) : woocommerce::add_error( $field['label'] . __(' (billing) is not a valid postcode/ZIP.', 'woothemes') );
else :
$this->posted[$field['name']] = jigoshop_validation::format_postcode( $this->posted[$field['name']], $_POST['billing-country'] );
$this->posted[$field['name']] = woocommerce_validation::format_postcode( $this->posted[$field['name']], $_POST['billing-country'] );
endif;
break;
endswitch;
@ -294,10 +296,10 @@ class jigoshop_checkout {
endforeach;
// Shipping Information
if (jigoshop_cart::needs_shipping() && !jigoshop_cart::ship_to_billing_address_only() && empty($this->posted['shiptobilling'])) :
if (woocommerce_cart::needs_shipping() && !woocommerce_cart::ship_to_billing_address_only() && empty($this->posted['shiptobilling'])) :
foreach ($this->shipping_fields as $field) :
if (isset( $_POST[$field['name']] )) $this->posted[$field['name']] = jigowatt_clean($_POST[$field['name']]); else $this->posted[$field['name']] = '';
if (isset( $_POST[$field['name']] )) $this->posted[$field['name']] = woocommerce_clean($_POST[$field['name']]); else $this->posted[$field['name']] = '';
// Format
if (isset($field['format'])) switch ( $field['format'] ) :
@ -305,14 +307,14 @@ class jigoshop_checkout {
endswitch;
// Required
if ( isset($field['required']) && $field['required'] && empty($this->posted[$field['name']]) ) jigoshop::add_error( $field['label'] . __(' (shipping) is a required field.','jigoshop') );
if ( isset($field['required']) && $field['required'] && empty($this->posted[$field['name']]) ) woocommerce::add_error( $field['label'] . __(' (shipping) is a required field.', 'woothemes') );
// Validation
if (isset($field['validate']) && !empty($this->posted[$field['name']])) switch ( $field['validate'] ) :
case 'postcode' :
if (!jigoshop_validation::is_postcode( $this->posted[$field['name']], $this->posted['shipping-country'] )) : jigoshop::add_error( $field['label'] . __(' (shipping) is not a valid postcode/ZIP.','jigoshop') );
if (!woocommerce_validation::is_postcode( $this->posted[$field['name']], $this->posted['shipping-country'] )) : woocommerce::add_error( $field['label'] . __(' (shipping) is not a valid postcode/ZIP.', 'woothemes') );
else :
$this->posted[$field['name']] = jigoshop_validation::format_postcode( $this->posted[$field['name']], $this->posted['shipping-country'] );
$this->posted[$field['name']] = woocommerce_validation::format_postcode( $this->posted[$field['name']], $this->posted['shipping-country'] );
endif;
break;
endswitch;
@ -333,48 +335,48 @@ class jigoshop_checkout {
if ($this->creating_account && !$user_id) :
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') );
if ( empty($this->posted['account-username']) ) woocommerce::add_error( __('Please enter an account username.', 'woothemes') );
if ( empty($this->posted['account-password']) ) woocommerce::add_error( __('Please enter an account password.', 'woothemes') );
if ( $this->posted['account-password-2'] !== $this->posted['account-password'] ) woocommerce::add_error( __('Passwords do not match.', 'woothemes') );
// Check the username
if ( !validate_username( $this->posted['account-username'] ) ) :
jigoshop::add_error( __('Invalid email/username.','jigoshop') );
woocommerce::add_error( __('Invalid email/username.', 'woothemes') );
elseif ( username_exists( $this->posted['account-username'] ) ) :
jigoshop::add_error( __('An account is already registered with that username. Please choose another.','jigoshop') );
woocommerce::add_error( __('An account is already registered with that username. Please choose another.', 'woothemes') );
endif;
// 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') );
woocommerce::add_error( __('An account is already registered with your email address. Please login.', 'woothemes') );
endif;
endif;
// Terms
if (!isset($_POST['update_totals']) && empty($this->posted['terms']) && get_option('jigoshop_terms_page_id')>0 ) jigoshop::add_error( __('You must accept our Terms &amp; Conditions.','jigoshop') );
if (!isset($_POST['update_totals']) && empty($this->posted['terms']) && get_option('woocommerce_terms_page_id')>0 ) woocommerce::add_error( __('You must accept our Terms &amp; Conditions.', 'woothemes') );
if (jigoshop_cart::needs_shipping()) :
if (woocommerce_cart::needs_shipping()) :
// Shipping Method
$available_methods = jigoshop_shipping::get_available_shipping_methods();
$available_methods = woocommerce_shipping::get_available_shipping_methods();
if (!isset($available_methods[$this->posted['shipping_method']])) :
jigoshop::add_error( __('Invalid shipping method.','jigoshop') );
woocommerce::add_error( __('Invalid shipping method.', 'woothemes') );
endif;
endif;
if (jigoshop_cart::needs_payment()) :
if (woocommerce_cart::needs_payment()) :
// Payment Method
$available_gateways = jigoshop_payment_gateways::get_available_payment_gateways();
$available_gateways = woocommerce_payment_gateways::get_available_payment_gateways();
if (!isset($available_gateways[$this->posted['payment_method']])) :
jigoshop::add_error( __('Invalid payment method.','jigoshop') );
woocommerce::add_error( __('Invalid payment method.', 'woothemes') );
else :
// Payment Method Field Validation
$available_gateways[$this->posted['payment_method']]->validate_fields();
endif;
endif;
if (!isset($_POST['update_totals']) && jigoshop::error_count()==0) :
if (!isset($_POST['update_totals']) && woocommerce::error_count()==0) :
$user_id = get_current_user_id();
@ -393,7 +395,7 @@ class jigoshop_checkout {
$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'), get_option('admin_email')));
woocommerce::add_error( sprintf(__('<strong>ERROR</strong>: Couldn&#8217;t register you... please contact the <a href="mailto:%s">webmaster</a> !', 'woothemes'), get_option('admin_email')));
break;
}
@ -408,7 +410,7 @@ class jigoshop_checkout {
wp_set_auth_cookie($user_id, true, $secure_cookie);
else :
jigoshop::add_error( $reg_errors->get_error_message() );
woocommerce::add_error( $reg_errors->get_error_message() );
break;
endif;
@ -427,7 +429,7 @@ class jigoshop_checkout {
$shipping_postcode = $this->posted['billing-postcode'];
$shipping_country = $this->posted['billing-country'];
elseif ( jigoshop_cart::needs_shipping() ) :
elseif ( woocommerce_cart::needs_shipping() ) :
$shipping_first_name = $this->posted['shipping-first_name'];
$shipping_last_name = $this->posted['shipping-last_name'];
@ -455,7 +457,7 @@ class jigoshop_checkout {
update_user_meta( $user_id, 'billing-state', $this->posted['billing-state'] );
update_user_meta( $user_id, 'billing-phone', $this->posted['billing-phone'] );
if ( empty($this->posted['shiptobilling']) && jigoshop_cart::needs_shipping() ) :
if ( empty($this->posted['shiptobilling']) && woocommerce_cart::needs_shipping() ) :
update_user_meta( $user_id, 'shipping-first_name', $this->posted['shipping-first_name'] );
update_user_meta( $user_id, 'shipping-last_name', $this->posted['shipping-last_name'] );
update_user_meta( $user_id, 'shipping-company', $this->posted['shipping-company'] );
@ -465,7 +467,7 @@ class jigoshop_checkout {
update_user_meta( $user_id, 'shipping-postcode', $this->posted['shipping-postcode'] );
update_user_meta( $user_id, 'shipping-country', $this->posted['shipping-country'] );
update_user_meta( $user_id, 'shipping-state', $this->posted['shipping-state'] );
elseif ( $this->posted['shiptobilling'] && jigoshop_cart::needs_shipping() ) :
elseif ( $this->posted['shiptobilling'] && woocommerce_cart::needs_shipping() ) :
update_user_meta( $user_id, 'shipping-first_name', $this->posted['billing-first_name'] );
update_user_meta( $user_id, 'shipping-last_name', $this->posted['billing-last_name'] );
update_user_meta( $user_id, 'shipping-company', $this->posted['billing-company'] );
@ -481,7 +483,7 @@ class jigoshop_checkout {
// Create Order (send cart variable so we can record items and reduce inventory). Only create if this is a new order, not if the payment was rejected last time.
$_tax = new jigoshop_tax();
$_tax = new woocommerce_tax();
$order_data = array(
'post_type' => 'shop_order',
@ -515,17 +517,17 @@ class jigoshop_checkout {
$data['shipping_state'] = $shipping_state;
$data['shipping_method'] = $this->posted['shipping_method'];
$data['payment_method'] = $this->posted['payment_method'];
$data['order_subtotal'] = number_format(jigoshop_cart::$subtotal_ex_tax, 2, '.', '');
$data['order_shipping'] = number_format(jigoshop_cart::$shipping_total, 2, '.', '');
$data['order_discount'] = number_format(jigoshop_cart::$discount_total, 2, '.', '');
$data['order_tax'] = number_format(jigoshop_cart::$tax_total, 2, '.', '');
$data['order_shipping_tax'] = number_format(jigoshop_cart::$shipping_tax_total, 2, '.', '');
$data['order_total'] = number_format(jigoshop_cart::$total, 2, '.', '');
$data['order_subtotal'] = number_format(woocommerce_cart::$subtotal_ex_tax, 2, '.', '');
$data['order_shipping'] = number_format(woocommerce_cart::$shipping_total, 2, '.', '');
$data['order_discount'] = number_format(woocommerce_cart::$discount_total, 2, '.', '');
$data['order_tax'] = number_format(woocommerce_cart::$tax_total, 2, '.', '');
$data['order_shipping_tax'] = number_format(woocommerce_cart::$shipping_tax_total, 2, '.', '');
$data['order_total'] = number_format(woocommerce_cart::$total, 2, '.', '');
// Cart items
$order_items = array();
foreach (jigoshop_cart::$cart_contents as $cart_item_key => $values) :
foreach (woocommerce_cart::$cart_contents as $cart_item_key => $values) :
$_product = $values['data'];
@ -548,7 +550,7 @@ class jigoshop_checkout {
if ($_product->managing_stock()) :
if (!$_product->is_in_stock() || !$_product->has_enough_stock( $values['quantity'] )) :
jigoshop::add_error( sprintf(__('Sorry, we do not have enough "%s" in stock to fulfill your order. Please edit your cart and try again. We apologise for any inconvenience caused.', 'jigoshop'), $_product->get_title() ) );
woocommerce::add_error( sprintf(__('Sorry, we do not have enough "%s" in stock to fulfill your order. Please edit your cart and try again. We apologise for any inconvenience caused.', 'woothemes'), $_product->get_title() ) );
break;
endif;
@ -556,7 +558,7 @@ class jigoshop_checkout {
if (!$_product->is_in_stock()) :
jigoshop::add_error( sprintf(__('Sorry, we do not have enough "%s" in stock to fulfill your order. Please edit your cart and try again. We apologise for any inconvenience caused.', 'jigoshop'), $_product->get_title() ) );
woocommerce::add_error( sprintf(__('Sorry, we do not have enough "%s" in stock to fulfill your order. Please edit your cart and try again. We apologise for any inconvenience caused.', 'woothemes'), $_product->get_title() ) );
break;
endif;
@ -565,7 +567,7 @@ class jigoshop_checkout {
endforeach;
if (jigoshop::error_count()>0) break;
if (woocommerce::error_count()>0) break;
// Insert or update the post data
if (isset($_SESSION['order_awaiting_payment']) && $_SESSION['order_awaiting_payment'] > 0) :
@ -578,7 +580,7 @@ class jigoshop_checkout {
$order_id = wp_insert_post( $order_data );
if (is_wp_error($order_id)) :
jigoshop::add_error( 'Error: Unable to create order. Please try again.' );
woocommerce::add_error( 'Error: Unable to create order. Please try again.' );
break;
endif;
endif;
@ -590,12 +592,12 @@ class jigoshop_checkout {
update_post_meta( $order_id, 'order_items', $order_items );
wp_set_object_terms( $order_id, 'pending', 'shop_order_status' );
$order = &new jigoshop_order($order_id);
$order = &new woocommerce_order($order_id);
// Inserted successfully
do_action('jigoshop_new_order', $order_id);
do_action('woocommerce_new_order', $order_id);
if (jigoshop_cart::needs_payment()) :
if (woocommerce_cart::needs_payment()) :
// Store Order ID in session so it can be re-used after payment failure
$_SESSION['order_awaiting_payment'] = $order_id;
@ -623,15 +625,15 @@ class jigoshop_checkout {
$order->payment_complete();
// Empty the Cart
jigoshop_cart::empty_cart();
woocommerce_cart::empty_cart();
// Redirect to success/confirmation/payment page
if (is_ajax()) :
ob_clean();
echo json_encode( array('redirect' => get_permalink(get_option('jigoshop_thanks_page_id'))) );
echo json_encode( array('redirect' => get_permalink(get_option('woocommerce_thanks_page_id'))) );
exit;
else :
wp_safe_redirect( get_permalink(get_option('jigoshop_thanks_page_id')) );
wp_safe_redirect( get_permalink(get_option('woocommerce_thanks_page_id')) );
exit;
endif;
@ -647,10 +649,10 @@ class jigoshop_checkout {
// If we reached this point then there were errors
if (is_ajax()) :
ob_clean();
jigoshop::show_messages();
woocommerce::show_messages();
exit;
else :
jigoshop::show_messages();
woocommerce::show_messages();
endif;
endif;

View File

@ -1,15 +1,15 @@
<?php
/**
* Jigoshop countries
* @class jigoshop_countries
* WooCommerce countries
*
* The JigoShop countries class stores country/state data.
* The WooCommerce countries class stores country/state data.
*
* @author Jigowatt
* @category Classes
* @package JigoShop
* @class woocommerce_countries
* @package WooCommerce
* @category Class
* @author WooThemes
*/
class jigoshop_countries {
class woocommerce_countries {
public static $countries = array(
'AD' => 'Andorra',
@ -472,7 +472,7 @@ class jigoshop_countries {
/** get base country */
function get_base_country() {
$default = get_option('jigoshop_default_country');
$default = get_option('woocommerce_default_country');
if (strstr($default, ':')) :
$country = current(explode(':', $default));
$state = end(explode(':', $default));
@ -486,7 +486,7 @@ class jigoshop_countries {
/** get base state */
function get_base_state() {
$default = get_option('jigoshop_default_country');
$default = get_option('woocommerce_default_country');
if (strstr($default, ':')) :
$country = current(explode(':', $default));
$state = end(explode(':', $default));
@ -505,11 +505,11 @@ class jigoshop_countries {
asort($countries);
if (get_option('jigoshop_allowed_countries')!=='specific') return $countries;
if (get_option('woocommerce_allowed_countries')!=='specific') return $countries;
$allowed_countries = array();
$allowed_countries_raw = get_option('jigoshop_specific_allowed_countries');
$allowed_countries_raw = get_option('woocommerce_specific_allowed_countries');
foreach ($allowed_countries_raw as $country) :
@ -525,16 +525,16 @@ class jigoshop_countries {
/** Gets the correct string for shipping - ether 'to the' or 'to' */
function shipping_to_prefix() {
$return = '';
if (in_array(jigoshop_customer::get_country(), array( 'GB', 'US', 'AE', 'CZ', 'DO', 'NL', 'PH', 'USAF' ))) $return = __('to the', 'jigoshop');
else $return = __('to', 'jigoshop');
$return = apply_filters('shipping_to_prefix', $return, jigoshop_customer::get_shipping_country());
if (in_array(woocommerce_customer::get_country(), array( 'GB', 'US', 'AE', 'CZ', 'DO', 'NL', 'PH', 'USAF' ))) $return = __('to the', 'woothemes');
else $return = __('to', 'woothemes');
$return = apply_filters('shipping_to_prefix', $return, woocommerce_customer::get_shipping_country());
return $return;
}
function estimated_for_prefix() {
$return = '';
if (in_array(jigoshop_customer::get_country(), array( 'GB', 'US', 'AE', 'CZ', 'DO', 'NL', 'PH', 'USAF' ))) $return = __('the ', 'jigoshop');
$return = apply_filters('estimated_for_prefix', $return, jigoshop_customer::get_shipping_country());
if (in_array(woocommerce_customer::get_country(), array( 'GB', 'US', 'AE', 'CZ', 'DO', 'NL', 'PH', 'USAF' ))) $return = __('the ', 'woothemes');
$return = apply_filters('estimated_for_prefix', $return, woocommerce_customer::get_shipping_country());
return $return;
}
@ -554,7 +554,7 @@ class jigoshop_countries {
echo '<optgroup label="'.$value.'">';
echo '<option value="'.$key.'"';
if ($selected_country==$key && $selected_state=='*') echo ' selected="selected"';
echo '>'.$value.' &mdash; '.__('All states', 'jigoshop').'</option>';
echo '>'.$value.' &mdash; '.__('All states', 'woothemes').'</option>';
foreach ($states as $state_key=>$state_value) :
echo '<option value="'.$key.':'.$state_key.'"';
@ -566,7 +566,7 @@ class jigoshop_countries {
else :
echo '<option';
if ($selected_country==$key && $selected_state=='*') echo ' selected="selected"';
echo ' value="'.$key.'">'. ($escape ? esc_js( __($value, 'jigoshop') ) : __($value, 'jigoshop') ) .'</option>';
echo ' value="'.$key.'">'. ($escape ? esc_js( __($value, 'woothemes') ) : __($value, 'woothemes') ) .'</option>';
endif;
endforeach;
}

41
classes/coupons.class.php Normal file
View File

@ -0,0 +1,41 @@
<?php
/**
* WooCommerce coupons
*
* The WooCommerce coupons class gets coupon data from storage
*
* @class woocommerce_coupons
* @package WooCommerce
* @category Class
* @author WooThemes
*/
class woocommerce_coupons {
/** get coupons from the options database */
function get_coupons() {
$coupons = get_option('woocommerce_coupons') ? $coupons = (array) get_option('woocommerce_coupons') : $coupons = array();
return $coupons;
}
/** get coupon with $code */
function get_coupon($code) {
$coupons = get_option('woocommerce_coupons') ? $coupons = (array) get_option('woocommerce_coupons') : $coupons = array();
if (isset($coupons[$code])) return $coupons[$code];
return false;
}
/** Check coupon is valid by looking at cart */
function is_valid($code) {
$coupon = self::get_coupon($code);
if (sizeof($coupon['products'])>0) :
$valid = false;
if (sizeof(woocommerce_cart::$cart_contents)>0) : foreach (woocommerce_cart::$cart_contents as $item_id => $values) :
if (in_array($item_id, $coupon['products'])) :
$valid = true;
endif;
endforeach; endif;
return $valid;
endif;
return true;
}
}

View File

@ -1,15 +1,15 @@
<?php
/**
* Customer
* @class jigoshop_customer
*
* The JigoShop custoemr class handles storage of the current customer's data, such as location.
* The WooCommerce custoemr class handles storage of the current customer's data, such as location.
*
* @author Jigowatt
* @category Classes
* @package JigoShop
* @class woocommerce_customer
* @package WooCommerce
* @category Class
* @author WooThemes
*/
class jigoshop_customer {
class woocommerce_customer {
private static $_instance;
@ -18,7 +18,7 @@ class jigoshop_customer {
if ( !isset($_SESSION['customer']) ) :
$default = get_option('jigoshop_default_country');
$default = get_option('woocommerce_default_country');
if (strstr($default, ':')) :
$country = current(explode(':', $default));
$state = end(explode(':', $default));
@ -53,7 +53,7 @@ class jigoshop_customer {
public static function is_customer_outside_base() {
if (isset($_SESSION['customer']['country'])) :
$default = get_option('jigoshop_default_country');
$default = get_option('woocommerce_default_country');
if (strstr($default, ':')) :
$country = current(explode(':', $default));
$state = end(explode(':', $default));
@ -163,14 +163,14 @@ class jigoshop_customer {
if (is_user_logged_in()) :
$jigoshop_orders = &new jigoshop_orders();
$jigoshop_orders->get_customer_orders( get_current_user_id() );
if ($jigoshop_orders->orders) foreach ($jigoshop_orders->orders as $order) :
$woocommerce_orders = &new woocommerce_orders();
$woocommerce_orders->get_customer_orders( get_current_user_id() );
if ($woocommerce_orders->orders) foreach ($woocommerce_orders->orders as $order) :
if ( $order->status == 'completed' ) {
$results = $wpdb->get_results( "SELECT * FROM ".$wpdb->prefix."jigoshop_downloadable_product_permissions WHERE order_key = \"".$order->order_key."\" AND user_id = ".get_current_user_id().";" );
$results = $wpdb->get_results( "SELECT * FROM ".$wpdb->prefix."woocommerce_downloadable_product_permissions WHERE order_key = \"".$order->order_key."\" AND user_id = ".get_current_user_id().";" );
$user_info = get_userdata(get_current_user_id());
if ($results) foreach ($results as $result) :
$_product = &new jigoshop_product( $result->product_id );
$_product = &new woocommerce_product( $result->product_id );
if ($_product->exists) :
$download_name = $_product->get_title();
else :

View File

@ -0,0 +1,204 @@
<?php
/**
* Bank Transfer Payment Gateway
*
* Provides a Bank Transfer Payment Gateway. Adapted from code by Mike Pepper (https://github.com/takeover/jigoshop-bacs-gateway - mike@takeovermedia.co.uk)
*
* @class woocommerce_bacs
* @package WooCommerce
* @category Payment Gateways
* @author WooThemes
*/
class woocommerce_bacs extends woocommerce_payment_gateway {
public function __construct() {
$this->id = 'bacs';
$this->icon = '';
$this->has_fields = false;
$this->enabled = get_option('jigoshop_bacs_enabled');
$this->title = get_option('jigoshop_bacs_title');
$this->description = get_option('jigoshop_bacs_description');
$this->account_name = get_option('jigoshop_bacs_account_name');
$this->account_number = get_option('jigoshop_bacs_account_number');
$this->sort_code = get_option('jigoshop_bacs_sort_code');
$this->bank_name = get_option('jigoshop_bacs_bank_name');
$this->iban = get_option('jigoshop_bacs_iban');
$this->bic = get_option('jigoshop_bacs_bic');
add_action('jigoshop_update_options', array(&$this, 'process_admin_options'));
add_option('jigoshop_bacs_enabled', 'no');
add_option('jigoshop_bacs_title', __('Direct Bank Transer', 'jigoshop-bacs-gateway'));
add_option('jigoshop_bacs_description', __('Make your payment directly into our bank account. Please use your Order ID as the payment reference. Your order wont be shipped until the funds have cleared in our account.', 'jigoshop-bacs-gateway'));
add_action('thankyou_bacs', array(&$this, 'thankyou_page'));
}
public function is_available(){
return ($this->enabled == 'yes') ? true : false;
}
public function set_current(){ true; }
public function icon(){}
public function validate_fields(){ true; }
/**
* Admin Panel Options
**/
public function admin_options() { ?>
<thead>
<tr>
<th scope="col" width="200px"><?php _e('BACS Payment', 'jigoshop-bacs-gateway'); ?></th>
<th scope="col" class="desc"><?php _e('Allows payments by BACS (Bank Account Clearing System), more commonly known as direct bank/wire transfer.', 'jigoshop-bacs-gateway'); ?></th>
</tr>
</thead>
<tr>
<td class="titledesc"><?php _e('Enable BACS Payment', 'jigoshop-bacs-gateway') ?>:</td>
<td class="forminp">
<select name="jigoshop_bacs_enabled" id="jigoshop_bacs_enabled" style="min-width:100px;">
<option value="yes" <?php if (get_option('jigoshop_bacs_enabled') == 'yes') echo 'selected="selected"'; ?>><?php _e('Yes', 'jigoshop-bacs-gateway'); ?></option>
<option value="no" <?php if (get_option('jigoshop_bacs_enabled') == 'no') echo 'selected="selected"'; ?>><?php _e('No', 'jigoshop-bacs-gateway'); ?></option>
</select>
</td>
</tr>
<tr>
<td class="titledesc"><a href="#" tip="<?php _e('This controls the title which the user sees during checkout.','jigoshop-bacs-gateway') ?>" class="tips" tabindex="99"></a><?php _e('Method Title', 'jigoshop') ?>:</td>
<td class="forminp">
<input class="input-text" type="text" name="jigoshop_bacs_title" id="jigoshop_bacs_title" value="<?php if ($value = get_option('jigoshop_bacs_title')) echo $value; else echo 'BACS Payment'; ?>" />
</td>
</tr>
<tr>
<td class="titledesc"><a href="#" tip="<?php _e('Give the customer instructions for paying via BACS, and let them know that their order won\'t be shipping until the money is received.','jigoshop-bacs-gateway') ?>" class="tips" tabindex="99"></a><?php _e('Customer Message', 'jigoshop') ?>:</td>
<td class="forminp">
<input class="input-text wide-input" type="text" name="jigoshop_bacs_description" id="jigoshop_bacs_description" value="<?php if ($value = get_option('jigoshop_bacs_description')) echo $value; ?>" />
</td>
</tr>
<tr>
<td class="titledesc"><a href="#" tabindex="99"></a><?php _e('Account Name', 'jigoshop-bacs-gateway') ?>:</td>
<td class="forminp">
<input class="input-text" type="text" name="jigoshop_bacs_account_name" id="jigoshop_bacs_account_name" value="<?php if ($value = get_option('jigoshop_bacs_account_name')) echo $value; ?>" />
</td>
</tr>
<tr>
<td class="titledesc"><a href="#" tabindex="99"></a><?php _e('Account Number', 'jigoshop-bacs-gateway') ?>:</td>
<td class="forminp">
<input class="input-text" type="text" name="jigoshop_bacs_account_number" id="jigoshop_bacs_account_number" value="<?php if ($value = get_option('jigoshop_bacs_account_number')) echo $value; ?>" />
</td>
</tr>
<tr>
<td class="titledesc"><a href="#" tabindex="99"></a><?php _e('Sort Code', 'jigoshop-bacs-gateway') ?>:</td>
<td class="forminp">
<input class="input-text" type="text" name="jigoshop_bacs_sort_code" id="jigoshop_bacs_sort_code" value="<?php if ($value = get_option('jigoshop_bacs_sort_code')) echo $value; ?>" />
</td>
</tr>
<tr>
<td class="titledesc"><a href="#" tabindex="99"></a><?php _e('Bank Name', 'jigoshop-bacs-gateway') ?>:</td>
<td class="forminp">
<input class="input-text" type="text" name="jigoshop_bacs_bank_name" id="jigoshop_bacs_bank_name" value="<?php if ($value = get_option('jigoshop_bacs_bank_name')) echo $value; ?>" />
</td>
</tr>
<tr>
<td class="titledesc"><a href="#" tip="<?php _e('Your bank may require this for international payments','jigoshop-bacs-gateway') ?>" class="tips" tabindex="99"></a><?php _e('IBAN', 'jigoshop-bacs-gateway') ?>:</td>
<td class="forminp">
<input class="input-text" type="text" name="jigoshop_bacs_iban" id="jigoshop_bacs_iban" value="<?php if ($value = get_option('jigoshop_bacs_iban')) echo $value; ?>" />
</td>
</tr>
<tr>
<td class="titledesc"><a href="#" tip="<?php _e('Your bank may require this for international payments','jigoshop-bacs-gateway') ?>" class="tips" tabindex="99"></a><?php _e('BIC (formerly \'Swift\')', 'jigoshop') ?>:</td>
<td class="forminp">
<input class="input-text" type="text" name="jigoshop_bacs_bic" id="jigoshop_bacs_bic" value="<?php if ($value = get_option('jigoshop_bacs_bic')) echo $value; ?>" />
</td>
</tr>
<?php }
/**
* There are no payment fields for bacs, but we want to show the description if set.
**/
function payment_fields() {
if ($this->description) echo wpautop(wptexturize($this->description));
}
function thankyou_page() {
if ($this->description) echo wpautop(wptexturize($this->description));
?><h2><?php _e('Our Details', 'jigoshop-bacs-gateway') ?></h2><ul class="order_details bacs_details"><?php
if ($this->account_name) { ?>
<li class="account_name">
<?php _e('Account Name', 'jigoshop-bacs-gateway') ?>:
<strong><?php echo wptexturize($this->account_name) ?></strong>
</li>
<?php }
if ($this->account_number) { ?>
<li class="account_number">
<?php _e('Account Number', 'jigoshop-bacs-gateway') ?>:
<strong><?php echo wptexturize($this->account_number) ?></strong>
</li>
<?php }
if ($this->sort_code) { ?>
<li class="sort_code">
<?php _e('Sort Code', 'jigoshop-bacs-gateway') ?>:
<strong><?php echo wptexturize($this->sort_code) ?></strong>
</li>
<?php }
if ($this->bank_name) { ?>
<li class="bank_name">
<?php _e('Bank Name', 'jigoshop-bacs-gateway') ?>:
<strong><?php echo wptexturize($this->bank_name) ?></strong>
</li>
<?php }
if ($this->iban) { ?>
<li class="iban">
<?php _e('IBAN', 'jigoshop-bacs-gateway') ?>:
<strong><?php echo wptexturize($this->iban) ?></strong>
</li>
<?php }
if ($this->bic) { ?>
<li class="bic">
<?php _e('BIC', 'jigoshop-bacs-gateway') ?>:
<strong><?php echo wptexturize($this->bic) ?></strong>
</li>
<?php }
echo "</ul>";
}
/**
* Admin Panel Options Processing
* - Saves the options to the DB
**/
public function process_admin_options() {
if(isset($_POST['jigoshop_bacs_enabled'])) update_option('jigoshop_bacs_enabled', jigowatt_clean($_POST['jigoshop_bacs_enabled'])); else @delete_option('jigoshop_bacs_enabled');
if(isset($_POST['jigoshop_bacs_title'])) update_option('jigoshop_bacs_title', jigowatt_clean($_POST['jigoshop_bacs_title'])); else @delete_option('jigoshop_bacs_title');
if(isset($_POST['jigoshop_bacs_description'])) update_option('jigoshop_bacs_description', jigowatt_clean($_POST['jigoshop_bacs_description'])); else @delete_option('jigoshop_bacs_description');
if(isset($_POST['jigoshop_bacs_account_name'])) update_option('jigoshop_bacs_account_name', jigowatt_clean($_POST['jigoshop_bacs_account_name'])); else @delete_option('jigoshop_bacs_account_name');
if(isset($_POST['jigoshop_bacs_account_number'])) update_option('jigoshop_bacs_account_number', jigowatt_clean($_POST['jigoshop_bacs_account_number'])); else @delete_option('jigoshop_bacs_account_number');
if(isset($_POST['jigoshop_bacs_sort_code'])) update_option('jigoshop_bacs_sort_code', jigowatt_clean($_POST['jigoshop_bacs_sort_code'])); else @delete_option('jigoshop_bacs_sort_code');
if(isset($_POST['jigoshop_bacs_bank_name'])) update_option('jigoshop_bacs_bank_name', jigowatt_clean($_POST['jigoshop_bacs_bank_name'])); else @delete_option('jigoshop_bacs_bank_name');
if(isset($_POST['jigoshop_bacs_iban'])) update_option('jigoshop_bacs_iban', jigowatt_clean($_POST['jigoshop_bacs_iban'])); else @delete_option('jigoshop_bacs_iban');
if(isset($_POST['jigoshop_bacs_bic'])) update_option('jigoshop_bacs_bic', jigowatt_clean($_POST['jigoshop_bacs_bic'])); else @delete_option('jigoshop_bacs_bic');
}
/**
* Process the payment and return the result
**/
function process_payment( $order_id ) {
$order = &new jigoshop_order( $order_id );
// Mark as on-hold (we're awaiting the payment)
$order->update_status('on-hold', __('Awaiting BACS payment', 'jigoshop-bacs-gateway'));
// Remove cart
jigoshop_cart::empty_cart();
// Return thankyou redirect
return array(
'result' => 'success',
'redirect' => add_query_arg('key', $order->order_key, add_query_arg('order', $order_id, get_permalink(get_option('jigoshop_thanks_page_id'))))
);
}
}
/**
* Add the gateway to WooCommerce
**/
function add_bacs_gateway( $methods ) {
$methods[] = 'woocommerce_bacs'; return $methods;
}

View File

@ -0,0 +1,114 @@
<?php
/**
* Cheque Payment Gateway
*
* Provides a Cheque Payment Gateway for testing purposes. Created by Andrew Benbow (andrew@chromeorange.co.uk)
*
* @class woocommerce_cheque
* @package WooCommerce
* @category Payment Gateways
* @author WooThemes
*/
class woocommerce_cheque extends woocommerce_payment_gateway {
public function __construct() {
$this->id = 'cheque';
$this->icon = '';
$this->has_fields = false;
$this->enabled = get_option('woocommerce_cheque_enabled');
$this->title = get_option('woocommerce_cheque_title');
$this->description = get_option('woocommerce_cheque_description');
add_action('woocommerce_update_options', array(&$this, 'process_admin_options'));
add_option('woocommerce_cheque_enabled', 'yes');
add_option('woocommerce_cheque_title', __('Cheque Payment', 'woothemes') );
add_option('woocommerce_cheque_description', __('Please send your cheque to Store Name, Store Street, Store Town, Store State / County, Store Postcode.', 'woothemes'));
add_action('thankyou_cheque', array(&$this, 'thankyou_page'));
}
/**
* Admin Panel Options
* - Options for bits like 'title' and availability on a country-by-country basis
**/
public function admin_options() {
?>
<thead><tr><th scope="col" width="200px"><?php _e('Cheque Payment', 'woothemes'); ?></th><th scope="col" class="desc"><?php _e('Allows cheque payments. Why would you take cheques in this day and age? Well you probably wouldn\'t but it does allow you to make test purchases without having to use the sandbox area of a payment gateway which is useful for demonstrating to clients and for testing order emails and the \'success\' pages etc.', 'woothemes'); ?></th></tr></thead>
<tr>
<td class="titledesc"><?php _e('Enable Cheque Payment', 'woothemes') ?>:</td>
<td class="forminp">
<select name="woocommerce_cheque_enabled" id="woocommerce_cheque_enabled" style="min-width:100px;">
<option value="yes" <?php if (get_option('woocommerce_cheque_enabled') == 'yes') echo 'selected="selected"'; ?>><?php _e('Yes', 'woothemes'); ?></option>
<option value="no" <?php if (get_option('woocommerce_cheque_enabled') == 'no') echo 'selected="selected"'; ?>><?php _e('No', 'woothemes'); ?></option>
</select>
</td>
</tr>
<tr>
<td class="titledesc"><a href="#" tip="<?php _e('This controls the title which the user sees during checkout.', 'woothemes') ?>" class="tips" tabindex="99"></a><?php _e('Method Title', 'woothemes') ?>:</td>
<td class="forminp">
<input class="input-text" type="text" name="woocommerce_cheque_title" id="woocommerce_cheque_title" value="<?php if ($value = get_option('woocommerce_cheque_title')) echo $value; else echo 'Cheque Payment'; ?>" />
</td>
</tr>
<tr>
<td class="titledesc"><a href="#" tip="<?php _e('Let the customer know the payee and where they should be sending the cheque too and that their order won\'t be shipping until you receive it.', 'woothemes') ?>" class="tips" tabindex="99"></a><?php _e('Customer Message', 'woothemes') ?>:</td>
<td class="forminp">
<input class="input-text wide-input" type="text" name="woocommerce_cheque_description" id="woocommerce_cheque_description" value="<?php if ($value = get_option('woocommerce_cheque_description')) echo $value; ?>" />
</td>
</tr>
<?php
}
/**
* There are no payment fields for cheques, but we want to show the description if set.
**/
function payment_fields() {
if ($this->description) echo wpautop(wptexturize($this->description));
}
function thankyou_page() {
if ($this->description) echo wpautop(wptexturize($this->description));
}
/**
* Admin Panel Options Processing
* - Saves the options to the DB
**/
public function process_admin_options() {
if(isset($_POST['woocommerce_cheque_enabled'])) update_option('woocommerce_cheque_enabled', woocommerce_clean($_POST['woocommerce_cheque_enabled'])); else @delete_option('woocommerce_cheque_enabled');
if(isset($_POST['woocommerce_cheque_title'])) update_option('woocommerce_cheque_title', woocommerce_clean($_POST['woocommerce_cheque_title'])); else @delete_option('woocommerce_cheque_title');
if(isset($_POST['woocommerce_cheque_description'])) update_option('woocommerce_cheque_description', woocommerce_clean($_POST['woocommerce_cheque_description'])); else @delete_option('woocommerce_cheque_description');
}
/**
* Process the payment and return the result
**/
function process_payment( $order_id ) {
$order = &new woocommerce_order( $order_id );
// Mark as on-hold (we're awaiting the cheque)
$order->update_status('on-hold', __('Awaiting cheque payment', 'woothemes'));
// Remove cart
woocommerce_cart::empty_cart();
// Return thankyou redirect
return array(
'result' => 'success',
'redirect' => add_query_arg('key', $order->order_key, add_query_arg('order', $order_id, get_permalink(get_option('woocommerce_thanks_page_id'))))
);
}
}
/**
* Add the gateway to WooCommerce
**/
function add_cheque_gateway( $methods ) {
$methods[] = 'woocommerce_cheque'; return $methods;
}
add_filter('woocommerce_payment_gateways', 'add_cheque_gateway' );

View File

@ -0,0 +1,307 @@
<?php
/**
* Moneybookers Payment Gateway
*
* Provides a Moneybookers Payment Gateway.
*
* @class woocommerce_moneybookers
* @package WooCommerce
* @category Payment Gateways
* @author WooThemes
*/
class woocommerce_moneybookers extends woocommerce_payment_gateway {
public function __construct() {
$this->id = 'moneybookers';
$this->title = 'Moneybookers';
$this->icon = woocommerce::plugin_url() . '/assets/images/icons/moneybookers.png';
$this->has_fields = false;
$this->enabled = get_option('woocommerce_moneybookers_enabled');
$this->title = get_option('woocommerce_moneybookers_title');
$this->email = get_option('woocommerce_moneybookers_email');
add_action( 'init', array(&$this, 'check_status_response') );
if(isset($_GET['moneybookersPayment']) && $_GET['moneybookersPayment'] == true):
add_action( 'init', array(&$this, 'generate_moneybookers_form') );
endif;
add_action('valid-moneybookers-status-report', array(&$this, 'successful_request') );
add_action('woocommerce_update_options', array(&$this, 'process_admin_options'));
add_option('woocommerce_moneybookers_enabled', 'yes');
add_option('woocommerce_moneybookers_email', '');
add_option('woocommerce_moneybookers_title', 'moneybookers');
add_action('receipt_moneybookers', array(&$this, 'receipt_moneybookers'));
}
/**
* Admin Panel Options
* - Options for bits like 'title' and availability on a country-by-country basis
**/
public function admin_options() {
?>
<thead><tr><th scope="col" width="200px"><?php _e('Moneybookers (Moneybookers)', 'woothemes'); ?></th><th scope="col" class="desc"><?php _e('Moneybookers works by using an iFrame to submit payment information securely to Moneybookers.', 'woothemes'); ?></th></tr></thead>
<tr>
<td class="titledesc"><?php _e('Enable Moneybookers', 'woothemes') ?>:</td>
<td class="forminp">
<select name="woocommerce_moneybookers_enabled" id="woocommerce_moneybookers_enabled" style="min-width:100px;">
<option value="yes" <?php if (get_option('woocommerce_moneybookers_enabled') == 'yes') echo 'selected="selected"'; ?>><?php _e('Yes', 'woothemes'); ?></option>
<option value="no" <?php if (get_option('woocommerce_moneybookers_enabled') == 'no') echo 'selected="selected"'; ?>><?php _e('No', 'woothemes'); ?></option>
</select>
</td>
</tr>
<tr>
<td class="titledesc"><a href="#" tip="<?php _e('This controls the title which the user sees during checkout.', 'woothemes') ?>" class="tips" tabindex="99"></a><?php _e('Method Title', 'woothemes') ?>:</td>
<td class="forminp">
<input class="input-text" type="text" name="woocommerce_moneybookers_title" id="woocommerce_moneybookers_title" style="min-width:50px;" value="<?php if ($value = get_option('woocommerce_moneybookers_title')) echo $value; else echo 'moneybookers'; ?>" />
</td>
</tr>
<tr>
<td class="titledesc"><a href="#" tip="<?php _e('Please enter your moneybookers email address; this is needed in order to take payment!', 'woothemes') ?>" class="tips" tabindex="99"></a><?php _e('Moneybookers merchant e-mail', 'woothemes') ?>:</td>
<td class="forminp">
<input class="input-text" type="text" name="woocommerce_moneybookers_email" id="woocommerce_moneybookers_email" style="min-width:50px;" value="<?php if ($value = get_option('woocommerce_moneybookers_email')) echo $value; ?>" />
</td>
</tr>
<tr>
<td class="titledesc"><a href="#" tip="<?php _e('Please enter your moneybookers secretword; this is needed in order to take payment!', 'woothemes') ?>" class="tips" tabindex="99"></a><?php _e('Moneybookers Secret Word', 'woothemes') ?>:</td>
<td class="forminp">
<input class="input-text" type="text" name="woocommerce_moneybookers_secret_word" id="woocommerce_moneybookers_secret_word" style="min-width:50px;" value="<?php if ($value = get_option('woocommerce_moneybookers_secret_word')) echo $value; ?>" />
</td>
</tr>
<tr>
<td class="titledesc"><a href="#" tip="<?php _e('Please enter your moneybookers Customer ID; this is needed in order to take payment!', 'woothemes') ?>" class="tips" tabindex="99"></a><?php _e('Moneybookers Customer ID', 'woothemes') ?>:</td>
<td class="forminp">
<input class="input-text" type="text" name="woocommerce_moneybookers_customer_id" id="woocommerce_moneybookers_customer_id" style="min-width:50px;" value="<?php if ($value = get_option('woocommerce_moneybookers_customer_id')) echo $value; ?>" />
</td>
</tr>
<?php
}
/**
* Admin Panel Options Processing
* - Saves the options to the DB
**/
public function process_admin_options() {
if(isset($_POST['woocommerce_moneybookers_enabled'])) update_option('woocommerce_moneybookers_enabled', woocommerce_clean($_POST['woocommerce_moneybookers_enabled'])); else @delete_option('woocommerce_moneybookers_enabled');
if(isset($_POST['woocommerce_moneybookers_title'])) update_option('woocommerce_moneybookers_title', woocommerce_clean($_POST['woocommerce_moneybookers_title'])); else @delete_option('woocommerce_moneybookers_title');
if(isset($_POST['woocommerce_moneybookers_email'])) update_option('woocommerce_moneybookers_email', woocommerce_clean($_POST['woocommerce_moneybookers_email'])); else @delete_option('woocommerce_moneybookers_email');
if(isset($_POST['woocommerce_moneybookers_secret_word'])) update_option('woocommerce_moneybookers_secret_word', woocommerce_clean($_POST['woocommerce_moneybookers_secret_word'])); else @delete_option('woocommerce_moneybookers_secret_word');
if(isset($_POST['woocommerce_moneybookers_customer_id'])) update_option('woocommerce_moneybookers_customer_id', woocommerce_clean($_POST['woocommerce_moneybookers_customer_id'])); else @delete_option('woocommerce_moneybookers_customer_id');
}
/**
* Generate the moneybookers button link
**/
public function generate_moneybookers_form() {
$order_id = $_GET['orderId'];
$order = &new woocommerce_order( $order_id );
$moneybookers_adr = 'https://www.moneybookers.com/app/payment.pl';
$shipping_name = explode(' ', $order->shipping_method);
$order_total = trim($order->order_total, 0);
if( substr($order_total, -1) == '.' ) $order_total = str_replace('.', '', $order_total);
$moneybookers_args = array(
'merchant_fields' => 'partner',
'partner' => '21890813',
'pay_to_email' => $this->email,
'recipient_description' => get_bloginfo('name'),
'transaction_id' => $order_id,
'return_url' => get_permalink(get_option('woocommerce_thanks_page_id')),
'return_url_text' => 'Return to Merchant',
'new_window_redirect' => 0,
'rid' => 20521479,
'prepare_only' => 0,
'return_url_target' => 1,
'cancel_url' => trailingslashit(get_bloginfo('wpurl')).'?moneybookersListener=moneybookers_cancel',
'cancel_url_target' => 1,
'status_url' => trailingslashit(get_bloginfo('wpurl')).'?moneybookersListener=moneybookers_status',
'dynamic_descriptor' => 'Description',
'language' => 'EN',
'hide_login' => 1,
'confirmation_note' => 'Thank you for your custom',
'pay_from_email' => $order->billing_email,
//'title' => 'Mr',
'firstname' => $order->billing_first_name,
'lastname' => $order->billing_last_name,
'address' => $order->billing_address_1,
'address2' => $order->billing_address_2,
'phone_number' => $order->billing_phone,
'postal_code' => $order->billing_postcode,
'city' => $order->billing_city,
'state' => $order->billing_state,
'country' => 'GBR',
'amount' => $order_total,
'currency' => get_option('woocommerce_currency'),
'detail1_description' => 'Order ID',
'detail1_text'=> $order_id
);
// Cart Contents
$item_loop = 0;
if (sizeof($order->items)>0) : foreach ($order->items as $item) :
$_product = &new woocommerce_product($item['id']);
if ($_product->exists() && $item['qty']) :
$item_loop++;
$moneybookers_args['item_name_'.$item_loop] = $_product->get_title();
$moneybookers_args['quantity_'.$item_loop] = $item['qty'];
$moneybookers_args['amount_'.$item_loop] = $_product->get_price_excluding_tax();
endif;
endforeach; endif;
// Shipping Cost
$item_loop++;
$moneybookers_args['item_name_'.$item_loop] = __('Shipping cost', 'woothemes');
$moneybookers_args['quantity_'.$item_loop] = '1';
$moneybookers_args['amount_'.$item_loop] = number_format($order->order_shipping, 2);
$moneybookers_args_array = array();
foreach ($moneybookers_args as $key => $value) {
$moneybookers_args_array[] = '<input type="hidden" name="'.$key.'" value="'.$value.'" />';
}
// Skirll MD5 concatenation
$moneybookers_md = get_option('woocommerce_moneybookers_customer_id') . $moneybookers_args['transaction_id'] . strtoupper(md5(get_option('woocommerce_moneybookers_secret_word'))) . $order_total . get_option('woocommerce_currency') . '2';
$moneybookers_md = md5($moneybookers_md);
add_post_meta($order_id, '_moneybookersmd', $moneybookers_md);
echo '<form name="moneybookers" id="moneybookers_place_form" action="'.$moneybookers_adr.'" method="POST">' . implode('', $moneybookers_args_array) . '</form>';
echo '<script type="text/javascript">
//<![CDATA[
var paymentform = document.getElementById(\'moneybookers_place_form\');
window.onload = paymentform.submit();
//]]>
</script>';
exit();
}
/**
* Process the payment and return the result
**/
function process_payment( $order_id ) {
$order = &new woocommerce_order( $order_id );
return array(
'result' => 'success',
'redirect' => add_query_arg('order', $order->id, add_query_arg('key', $order->order_key, get_permalink(get_option('woocommerce_pay_page_id'))))
);
}
/**
* receipt_page
**/
function receipt_moneybookers( $order ) {
echo '<p>'.__('Thank you for your order, please complete the secure (SSL) form below to pay with Moneybookers.', 'woothemes').'</p>';
echo '<iframe class="moneybookers-loader" width="100%" height="700" id="2" src ="'.home_url('?moneybookersPayment=1&orderId='.$order).'">';
echo '<p>Your browser does not support iFrames, please contact us to place an order.</p>';
echo '</iframe>';
}
/**
* Check Moneybookers status report validity
**/
function check_status_report_is_valid() {
// Get Moneybookers post data array
$params = $_POST;
if(!isset($params['transaction_id'])) return false;
$order_id = $params['transaction_id'];
$_moneybookersmd = strtoupper(get_post_meta($order_id, '_moneybookersmd', true));
// Check MD5 signiture
if($params['md5sig'] == $_moneybookersmd) return true;
return false;
}
/**
* Check for Moneybookers Status Response
**/
function check_status_response() {
if (isset($_GET['moneybookersListener']) && $_GET['moneybookersListener'] == 'moneybookers_status'):
$_POST = stripslashes_deep($_POST);
if (self::check_status_report_is_valid()) :
do_action("valid-moneybookers-status-report", $_POST);
endif;
endif;
}
/**
* Successful Payment!
**/
function successful_request( $posted ) {
// Custom holds post ID
if ( !empty($posted['mb_transaction_id']) ) {
$order = new woocommerce_order( (int) $posted['transaction_id'] );
if ($order->status !== 'completed') :
// We are here so lets check status and do actions
switch ($posted['status']) :
case '2' : // Processed
$order->add_order_note( __('Moneybookers payment completed', 'woothemes') );
$order->payment_complete();
break;
case '0' : // Pending
case '-2' : // Failed
$order->update_status('on-hold', sprintf(__('Moneybookers payment failed (%s)', 'woothemes'), strtolower(sanitize($posted['status'])) ) );
break;
case '-1' : // Cancelled
$order->update_status('cancelled', __('Moneybookers payment cancelled', 'woothemes'));
break;
default:
$order->update_status('cancelled', __('Moneybookers exception', 'woothemes'));
break;
endswitch;
endif;
exit;
}
}
}
/** Add the gateway to WooCommerce **/
function add_moneybookers_gateway( $methods ) {
$methods[] = 'woocommerce_moneybookers'; return $methods;
}
add_filter('woocommerce_payment_gateways', 'add_moneybookers_gateway' );

View File

@ -1,35 +1,41 @@
<?php
/**
* PayPal Standard Gateway
**/
class paypal extends jigoshop_payment_gateway {
* PayPal Standard Payment Gateway
*
* Provides a PayPal Standard Payment Gateway.
*
* @class woocommerce_moneybookers
* @package WooCommerce
* @category Payment Gateways
* @author WooThemes
*/
class woocommerce_paypal extends woocommerce_payment_gateway {
public function __construct() {
$this->id = 'paypal';
$this->icon = jigoshop::plugin_url() . '/assets/images/icons/paypal.png';
$this->icon = woocommerce::plugin_url() . '/assets/images/icons/paypal.png';
$this->has_fields = false;
$this->enabled = get_option('jigoshop_paypal_enabled');
$this->title = get_option('jigoshop_paypal_title');
$this->email = get_option('jigoshop_paypal_email');
$this->description = get_option('jigoshop_paypal_description');
$this->enabled = get_option('woocommerce_paypal_enabled');
$this->title = get_option('woocommerce_paypal_title');
$this->email = get_option('woocommerce_paypal_email');
$this->description = get_option('woocommerce_paypal_description');
$this->liveurl = 'https://www.paypal.com/webscr';
$this->testurl = 'https://www.sandbox.paypal.com/webscr';
$this->testmode = get_option('jigoshop_paypal_testmode');
$this->testmode = get_option('woocommerce_paypal_testmode');
$this->send_shipping = get_option('jigoshop_paypal_send_shipping');
$this->send_shipping = get_option('woocommerce_paypal_send_shipping');
add_action( 'init', array(&$this, 'check_ipn_response') );
add_action('valid-paypal-standard-ipn-request', array(&$this, 'successful_request') );
add_action('jigoshop_update_options', array(&$this, 'process_admin_options'));
add_option('jigoshop_paypal_enabled', 'yes');
add_option('jigoshop_paypal_email', '');
add_option('jigoshop_paypal_title', __('PayPal', 'jigoshop') );
add_option('jigoshop_paypal_description', __("Pay via PayPal; you can pay with your credit card if you don't have a PayPal account", 'jigoshop') );
add_option('jigoshop_paypal_testmode', 'no');
add_option('jigoshop_paypal_send_shipping', 'no');
add_action('woocommerce_update_options', array(&$this, 'process_admin_options'));
add_option('woocommerce_paypal_enabled', 'yes');
add_option('woocommerce_paypal_email', '');
add_option('woocommerce_paypal_title', __('PayPal', 'woothemes') );
add_option('woocommerce_paypal_description', __("Pay via PayPal; you can pay with your credit card if you don't have a PayPal account", 'woothemes') );
add_option('woocommerce_paypal_testmode', 'no');
add_option('woocommerce_paypal_send_shipping', 'no');
add_action('receipt_paypal', array(&$this, 'receipt_page'));
}
@ -40,49 +46,49 @@ class paypal extends jigoshop_payment_gateway {
**/
public function admin_options() {
?>
<thead><tr><th scope="col" width="200px"><?php _e('PayPal standard', 'jigoshop'); ?></th><th scope="col" class="desc"><?php _e('PayPal standard works by sending the user to <a href="https://www.paypal.com/uk/mrb/pal=JFC9L8JJUZZK2">PayPal</a> to enter their payment information.', 'jigoshop'); ?></th></tr></thead>
<thead><tr><th scope="col" width="200px"><?php _e('PayPal standard', 'woothemes'); ?></th><th scope="col" class="desc"><?php _e('PayPal standard works by sending the user to <a href="https://www.paypal.com/uk/mrb/pal=JFC9L8JJUZZK2">PayPal</a> to enter their payment information.', 'woothemes'); ?></th></tr></thead>
<tr>
<td class="titledesc"><?php _e('Enable PayPal standard', 'jigoshop') ?>:</td>
<td class="titledesc"><?php _e('Enable PayPal standard', 'woothemes') ?>:</td>
<td class="forminp">
<select name="jigoshop_paypal_enabled" id="jigoshop_paypal_enabled" style="min-width:100px;">
<option value="yes" <?php if (get_option('jigoshop_paypal_enabled') == 'yes') echo 'selected="selected"'; ?>><?php _e('Yes', 'jigoshop'); ?></option>
<option value="no" <?php if (get_option('jigoshop_paypal_enabled') == 'no') echo 'selected="selected"'; ?>><?php _e('No', 'jigoshop'); ?></option>
<select name="woocommerce_paypal_enabled" id="woocommerce_paypal_enabled" style="min-width:100px;">
<option value="yes" <?php if (get_option('woocommerce_paypal_enabled') == 'yes') echo 'selected="selected"'; ?>><?php _e('Yes', 'woothemes'); ?></option>
<option value="no" <?php if (get_option('woocommerce_paypal_enabled') == 'no') echo 'selected="selected"'; ?>><?php _e('No', 'woothemes'); ?></option>
</select>
</td>
</tr>
<tr>
<td class="titledesc"><a href="#" tip="<?php _e('This controls the title which the user sees during checkout.','jigoshop') ?>" class="tips" tabindex="99"></a><?php _e('Method Title', 'jigoshop') ?>:</td>
<td class="titledesc"><a href="#" tip="<?php _e('This controls the title which the user sees during checkout.', 'woothemes') ?>" class="tips" tabindex="99"></a><?php _e('Method Title', 'woothemes') ?>:</td>
<td class="forminp">
<input class="input-text" type="text" name="jigoshop_paypal_title" id="jigoshop_paypal_title" style="min-width:50px;" value="<?php if ($value = get_option('jigoshop_paypal_title')) echo $value; else echo 'PayPal'; ?>" />
<input class="input-text" type="text" name="woocommerce_paypal_title" id="woocommerce_paypal_title" style="min-width:50px;" value="<?php if ($value = get_option('woocommerce_paypal_title')) echo $value; else echo 'PayPal'; ?>" />
</td>
</tr>
<tr>
<td class="titledesc"><a href="#" tip="<?php _e('This controls the description which the user sees during checkout.','jigoshop') ?>" class="tips" tabindex="99"></a><?php _e('Description', 'jigoshop') ?>:</td>
<td class="titledesc"><a href="#" tip="<?php _e('This controls the description which the user sees during checkout.', 'woothemes') ?>" class="tips" tabindex="99"></a><?php _e('Description', 'woothemes') ?>:</td>
<td class="forminp">
<input class="input-text wide-input" type="text" name="jigoshop_paypal_description" id="jigoshop_paypal_description" style="min-width:50px;" value="<?php if ($value = get_option('jigoshop_paypal_description')) echo $value; ?>" />
<input class="input-text wide-input" type="text" name="woocommerce_paypal_description" id="woocommerce_paypal_description" style="min-width:50px;" value="<?php if ($value = get_option('woocommerce_paypal_description')) echo $value; ?>" />
</td>
</tr>
<tr>
<td class="titledesc"><a href="#" tip="<?php _e('Please enter your PayPal email address; this is needed in order to take payment!','jigoshop') ?>" class="tips" tabindex="99"></a><?php _e('PayPal email address', 'jigoshop') ?>:</td>
<td class="titledesc"><a href="#" tip="<?php _e('Please enter your PayPal email address; this is needed in order to take payment!', 'woothemes') ?>" class="tips" tabindex="99"></a><?php _e('PayPal email address', 'woothemes') ?>:</td>
<td class="forminp">
<input class="input-text" type="text" name="jigoshop_paypal_email" id="jigoshop_paypal_email" style="min-width:50px;" value="<?php if ($value = get_option('jigoshop_paypal_email')) echo $value; ?>" />
<input class="input-text" type="text" name="woocommerce_paypal_email" id="woocommerce_paypal_email" style="min-width:50px;" value="<?php if ($value = get_option('woocommerce_paypal_email')) echo $value; ?>" />
</td>
</tr>
<tr>
<td class="titledesc"><a href="#" tip="<?php _e('If your checkout page does not ask for shipping details, or if you do not want to send shipping information to PayPal, set this option to no. If you enable this option PayPal may restrict where things can be sent, and will prevent some orders going through for your protection.','jigoshop') ?>" class="tips" tabindex="99"></a><?php _e('Send shipping details to PayPal', 'jigoshop') ?>:</td>
<td class="titledesc"><a href="#" tip="<?php _e('If your checkout page does not ask for shipping details, or if you do not want to send shipping information to PayPal, set this option to no. If you enable this option PayPal may restrict where things can be sent, and will prevent some orders going through for your protection.', 'woothemes') ?>" class="tips" tabindex="99"></a><?php _e('Send shipping details to PayPal', 'woothemes') ?>:</td>
<td class="forminp">
<select name="jigoshop_paypal_send_shipping" id="jigoshop_paypal_send_shipping" style="min-width:100px;">
<option value="yes" <?php if (get_option('jigoshop_paypal_send_shipping') == 'yes') echo 'selected="selected"'; ?>><?php _e('Yes', 'jigoshop'); ?></option>
<option value="no" <?php if (get_option('jigoshop_paypal_send_shipping') == 'no') echo 'selected="selected"'; ?>><?php _e('No', 'jigoshop'); ?></option>
<select name="woocommerce_paypal_send_shipping" id="woocommerce_paypal_send_shipping" style="min-width:100px;">
<option value="yes" <?php if (get_option('woocommerce_paypal_send_shipping') == 'yes') echo 'selected="selected"'; ?>><?php _e('Yes', 'woothemes'); ?></option>
<option value="no" <?php if (get_option('woocommerce_paypal_send_shipping') == 'no') echo 'selected="selected"'; ?>><?php _e('No', 'woothemes'); ?></option>
</select>
</td>
</tr>
<tr>
<td class="titledesc"><?php _e('Enable PayPal sandbox', 'jigoshop') ?>:</td>
<td class="titledesc"><?php _e('Enable PayPal sandbox', 'woothemes') ?>:</td>
<td class="forminp">
<select name="jigoshop_paypal_testmode" id="jigoshop_paypal_testmode" style="min-width:100px;">
<option value="yes" <?php if (get_option('jigoshop_paypal_testmode') == 'yes') echo 'selected="selected"'; ?>><?php _e('Yes', 'jigoshop'); ?></option>
<option value="no" <?php if (get_option('jigoshop_paypal_testmode') == 'no') echo 'selected="selected"'; ?>><?php _e('No', 'jigoshop'); ?></option>
<select name="woocommerce_paypal_testmode" id="woocommerce_paypal_testmode" style="min-width:100px;">
<option value="yes" <?php if (get_option('woocommerce_paypal_testmode') == 'yes') echo 'selected="selected"'; ?>><?php _e('Yes', 'woothemes'); ?></option>
<option value="no" <?php if (get_option('woocommerce_paypal_testmode') == 'no') echo 'selected="selected"'; ?>><?php _e('No', 'woothemes'); ?></option>
</select>
</td>
</tr>
@ -93,7 +99,7 @@ class paypal extends jigoshop_payment_gateway {
* There are no payment fields for paypal, but we want to show the description if set.
**/
function payment_fields() {
if ($jigoshop_paypal_description = get_option('jigoshop_paypal_description')) echo wpautop(wptexturize($jigoshop_paypal_description));
if ($woocommerce_paypal_description = get_option('woocommerce_paypal_description')) echo wpautop(wptexturize($woocommerce_paypal_description));
}
/**
@ -101,12 +107,12 @@ class paypal extends jigoshop_payment_gateway {
* - Saves the options to the DB
**/
public function process_admin_options() {
if(isset($_POST['jigoshop_paypal_enabled'])) update_option('jigoshop_paypal_enabled', jigowatt_clean($_POST['jigoshop_paypal_enabled'])); else @delete_option('jigoshop_paypal_enabled');
if(isset($_POST['jigoshop_paypal_title'])) update_option('jigoshop_paypal_title', jigowatt_clean($_POST['jigoshop_paypal_title'])); else @delete_option('jigoshop_paypal_title');
if(isset($_POST['jigoshop_paypal_email'])) update_option('jigoshop_paypal_email', jigowatt_clean($_POST['jigoshop_paypal_email'])); else @delete_option('jigoshop_paypal_email');
if(isset($_POST['jigoshop_paypal_description'])) update_option('jigoshop_paypal_description', jigowatt_clean($_POST['jigoshop_paypal_description'])); else @delete_option('jigoshop_paypal_description');
if(isset($_POST['jigoshop_paypal_testmode'])) update_option('jigoshop_paypal_testmode', jigowatt_clean($_POST['jigoshop_paypal_testmode'])); else @delete_option('jigoshop_paypal_testmode');
if(isset($_POST['jigoshop_paypal_send_shipping'])) update_option('jigoshop_paypal_send_shipping', jigowatt_clean($_POST['jigoshop_paypal_send_shipping'])); else @delete_option('jigoshop_paypal_send_shipping');
if(isset($_POST['woocommerce_paypal_enabled'])) update_option('woocommerce_paypal_enabled', woocommerce_clean($_POST['woocommerce_paypal_enabled'])); else @delete_option('woocommerce_paypal_enabled');
if(isset($_POST['woocommerce_paypal_title'])) update_option('woocommerce_paypal_title', woocommerce_clean($_POST['woocommerce_paypal_title'])); else @delete_option('woocommerce_paypal_title');
if(isset($_POST['woocommerce_paypal_email'])) update_option('woocommerce_paypal_email', woocommerce_clean($_POST['woocommerce_paypal_email'])); else @delete_option('woocommerce_paypal_email');
if(isset($_POST['woocommerce_paypal_description'])) update_option('woocommerce_paypal_description', woocommerce_clean($_POST['woocommerce_paypal_description'])); else @delete_option('woocommerce_paypal_description');
if(isset($_POST['woocommerce_paypal_testmode'])) update_option('woocommerce_paypal_testmode', woocommerce_clean($_POST['woocommerce_paypal_testmode'])); else @delete_option('woocommerce_paypal_testmode');
if(isset($_POST['woocommerce_paypal_send_shipping'])) update_option('woocommerce_paypal_send_shipping', woocommerce_clean($_POST['woocommerce_paypal_send_shipping'])); else @delete_option('woocommerce_paypal_send_shipping');
}
/**
@ -114,7 +120,7 @@ class paypal extends jigoshop_payment_gateway {
**/
public function generate_paypal_form( $order_id ) {
$order = &new jigoshop_order( $order_id );
$order = &new woocommerce_order( $order_id );
if ( $this->testmode == 'yes' ):
$paypal_adr = $this->testurl . '?test_ipn=1&';
@ -145,11 +151,11 @@ class paypal extends jigoshop_payment_gateway {
'cmd' => '_cart',
'business' => $this->email,
'no_note' => 1,
'currency_code' => get_option('jigoshop_currency'),
'currency_code' => get_option('woocommerce_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')))),
'return' => add_query_arg('key', $order->order_key, add_query_arg('order', $order_id, get_permalink(get_option('woocommerce_thanks_page_id')))),
'cancel_return' => $order->get_cancel_order_url(),
//'cancel_return' => home_url(),
@ -191,7 +197,7 @@ class paypal extends jigoshop_payment_gateway {
// Cart Contents
$item_loop = 0;
if (sizeof($order->items)>0) : foreach ($order->items as $item) :
$_product = &new jigoshop_product($item['id']);
$_product = &new woocommerce_product($item['id']);
if ($_product->exists() && $item['qty']) :
$item_loop++;
@ -205,7 +211,7 @@ class paypal extends jigoshop_payment_gateway {
// Shipping Cost
$item_loop++;
$paypal_args['item_name_'.$item_loop] = __('Shipping cost', 'jigoshop');
$paypal_args['item_name_'.$item_loop] = __('Shipping cost', 'woothemes');
$paypal_args['quantity_'.$item_loop] = '1';
$paypal_args['amount_'.$item_loop] = number_format($order->order_shipping, 2);
@ -217,12 +223,12 @@ class paypal extends jigoshop_payment_gateway {
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>
<input type="submit" class="button-alt" id="submit_paypal_payment_form" value="'.__('Pay via PayPal', 'woothemes').'" /> <a class="button cancel" href="'.$order->get_cancel_order_url().'">'.__('Cancel order &amp; restore cart', 'woothemes').'</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').'",
message: "<img src=\"'.woocommerce::plugin_url().'/assets/images/ajax-loader.gif\" alt=\"Redirecting...\" />'.__('Thank you for your order. We are now redirecting you to PayPal to make payment.', 'woothemes').'",
overlayCSS:
{
background: "#fff",
@ -249,11 +255,11 @@ class paypal extends jigoshop_payment_gateway {
**/
function process_payment( $order_id ) {
$order = &new jigoshop_order( $order_id );
$order = &new woocommerce_order( $order_id );
return array(
'result' => 'success',
'redirect' => add_query_arg('order', $order->id, add_query_arg('key', $order->order_key, get_permalink(get_option('jigoshop_pay_page_id'))))
'redirect' => add_query_arg('order', $order->id, add_query_arg('key', $order->order_key, get_permalink(get_option('woocommerce_pay_page_id'))))
);
}
@ -263,7 +269,7 @@ class paypal extends jigoshop_payment_gateway {
**/
function receipt_page( $order ) {
echo '<p>'.__('Thank you for your order, please click the button below to pay with PayPal.', 'jigoshop').'</p>';
echo '<p>'.__('Thank you for your order, please click the button below to pay with PayPal.', 'woothemes').'</p>';
echo $this->generate_paypal_form( $order );
@ -332,7 +338,7 @@ class paypal extends jigoshop_payment_gateway {
if (!in_array(strtolower($posted['txn_type']), $accepted_types)) exit;
$order = new jigoshop_order( (int) $posted['custom'] );
$order = new woocommerce_order( (int) $posted['custom'] );
if ($order->order_key!==$posted['invoice']) exit;
@ -345,7 +351,7 @@ class paypal extends jigoshop_payment_gateway {
switch (strtolower($posted['payment_status'])) :
case 'completed' :
// Payment completed
$order->add_order_note( __('IPN payment completed', 'jigoshop') );
$order->add_order_note( __('IPN payment completed', 'woothemes') );
$order->payment_complete();
break;
case 'denied' :
@ -353,7 +359,7 @@ class paypal extends jigoshop_payment_gateway {
case 'failed' :
case 'voided' :
// Hold order
$order->update_status('on-hold', sprintf(__('Payment %s via IPN.', 'jigoshop'), strtolower(sanitize($posted['payment_status'])) ) );
$order->update_status('on-hold', sprintf(__('Payment %s via IPN.', 'woothemes'), strtolower(sanitize($posted['payment_status'])) ) );
break;
default:
// No action
@ -370,10 +376,10 @@ class paypal extends jigoshop_payment_gateway {
}
/**
* Add the gateway to JigoShop
* Add the gateway to WooCommerce
**/
function add_paypal_gateway( $methods ) {
$methods[] = 'paypal'; return $methods;
$methods[] = 'woocommerce_paypal'; return $methods;
}
add_filter('jigoshop_payment_gateways', 'add_paypal_gateway' );
add_filter('woocommerce_payment_gateways', 'add_paypal_gateway' );

View File

@ -1,9 +1,15 @@
<?php
/**
* Jigoshop Payment Gateway class
**/
class jigoshop_payment_gateway {
* WooCommerce Payment Gateway class
*
* Extended by individual payment gateways to handle payments.
*
* @class woocommerce_payment_gateway
* @package WooCommerce
* @category Payment Gateways
* @author WooThemes
*/
class woocommerce_payment_gateway {
var $id;
var $title;
@ -32,7 +38,7 @@ class jigoshop_payment_gateway {
function icon() {
if ($this->icon) :
return '<img src="'. jigoshop::force_ssl($this->icon).'" alt="'.$this->title.'" />';
return '<img src="'. woocommerce::force_ssl($this->icon).'" alt="'.$this->title.'" />';
endif;
}

View File

@ -1,16 +1,22 @@
<?php
/**
* Jigoshop Payment Gateways class
**/
class jigoshop_payment_gateways {
* WooCommerce Payment Gateways class
*
* Loads payment gateways via hooks for use in the store.
*
* @class woocommerce_payment_gateways
* @package WooCommerce
* @category Payment Gateways
* @author WooThemes
*/
class woocommerce_payment_gateways {
private static $instance;
static $payment_gateways;
public static function init() {
$load_gateways = apply_filters('jigoshop_payment_gateways', array());
$load_gateways = apply_filters('woocommerce_payment_gateways', array());
foreach ($load_gateways as $gateway) :

View File

@ -1,41 +0,0 @@
<?php
/**
* Jigoshop coupons
* @class jigoshop_coupons
*
* The JigoShop coupons class gets coupon data from storage
*
* @author Jigowatt
* @category Classes
* @package JigoShop
*/
class jigoshop_coupons {
/** get coupons from the options database */
function get_coupons() {
$coupons = get_option('jigoshop_coupons') ? $coupons = (array) get_option('jigoshop_coupons') : $coupons = array();
return $coupons;
}
/** get coupon with $code */
function get_coupon($code) {
$coupons = get_option('jigoshop_coupons') ? $coupons = (array) get_option('jigoshop_coupons') : $coupons = array();
if (isset($coupons[$code])) return $coupons[$code];
return false;
}
/** Check coupon is valid by looking at cart */
function is_valid($code) {
$coupon = self::get_coupon($code);
if (sizeof($coupon['products'])>0) :
$valid = false;
if (sizeof(jigoshop_cart::$cart_contents)>0) : foreach (jigoshop_cart::$cart_contents as $item_id => $values) :
if (in_array($item_id, $coupon['products'])) :
$valid = true;
endif;
endforeach; endif;
return $valid;
endif;
return true;
}
}

View File

@ -1,15 +1,15 @@
<?php
/**
* Order
* @class jigoshop_order
*
* The JigoShop order class handles order data.
* The WooCommerce order class handles order data.
*
* @author Jigowatt
* @category Classes
* @package JigoShop
* @class woocommerce_order
* @package WooCommerce
* @category Class
* @author WooThemes
*/
class jigoshop_order {
class woocommerce_order {
private $_data = array();
@ -22,7 +22,7 @@ class jigoshop_order {
}
/** Get the order if ID is passed, otherwise the order is new and empty */
function jigoshop_order( $id='' ) {
function woocommerce_order( $id='' ) {
if ($id>0) $this->get_order( $id );
}
@ -85,7 +85,7 @@ class jigoshop_order {
// Formatted Addresses
$formatted_address = array();
$country = ($this->billing_country && isset(jigoshop_countries::$countries[$this->billing_country])) ? jigoshop_countries::$countries[$this->billing_country] : $this->billing_country;
$country = ($this->billing_country && isset(woocommerce_countries::$countries[$this->billing_country])) ? woocommerce_countries::$countries[$this->billing_country] : $this->billing_country;
$address = array_map('trim', array(
$this->billing_address_1,
$this->billing_address_2,
@ -99,7 +99,7 @@ class jigoshop_order {
if ($this->shipping_address_1) :
$formatted_address = array();
$country = ($this->shipping_country && isset(jigoshop_countries::$countries[$this->shipping_country])) ? jigoshop_countries::$countries[$this->shipping_country] : $this->shipping_country;
$country = ($this->shipping_country && isset(woocommerce_countries::$countries[$this->shipping_country])) ? woocommerce_countries::$countries[$this->shipping_country] : $this->shipping_country;
$address = array_map('trim', array(
$this->shipping_address_1,
$this->shipping_address_2,
@ -136,10 +136,10 @@ class jigoshop_order {
function get_subtotal_to_display() {
$subtotal = jigoshop_price($this->order_subtotal);
$subtotal = woocommerce_price($this->order_subtotal);
if ($this->order_tax>0) :
$subtotal .= __(' <small>(ex. tax)</small>', 'jigoshop');
$subtotal .= __(' <small>(ex. tax)</small>', 'woothemes');
endif;
return $subtotal;
@ -150,13 +150,13 @@ class jigoshop_order {
if ($this->order_shipping > 0) :
$shipping = jigoshop_price($this->order_shipping);
$shipping = woocommerce_price($this->order_shipping);
if ($this->order_shipping_tax > 0) :
$shipping .= sprintf(__(' <small>(ex. tax) via %s</small>', 'jigoshop'), ucwords($this->shipping_method));
$shipping .= sprintf(__(' <small>(ex. tax) via %s</small>', 'woothemes'), ucwords($this->shipping_method));
endif;
else :
$shipping = __('Free!', 'jigoshop');
$shipping = __('Free!', 'woothemes');
endif;
return $shipping;
@ -166,9 +166,9 @@ class jigoshop_order {
function get_product_from_item( $item ) {
if (isset($item['variation_id']) && $item['variation_id']>0) :
$_product = &new jigoshop_product_variation( $item['variation_id'] );
$_product = &new woocommerce_product_variation( $item['variation_id'] );
else :
$_product = &new jigoshop_product( $item['id'] );
$_product = &new woocommerce_product( $item['id'] );
endif;
return $_product;
@ -184,7 +184,7 @@ class jigoshop_order {
$_product = $this->get_product_from_item( $item );
$return .= $item['qty'] . ' x ' . apply_filters('jigoshop_order_product_title', $item['name'], $_product);
$return .= $item['qty'] . ' x ' . apply_filters('woocommerce_order_product_title', $item['name'], $_product);
if ($show_sku) :
@ -192,10 +192,10 @@ class jigoshop_order {
endif;
$return .= ' - ' . strip_tags(jigoshop_price( $item['cost']*$item['qty'], array('ex_tax_label' => 1 )));
$return .= ' - ' . strip_tags(woocommerce_price( $item['cost']*$item['qty'], array('ex_tax_label' => 1 )));
if (isset($_product->variation_data)) :
$return .= PHP_EOL . jigoshop_get_formatted_variation( $_product->variation_data, true );
$return .= PHP_EOL . woocommerce_get_formatted_variation( $_product->variation_data, true );
endif;
if ($show_download_links) :
@ -221,9 +221,9 @@ class jigoshop_order {
/** Generates a URL so that a customer can checkout/pay for their (unpaid - pending) order via a link */
function get_checkout_payment_url() {
$payment_page = get_permalink(get_option('jigoshop_pay_page_id'));
$payment_page = get_permalink(get_option('woocommerce_pay_page_id'));
if (get_option('jigoshop_force_ssl_checkout')=='yes' || is_ssl()) $payment_page = str_replace('http:', 'https:', $payment_page);
if (get_option('woocommerce_force_ssl_checkout')=='yes' || is_ssl()) $payment_page = str_replace('http:', 'https:', $payment_page);
return add_query_arg('pay_for_order', 'true', add_query_arg('order', $this->order_key, add_query_arg('order_id', $this->id, $payment_page)));
}
@ -231,7 +231,7 @@ class jigoshop_order {
/** 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()))));
return woocommerce::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()))));
}
@ -259,8 +259,8 @@ class jigoshop_order {
function add_order_note( $note, $private = 1 ) {
$comment_post_ID = $this->id;
$comment_author = 'JigoShop';
$comment_author_email = 'jigoshop@' . str_replace('www.', '', str_replace('http://', '', site_url()));
$comment_author = 'WooCommerce';
$comment_author_email = 'woocommerce@' . str_replace('www.', '', str_replace('http://', '', site_url()));
$comment_author_url = '';
$comment_content = $note;
$comment_type = '';
@ -299,7 +299,7 @@ class jigoshop_order {
// Status was changed
do_action( 'order_status_'.$new_status->slug, $this->id );
do_action( 'order_status_'.$this->status.'_to_'.$new_status->slug, $this->id );
$this->add_order_note( $note . sprintf( __('Order status changed from %s to %s.', 'jigoshop'), $this->status, $new_status->slug ) );
$this->add_order_note( $note . sprintf( __('Order status changed from %s to %s.', 'woothemes'), $this->status, $new_status->slug ) );
clean_term_cache( '', 'shop_order_status' );
endif;
@ -378,17 +378,17 @@ class jigoshop_order {
$new_quantity = $_product->reduce_stock( $item['qty'] );
$this->add_order_note( sprintf( __('Item #%s stock reduced from %s to %s.', 'jigoshop'), $item['id'], $old_stock, $new_quantity) );
$this->add_order_note( sprintf( __('Item #%s stock reduced from %s to %s.', 'woothemes'), $item['id'], $old_stock, $new_quantity) );
if ($new_quantity<0) :
do_action('jigoshop_product_on_backorder_notification', $item['id'], $item['qty']);
do_action('woocommerce_product_on_backorder_notification', $item['id'], $item['qty']);
endif;
// stock status notifications
if (get_option('jigoshop_notify_no_stock_amount') && get_option('jigoshop_notify_no_stock_amount')>=$new_quantity) :
do_action('jigoshop_no_stock_notification', $item['id']);
elseif (get_option('jigoshop_notify_low_stock_amount') && get_option('jigoshop_notify_low_stock_amount')>=$new_quantity) :
do_action('jigoshop_low_stock_notification', $item['id']);
if (get_option('woocommerce_notify_no_stock_amount') && get_option('woocommerce_notify_no_stock_amount')>=$new_quantity) :
do_action('woocommerce_no_stock_notification', $item['id']);
elseif (get_option('woocommerce_notify_low_stock_amount') && get_option('woocommerce_notify_low_stock_amount')>=$new_quantity) :
do_action('woocommerce_low_stock_notification', $item['id']);
endif;
endif;
@ -397,7 +397,7 @@ class jigoshop_order {
endforeach;
$this->add_order_note( __('Order item stock reduced successfully.', 'jigoshop') );
$this->add_order_note( __('Order item stock reduced successfully.', 'woothemes') );
}

View File

@ -1,15 +1,15 @@
<?php
/**
* Orders
* @class jigoshop_orders
*
* The JigoShop orders class loads orders and calculates counts
* The WooCommerce orders class loads orders and calculates counts
*
* @author Jigowatt
* @category Classes
* @package JigoShop
* @class woocommerce_orders
* @package WooCommerce
* @category Class
* @author WooThemes
*/
class jigoshop_orders {
class woocommerce_orders {
var $orders;
var $count;
@ -21,7 +21,7 @@ class jigoshop_orders {
var $refunded_count;
/** Loads orders and counts them */
function jigoshop_orders() {
function woocommerce_orders() {
$this->orders = array();
// Get Counts
@ -54,7 +54,7 @@ class jigoshop_orders {
if ($results) :
foreach ($results as $result) :
$order = &new jigoshop_order();
$order = &new woocommerce_order();
$order->populate($result);
$this->orders[] = $order;
endforeach;

View File

@ -1,15 +1,15 @@
<?php
/**
* Product Class
* @class jigoshop_product
*
* The JigoShop product class handles individual product data.
* The WooCommerce product class handles individual product data.
*
* @author Jigowatt
* @category Classes
* @package JigoShop
* @class woocommerce_product
* @package WooCommerce
* @category Class
* @author WooThemes
*/
class jigoshop_product {
class woocommerce_product {
var $id;
var $exists;
@ -30,7 +30,7 @@ class jigoshop_product {
*
* @param int $id ID of the product to load
*/
function jigoshop_product( $id ) {
function woocommerce_product( $id ) {
$this->id = $id;
@ -83,9 +83,9 @@ class jigoshop_product {
if ($children_products) foreach ($children_products as $child) :
if ($this->is_type('variable')) :
$child->product = &new jigoshop_product_variation( $child->ID );
$child->product = &new woocommerce_product_variation( $child->ID );
else :
$child->product = &new jigoshop_product( $child->ID );
$child->product = &new woocommerce_product( $child->ID );
endif;
endforeach;
@ -169,7 +169,7 @@ class jigoshop_product {
/** Get the title of the post */
function get_title () {
$this->get_post_data();
return apply_filters('jigoshop_product_title', $this->post->post_title, $this);
return apply_filters('woocommerce_product_title', $this->post->post_title, $this);
}
@ -186,13 +186,13 @@ class jigoshop_product {
$url = add_query_arg('add-to-cart', $this->id);
endif;
$url = jigoshop::nonce_url( 'add_to_cart', $url );
$url = woocommerce::nonce_url( 'add_to_cart', $url );
return $url;
}
/** Returns whether or not the product is stock managed */
function managing_stock() {
if (get_option('jigoshop_manage_stock')=='yes') :
if (get_option('woocommerce_manage_stock')=='yes') :
if (isset($this->data['manage_stock']) && $this->data['manage_stock']=='yes') return true;
endif;
return false;
@ -249,46 +249,46 @@ class jigoshop_product {
if (!$this->managing_stock()) :
if ($this->is_in_stock()) :
//$availability = __('In stock', 'jigoshop'); /* Lets not bother showing stock if its not managed and is available */
//$availability = __('In stock', 'woothemes'); /* Lets not bother showing stock if its not managed and is available */
else :
$availability = __('Out of stock', 'jigoshop');
$availability = __('Out of stock', 'woothemes');
$class = 'out-of-stock';
endif;
else :
if ($this->is_in_stock()) :
if ($this->stock > 0) :
$availability = __('In stock', 'jigoshop');
$availability = __('In stock', 'woothemes');
if ($this->backorders_allowed()) :
if ($this->backorders_require_notification()) :
$availability .= ' &ndash; '.$this->stock.' ';
$availability .= __('available', 'jigoshop');
$availability .= __(' (backorders allowed)', 'jigoshop');
$availability .= __('available', 'woothemes');
$availability .= __(' (backorders allowed)', 'woothemes');
endif;
else :
$availability .= ' &ndash; '.$this->stock.' ';
$availability .= __('available', 'jigoshop');
$availability .= __('available', 'woothemes');
endif;
else :
if ($this->backorders_allowed()) :
if ($this->backorders_require_notification()) :
$availability = __('Available on backorder', 'jigoshop');
$availability = __('Available on backorder', 'woothemes');
else :
$availability = __('In stock', 'jigoshop');
$availability = __('In stock', 'woothemes');
endif;
else :
$availability = __('Out of stock', 'jigoshop');
$availability = __('Out of stock', 'woothemes');
$class = 'out-of-stock';
endif;
endif;
else :
if ($this->backorders_allowed()) :
$availability = __('Available on backorder', 'jigoshop');
$availability = __('Available on backorder', 'woothemes');
else :
$availability = __('Out of stock', 'jigoshop');
$availability = __('Out of stock', 'woothemes');
$class = 'out-of-stock';
endif;
endif;
@ -349,9 +349,9 @@ class jigoshop_product {
/*if (!$price) $price = $this->price;
if (get_option('jigoshop_prices_include_tax')=='yes' && $this->is_taxable() && jigoshop_customer::is_customer_outside_base()) :
if (get_option('woocommerce_prices_include_tax')=='yes' && $this->is_taxable() && woocommerce_customer::is_customer_outside_base()) :
$_tax = &new jigoshop_tax();
$_tax = &new woocommerce_tax();
$price = $price * 100;
@ -373,13 +373,13 @@ class jigoshop_product {
$price = $this->price;
if (get_option('jigoshop_prices_include_tax')=='yes') :
if (get_option('woocommerce_prices_include_tax')=='yes') :
if ( $rate = $this->get_tax_base_rate() ) :
if ( $rate>0 ) :
$_tax = &new jigoshop_tax();
$_tax = &new woocommerce_tax();
$tax_amount = $_tax->calc_tax( $price, $rate, true );
@ -397,9 +397,9 @@ class jigoshop_product {
/** Returns the base tax rate */
function get_tax_base_rate() {
if ( $this->is_taxable() && get_option('jigoshop_calc_taxes')=='yes') :
if ( $this->is_taxable() && get_option('woocommerce_calc_taxes')=='yes') :
$_tax = &new jigoshop_tax();
$_tax = &new woocommerce_tax();
$rate = $_tax->get_shop_base_rate( $this->data['tax_class'] );
return $rate;
@ -422,17 +422,17 @@ class jigoshop_product {
if ($child_price>$max_price || $max_price == '') $max_price = $child_price;
endforeach;
$price .= '<span class="from">' . __('From: ', 'jigoshop') . '</span>' . jigoshop_price($min_price);
$price .= '<span class="from">' . __('From: ', 'woothemes') . '</span>' . woocommerce_price($min_price);
elseif ($this->is_type('variable')) :
$price .= '<span class="from">' . __('From: ', 'jigoshop') . '</span>' . jigoshop_price($this->get_price());
$price .= '<span class="from">' . __('From: ', 'woothemes') . '</span>' . woocommerce_price($this->get_price());
else :
if ($this->price) :
if ($this->is_on_sale() && isset($this->data['regular_price'])) :
$price .= '<del>'.jigoshop_price( $this->data['regular_price'] ).'</del> <ins>'.jigoshop_price($this->get_price()).'</ins>';
$price .= '<del>'.woocommerce_price( $this->data['regular_price'] ).'</del> <ins>'.woocommerce_price($this->get_price()).'</ins>';
else :
$price .= jigoshop_price($this->get_price());
$price .= woocommerce_price($this->get_price());
endif;
endif;
endif;

View File

@ -1,15 +1,15 @@
<?php
/**
* Product Variation Class
* @class jigoshop_product_variation
*
* The JigoShop product variation class handles product variation data.
* The WooCommerce product variation class handles product variation data.
*
* @author Jigowatt
* @category Classes
* @package JigoShop
* @class woocommerce_product_variation
* @package WooCommerce
* @category Class
* @author WooThemes
*/
class jigoshop_product_variation extends jigoshop_product {
class woocommerce_product_variation extends woocommerce_product {
var $variation;
var $variation_data;
@ -25,7 +25,7 @@ class jigoshop_product_variation extends jigoshop_product {
*
* @param int $id ID of the product to load
*/
function jigoshop_product_variation( $variation_id ) {
function woocommerce_product_variation( $variation_id ) {
$this->variation_id = $variation_id;
@ -66,7 +66,7 @@ class jigoshop_product_variation extends jigoshop_product {
$this->exists = false;
endif;
//parent::jigoshop_product( $this->variation->post_parent );
//parent::woocommerce_product( $this->variation->post_parent );
/* Pverride parent data with variation */
if (isset($product_custom_fields['SKU'][0]) && !empty($product_custom_fields['SKU'][0])) :
@ -125,15 +125,15 @@ class jigoshop_product_variation extends jigoshop_product {
if ($this->price) :
if ($this->variation_has_sale_price) :
$price .= '<del>'.jigoshop_price( $this->price ).'</del> <ins>'.jigoshop_price( $this->data['sale_price'] ).'</ins>';
$price .= '<del>'.woocommerce_price( $this->price ).'</del> <ins>'.woocommerce_price( $this->data['sale_price'] ).'</ins>';
else :
$price .= jigoshop_price( $this->price );
$price .= woocommerce_price( $this->price );
endif;
endif;
return $price;
else :
return jigoshop_price(parent::get_price());
return woocommerce_price(parent::get_price());
endif;
}

View File

@ -0,0 +1,197 @@
<?php
/**
* Flat Rate Shipping Method
*
* A simple shipping method for a flat fee per item or per order
*
* @class flat_rate
* @package WooCommerce
* @category Shipping
* @author WooThemes
*/
class flat_rate extends woocommerce_shipping_method {
public function __construct() {
$this->id = 'flat_rate';
$this->enabled = get_option('woocommerce_flat_rate_enabled');
$this->title = get_option('woocommerce_flat_rate_title');
$this->availability = get_option('woocommerce_flat_rate_availability');
$this->countries = get_option('woocommerce_flat_rate_countries');
$this->type = get_option('woocommerce_flat_rate_type');
$this->tax_status = get_option('woocommerce_flat_rate_tax_status');
$this->cost = get_option('woocommerce_flat_rate_cost');
$this->fee = get_option('woocommerce_flat_rate_handling_fee');
add_action('woocommerce_update_options', array(&$this, 'process_admin_options'));
add_option('woocommerce_flat_rate_availability', 'all');
add_option('woocommerce_flat_rate_title', 'Flat Rate');
add_option('woocommerce_flat_rate_tax_status', 'taxable');
}
public function calculate_shipping() {
$_tax = &new woocommerce_tax();
$this->shipping_total = 0;
$this->shipping_tax = 0;
if ($this->type=='order') :
// Shipping for whole order
$this->shipping_total = $this->cost + $this->get_fee( $this->fee, woocommerce_cart::$cart_contents_total );
if ( get_option('woocommerce_calc_taxes')=='yes' && $this->tax_status=='taxable' ) :
$rate = $_tax->get_shipping_tax_rate();
if ($rate>0) :
$tax_amount = $_tax->calc_shipping_tax( $this->shipping_total, $rate );
$this->shipping_tax = $this->shipping_tax + $tax_amount;
endif;
endif;
else :
// Shipping per item
if (sizeof(woocommerce_cart::$cart_contents)>0) : foreach (woocommerce_cart::$cart_contents as $item_id => $values) :
$_product = $values['data'];
if ($_product->exists() && $values['quantity']>0) :
$item_shipping_price = ($this->cost + $this->get_fee( $this->fee, $_product->get_price() )) * $values['quantity'];
// Only count 'psysical' products
if ($_product->is_type( 'simple' ) || $_product->is_type( 'variable' )) :
$this->shipping_total = $this->shipping_total + $item_shipping_price;
if ( $_product->is_shipping_taxable() && $this->tax_status=='taxable' ) :
$rate = $_tax->get_shipping_tax_rate( $_product->data['tax_class'] );
if ($rate>0) :
$tax_amount = $_tax->calc_shipping_tax( $item_shipping_price, $rate );
$this->shipping_tax = $this->shipping_tax + $tax_amount;
endif;
endif;
endif;
endif;
endforeach; endif;
endif;
}
public function admin_options() {
?>
<thead><tr><th scope="col" width="200px"><?php _e('Flat Rates', 'woothemes'); ?></th><th scope="col" class="desc"><?php _e('Flat rates let you define a standard rate per item, or per order.', 'woothemes'); ?>&nbsp;</th></tr></thead>
<tr>
<td class="titledesc"><?php _e('Enable Flat Rate', 'woothemes') ?>:</td>
<td class="forminp">
<select name="woocommerce_flat_rate_enabled" id="woocommerce_flat_rate_enabled" style="min-width:100px;">
<option value="yes" <?php if (get_option('woocommerce_flat_rate_enabled') == 'yes') echo 'selected="selected"'; ?>><?php _e('Yes', 'woothemes'); ?></option>
<option value="no" <?php if (get_option('woocommerce_flat_rate_enabled') == 'no') echo 'selected="selected"'; ?>><?php _e('No', 'woothemes'); ?></option>
</select>
</td>
</tr>
<tr>
<td class="titledesc"><a href="#" tip="<?php _e('This controls the title which the user sees during checkout.', 'woothemes') ?>" class="tips" tabindex="99"></a><?php _e('Method Title', 'woothemes') ?>:</td>
<td class="forminp">
<input type="text" name="woocommerce_flat_rate_title" id="woocommerce_flat_rate_title" style="min-width:50px;" value="<?php if ($value = get_option('woocommerce_flat_rate_title')) echo $value; else echo 'Flat Rate'; ?>" />
</td>
</tr>
<tr>
<td class="titledesc"><?php _e('Type', 'woothemes') ?>:</td>
<td class="forminp">
<select name="woocommerce_flat_rate_type" id="woocommerce_flat_rate_type" style="min-width:100px;">
<option value="order" <?php if (get_option('woocommerce_flat_rate_type') == 'order') echo 'selected="selected"'; ?>><?php _e('Per Order', 'woothemes'); ?></option>
<option value="item" <?php if (get_option('woocommerce_flat_rate_type') == 'item') echo 'selected="selected"'; ?>><?php _e('Per Item', 'woothemes'); ?></option>
</select>
</td>
</tr>
<?php $_tax = new woocommerce_tax(); ?>
<tr>
<td class="titledesc"><?php _e('Tax Status', 'woothemes') ?>:</td>
<td class="forminp">
<select name="woocommerce_flat_rate_tax_status">
<option value="taxable" <?php if (get_option('woocommerce_flat_rate_tax_status')=='taxable') echo 'selected="selected"'; ?>><?php _e('Taxable', 'woothemes'); ?></option>
<option value="none" <?php if (get_option('woocommerce_flat_rate_tax_status')=='none') echo 'selected="selected"'; ?>><?php _e('None', 'woothemes'); ?></option>
</select>
</td>
</tr>
<tr>
<td class="titledesc"><a href="#" tip="<?php _e('Cost excluding tax. Enter an amount, e.g. 2.50.', 'woothemes') ?>" class="tips" tabindex="99"></a><?php _e('Cost', 'woothemes') ?>:</td>
<td class="forminp">
<input type="text" name="woocommerce_flat_rate_cost" id="woocommerce_flat_rate_cost" style="min-width:50px;" value="<?php if ($value = get_option('woocommerce_flat_rate_cost')) echo $value; ?>" />
</td>
</tr>
<tr>
<td class="titledesc"><a href="#" tip="<?php _e('Fee excluding tax. Enter an amount, e.g. 2.50, or a percentage, e.g. 5%. Leave blank to disable.', 'woothemes') ?>" class="tips" tabindex="99"></a><?php _e('Handling Fee', 'woothemes') ?>:</td>
<td class="forminp">
<input type="text" name="woocommerce_flat_rate_handling_fee" id="woocommerce_flat_rate_handling_fee" style="min-width:50px;" value="<?php if ($value = get_option('woocommerce_flat_rate_handling_fee')) echo $value; ?>" />
</td>
</tr>
<tr>
<td class="titledesc"><?php _e('Method available for', 'woothemes') ?>:</td>
<td class="forminp">
<select name="woocommerce_flat_rate_availability" id="woocommerce_flat_rate_availability" style="min-width:100px;">
<option value="all" <?php if (get_option('woocommerce_flat_rate_availability') == 'all') echo 'selected="selected"'; ?>><?php _e('All allowed countries', 'woothemes'); ?></option>
<option value="specific" <?php if (get_option('woocommerce_flat_rate_availability') == 'specific') echo 'selected="selected"'; ?>><?php _e('Specific Countries', 'woothemes'); ?></option>
</select>
</td>
</tr>
<?php
$countries = woocommerce_countries::$countries;
asort($countries);
$selections = get_option('woocommerce_flat_rate_countries', array());
?><tr class="multi_select_countries">
<td class="titledesc"><?php _e('Specific Countries', 'woothemes'); ?>:</td>
<td class="forminp">
<div class="multi_select_countries"><ul><?php
if ($countries) foreach ($countries as $key=>$val) :
echo '<li><label><input type="checkbox" name="woocommerce_flat_rate_countries[]" value="'. $key .'" ';
if (in_array($key, $selections)) echo 'checked="checked"';
echo ' />'. __($val, 'woothemes') .'</label></li>';
endforeach;
?></ul></div>
</td>
</tr>
<script type="text/javascript">
jQuery(function() {
jQuery('select#woocommerce_flat_rate_availability').change(function(){
if (jQuery(this).val()=="specific") {
jQuery(this).parent().parent().next('tr.multi_select_countries').show();
} else {
jQuery(this).parent().parent().next('tr.multi_select_countries').hide();
}
}).change();
});
</script>
<?php
}
public function process_admin_options() {
if(isset($_POST['woocommerce_flat_rate_tax_status'])) update_option('woocommerce_flat_rate_tax_status', woocommerce_clean($_POST['woocommerce_flat_rate_tax_status'])); else @delete_option('woocommerce_flat_rate_tax_status');
if(isset($_POST['woocommerce_flat_rate_enabled'])) update_option('woocommerce_flat_rate_enabled', woocommerce_clean($_POST['woocommerce_flat_rate_enabled'])); else @delete_option('woocommerce_flat_rate_enabled');
if(isset($_POST['woocommerce_flat_rate_title'])) update_option('woocommerce_flat_rate_title', woocommerce_clean($_POST['woocommerce_flat_rate_title'])); else @delete_option('woocommerce_flat_rate_title');
if(isset($_POST['woocommerce_flat_rate_type'])) update_option('woocommerce_flat_rate_type', woocommerce_clean($_POST['woocommerce_flat_rate_type'])); else @delete_option('woocommerce_flat_rate_type');
if(isset($_POST['woocommerce_flat_rate_cost'])) update_option('woocommerce_flat_rate_cost', woocommerce_clean($_POST['woocommerce_flat_rate_cost'])); else @delete_option('woocommerce_flat_rate_cost');
if(isset($_POST['woocommerce_flat_rate_handling_fee'])) update_option('woocommerce_flat_rate_handling_fee', woocommerce_clean($_POST['woocommerce_flat_rate_handling_fee'])); else @delete_option('woocommerce_flat_rate_handling_fee');
if(isset($_POST['woocommerce_flat_rate_availability'])) update_option('woocommerce_flat_rate_availability', woocommerce_clean($_POST['woocommerce_flat_rate_availability'])); else @delete_option('woocommerce_flat_rate_availability');
if (isset($_POST['woocommerce_flat_rate_countries'])) $selected_countries = $_POST['woocommerce_flat_rate_countries']; else $selected_countries = array();
update_option('woocommerce_flat_rate_countries', $selected_countries);
}
}
function add_flat_rate_method( $methods ) {
$methods[] = 'flat_rate'; return $methods;
}
add_filter('woocommerce_shipping_methods', 'add_flat_rate_method' );

View File

@ -0,0 +1,116 @@
<?php
/**
* Free Shipping Method
*
* A simple shipping method for free shipping
*
* @class free_shipping
* @package WooCommerce
* @category Shipping
* @author WooThemes
*/
class free_shipping extends woocommerce_shipping_method {
public function __construct() {
$this->id = 'free_shipping';
$this->enabled = get_option('woocommerce_free_shipping_enabled');
$this->title = get_option('woocommerce_free_shipping_title');
$this->min_amount = get_option('woocommerce_free_shipping_minimum_amount');
$this->availability = get_option('woocommerce_free_shipping_availability');
$this->countries = get_option('woocommerce_free_shipping_countries');
if (isset($_SESSION['_chosen_method_id']) && $_SESSION['_chosen_method_id']==$this->id) $this->chosen = true;
add_action('woocommerce_update_options', array(&$this, 'process_admin_options'));
add_option('woocommerce_free_shipping_availability', 'all');
add_option('woocommerce_free_shipping_title', 'Free Shipping');
}
public function calculate_shipping() {
$this->shipping_total = 0;
$this->shipping_tax = 0;
$this->shipping_label = $this->title;
}
public function admin_options() {
?>
<thead><tr><th scope="col" width="200px"><?php _e('Free Shipping', 'woothemes'); ?></th><th scope="col" class="desc">&nbsp;</th></tr></thead>
<tr>
<td class="titledesc"><?php _e('Enable Free Shipping', 'woothemes') ?>:</td>
<td class="forminp">
<select name="woocommerce_free_shipping_enabled" id="woocommerce_free_shipping_enabled" style="min-width:100px;">
<option value="yes" <?php if (get_option('woocommerce_free_shipping_enabled') == 'yes') echo 'selected="selected"'; ?>><?php _e('Yes', 'woothemes'); ?></option>
<option value="no" <?php if (get_option('woocommerce_free_shipping_enabled') == 'no') echo 'selected="selected"'; ?>><?php _e('No', 'woothemes'); ?></option>
</select>
</td>
</tr>
<tr>
<td class="titledesc"><a href="#" tip="<?php _e('This controls the title which the user sees during checkout.', 'woothemes') ?>" class="tips" tabindex="99"></a><?php _e('Method Title', 'woothemes') ?>:</td>
<td class="forminp">
<input type="text" name="woocommerce_free_shipping_title" id="woocommerce_free_shipping_title" style="min-width:50px;" value="<?php if ($value = get_option('woocommerce_free_shipping_title')) echo $value; else echo 'Free Shipping'; ?>" />
</td>
</tr>
<tr>
<td class="titledesc"><a href="#" tip="<?php _e('Users will need to spend this amount to get free shipping. Leave blank to disable.', 'woothemes') ?>" class="tips" tabindex="99"></a><?php _e('Minimum Order Amount', 'woothemes') ?>:</td>
<td class="forminp">
<input type="text" name="woocommerce_free_shipping_minimum_amount" id="woocommerce_free_shipping_minimum_amount" style="min-width:50px;" value="<?php if ($value = get_option('woocommerce_free_shipping_minimum_amount')) echo $value; else echo 'Free Shipping'; ?>" />
</td>
</tr>
<tr>
<td class="titledesc"><?php _e('Method available for', 'woothemes') ?>:</td>
<td class="forminp">
<select name="woocommerce_free_shipping_availability" id="woocommerce_free_shipping_availability" style="min-width:100px;">
<option value="all" <?php if (get_option('woocommerce_free_shipping_availability') == 'all') echo 'selected="selected"'; ?>><?php _e('All allowed countries', 'woothemes'); ?></option>
<option value="specific" <?php if (get_option('woocommerce_free_shipping_availability') == 'specific') echo 'selected="selected"'; ?>><?php _e('Specific Countries', 'woothemes'); ?></option>
</select>
</td>
</tr>
<?php
$countries = woocommerce_countries::$countries;
$selections = get_option('woocommerce_free_shipping_countries', array());
?><tr class="multi_select_countries">
<td class="titledesc"><?php _e('Specific Countries', 'woothemes'); ?>:</td>
<td class="forminp">
<div class="multi_select_countries"><ul><?php
if ($countries) foreach ($countries as $key=>$val) :
echo '<li><label><input type="checkbox" name="woocommerce_free_shipping_countries[]" value="'. $key .'" ';
if (in_array($key, $selections)) echo 'checked="checked"';
echo ' />'. __($val, 'woothemes') .'</label></li>';
endforeach;
?></ul></div>
</td>
</tr>
<script type="text/javascript">
jQuery(function() {
jQuery('select#woocommerce_free_shipping_availability').change(function(){
if (jQuery(this).val()=="specific") {
jQuery(this).parent().parent().next('tr.multi_select_countries').show();
} else {
jQuery(this).parent().parent().next('tr.multi_select_countries').hide();
}
}).change();
});
</script>
<?php
}
public function process_admin_options() {
if(isset($_POST['woocommerce_free_shipping_enabled'])) update_option('woocommerce_free_shipping_enabled', woocommerce_clean($_POST['woocommerce_free_shipping_enabled'])); else @delete_option('woocommerce_free_shipping_enabled');
if(isset($_POST['woocommerce_free_shipping_title'])) update_option('woocommerce_free_shipping_title', woocommerce_clean($_POST['woocommerce_free_shipping_title'])); else @delete_option('woocommerce_free_shipping_title');
if(isset($_POST['woocommerce_free_shipping_minimum_amount'])) update_option('woocommerce_free_shipping_minimum_amount', woocommerce_clean($_POST['woocommerce_free_shipping_minimum_amount'])); else @delete_option('woocommerce_free_shipping_minimum_amount');
if(isset($_POST['woocommerce_free_shipping_availability'])) update_option('woocommerce_free_shipping_availability', woocommerce_clean($_POST['woocommerce_free_shipping_availability'])); else @delete_option('woocommerce_free_shipping_availability');
if (isset($_POST['woocommerce_free_shipping_countries'])) $selected_countries = $_POST['woocommerce_free_shipping_countries']; else $selected_countries = array();
update_option('woocommerce_free_shipping_countries', $selected_countries);
}
}
function add_free_shipping_method( $methods ) {
$methods[] = 'free_shipping'; return $methods;
}
add_filter('woocommerce_shipping_methods', 'add_free_shipping_method' );

View File

@ -1,5 +1,15 @@
<?php
class jigoshop_shipping {
<?php
/**
* WooCommerce Shipping Class
*
* Handles shipping and loads shipping methods via hooks.
*
* @class woocommerce_shipping
* @package WooCommerce
* @category Shipping
* @author WooThemes
*/
class woocommerce_shipping {
private static $_instance;
@ -12,11 +22,11 @@ class jigoshop_shipping {
public static function init() {
if (get_option('jigoshop_calc_shipping')!='no') self::$enabled = true;
if (get_option('woocommerce_calc_shipping')!='no') self::$enabled = true;
do_action('jigoshop_shipping_init');
do_action('woocommerce_shipping_init');
$load_methods = apply_filters('jigoshop_shipping_methods', array());
$load_methods = apply_filters('woocommerce_shipping_methods', array());
foreach ($load_methods as $method) :

View File

@ -1,5 +1,15 @@
<?php
class jigoshop_shipping_method {
/**
* WooCommerce Shipping Method Class
*
* Extended by shipping methods to handle shipping calculations etc.
*
* @class woocommerce_shipping_method
* @package WooCommerce
* @category Shipping
* @author WooThemes
*/
class woocommerce_shipping_method {
var $id;
var $title;
@ -18,20 +28,20 @@ class jigoshop_shipping_method {
if ($this->enabled=="no") return false;
if (isset(jigoshop_cart::$cart_contents_total) && isset($this->min_amount) && $this->min_amount && $this->min_amount > jigoshop_cart::$cart_contents_total) return false;
if (isset(woocommerce_cart::$cart_contents_total) && isset($this->min_amount) && $this->min_amount && $this->min_amount > woocommerce_cart::$cart_contents_total) return false;
$ship_to_countries = '';
if ($this->availability == 'specific') :
$ship_to_countries = $this->countries;
else :
if (get_option('jigoshop_allowed_countries')=='specific') :
$ship_to_countries = get_option('jigoshop_specific_allowed_countries');
if (get_option('woocommerce_allowed_countries')=='specific') :
$ship_to_countries = get_option('woocommerce_specific_allowed_countries');
endif;
endif;
if (is_array($ship_to_countries)) :
if (!in_array(jigoshop_customer::get_shipping_country(), $ship_to_countries)) return false;
if (!in_array(woocommerce_customer::get_shipping_country(), $ship_to_countries)) return false;
endif;
return true;

View File

@ -1,14 +1,14 @@
<?php
/**
* Contains tax calculations
* Performs tax calculations
*
* @package JigoShop
* @category Tax
* @author Jigowatt
* @since 1.0
* @class woocommerce_tax
* @package WooCommerce
* @category Class
* @author WooThemes
*/
class jigoshop_tax {
class woocommerce_tax {
var $total;
var $rates;
@ -18,7 +18,7 @@ class jigoshop_tax {
*
* @return array
*/
function jigoshop_tax() {
function woocommerce_tax() {
$this->rates = $this->get_tax_rates();
}
@ -28,7 +28,7 @@ class jigoshop_tax {
* @return array
*/
function get_tax_classes() {
$classes = get_option('jigoshop_tax_classes');
$classes = get_option('woocommerce_tax_classes');
$classes = explode("\n", $classes);
$classes = array_map('trim', $classes);
$classes_array = array();
@ -44,7 +44,7 @@ class jigoshop_tax {
* @return array
*/
function get_tax_rates() {
$tax_rates = get_option('jigoshop_tax_rates');
$tax_rates = get_option('woocommerce_tax_rates');
$tax_rates_array = array();
if ($tax_rates && is_array($tax_rates) && sizeof($tax_rates)>0) foreach( $tax_rates as $rate ) :
if ($rate['class']) :
@ -100,10 +100,10 @@ class jigoshop_tax {
function get_rate( $tax_class = '' ) {
/* Checkout uses customer location, otherwise use store base rate */
if ( defined('JIGOSHOP_CHECKOUT') && JIGOSHOP_CHECKOUT ) :
if ( defined('WOOCOMMERCE_CHECKOUT') && WOOCOMMERCE_CHECKOUT ) :
$country = jigoshop_customer::get_country();
$state = jigoshop_customer::get_state();
$country = woocommerce_customer::get_country();
$state = woocommerce_customer::get_state();
$rate = $this->find_rate( $country, $state, $tax_class );
@ -125,8 +125,8 @@ class jigoshop_tax {
*/
function get_shop_base_rate( $tax_class = '' ) {
$country = jigoshop_countries::get_base_country();
$state = jigoshop_countries::get_base_state();
$country = woocommerce_countries::get_base_country();
$state = woocommerce_countries::get_base_state();
$rate = $this->find_rate( $country, $state, $tax_class );
@ -142,12 +142,12 @@ class jigoshop_tax {
*/
function get_shipping_tax_rate( $tax_class = '' ) {
if (defined('JIGOSHOP_CHECKOUT') && JIGOSHOP_CHECKOUT) :
$country = jigoshop_customer::get_country();
$state = jigoshop_customer::get_state();
if (defined('WOOCOMMERCE_CHECKOUT') && WOOCOMMERCE_CHECKOUT) :
$country = woocommerce_customer::get_country();
$state = woocommerce_customer::get_state();
else :
$country = jigoshop_countries::get_base_country();
$state = jigoshop_countries::get_base_state();
$country = woocommerce_countries::get_base_country();
$state = woocommerce_countries::get_base_state();
endif;
// If we are here then shipping is taxable - work it out
@ -173,7 +173,7 @@ class jigoshop_tax {
$found_shipping_rates = array();
// Loop cart and find the highest tax band
if (sizeof(jigoshop_cart::$cart_contents)>0) : foreach (jigoshop_cart::$cart_contents as $item) :
if (sizeof(woocommerce_cart::$cart_contents)>0) : foreach (woocommerce_cart::$cart_contents as $item) :
if ($item['data']->data['tax_class']) :

View File

@ -2,13 +2,13 @@
/**
* Contains Validation functions
*
* @package JigoShop
* @category Validation
* @author Jigowatt
* @since 1.0
* @class woocommerce_validation
* @package WooCommerce
* @category Class
* @author WooThemes
*/
class jigoshop_validation {
class woocommerce_validation {
/**
* Validates an email using wordpress native is_email function

View File

@ -1,14 +1,13 @@
<?php
/**
* Contains the main functions for jigoshop, stores variables, and handles error messages
* Contains the main functions for WooCommerce, stores variables, and handles error messages
*
*
* @package JigoShop
* @category Core
* @author Jigowatt
* @since 1.0
* @class woocommerce
* @package WooCommerce
* @category Class
* @author WooThemes
*/
class jigoshop {
class woocommerce {
private static $_instance;
private static $_cache;
@ -34,7 +33,7 @@ class jigoshop {
global $wpdb;
// Vars
self::$attribute_taxonomies = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."jigoshop_attribute_taxonomies;");
self::$attribute_taxonomies = $wpdb->get_results("SELECT * FROM ".$wpdb->prefix."woocommerce_attribute_taxonomies;");
if (isset($_SESSION['errors'])) self::$errors = $_SESSION['errors'];
if (isset($_SESSION['messages'])) self::$messages = $_SESSION['messages'];
@ -93,7 +92,7 @@ class jigoshop {
/**
* Get a var
*
* Variable is filtered by jigoshop_get_var_{var name}
* Variable is filtered by woocommerce_get_var_{var name}
*
* @param string var
* @return string variable
@ -101,7 +100,7 @@ class jigoshop {
public static function get_var($var) {
$return = '';
switch ($var) :
case "version" : $return = JIGOSHOP_VERSION; break;
case "version" : $return = WOOCOMMERCE_VERSION; break;
case "shop_small_w" : $return = self::SHOP_SMALL_W; break;
case "shop_small_h" : $return = self::SHOP_SMALL_H; break;
case "shop_tiny_w" : $return = self::SHOP_TINY_W; break;
@ -111,7 +110,7 @@ class jigoshop {
case "shop_large_w" : $return = self::SHOP_LARGE_W; break;
case "shop_large_h" : $return = self::SHOP_LARGE_H; break;
endswitch;
return apply_filters( 'jigoshop_get_var_'.$var, $return );
return apply_filters( 'woocommerce_get_var_'.$var, $return );
}
/**
@ -157,11 +156,11 @@ class jigoshop {
public static function show_messages() {
if (isset(self::$errors) && sizeof(self::$errors)>0) :
echo '<div class="jigoshop_error">'.self::$errors[0].'</div>';
echo '<div class="woocommerce_error">'.self::$errors[0].'</div>';
self::clear_messages();
return true;
elseif (isset(self::$messages) && sizeof(self::$messages)>0) :
echo '<div class="jigoshop_message">'.self::$messages[0].'</div>';
echo '<div class="woocommerce_message">'.self::$messages[0].'</div>';
self::clear_messages();
return true;
else :
@ -172,7 +171,7 @@ class jigoshop {
public static function nonce_field ($action, $referer = true , $echo = true) {
$name = '_n';
$action = 'jigoshop-' . $action;
$action = 'woocommerce-' . $action;
return wp_nonce_field($action, $name, $referer, $echo);
@ -181,14 +180,14 @@ class jigoshop {
public static function nonce_url ($action, $url = '') {
$name = '_n';
$action = 'jigoshop-' . $action;
$action = 'woocommerce-' . $action;
$url = add_query_arg( $name, wp_create_nonce( $action ), $url);
return $url;
}
/**
* Check a nonce and sets jigoshop error in case it is invalid
* Check a nonce and sets woocommerce error in case it is invalid
* To fail silently, set the error_message to an empty string
*
* @param string $name the nonce name
@ -201,9 +200,9 @@ class jigoshop {
public static function verify_nonce($action, $method='_POST', $error_message = false) {
$name = '_n';
$action = 'jigoshop-' . $action;
$action = 'woocommerce-' . $action;
if( $error_message === false ) $error_message = __('Action failed. Please refresh the page and retry.', 'jigoshop');
if( $error_message === false ) $error_message = __('Action failed. Please refresh the page and retry.', 'woothemes');
if(!in_array($method, array('_GET', '_POST', '_REQUEST'))) $method = '_POST';
@ -215,7 +214,7 @@ class jigoshop {
if ( isset($_REQUEST[$name]) && wp_verify_nonce($_REQUEST[$name], $action) ) return true;
if( $error_message ) jigoshop::add_error( $error_message );
if( $error_message ) woocommerce::add_error( $error_message );
return false;
@ -235,11 +234,11 @@ class jigoshop {
}
static public function shortcode_wrapper ($function, $atts=array()) {
if( $content = jigoshop::cache_get( $function . '-shortcode', $atts ) ) return $content;
if( $content = woocommerce::cache_get( $function . '-shortcode', $atts ) ) return $content;
ob_start();
call_user_func($function, $atts);
return jigoshop::cache( $function . '-shortcode', ob_get_clean(), $atts);
return woocommerce::cache( $function . '-shortcode', ob_get_clean(), $atts);
}
/**

View File

@ -1,108 +0,0 @@
<?php
/*
Provides a Cheque Payment Gateway for testing purposes.
Created by Andrew Benbow (andrew@chromeorange.co.uk)
*/
class jigoshop_cheque extends jigoshop_payment_gateway {
public function __construct() {
$this->id = 'cheque';
$this->icon = '';
$this->has_fields = false;
$this->enabled = get_option('jigoshop_cheque_enabled');
$this->title = get_option('jigoshop_cheque_title');
$this->description = get_option('jigoshop_cheque_description');
add_action('jigoshop_update_options', array(&$this, 'process_admin_options'));
add_option('jigoshop_cheque_enabled', 'yes');
add_option('jigoshop_cheque_title', __('Cheque Payment', 'jigoshop') );
add_option('jigoshop_cheque_description', __('Please send your cheque to Store Name, Store Street, Store Town, Store State / County, Store Postcode.', 'jigoshop'));
add_action('thankyou_cheque', array(&$this, 'thankyou_page'));
}
/**
* Admin Panel Options
* - Options for bits like 'title' and availability on a country-by-country basis
**/
public function admin_options() {
?>
<thead><tr><th scope="col" width="200px"><?php _e('Cheque Payment', 'jigoshop'); ?></th><th scope="col" class="desc"><?php _e('Allows cheque payments. Why would you take cheques in this day and age? Well you probably wouldn\'t but it does allow you to make test purchases without having to use the sandbox area of a payment gateway which is useful for demonstrating to clients and for testing order emails and the \'success\' pages etc.', 'jigoshop'); ?></th></tr></thead>
<tr>
<td class="titledesc"><?php _e('Enable Cheque Payment', 'jigoshop') ?>:</td>
<td class="forminp">
<select name="jigoshop_cheque_enabled" id="jigoshop_cheque_enabled" style="min-width:100px;">
<option value="yes" <?php if (get_option('jigoshop_cheque_enabled') == 'yes') echo 'selected="selected"'; ?>><?php _e('Yes', 'jigoshop'); ?></option>
<option value="no" <?php if (get_option('jigoshop_cheque_enabled') == 'no') echo 'selected="selected"'; ?>><?php _e('No', 'jigoshop'); ?></option>
</select>
</td>
</tr>
<tr>
<td class="titledesc"><a href="#" tip="<?php _e('This controls the title which the user sees during checkout.','jigoshop') ?>" class="tips" tabindex="99"></a><?php _e('Method Title', 'jigoshop') ?>:</td>
<td class="forminp">
<input class="input-text" type="text" name="jigoshop_cheque_title" id="jigoshop_cheque_title" value="<?php if ($value = get_option('jigoshop_cheque_title')) echo $value; else echo 'Cheque Payment'; ?>" />
</td>
</tr>
<tr>
<td class="titledesc"><a href="#" tip="<?php _e('Let the customer know the payee and where they should be sending the cheque too and that their order won\'t be shipping until you receive it.','jigoshop') ?>" class="tips" tabindex="99"></a><?php _e('Customer Message', 'jigoshop') ?>:</td>
<td class="forminp">
<input class="input-text wide-input" type="text" name="jigoshop_cheque_description" id="jigoshop_cheque_description" value="<?php if ($value = get_option('jigoshop_cheque_description')) echo $value; ?>" />
</td>
</tr>
<?php
}
/**
* There are no payment fields for cheques, but we want to show the description if set.
**/
function payment_fields() {
if ($this->description) echo wpautop(wptexturize($this->description));
}
function thankyou_page() {
if ($this->description) echo wpautop(wptexturize($this->description));
}
/**
* Admin Panel Options Processing
* - Saves the options to the DB
**/
public function process_admin_options() {
if(isset($_POST['jigoshop_cheque_enabled'])) update_option('jigoshop_cheque_enabled', jigowatt_clean($_POST['jigoshop_cheque_enabled'])); else @delete_option('jigoshop_cheque_enabled');
if(isset($_POST['jigoshop_cheque_title'])) update_option('jigoshop_cheque_title', jigowatt_clean($_POST['jigoshop_cheque_title'])); else @delete_option('jigoshop_cheque_title');
if(isset($_POST['jigoshop_cheque_description'])) update_option('jigoshop_cheque_description', jigowatt_clean($_POST['jigoshop_cheque_description'])); else @delete_option('jigoshop_cheque_description');
}
/**
* Process the payment and return the result
**/
function process_payment( $order_id ) {
$order = &new jigoshop_order( $order_id );
// Mark as on-hold (we're awaiting the cheque)
$order->update_status('on-hold', __('Awaiting cheque payment', 'jigoshop'));
// Remove cart
jigoshop_cart::empty_cart();
// Return thankyou redirect
return array(
'result' => 'success',
'redirect' => add_query_arg('key', $order->order_key, add_query_arg('order', $order_id, get_permalink(get_option('jigoshop_thanks_page_id'))))
);
}
}
/**
* Add the gateway to JigoShop
**/
function add_cheque_gateway( $methods ) {
$methods[] = 'jigoshop_cheque'; return $methods;
}
add_filter('jigoshop_payment_gateways', 'add_cheque_gateway' );

View File

@ -1,300 +0,0 @@
<?php
/** Skrill Gateway **/
class skrill extends jigoshop_payment_gateway {
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'));
}
/**
* Admin Panel Options
* - Options for bits like 'title' and availability on a country-by-country basis
**/
public function admin_options() {
?>
<thead><tr><th scope="col" width="200px"><?php _e('Skrill (Moneybookers)', 'jigoshop'); ?></th><th scope="col" class="desc"><?php _e('Skrill works by using an iFrame to submit payment information securely to Moneybookers.', 'jigoshop'); ?></th></tr></thead>
<tr>
<td class="titledesc"><?php _e('Enable Skrill', 'jigoshop') ?>:</td>
<td class="forminp">
<select name="jigoshop_skrill_enabled" id="jigoshop_skrill_enabled" style="min-width:100px;">
<option value="yes" <?php if (get_option('jigoshop_skrill_enabled') == 'yes') echo 'selected="selected"'; ?>><?php _e('Yes', 'jigoshop'); ?></option>
<option value="no" <?php if (get_option('jigoshop_skrill_enabled') == 'no') echo 'selected="selected"'; ?>><?php _e('No', 'jigoshop'); ?></option>
</select>
</td>
</tr>
<tr>
<td class="titledesc"><a href="#" tip="<?php _e('This controls the title which the user sees during checkout.','jigoshop') ?>" class="tips" tabindex="99"></a><?php _e('Method Title', 'jigoshop') ?>:</td>
<td class="forminp">
<input class="input-text" type="text" name="jigoshop_skrill_title" id="jigoshop_skrill_title" style="min-width:50px;" value="<?php if ($value = get_option('jigoshop_skrill_title')) echo $value; else echo 'skrill'; ?>" />
</td>
</tr>
<tr>
<td class="titledesc"><a href="#" tip="<?php _e('Please enter your skrill email address; this is needed in order to take payment!','jigoshop') ?>" class="tips" tabindex="99"></a><?php _e('Skrill merchant e-mail', 'jigoshop') ?>:</td>
<td class="forminp">
<input class="input-text" type="text" name="jigoshop_skrill_email" id="jigoshop_skrill_email" style="min-width:50px;" value="<?php if ($value = get_option('jigoshop_skrill_email')) echo $value; ?>" />
</td>
</tr>
<tr>
<td class="titledesc"><a href="#" tip="<?php _e('Please enter your skrill secretword; this is needed in order to take payment!','jigoshop') ?>" class="tips" tabindex="99"></a><?php _e('Skrill Secret Word', 'jigoshop') ?>:</td>
<td class="forminp">
<input class="input-text" type="text" name="jigoshop_skrill_secret_word" id="jigoshop_skrill_secret_word" style="min-width:50px;" value="<?php if ($value = get_option('jigoshop_skrill_secret_word')) echo $value; ?>" />
</td>
</tr>
<tr>
<td class="titledesc"><a href="#" tip="<?php _e('Please enter your skrill Customer ID; this is needed in order to take payment!','jigoshop') ?>" class="tips" tabindex="99"></a><?php _e('Skrill Customer ID', 'jigoshop') ?>:</td>
<td class="forminp">
<input class="input-text" type="text" name="jigoshop_skrill_customer_id" id="jigoshop_skrill_customer_id" style="min-width:50px;" value="<?php if ($value = get_option('jigoshop_skrill_customer_id')) echo $value; ?>" />
</td>
</tr>
<?php
}
/**
* Admin Panel Options Processing
* - Saves the options to the DB
**/
public function process_admin_options() {
if(isset($_POST['jigoshop_skrill_enabled'])) update_option('jigoshop_skrill_enabled', jigowatt_clean($_POST['jigoshop_skrill_enabled'])); else @delete_option('jigoshop_skrill_enabled');
if(isset($_POST['jigoshop_skrill_title'])) update_option('jigoshop_skrill_title', jigowatt_clean($_POST['jigoshop_skrill_title'])); else @delete_option('jigoshop_skrill_title');
if(isset($_POST['jigoshop_skrill_email'])) update_option('jigoshop_skrill_email', jigowatt_clean($_POST['jigoshop_skrill_email'])); else @delete_option('jigoshop_skrill_email');
if(isset($_POST['jigoshop_skrill_secret_word'])) update_option('jigoshop_skrill_secret_word', jigowatt_clean($_POST['jigoshop_skrill_secret_word'])); else @delete_option('jigoshop_skrill_secret_word');
if(isset($_POST['jigoshop_skrill_customer_id'])) update_option('jigoshop_skrill_customer_id', jigowatt_clean($_POST['jigoshop_skrill_customer_id'])); else @delete_option('jigoshop_skrill_customer_id');
}
/**
* Generate the skrill button link
**/
public function generate_skrill_form() {
$order_id = $_GET['orderId'];
$order = &new jigoshop_order( $order_id );
$skrill_adr = 'https://www.moneybookers.com/app/payment.pl';
$shipping_name = explode(' ', $order->shipping_method);
$order_total = trim($order->order_total, 0);
if( substr($order_total, -1) == '.' ) $order_total = str_replace('.', '', $order_total);
$skrill_args = array(
'merchant_fields' => 'partner',
'partner' => '21890813',
'pay_to_email' => $this->email,
'recipient_description' => get_bloginfo('name'),
'transaction_id' => $order_id,
'return_url' => get_permalink(get_option('jigoshop_thanks_page_id')),
'return_url_text' => 'Return to Merchant',
'new_window_redirect' => 0,
'rid' => 20521479,
'prepare_only' => 0,
'return_url_target' => 1,
'cancel_url' => trailingslashit(get_bloginfo('wpurl')).'?skrillListener=skrill_cancel',
'cancel_url_target' => 1,
'status_url' => trailingslashit(get_bloginfo('wpurl')).'?skrillListener=skrill_status',
'dynamic_descriptor' => 'Description',
'language' => 'EN',
'hide_login' => 1,
'confirmation_note' => 'Thank you for your custom',
'pay_from_email' => $order->billing_email,
//'title' => 'Mr',
'firstname' => $order->billing_first_name,
'lastname' => $order->billing_last_name,
'address' => $order->billing_address_1,
'address2' => $order->billing_address_2,
'phone_number' => $order->billing_phone,
'postal_code' => $order->billing_postcode,
'city' => $order->billing_city,
'state' => $order->billing_state,
'country' => 'GBR',
'amount' => $order_total,
'currency' => get_option('jigoshop_currency'),
'detail1_description' => 'Order ID',
'detail1_text'=> $order_id
);
// 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++;
$skrill_args['item_name_'.$item_loop] = $_product->get_title();
$skrill_args['quantity_'.$item_loop] = $item['qty'];
$skrill_args['amount_'.$item_loop] = $_product->get_price_excluding_tax();
endif;
endforeach; endif;
// Shipping Cost
$item_loop++;
$skrill_args['item_name_'.$item_loop] = __('Shipping cost', 'jigoshop');
$skrill_args['quantity_'.$item_loop] = '1';
$skrill_args['amount_'.$item_loop] = number_format($order->order_shipping, 2);
$skrill_args_array = array();
foreach ($skrill_args as $key => $value) {
$skrill_args_array[] = '<input type="hidden" name="'.$key.'" value="'.$value.'" />';
}
// Skirll MD5 concatenation
$skrill_md = get_option('jigoshop_skrill_customer_id') . $skrill_args['transaction_id'] . strtoupper(md5(get_option('jigoshop_skrill_secret_word'))) . $order_total . get_option('jigoshop_currency') . '2';
$skrill_md = md5($skrill_md);
add_post_meta($order_id, '_skrillmd', $skrill_md);
echo '<form name="moneybookers" id="moneybookers_place_form" action="'.$skrill_adr.'" method="POST">' . implode('', $skrill_args_array) . '</form>';
echo '<script type="text/javascript">
//<![CDATA[
var paymentform = document.getElementById(\'moneybookers_place_form\');
window.onload = paymentform.submit();
//]]>
</script>';
exit();
}
/**
* Process the payment and return the result
**/
function process_payment( $order_id ) {
$order = &new jigoshop_order( $order_id );
return array(
'result' => 'success',
'redirect' => add_query_arg('order', $order->id, add_query_arg('key', $order->order_key, get_permalink(get_option('jigoshop_pay_page_id'))))
);
}
/**
* receipt_page
**/
function receipt_skrill( $order ) {
echo '<p>'.__('Thank you for your order, please complete the secure (SSL) form below to pay with Skrill.', 'jigoshop').'</p>';
echo '<iframe class="skrill-loader" width="100%" height="700" id="2" src ="'.home_url('?skrillPayment=1&orderId='.$order).'">';
echo '<p>Your browser does not support iFrames, please contact us to place an order.</p>';
echo '</iframe>';
}
/**
* Check Skrill status report validity
**/
function check_status_report_is_valid() {
// Get Skrill post data array
$params = $_POST;
if(!isset($params['transaction_id'])) return false;
$order_id = $params['transaction_id'];
$_skrillmd = strtoupper(get_post_meta($order_id, '_skrillmd', true));
// Check MD5 signiture
if($params['md5sig'] == $_skrillmd) return true;
return false;
}
/**
* Check for Skrill Status Response
**/
function check_status_response() {
if (isset($_GET['skrillListener']) && $_GET['skrillListener'] == 'skrill_status'):
$_POST = stripslashes_deep($_POST);
if (self::check_status_report_is_valid()) :
do_action("valid-skrill-status-report", $_POST);
endif;
endif;
}
/**
* Successful Payment!
**/
function successful_request( $posted ) {
// Custom holds post ID
if ( !empty($posted['mb_transaction_id']) ) {
$order = new jigoshop_order( (int) $posted['transaction_id'] );
if ($order->status !== 'completed') :
// We are here so lets check status and do actions
switch ($posted['status']) :
case '2' : // Processed
$order->add_order_note( __('Skrill payment completed', 'jigoshop') );
$order->payment_complete();
break;
case '0' : // Pending
case '-2' : // Failed
$order->update_status('on-hold', sprintf(__('Skrill payment failed (%s)', 'jigoshop'), strtolower(sanitize($posted['status'])) ) );
break;
case '-1' : // Cancelled
$order->update_status('cancelled', __('Skrill payment cancelled', 'jigoshop'));
break;
default:
$order->update_status('cancelled', __('Skrill exception', 'jigoshop'));
break;
endswitch;
endif;
exit;
}
}
}
/** Add the gateway to JigoShop **/
function add_skrill_gateway( $methods ) {
$methods[] = 'skrill'; return $methods;
}
add_filter('jigoshop_payment_gateways', 'add_skrill_gateway' );

Binary file not shown.

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

Binary file not shown.

File diff suppressed because it is too large Load Diff

Some files were not shown because too many files have changed in this diff Show More