Permalink
Browse files

Updated to version 1.1

  • Loading branch information...
1 parent c0307a3 commit 525359ac25962b286b91d3118b9b4d0f1d4c5104 Rob Rhoades committed Feb 13, 2012
Showing with 33,336 additions and 9,246 deletions.
  1. +21 −2 .gitignore
  2. +1 −1 LICENSE.md
  3. +29 −36 README.md
  4. +91 −71 admin/jigoshop-admin-attributes.php
  5. +121 −121 admin/jigoshop-admin-dashboard.php
  6. +14 −10 admin/jigoshop-admin-help.php
  7. +91 −55 admin/jigoshop-admin-post-types.php
  8. +101 −102 admin/jigoshop-admin-settings-options.php
  9. +61 −49 admin/jigoshop-admin-settings.php
  10. +61 −57 admin/jigoshop-admin.php
  11. +64 −47 admin/jigoshop-install.php
  12. +30 −30 admin/jigoshop-write-panels.php
  13. +11 −17 admin/write-panels/order-data-save.php
  14. +24 −24 admin/write-panels/order-data.php
  15. +17 −27 admin/write-panels/product-data-save.php
  16. +42 −38 admin/write-panels/product-data.php
  17. +20 −23 admin/write-panels/product-types/variable.php
  18. +1 −1 assets/css/admin.css
  19. +31 −28 assets/css/admin.less
  20. +3 −3 assets/css/fancybox.css
  21. +1 −1 assets/css/frontend.css
  22. +71 −34 assets/css/frontend.less
  23. +3 −3 assets/css/jquery-ui-1.8.16.jigoshop.css
  24. +2 −2 assets/css/mixins.less
  25. +13 −13 assets/js/blockui.js
  26. +15 −15 assets/js/categories-ordering.js
  27. +3 −3 assets/js/cookie.js
  28. +1 −1 assets/js/easyTooltip.js
  29. +3 −3 assets/js/jigoshop_backend.js
  30. +4 −4 assets/js/jigoshop_frontend.js
  31. +2 −2 assets/js/jquery.fancybox-1.3.4.pack.js
  32. +3 −3 assets/js/jquery.placeholder.js
  33. +123 −94 assets/js/script.js
  34. +10 −10 assets/js/variable.js
  35. +19 −10 assets/js/write-panels.js
  36. +9 −10 classes/abstract/jigoshop_base.class.php
  37. +21 −22 classes/abstract/jigoshop_singleton.php
  38. +56 −56 classes/jigoshop.class.php
  39. +55 −48 classes/jigoshop_cart.class.php
  40. +264 −211 classes/jigoshop_checkout.class.php
  41. +757 −717 classes/jigoshop_countries.class.php
  42. +11 −11 classes/jigoshop_coupons.class.php
  43. +50 −50 classes/jigoshop_customer.class.php
  44. +160 −130 classes/jigoshop_order.class.php
  45. +13 −13 classes/jigoshop_orders.class.php
  46. +137 −111 classes/jigoshop_product.class.php
  47. +10 −10 classes/jigoshop_product_variation.class.php
  48. +64 −65 classes/jigoshop_query.class.php
  49. +24 −24 classes/jigoshop_sanitize.class.php
  50. +7 −7 classes/jigoshop_session.class.php
  51. +23 −20 classes/jigoshop_shipping.class.php
  52. +75 −75 classes/jigoshop_tax.class.php
  53. +29 −29 classes/jigoshop_validation.class.php
  54. +30 −30 gateways/bank_transfer.php
  55. +23 −23 gateways/cheque.php
  56. +120 −0 gateways/cod.php
  57. +73 −62 gateways/dibs.php
  58. +17 −17 gateways/gateway.class.php
  59. +28 −28 gateways/gateways.class.php
  60. +102 −102 gateways/paypal.php
  61. +70 −70 gateways/skrill.php
  62. +122 −61 jigoshop.php
  63. +61 −47 jigoshop_actions.php
  64. +19 −20 jigoshop_cron.php
  65. +34 −21 jigoshop_emails.php
  66. +39 −13 jigoshop_shortcodes.php
  67. +77 −77 jigoshop_taxonomy.php
  68. +11 −11 jigoshop_template_actions.php
  69. +86 −50 jigoshop_template_functions.php
  70. +6 −7 jigoshop_templates.php
  71. +56 −24 jigoshop_upgrade.php
  72. +11 −12 languages/countries.php
  73. +4 −0 languages/jigoshop-de_DE.po
  74. +4,810 −2,315 languages/jigoshop-en_GB.po
  75. BIN languages/jigoshop-hr_HR.mo
  76. +1 −1 languages/jigoshop-hr_HR.po
  77. BIN languages/jigoshop-nb_NO.mo
  78. +6,852 −0 languages/jigoshop-nb_NO.po
  79. BIN languages/jigoshop-pl_PL.mo
  80. +6,401 −0 languages/jigoshop-pl_PL.po
  81. BIN languages/jigoshop-pt_BR.mo
  82. +6,854 −0 languages/jigoshop-pt_BR.po
  83. +3,478 −2,768 languages/jigoshop.pot
  84. +27 −0 languages/strings.php
  85. +175 −112 readme.txt
  86. BIN screenshot-1.png
  87. BIN screenshot-2.png
  88. BIN screenshot-3.png
  89. BIN screenshot-4.png
  90. BIN screenshot-5.png
  91. BIN screenshot-6.png
  92. BIN screenshot-7.png
  93. BIN screenshot-8.png
  94. BIN screenshot-9.png
  95. +35 −35 shipping/flat_rate.php
  96. +19 −19 shipping/free_shipping.php
  97. +36 −26 shipping/jigoshop_calculable_shipping.php
  98. +114 −0 shipping/local_pickup.php
  99. +42 −38 shipping/shipping_method.class.php
  100. +10 −14 shortcodes/cart.php
  101. +16 −16 shortcodes/checkout.php
  102. +27 −28 shortcodes/my_account.php
  103. +10 −10 shortcodes/order_tracking.php
  104. +8 −8 shortcodes/pay.php
  105. +7 −7 shortcodes/thankyou.php
  106. +10 −10 templates/archive-product.php
  107. +12 −12 templates/checkout/form.php
  108. +9 −9 templates/checkout/pay_for_order.php
  109. +27 −152 templates/checkout/review_order.php
  110. +5 −5 templates/loop-shop.php
  111. +10 −10 templates/product_taxonomy.php
  112. +33 −33 templates/single-product-reviews.php
  113. +18 −18 templates/single-product.php
  114. +34 −7 uninstall.php
  115. +1 −1 version.txt
  116. +12 −12 widgets/best-sellers.php
  117. +12 −12 widgets/cart.php
  118. +20 −20 widgets/featured-products.php
  119. +1 −1 widgets/init.php
  120. +59 −59 widgets/layered_nav.php
  121. +12 −12 widgets/price-filter.php
  122. +19 −19 widgets/product-categories.php
  123. +15 −15 widgets/product_search.php
  124. +25 −25 widgets/product_tag_cloud.php
  125. +28 −26 widgets/products_on_sale.php
  126. +16 −13 widgets/random-products.php
  127. +36 −36 widgets/recent_products.php
  128. +32 −32 widgets/recent_reviews.php
  129. +49 −35 widgets/recently_viewed.php
  130. +28 −28 widgets/top-rated.php
  131. +30 −23 widgets/user_login.php
View
23 .gitignore
@@ -1,6 +1,25 @@
+# osx noise
+.DS_Store
+profile
+
+# xcode noise
+build/*
+*.mode1
+*.mode1v3
+*.mode2v3
+*.perspective
+*.perspectivev3
+*.pbxuser
+*.xcworkspace
+xcuserdata
+
+# svn & cvs
+.svn
+CV
+
+# Extra noise
.settings/*
.buildpath
.project
nbproject
-deploy.sh
-.ds_store
+deploy.sh
View
2 LICENSE.md
@@ -1,6 +1,6 @@
This program incorporates work covered by the following copyright and
permission notices:
-
+
fancyBox
========
View
65 README.md
@@ -1,52 +1,45 @@
-# [Jigoshop - WordPress eCommerce](http://jigoshop.com)
+[Jigoshop](http://jigoshop.com)
+=================
-Jigoshop is a featured packed eCommerce plugin built upon Wordpress core functionality ensuring excellent performance and customisability. Set up a shop in minutes with physical & downloadable products or even services.
+Jigoshop is a feature-packed eCommerce plugin built upon Wordpress core functionality ensuring excellent performance and customizability.
-There are integrated worldwide payment and shipping options to cater for a global audience.
+Quick start
+-----------
-Inside the custom dashboard you get sortable sales graphs, incoming order / review notifications as well as stats on your stores performance.
+To get started, [check out our installation guide](http://forum.jigoshop.com/kb/getting-started/installation)!
-Manage your stock levels and customer orders easily. Jigoshop has been engineered to make the boring parts of eCommerce, well, less boring!
+1. You can also clone the git repo:
-Styled to work with Twenty Ten, setting up a clean stylish store is easy.
+ ```
+ git clone git://github.com/jigoshop/jigoshop.git
+ ```
-Find out more on the official [Jigoshop web site](http://jigoshop.com).
+2. Or download it into your WordPress plugin directory:
-## Quick Start
+ https://github.com/jigoshop/jigoshop/zipball/master
-Clone the git repo - `git clone git://github.com/jigoshop/jigoshop.git` - or [download it](https://github.com/jigoshop/jigoshop/zipball/master) into your WordPress plugins directory
+Bug tracker
+-----------
-Activate the plugin & enjoy!
+Have a bug? Please create an issue here on GitHub!
-## Contributing
-Anyone and everyone is welcome to contribute. Jigoshop wouldn't be what it is today without the github community. There are several ways you can help out:
+https://github.com/jigoshop/jigoshop/issues
-1. Raising [issues](https://github.com/jigoshop/jigoshop/issues) on GitHub.
-2. Sending pull requests for bug fixes or new features and improvements.
+Contributing
+------------
-### Project information
+Anyone and everyone is welcome to contribute. Jigoshop wouldn't be what it is today without the github community.
+
+There are several ways you can help out:
+
+* Raising [issues](https://github.com/jigoshop/jigoshop/issues) on GitHub.
+* Submit bug fixes or offer new features / improvements by sending [pull requests](http://help.github.com/send-pull-requests/).
+* Offering [your own translations](http://forum.jigoshop.com/kb/shortcodes/languages).
+
+Project information
+-------------------
-* Source: http://github.com/jigoshop/jigoshop
* Web: http://jigoshop.com
* Docs: http://forum.jigoshop.com/kb
* Twitter: http://twitter.com/jigoshop
-
-### Features
-
-* Sell physical, digital and virtual products
-* Simple, grouped and configurable products
-* Discount coupon management
-* Automatic related products
-* Product reviews / hreviews
-* Tax by location
-* Currency options
-* Multiple shipping options
-* Layered product navigation
-* Customer account area
-* Inventory tracking
-* Detailed order management
-* Product import / export
-* Custom widgets - recent / featured products, shopping cart, product search
-* PayPal standard
-* Moneybookers / Skrill
-* Cheque payments
+* Source: http://github.com/jigoshop/jigoshop
View
162 admin/jigoshop-admin-attributes.php
@@ -1,7 +1,7 @@
<?php
/**
* 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.
*
* DISCLAIMER
@@ -10,11 +10,11 @@
* versions in the future. If you wish to customise Jigoshop core for your needs,
* please use our GitHub repository to publish essential changes for consideration.
*
- * @package Jigoshop
- * @category Admin
- * @author Jigowatt
- * @copyright Copyright (c) 2011 Jigowatt Ltd.
- * @license http://jigoshop.com/license/commercial-edition
+ * @package Jigoshop
+ * @category Admin
+ * @author Jigowatt
+ * @copyright Copyright (c) 2011-2012 Jigowatt Ltd.
+ * @license http://jigoshop.com/license/commercial-edition
*/
/**
@@ -25,97 +25,103 @@
* @usedby jigoshop_admin_menu2()
*/
function jigoshop_attributes() {
-
+
global $wpdb;
-
+
if (isset($_POST['add_new_attribute']) && $_POST['add_new_attribute']) :
-
- $attribute_name = (string) $_POST['attribute_name'];
+
+ $attribute_label = (string) $_POST['attribute_label'];
+ $attribute_name = !$_POST['attribute_name']
+ ? sanitize_title(sanitize_user($attribute_label, $strict = true))
+ : sanitize_title(sanitize_user($_POST['attribute_name'], $strict = true));
$attribute_type = (string) $_POST['attribute_type'];
+
if (isset($_POST['show-on-product-page']) && $_POST['show-on-product-page']) $product_page = 1; else $product_page = 0;
-
- if ($attribute_name && $attribute_type && !taxonomy_exists('pa_'.sanitize_title($attribute_name))) :
-
- $wpdb->insert( $wpdb->prefix . "jigoshop_attribute_taxonomies", array( 'attribute_name' => $attribute_name, 'attribute_type' => $attribute_type ), array( '%s', '%s' ) );
-
+
+ if ($attribute_name && strlen($attribute_name)<30 && $attribute_type && !taxonomy_exists('pa_'.sanitize_title($attribute_name))) :
+
+ $wpdb->insert( $wpdb->prefix . "jigoshop_attribute_taxonomies", array( 'attribute_name' => $attribute_name, 'attribute_label' => $attribute_label, 'attribute_type' => $attribute_type ), array( '%s', '%s' ) );
+
update_option('jigowatt_update_rewrite_rules', '1');
-
- wp_safe_redirect( get_admin_url() . 'admin.php?page=attributes' );
+
+ wp_safe_redirect( get_admin_url() . 'edit.php?post_type=product&page=jigoshop_attributes' );
exit;
-
+
else :
print_r('<div id="message" class="error"><p>'.__('That attribute already exists, no additions were made.', 'jigoshop' ).'</p></div>');
endif;
-
+
elseif (isset($_POST['save_attribute']) && $_POST['save_attribute'] && isset($_GET['edit'])) :
-
+
$edit = absint($_GET['edit']);
-
+
if ($edit>0) :
-
+
$attribute_type = $_POST['attribute_type'];
-
- $wpdb->update( $wpdb->prefix . "jigoshop_attribute_taxonomies", array( 'attribute_type' => $attribute_type ), array( 'attribute_id' => $_GET['edit'] ), array( '%s' ) );
-
+ $attribute_label = (string) $_POST['attribute_label'];
+
+ $wpdb->update( $wpdb->prefix . "jigoshop_attribute_taxonomies", array( 'attribute_type' => $attribute_type, 'attribute_label' => $attribute_label ), array( 'attribute_id' => $_GET['edit'] ), array( '%s', '%s') );
+
endif;
-
- wp_safe_redirect( get_admin_url() . 'admin.php?page=attributes' );
+
+ wp_safe_redirect( get_admin_url() . 'edit.php?post_type=product&page=jigoshop_attributes' );
exit;
-
+
elseif (isset($_GET['delete'])) :
-
+
$delete = absint($_GET['delete']);
-
+
if ($delete>0) :
-
+
$att_name = $wpdb->get_var("SELECT attribute_name FROM " . $wpdb->prefix . "jigoshop_attribute_taxonomies WHERE attribute_id = '$delete'");
-
+
if ($att_name && $wpdb->query("DELETE FROM " . $wpdb->prefix . "jigoshop_attribute_taxonomies WHERE attribute_id = '$delete'")) :
-
+
$taxonomy = 'pa_'.sanitize_title($att_name);
-
+
// Old taxonomy prefix left in for backwards compatibility
if (taxonomy_exists($taxonomy)) :
-
- $terms = get_terms($taxonomy, 'orderby=name&hide_empty=0');
+
+ $terms = get_terms($taxonomy, 'orderby=name&hide_empty=0');
foreach ($terms as $term) {
wp_delete_term( $term->term_id, $taxonomy );
}
-
+
endif;
-
- wp_safe_redirect( get_admin_url() . 'admin.php?page=attributes' );
+
+ wp_safe_redirect( get_admin_url() . 'edit.php?post_type=product&page=jigoshop_attributes' );
exit;
-
+
endif;
-
+
endif;
-
+
endif;
-
+
if (isset($_GET['edit']) && $_GET['edit'] > 0) :
jigoshop_edit_attribute();
- else :
+ else :
jigoshop_add_attribute();
endif;
-
+
}
/**
* 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() {
-
+
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 . "jigoshop_attribute_taxonomies WHERE attribute_id = '$edit'");
+ $att_label = $wpdb->get_var("SELECT attribute_label FROM " . $wpdb->prefix . "jigoshop_attribute_taxonomies WHERE attribute_id = '$edit'");
?>
<div class="wrap jigoshop">
<div class="icon32 icon32-attributes" id="icon-jigoshop"><br/></div>
@@ -127,17 +133,21 @@ function jigoshop_edit_attribute() {
<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>
- <form action="admin.php?page=attributes&amp;edit=<?php echo $edit; ?>" method="post">
-
+ <form action="admin.php?page=jigoshop_attributes&amp;edit=<?php echo $edit; ?>" method="post">
+ <div class="form-field">
+ <label for="attribute_label"><?php _e('Attribute Label', 'jigoshop'); ?></label>
+ <input name="attribute_label" id="attribute_label" type="text" value="<?php echo esc_attr( $att_label ); ?>" />
+ <p class="description"><?php _e('The label is how it appears on your site.', 'jigoshop'); ?></p>
+ </div>
<div class="form-field">
<label for="attribute_type"><?php _e('Attribute type', 'jigoshop'); ?></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="text" <?php if ($att_type=='text') echo 'selected="selected"'; ?>><?php _e('Text','jigoshop') ?></option>
</select>
</div>
-
+
<p class="submit"><input type="submit" name="save_attribute" id="submit" class="button" value="<?php esc_html_e('Save Attribute', 'jigoshop'); ?>"></p>
</form>
</div>
@@ -146,12 +156,12 @@ function jigoshop_edit_attribute() {
</div>
</div>
<?php
-
+
}
/**
* Add Attribute admin panel
- *
+ *
* Shows the interface for adding new attributes
*
* @since 1.0
@@ -170,23 +180,27 @@ function jigoshop_add_attribute() {
<thead>
<tr>
<th scope="col"><?php _e('Name','jigoshop') ?></th>
+ <th scope="col"><?php _e('Label','jigoshop') ?></th>
<th scope="col"><?php _e('Type','jigoshop') ?></th>
- <th scope="col"><?php _e('Terms','jigoshop') ?></th>
+ <th scope="col" colspan="2"><?php _e('Terms','jigoshop') ?></th>
</tr>
</thead>
<tbody>
<?php
$attribute_taxonomies = jigoshop_product::getAttributeTaxonomies();
if ( $attribute_taxonomies ) :
foreach ($attribute_taxonomies as $tax) :
+ $att_title = $tax->attribute_name;
+ if ( isset( $tax->attribute_label ) ) { $att_title = $tax->attribute_label; }
?><tr>
- <td><a href="edit-tags.php?taxonomy=pa_<?php echo rawurlencode(sanitize_title($tax->attribute_name)); ?>&amp;post_type=product"><?php echo $tax->attribute_name; ?></a>
+ <td><a href="edit-tags.php?taxonomy=pa_<?php echo 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 esc_url( 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 esc_url( 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 esc_url( add_query_arg('edit', $tax->attribute_id, 'admin.php?page=jigoshop_attributes') ); ?>"><?php _e('Edit', 'jigoshop'); ?></a> | </span><span class="delete"><a class="delete" href="<?php echo esc_url( add_query_arg('delete', $tax->attribute_id, 'admin.php?page=jigoshop_attributes') ); ?>"><?php _e('Delete', 'jigoshop'); ?></a></span></div>
</td>
- <td><?php echo ucwords($tax->attribute_type); ?></td>
- <td><?php
+ <td><?php echo esc_html( ucwords( $att_title ) ); ?></td>
+ <td><?php echo esc_html ( ucwords( $tax->attribute_type ) ); ?></td>
+ <td><?php
if (taxonomy_exists('pa_'.sanitize_title($tax->attribute_name))) :
$terms_array = array();
$terms = get_terms( 'pa_'.sanitize_title($tax->attribute_name), 'orderby=name&hide_empty=0' );
@@ -202,10 +216,11 @@ function jigoshop_add_attribute() {
echo '<span class="na">&ndash;</span>';
endif;
?></td>
+ <td><a href="edit-tags.php?taxonomy=pa_<?php echo sanitize_title( $tax->attribute_name ); ?>&amp;post_type=product" class="button alignright"><?php _e('Configure&nbsp;terms', 'jigoshop'); ?></a></td>
</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.', 'jigoshop') ?></td></tr><?php
endif;
?>
</tbody>
@@ -216,21 +231,26 @@ function jigoshop_add_attribute() {
<div class="col-wrap">
<div class="form-wrap">
<h3><?php _e('Add New Attribute','jigoshop') ?></h3>
- <form action="admin.php?page=attributes" method="post">
- <div class="form-field form-required">
- <label for="attribute_name"><?php _e('Attribute Name', 'jigoshop'); ?></label>
- <input name="attribute_name" id="attribute_name" type="text" value=""/>
- <p><?php _e('The name is how it appears on your site') ?>.</p>
+ <form action="edit.php?post_type=product&page=jigoshop_attributes" method="post">
+ <div class="form-field">
+ <label for="attribute_label"><?php _e('Attribute Label', 'jigoshop'); ?></label>
+ <input name="attribute_label" id="attribute_label" type="text" value="" />
+ <p class="description"><?php _e('The label is how it appears on your site.', 'jigoshop'); ?></p>
+ </div>
+ <div class="form-field">
+ <label for="attribute_name"><?php _e('Attribute Slug', 'jigoshop'); ?></label>
+ <input name="attribute_name" id="attribute_name" type="text" value="" />
+ <p class="description"><?php _e('Slug for your attribute (optional).', 'jigoshop'); ?></p>
</div>
<div class="form-field">
<label for="attribute_type"><?php _e('Attribute type', 'jigoshop'); ?></label>
<select name="attribute_type" id="attribute_type" class="postform">
<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="text"><?php _e('Text','jigoshop') ?></option>
</select>
</div>
-
+
<p class="submit"><input type="submit" name="add_new_attribute" id="submit" class="button" value="<?php esc_html_e('Add Attribute', 'jigoshop'); ?>"></p>
</form>
</div>
@@ -239,13 +259,13 @@ function jigoshop_add_attribute() {
</div>
<script type="text/javascript">
/* <![CDATA[ */
-
+
jQuery('a.delete').click(function(){
var answer = confirm ("<?php _e('Are you sure you want to delete this?', 'jigoshop'); ?>");
if (answer) return true;
return false;
});
-
+
/* ]]> */
</script>
</div>
View
242 admin/jigoshop-admin-dashboard.php
@@ -8,16 +8,16 @@
* versions in the future. If you wish to customise Jigoshop core for your needs,
* please use our GitHub repository to publish essential changes for consideration.
*
- * @package Jigoshop
- * @category Admin
- * @author Jigowatt
- * @copyright Copyright (c) 2011 Jigowatt Ltd.
- * @license http://jigoshop.com/license/commercial-edition
+ * @package Jigoshop
+ * @category Admin
+ * @author Jigowatt
+ * @copyright Copyright (c) 2011-2012 Jigowatt Ltd.
+ * @license http://jigoshop.com/license/commercial-edition
*/
/**
* Function for showing the dashboard
- *
+ *
* The dashboard shows widget for things such as:
* - Products
* - Sales
@@ -32,11 +32,11 @@ function jigoshop_dashboard() {
<div class="icon32 jigoshop_icon"><br/></div>
<h2><?php _e('Jigoshop Dashboard','jigoshop'); ?></h2>
<div id="jigoshop_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 class="inside">
@@ -66,10 +66,10 @@ function jigoshop_dashboard() {
<td class="t"><a href="edit-tags.php?taxonomy=product_tag&post_type=product"><?php _e('Product Tag', 'jigoshop'); ?></a></td>
</tr>
<tr>
- <td class="first b"><a href="admin.php?page=attributes"><?php
+ <td class="first b"><a href="admin.php?page=jigoshop_attributes"><?php
echo count( jigoshop_product::getAttributeTaxonomies());
?></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=jigoshop_attributes"><?php _e('Attribute taxonomies', 'jigoshop'); ?></a></td>
</tr>
</tbody>
</table>
@@ -99,14 +99,14 @@ function jigoshop_dashboard() {
</table>
</div>
<div class="versions">
- <p id="wp-version-message"><?php _e('You are using', 'jigoshop'); ?> <strong>JigoShop
+ <p id="wp-version-message"><?php _e('You are using', 'jigoshop'); ?> <strong>JigoShop
<?php
echo jigoshop_get_plugin_data();
?></strong></p>
</div>
<div class="clear"></div>
</div>
-
+
</div><!-- postbox end -->
<div class="postbox">
@@ -118,18 +118,18 @@ function jigoshop_dashboard() {
'orderby' => 'post_date',
'order' => 'DESC',
'post_type' => 'shop_order',
- 'post_status' => 'publish'
+ 'post_status' => 'publish'
);
$orders = get_posts( $args );
if ($orders) :
echo '<ul class="recent-orders">';
foreach ($orders as $order) :
-
+
$this_order = new jigoshop_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 />
+ <span class="order-status '.sanitize_title($this_order->status).'">'.ucwords(__($this_order->status, 'jigoshop')).'</span> <a href="'.admin_url('post.php?post='.$order->ID).'&action=edit">'.get_the_time(__('l jS \of F Y h:i:s A', 'jigoshop'), $order->ID).'</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>
</li>';
@@ -138,21 +138,21 @@ function jigoshop_dashboard() {
endif;
?>
</div>
- </div><!-- postbox end -->
-
+ </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>
<div class="inside">
-
+
<?php
-
+
$lowstockamount = get_option('jigoshop_notify_low_stock_amount');
if (!is_numeric($lowstockamount)) $lowstockamount = 1;
-
+
$nostockamount = get_option('jigoshop_notify_no_stock_amount');
if (!is_numeric($nostockamount)) $nostockamount = 1;
-
+
$outofstock = array();
$lowinstock = array();
$args = array(
@@ -162,34 +162,34 @@ function jigoshop_dashboard() {
'posts_per_page' => -1
);
$my_query = new WP_Query($args);
- if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post();
-
+ if ($my_query->have_posts()) : while ($my_query->have_posts()) : $my_query->the_post();
+
$_product = new jigoshop_product( $my_query->post->ID );
if (!$_product->managing_stock()) continue;
$thisitem = '<tr class="first">
<td class="first b"><a href="post.php?post='.$my_query->post->ID.'&action=edit">'.$_product->stock.'</a></td>
<td class="t"><a href="post.php?post='.$my_query->post->ID.'&action=edit">'.$my_query->post->post_title.'</a></td>
</tr>';
-
+
if ($_product->stock<=$nostockamount) :
$outofstock[] = $thisitem;
continue;
endif;
-
+
if ($_product->stock<=$lowstockamount) $lowinstock[] = $thisitem;
endwhile; endif;
wp_reset_query();
-
+
if (sizeof($lowinstock)==0) :
$lowinstock[] = '<tr><td colspan="2">'.__('No products are low in stock.', 'jigoshop').'</td></tr>';
endif;
if (sizeof($outofstock)==0) :
$outofstock[] = '<tr><td colspan="2">'.__('No products are out of stock.', 'jigoshop').'</td></tr>';
endif;
?>
-
+
<div class="table table_content">
<p class="sub"><?php _e('Low Stock', 'jigoshop'); ?></p>
<table>
@@ -207,20 +207,20 @@ function jigoshop_dashboard() {
</table>
</div>
<div class="clear"></div>
-
+
</div>
</div><!-- postbox end -->
<?php endif; ?>
-
-
+
+
</div>
<div class="postbox-container" style="width:49%; float:right;">
-
+
<?php
global $current_month_offset;
-
+
$current_month_offset = (int) date('m');
-
+
if (isset($_GET['month'])) $current_month_offset = (int) $_GET['month'];
?>
<div class="postbox stats" id="jigoshop-stats">
@@ -234,7 +234,7 @@ function jigoshop_dashboard() {
/* <![CDATA[ */
jQuery(function(){
-
+
function weekendAreas(axes) {
var markings = [];
var d = new Date(axes.xaxis.min);
@@ -250,27 +250,27 @@ function weekendAreas(axes) {
markings.push({ xaxis: { from: i, to: i + 2 * 24 * 60 * 60 * 1000 } });
i += 7 * 24 * 60 * 60 * 1000;
} while (i < axes.xaxis.max);
-
+
return markings;
}
-
+
<?php
-
+
function orders_this_month( $where = '' ) {
global $current_month_offset;
-
+
$month = $current_month_offset;
$year = (int) date('Y');
-
+
$first_day = strtotime("{$year}-{$month}-01");
$last_day = strtotime('-1 second', strtotime('+1 month', $first_day));
-
+
$after = date('Y-m-d', $first_day);
$before = date('Y-m-d', $last_day);
-
+
$where .= " AND post_date > '$after'";
$where .= " AND post_date < '$before'";
-
+
return $where;
}
add_filter( 'posts_where', 'orders_this_month' );
@@ -284,79 +284,79 @@ function orders_this_month( $where = '' ) {
'suppress_filters' => false
);
$orders = get_posts( $args );
-
+
$order_counts = array();
$order_amounts = array();
-
+
// Blank date ranges to begin
$month = $current_month_offset;
$year = (int) date('Y');
-
+
$first_day = strtotime("{$year}-{$month}-01");
$last_day = strtotime('-1 second', strtotime('+1 month', $first_day));
-
+
if ((date('m') - $current_month_offset)==0) :
$up_to = date('d', strtotime('NOW'));
else :
$up_to = date('d', $last_day);
endif;
$count = 0;
-
+
while ($count < $up_to) :
-
+
$time = strtotime(date('Ymd', strtotime('+ '.$count.' DAY', $first_day))).'000';
-
+
$order_counts[$time] = 0;
$order_amounts[$time] = 0;
$count++;
endwhile;
-
+
if ($orders) :
foreach ($orders as $order) :
-
+
$order_data = new jigoshop_order($order->ID);
-
+
if ($order_data->status=='cancelled' || $order_data->status=='refunded') continue;
-
+
$time = strtotime(date('Ymd', strtotime($order->post_date))).'000';
-
+
if (isset($order_counts[$time])) :
$order_counts[$time]++;
else :
$order_counts[$time] = 1;
endif;
-
+
if (isset($order_amounts[$time])) :
$order_amounts[$time] = $order_amounts[$time] + $order_data->order_total;
else :
$order_amounts[$time] = (float) $order_data->order_total;
endif;
-
+
endforeach;
endif;
-
+
remove_filter( 'posts_where', 'orders_this_month' );
?>
-
+
var d = [
<?php
$values = array();
foreach ($order_counts as $key => $value) $values[] = "[$key, $value]";
echo implode(',', $values);
?>
];
-
+
for (var i = 0; i < d.length; ++i) d[i][0] += 60 * 60 * 1000;
-
+
var d2 = [
<?php
$values = array();
foreach ($order_amounts as $key => $value) $values[] = "[$key, $value]";
echo implode(',', $values);
?>
];
-
+
for (var i = 0; i < d2.length; ++i) d2[i][0] += 60 * 60 * 1000;
var plot = jQuery.plot(jQuery("#placeholder"), [ { label: "Number of sales", data: d }, { label: "Sales amount", data: d2, yaxis: 2 } ], {
@@ -375,16 +375,16 @@ function orders_this_month( $where = '' ) {
hoverable: true,
markings: weekendAreas
},
- xaxis: {
+ xaxis: {
mode: "time",
- timeformat: "%d %b",
+ timeformat: "%d %b",
tickLength: 1,
minTickSize: [1, "day"]
},
yaxes: [ { min: 0, tickSize: 1, tickDecimals: 0 }, { position: "right", min: 0, tickDecimals: 2 } ],
colors: ["#21759B", "#ed8432"]
});
-
+
function showTooltip(x, y, contents) {
jQuery('<div id="tooltip">' + contents + '</div>').css( {
position: 'absolute',
@@ -397,42 +397,42 @@ function showTooltip(x, y, contents) {
opacity: 0.80
}).appendTo("body").fadeIn(200);
}
-
+
var previousPoint = null;
jQuery("#placeholder").bind("plothover", function (event, pos, item) {
if (item) {
if (previousPoint != item.dataIndex) {
previousPoint = item.dataIndex;
-
+
jQuery("#tooltip").remove();
-
+
if (item.series.label=="Number of sales") {
-
+
var y = item.datapoint[1];
showTooltip(item.pageX, item.pageY, item.series.label + " - " + y);
-
+
} else {
-
+
var y = item.datapoint[1].toFixed(2);
showTooltip(item.pageX, item.pageY, item.series.label + " - <?php echo get_jigoshop_currency_symbol(); ?>" + y);
-
+
}
-
+
}
}
else {
jQuery("#tooltip").remove();
- previousPoint = null;
+ previousPoint = null;
}
});
-
+
});
-
+
/* ]]> */
</script>
</div>
- </div><!-- postbox end -->
-
+ </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">
@@ -441,90 +441,90 @@ function showTooltip(x, y, contents) {
$comments = $wpdb->get_results("SELECT *, SUBSTRING(comment_content,1,100) AS comment_excerpt
FROM $wpdb->comments
LEFT JOIN $wpdb->posts ON ($wpdb->comments.comment_post_ID = $wpdb->posts.ID)
- WHERE comment_approved = '1'
- AND comment_type = ''
+ WHERE comment_approved = '1'
+ AND comment_type = ''
AND post_password = ''
AND post_type = 'product'
ORDER BY comment_date_gmt DESC
LIMIT 5" );
-
- if ($comments) :
+
+ if ($comments) :
echo '<ul>';
foreach ($comments as $comment) :
-
+
echo '<li>';
-
+
echo get_avatar($comment->comment_author, '32');
-
+
$rating = get_comment_meta( $comment->comment_ID, 'rating', true );
-
+
echo '<div class="star-rating" title="'.esc_attr($rating).'">
<span style="width:'.($rating*16).'px">'.$rating.' '.__('out of 5', 'jigoshop').'</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>';
-
+
endforeach;
echo '</ul>';
else :
echo '<p>'.__('There are no product reviews yet.', 'jigoshop').'</p>';
endif;
?>
</div>
- </div><!-- postbox end -->
+ </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">
<?php
if (file_exists(ABSPATH.WPINC.'/class-simplepie.php')) {
-
+
include_once(ABSPATH.WPINC.'/class-simplepie.php');
-
+
$rss = fetch_feed('http://jigoshop.com/feed');
-
+
if (!is_wp_error( $rss ) ) :
-
- $maxitems = $rss->get_item_quantity(5);
- $rss_items = $rss->get_items(0, $maxitems);
-
+
+ $maxitems = $rss->get_item_quantity(5);
+ $rss_items = $rss->get_items(0, $maxitems);
+
if ( $maxitems > 0 ) :
-
+
echo '<ul>';
-
+
foreach ( $rss_items as $item ) :
-
+
$title = wptexturize($item->get_title(), ENT_QUOTES, "UTF-8");
-
+
$link = $item->get_permalink();
-
+
$date = $item->get_date('U');
-
+
if ( ( abs( time() - $date) ) < 86400 ) : // 1 Day
$human_date = sprintf(__('%s ago','jigoshop'), human_time_diff($date));
else :
$human_date = date(__('F jS Y','jigoshop'), $date);
endif;
-
+
echo '<li><a href="'.esc_url($link).'">'.$title.'</a> &ndash; <span class="rss-date">'.$human_date.'</span></li>';
-
+
endforeach;
-
+
echo '</ul>';
-
+
else :
echo '<ul><li>'.__('No items found.','jigoshop').'</li></ul>';
endif;
-
+
else :
echo '<ul><li>'.__('No items found.','jigoshop').'</li></ul>';
endif;
-
+
}
?>
</div>
</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">
@@ -541,32 +541,32 @@ function showTooltip(x, y, contents) {
<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>
</ul>
<div class="social">
-
+
<h4 class="first"><?php _e('Jigoshop Project', 'jigoshop') ?></h4>
<p><?php _e('Join our growing developer community today, contribute to the jigoshop project via GitHub.') ?></p>
-
+
<p><a href="https://github.com/jigoshop/Jigoshop" class="gitforked-button gitforked-forks gitforked-watchers">Fork</a></p>
<script src="http://gitforked.com/api/1.1/button.js" type="text/javascript"></script>
-
+
<h4><?php _e('Jigoshop Social', 'jigoshop'); ?></h4>
-
+
<div id="fb-root"></div><script src="http://connect.facebook.net/en_US/all.js#xfbml=1"></script><fb:like href="http://jigoshop.com" send="true" layout="button_count" width="250" show_faces="true" action="like" font="arial"></fb:like>
-
+
<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><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>
-
+
<h4><?php _e('Jigoshop is brought to you by&hellip;', 'jigoshop'); ?></h4>
<p><a href="http://jigowatt.co.uk/"><img src="<?php echo jigoshop::assets_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>
-
+
</div>
<div class="clear"></div>
</div>
- </div><!-- postbox end -->
-
+ </div><!-- postbox end -->
+
</div>
</div>
</div>
View
24 admin/jigoshop-admin-help.php
@@ -8,11 +8,11 @@
* versions in the future. If you wish to customise Jigoshop core for your needs,
* please use our GitHub repository to publish essential changes for consideration.
*
- * @package Jigoshop
- * @category Admin
- * @author Jigowatt
- * @copyright Copyright (c) 2011 Jigowatt Ltd.
- * @license http://jigoshop.com/license/commercial-edition
+ * @package Jigoshop
+ * @category Admin
+ * @author Jigowatt
+ * @copyright Copyright (c) 2011-2012 Jigowatt Ltd.
+ * @license http://jigoshop.com/license/commercial-edition
*/
add_action( 'load-product_page_attributes', 'jigoshop_product_attributes_help' );
@@ -35,9 +35,10 @@ function jigoshop_product_attributes_help() {
<p>Thats really all there is to it, enjoy!</p>
';
+ // TODO: ADD RELEVANT ARTICLE
$sidebar_content = '
<p><strong>'. __('For more information') . ':</strong></p>
- <p><a href="http://forum.jigoshop.com/kb/" target="_blank">Documentation on<br/>Product Attributes *TODO: ADD RELEVANT ARTICLE*</a></p>
+ <p><a href="http://forum.jigoshop.com/kb/" target="_blank">Documentation on<br/>Product Attributes</a></p>
<p><a href="http://jigoshop.com/support" target="_blank">Support Forum</a></p>
';
$screen->set_help_sidebar( $sidebar_content );
@@ -85,9 +86,10 @@ function jigoshop_product_category_help() {
<p>You can change the display of this screen using the Screen Options tab to set how many items are displayed per screen and to display/hide columns in the table.</p>
';
+ // *TODO: ADD RELEVANT ARTICLE*
$sidebar_content = '
<p><strong>'. __('For more information') . ':</strong></p>
- <p><a href="http://forum.jigoshop.com/kb/" target="_blank">Documentation on<br/>Product Categories *TODO: ADD RELEVANT ARTICLE*</a></p>
+ <p><a href="http://forum.jigoshop.com/kb/" target="_blank">Documentation on<br/>Product Categories</a></p>
<p><a href="http://jigoshop.com/support" target="_blank">Support Forum</a></p>
';
$screen->set_help_sidebar( $sidebar_content );
@@ -127,9 +129,10 @@ function jigoshop_product_tag_help() {
<p>You can change the display of this screen using the Screen Options tab to set how many items are displayed per screen and to display/hide columns in the table.</p>
';
+ // *TODO: ADD RELEVANT ARTICLE*
$sidebar_content = '
<p><strong>'. __('For more information') . ':</strong></p>
- <p><a href="http://forum.jigoshop.com/kb/" target="_blank">Documentation on<br/>Product Tags *TODO: ADD RELEVANT ARTICLE*</a></p>
+ <p><a href="http://forum.jigoshop.com/kb/" target="_blank">Documentation on<br/>Product Tags</a></p>
<p><a href="http://jigoshop.com/support" target="_blank">Support Forum</a></p>
';
$screen->set_help_sidebar( $sidebar_content );
@@ -180,9 +183,10 @@ function jigoshop_product_list_help() {
<p>'.__('When using Bulk Edit, you can change the metadata (categories, author, etc.) for all selected products at once. To remove a product from the grouping, just click the x next to its name in the Bulk Edit area that appears', 'jigoshop').'.</p>
';
+ // *TODO: ADD RELEVANT ARTICLE*
$sidebar_content = '
<p><strong>'. __('For more information') . ':</strong></p>
- <p><a href="http://forum.jigoshop.com/kb/" target="_blank">Documentation on<br/>Managing Products *TODO: ADD RELEVANT ARTICLE*</a></p>
+ <p><a href="http://forum.jigoshop.com/kb/" target="_blank">Documentation on<br/>Managing Products</a></p>
<p><a href="http://jigoshop.com/support" target="_blank">Support Forum</a></p>
';
$screen->set_help_sidebar( $sidebar_content );
@@ -217,7 +221,7 @@ function jigoshop_product_list_help() {
function jigoshop_product_data_help ( $post_type , $post ) {
if ( 'product' != $post_type )
return false;
-
+
$general = '
<p>Hi! It looks like you\'re in need of some help, this help section has been categorized by tabs & runs through quickly what each one does. If you need an extra hand please check out the links to the right</p>
<p><strong>Product Type</strong> - Products are categorized into types which determine what kind of shopping experience your customers will have. Simple products are the most common type & offer the standard view. For more info on product types please consult the documentation</p>
View
146 admin/jigoshop-admin-post-types.php
@@ -1,21 +1,20 @@
<?php
-
/**
- * Functions used for custom post types in admin
+ * Functions used for custom post types in admin
*
- * These functions control columns in admin, and other admin interface bits
+ * These functions control columns in admin, and other admin interface bits
*
* DISCLAIMER
*
* Do not edit or add directly to this file if you wish to upgrade Jigoshop to newer
* versions in the future. If you wish to customise Jigoshop core for your needs,
* please use our GitHub repository to publish essential changes for consideration.
*
- * @package Jigoshop
- * @category Admin
- * @author Jigowatt
- * @copyright Copyright (c) 2011 Jigowatt Ltd.
- * @license http://jigoshop.com/license/commercial-edition
+ * @package Jigoshop
+ * @category Admin
+ * @author Jigowatt
+ * @copyright Copyright (c) 2011-2012 Jigowatt Ltd.
+ * @license http://jigoshop.com/license/commercial-edition
*/
// Add filter to ensure the text is context relevant when updated
@@ -47,32 +46,35 @@ function jigoshop_product_updated_messages( $messages ) {
/**
* Custom columns
**/
- function jigoshop_edit_product_columns($columns){
-
+ function jigoshop_edit_product_columns($columns) {
+
$columns = array();
-
+
$columns["cb"] = "<input type=\"checkbox\" />";
$columns["thumb"] = null;
$columns["title"] = __("Title", 'jigoshop');
$columns["featured"] = __("Featured", 'jigoshop');
-
+
$columns["product-type"] = __("Type", 'jigoshop');
if( get_option('jigoshop_enable_sku', true) == 'yes' ) {
$columns["product-type"] .= ' &amp; ' . __("SKU", 'jigoshop');
}
-
+
if ( get_option('jigoshop_manage_stock')=='yes' ) {
$columns["stock"] = __("Stock", 'jigoshop');
}
-
+
$columns["price"] = __("Price", 'jigoshop');
+ $columns["product-visibility"] = __("Visibility", 'jigoshop');
+
$columns["product-date"] = __("Date", 'jigoshop');
-
+
return $columns;
}
+
add_filter('manage_edit-product_columns', 'jigoshop_edit_product_columns');
function jigoshop_custom_product_columns($column) {
@@ -88,11 +90,11 @@ function jigoshop_custom_product_columns($column) {
}
else {
echo jigoshop_get_product_thumbnail( 'admin_product_list' );
- }
+ }
break;
case "price":
- echo $product->get_price_html();
+ echo $product->get_price_html();
break;
case "featured" :
$url = wp_nonce_url( admin_url('admin-ajax.php?action=jigoshop-feature-product&product_id=' . $post->ID) );
@@ -104,7 +106,7 @@ function jigoshop_custom_product_columns($column) {
case "stock" :
if ( ! $product->is_type( 'grouped' ) && $product->is_in_stock() ) {
if ( $product->managing_stock() ) {
- echo $product->stock.' '.__('In Stock', 'jigoshop');
+ echo $product->stock.' '.__('In Stock', 'jigoshop');
} else {
echo __('In Stock', 'jigoshop');
}
@@ -154,25 +156,59 @@ function jigoshop_custom_product_columns($column) {
else :
_e( 'Draft', 'jigoshop' );
endif;
+ break;
- if ( $product->visibility ) {
- echo ' | ';
- echo ($product->visibility == 'Hidden')
- ? '<strong class="attention">'.ucfirst($product->visibility).'</strong>'
- : ucfirst($product->visibility);
-
- }
-
+ case "product-visibility" :
+ if ( $product->visibility ) :
+ echo ($product->visibility == 'Hidden')
+ ? '<strong class="attention">'.ucfirst($product->visibility).'</strong>'
+ : ucfirst($product->visibility);
+ endif;
break;
+
}
}
-// Enable sorting for date
+// Enable sorting for custom columns
+
add_filter("manage_edit-product_sortable_columns", 'jigoshop_custom_product_sort');
function jigoshop_custom_product_sort( $columns ) {
- $columns['product-date'] = 'date';
-
- return $columns;
+ $custom = array(
+ 'featured' => 'featured',
+ 'price' => 'price',
+ 'product-visibility' => 'visibility',
+ 'product-date' => 'date'
+ );
+ return wp_parse_args($custom, $columns);
+}
+
+// Product column orderby
+
+add_filter( 'request', 'jigoshop_custom_product_orderby' );
+
+function jigoshop_custom_product_orderby( $vars ) {
+ if (isset( $vars['orderby'] )) :
+ if ( 'featured' == $vars['orderby'] ) :
+ $vars = array_merge( $vars, array(
+ 'meta_key' => 'featured',
+ 'orderby' => 'meta_value'
+ ) );
+ endif;
+ if ( 'price' == $vars['orderby'] ) :
+ $vars = array_merge( $vars, array(
+ 'meta_key' => 'regular_price',
+ 'orderby' => 'meta_value_num'
+ ) );
+ endif;
+ if ( 'visibility' == $vars['orderby'] ) :
+ $vars = array_merge( $vars, array(
+ 'meta_key' => 'visibility',
+ 'orderby' => 'meta_value'
+ ) );
+ endif;
+ endif;
+
+ return $vars;
}
/**
@@ -197,15 +233,15 @@ function jigoshop_filter_products_type() {
if ( $typenow != 'product' )
return false;
-
+
// Get all active terms
$terms = get_terms('product_type');
echo "<select name='product_type' id='dropdown_product_type'>";
echo "<option value='0'>" . __('Show all types', 'jigoshop') . "</option>";
foreach($terms as $term) {
- echo "<option value='" . esc_attr( $term->slug ) . "' ".selected($term->slug, isset($wp_query->query['product_type']) ? $wp_query->query['product_type'] : '', false).">".esc_html( ucfirst($term->name) )." (".absint( $term->count ).")</option>";
+ echo "<option value='" . esc_attr( $term->slug ) . "' ".selected($term->slug, isset($wp_query->query['product_type']) ? $wp_query->query['product_type'] : '', false).">".esc_html( ucfirst($term->name) )." (".absint( $term->count ).")</option>";
}
echo "</select>";
@@ -244,7 +280,7 @@ function jigoshop_custom_order_columns($column) {
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>', sanitize_title($order->status), __($order->status, 'jigoshop') );
break;
case "order_title" :
@@ -306,16 +342,16 @@ function jigoshop_custom_order_columns($column) {
?>
<dl>
<dt><?php _e('Payment:', 'jigoshop'); ?></dt>
- <dd><?php echo $order->payment_method; ?></dd>
+ <dd><?php echo $order->payment_method_title; ?></dd>
<dt><?php _e('Shipping:', 'jigoshop'); ?></dt>
<?php
if ($order->shipping_service) :
?>
- <dd><?php echo $order->shipping_service . ' via ' . $order->shipping_method; ?></dd>
+ <dd><?php echo sprintf( __('%s via %s', 'jigoshop'), $order->shipping_service, $order->shipping_method_title); ?></dd>
<?php
else :
?>
- <dd><?php echo $order->shipping_method; ?></dd>
+ <dd><?php echo $order->shipping_method_title; ?></dd>
<?php
endif;
?>
@@ -385,16 +421,16 @@ function jigoshop_custom_order_columns($column) {
<tr>
<th><?php echo $order->get_tax_class_for_display($tax_class) . ' (' . (float) $order->get_tax_rate($tax_class) . '%):'; ?></th>
<td><?php echo $order->get_tax_amount($tax_class) ?></td>
- </tr>
+ </tr>
<?php endforeach;
- endif;
+ endif;
endif;
if ($order->order_discount > 0) : ?><tr>
<th><?php _e('Discount', 'jigoshop'); ?></th>
<td><?php echo jigoshop_price($order->order_discount); ?></td>
</tr><?php endif; ?>
- <tr>
+ <tr>
<th><?php _e('Total', 'jigoshop'); ?></th>
<td><?php echo jigoshop_price($order->order_total); ?></td>
</tr>
@@ -405,7 +441,7 @@ function jigoshop_custom_order_columns($column) {
}
/**
- * Search by SKU or ID for products.
+ * Search by SKU or ID for products.
* Adapted from code by BenIrvin (Admin Search by ID)
* Special Thanks to Esbjörn Eriksson (https://github.com/esbite) for this adaption
*/
@@ -415,7 +451,7 @@ function jigoshop_custom_order_columns($column) {
function jigoshop_admin_product_search( $wp ) {
global $pagenow, $wpdb;
-
+
if( 'edit.php' != $pagenow )
return false;
@@ -427,24 +463,24 @@ function jigoshop_admin_product_search( $wp ) {
if ( 'ID:' == substr( $wp->query_vars['s'], 0, 3 )) {
$id = absint( substr( $wp->query_vars['s'], 3 ) );
-
+
if( ! $id )
- return false;
-
+ return false;
+
unset( $wp->query_vars['s'] );
$wp->query_vars['p'] = $id;
}
elseif( $wp->query_vars['post_type'] == 'product' && 'SKU:' == substr( $wp->query_vars['s'], 0, 4 ) ) {
-
+
$sku = trim( substr( $wp->query_vars['s'], 4 ) );
-
+
if( ! $sku )
- return false;
-
+ return false;
+
$id = $wpdb->get_var('SELECT post_id FROM '.$wpdb->postmeta.' WHERE meta_key="sku" AND meta_value LIKE "%'.$sku.'%";');
-
+
if( ! $id )
- return false;
+ return false;
unset( $wp->query_vars['s'] );
$wp->query_vars['p'] = $id;
@@ -489,21 +525,21 @@ function jigoshop_admin_product_search( $wp ) {
function jigoshop_admin_product_search_label($query) {
global $pagenow, $typenow, $wp;
- if ( 'edit.php' != $pagenow )
+ if ( 'edit.php' != $pagenow )
return $query;
if ( $typenow == 'product' || $typenow == 'shop_order' ) {
-
+
$s = get_query_var( 's' );
if ( $s )
return $query;
-
+
$sku = get_query_var( 'sku' );
if($sku) {
$post_type = get_post_type_object($wp->query_vars['post_type']);
return sprintf(__("[%s with SKU of %s]", 'jigoshop'), $post_type->labels->singular_name, $sku);
}
-
+
$p = get_query_var( 'p' );
if ($p) {
$post_type = get_post_type_object($wp->query_vars['post_type']);
@@ -516,7 +552,7 @@ function jigoshop_admin_product_search_label($query) {
return sprintf(__("[%s with product ID of %d]", 'jigoshop'), $post_type->labels->singular_name, $order_id);
}
}
-
+
return $query;
}
View
203 admin/jigoshop-admin-settings-options.php
@@ -8,11 +8,11 @@
* versions in the future. If you wish to customise Jigoshop core for your needs,
* please use our GitHub repository to publish essential changes for consideration.
*
- * @package Jigoshop
- * @category Admin
- * @author Jigowatt
- * @copyright Copyright (c) 2011 Jigowatt Ltd.
- * @license http://jigoshop.com/license/commercial-edition
+ * @package Jigoshop
+ * @category Admin
+ * @author Jigowatt
+ * @copyright Copyright (c) 2011-2012 Jigowatt Ltd.
+ * @license http://jigoshop.com/license/commercial-edition
*/
/**
@@ -48,7 +48,7 @@
array(
'name' => __('Send Jigoshop emails from','jigoshop'),
- 'desc' => __(''),
+ 'desc' => '',
'tip' => __('The email used to send all Jigoshop related emails, such as order confirmations and notices.','jigoshop'),
'id' => 'jigoshop_email',
'css' => 'width:250px;',
@@ -91,20 +91,6 @@
),
array(
- 'name' => __('Allow guest purchases','jigoshop'),
- 'desc' => '',
- 'tip' => __('Setting this to Yes will allow users to checkout without registering or signing up. Otherwise, users must be signed in or must sign up to checkout.','jigoshop'),
- 'id' => 'jigoshop_enable_guest_checkout',
- 'css' => 'min-width:100px;',
- 'std' => 'yes',
- 'type' => 'select',
- 'options' => array(
- 'yes' => __('Yes', 'jigoshop'),
- 'no' => __('No', 'jigoshop')
- )
- ),
-
- array(
'name' => __('After adding product to cart','jigoshop'),
'desc' => '',
'tip' => __('Define what should happen when a user clicks on &#34;Add to Cart&#34; on any product or page.','jigoshop'),
@@ -120,24 +106,24 @@
),
array(
- 'name' => __('Force SSL on checkout','jigoshop'),
+ 'name' => __('Disable Jigoshop frontend.css','jigoshop'),
'desc' => '',
- 'tip' => __('Forcing SSL is recommended. This will load your checkout page with https://. An SSL certificate is <strong>required</strong> if you choose yes. Contact your hosting provider for more information on SSL Certs.','jigoshop'),
- 'id' => 'jigoshop_force_ssl_checkout',
+ '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(
- 'yes' => __('Yes', 'jigoshop'),
- 'no' => __('No', 'jigoshop')
+ 'no' => __('No', 'jigoshop'),
+ 'yes' => __('Yes', 'jigoshop')
)
),
array(
- 'name' => __('Disable Jigoshop frontend.css','jigoshop'),
+ 'name' => __('Disable bundled Fancybox','jigoshop'),
'desc' => '',
- 'tip' => __('Useful if you want to disable Jigoshop styles and theme it yourself via your theme.','jigoshop'),
- 'id' => 'jigoshop_disable_css',
+ 'tip' => __('Useful if or one of your plugin already loads the Fancybox script and css. But be careful, Jigoshop will still try to open product images using Fancybox.','jigoshop'),
+ 'id' => 'jigoshop_disable_fancybox',
'css' => 'min-width:100px;',
'std' => 'no',
'type' => 'select',
@@ -147,17 +133,59 @@
)
),
+ array( 'name' => __('Checkout options', 'jigoshop'), 'type' => 'title', 'desc' => '' ),
+
+ array(
+ 'name' => __('Allow guest purchases','jigoshop'),
+ 'desc' => '',
+ 'tip' => __('Setting this to Yes will allow users to checkout without registering or signing up. Otherwise, users must be signed in or must sign up to checkout.','jigoshop'),
+ 'id' => 'jigoshop_enable_guest_checkout',
+ 'css' => 'min-width:100px;',
+ 'std' => 'yes',
+ 'type' => 'select',
+ 'options' => array(
+ 'yes' => __('Yes', 'jigoshop'),
+ 'no' => __('No', 'jigoshop')
+ )
+ ),
+
array(
- 'name' => __('Disable bundled Fancybox','jigoshop'),
+ 'name' => __('Show login form','jigoshop'),
'desc' => '',
- 'tip' => __('Useful if or one of your plugin already loads the Fancybox script and css. But be careful, Jigoshop will still try to open product images using Fancybox.','jigoshop'),
- 'id' => 'jigoshop_disable_fancybox',
+ 'id' => 'jigoshop_enable_guest_login',
+ 'css' => 'min-width:100px;',
+ 'std' => 'yes',
+ 'type' => 'select',
+ 'options' => array(
+ 'yes' => __('Yes', 'jigoshop'),
+ 'no' => __('No', 'jigoshop')
+ )
+ ),
+
+ array(
+ 'name' => __('Allow registration','jigoshop'),
+ 'desc' => '',
+ 'id' => 'jigoshop_enable_signup_form',
+ '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. This will load your checkout page with https://. An SSL certificate is <strong>required</strong> if you choose yes. Contact your hosting provider for more information on SSL Certs.','jigoshop'),
+ 'id' => 'jigoshop_force_ssl_checkout',
'css' => 'min-width:100px;',
'std' => 'no',
'type' => 'select',
'options' => array(
- 'no' => __('No', 'jigoshop'),
- 'yes' => __('Yes', 'jigoshop')
+ 'yes' => __('Yes', 'jigoshop'),
+ 'no' => __('No', 'jigoshop')
)
),