Discount Rules for WooCommerce - Version 1.4.18

Version Description

  • 12/09/17 =
  • Fix OWl Carousel compatibility issue
Download this release

Release Info

Developer flycart
Plugin Icon 128x128 Discount Rules for WooCommerce
Version 1.4.18
Comparing to
See all releases

Code changes from version 1.4.17 to 1.4.18

assets/js/app.js CHANGED
@@ -303,7 +303,7 @@ function validateFields(){
303
  //'<optgroup label="Products In Cart"><option value="products_atleast_one">At least one product in cart</option><!-- These products should not present in the cart to apply. --><option value="products_not_in">None of selected products in cart</option></optgroup>' +
304
  //'<optgroup label="Categories In Cart"><!-- At least one of these should present in the cart to apply. --><option value="categories_atleast_one">At least one category in cart</option><!-- These Category should not present in the cart to apply. --><!--<option value="categories_not_in">None of selected categories in cart</option>--></optgroup>' +
305
  '<optgroup label="Customer Details (must be logged in)"><option value="users_in">User in list</option><option value="roles_in">User role in list</option><option value="shipping_countries_in">Shipping country in list</option></optgroup>' +
306
- '<optgroup label="Customer Email Domain (Eg: edu)"><option value="customer_email_tld">Email ends with</option></optgroup></select></label></div>' +
307
  '<optgroup label="Customer Billing Details"><option value="customer_billing_city">Billing city</option></optgroup></select></label></div>' +
308
  '<div class="col-md-3 form-group"><label> Value<div id="general_' + count + '"><input type="text" name="discount_rule[' + count + '][option_value]"></div>' +
309
  '<div id="user_div_' + count + '"><select id="cart_user_list_' + count + '" class="user_list selectpicker" multiple name="discount_rule[' + count + '][users_to_apply][]"></select></div>' +
@@ -320,7 +320,7 @@ function validateFields(){
320
  //'<optgroup label="Products In Cart"><option value="products_atleast_one">At least one product in cart</option><!-- These products should not present in the cart to apply. --><option value="products_not_in">None of selected products in cart</option></optgroup>' +
321
  //'<optgroup label="Categories In Cart"><!-- At least one of these should present in the cart to apply. --><option value="categories_atleast_one">At least one category in cart</option><!-- These Category should not present in the cart to apply. --><option value="categories_not_in">None of selected categories in cart</option></optgroup>' +
322
  '<optgroup label="Customer Details (must be logged in)"><option disabled>User in list <b>' + pro_suffix + '</b></option><option disabled>User role in list <b>' + pro_suffix + '</b></option><option disabled>Shipping country in list <b>' + pro_suffix + '</b></option></optgroup>' +
323
- '<optgroup label="Customer Email Domain (Eg: edu)"><option disabled>Email ends with <b>' + pro_suffix + '</b></option></optgroup></select></label></div>' +
324
  '<optgroup label="Customer Billing Details"><option disabled>Billing city <b>' + pro_suffix + '</b></option></optgroup></select></label></div>' +
325
  '<div class="col-md-3 form-group"><label> Value<div id="general_' + count + '"><input type="text" name="discount_rule[' + count + '][option_value]"></div>' +
326
  '<div id="user_div_' + count + '"><select id="cart_user_list_' + count + '" class="user_list selectpicker" multiple name="discount_rule[' + count + '][users_to_apply][]"></select></div>' +
303
  //'<optgroup label="Products In Cart"><option value="products_atleast_one">At least one product in cart</option><!-- These products should not present in the cart to apply. --><option value="products_not_in">None of selected products in cart</option></optgroup>' +
304
  //'<optgroup label="Categories In Cart"><!-- At least one of these should present in the cart to apply. --><option value="categories_atleast_one">At least one category in cart</option><!-- These Category should not present in the cart to apply. --><!--<option value="categories_not_in">None of selected categories in cart</option>--></optgroup>' +
305
  '<optgroup label="Customer Details (must be logged in)"><option value="users_in">User in list</option><option value="roles_in">User role in list</option><option value="shipping_countries_in">Shipping country in list</option></optgroup>' +
306
+ '<optgroup label="Customer Email Domain (Eg: edu)"><option value="customer_email_tld">Email ends with</option></optgroup>' +
307
  '<optgroup label="Customer Billing Details"><option value="customer_billing_city">Billing city</option></optgroup></select></label></div>' +
308
  '<div class="col-md-3 form-group"><label> Value<div id="general_' + count + '"><input type="text" name="discount_rule[' + count + '][option_value]"></div>' +
309
  '<div id="user_div_' + count + '"><select id="cart_user_list_' + count + '" class="user_list selectpicker" multiple name="discount_rule[' + count + '][users_to_apply][]"></select></div>' +
320
  //'<optgroup label="Products In Cart"><option value="products_atleast_one">At least one product in cart</option><!-- These products should not present in the cart to apply. --><option value="products_not_in">None of selected products in cart</option></optgroup>' +
321
  //'<optgroup label="Categories In Cart"><!-- At least one of these should present in the cart to apply. --><option value="categories_atleast_one">At least one category in cart</option><!-- These Category should not present in the cart to apply. --><option value="categories_not_in">None of selected categories in cart</option></optgroup>' +
322
  '<optgroup label="Customer Details (must be logged in)"><option disabled>User in list <b>' + pro_suffix + '</b></option><option disabled>User role in list <b>' + pro_suffix + '</b></option><option disabled>Shipping country in list <b>' + pro_suffix + '</b></option></optgroup>' +
323
+ '<optgroup label="Customer Email Domain (Eg: edu)"><option disabled>Email ends with <b>' + pro_suffix + '</b></option></optgroup>' +
324
  '<optgroup label="Customer Billing Details"><option disabled>Billing city <b>' + pro_suffix + '</b></option></optgroup></select></label></div>' +
325
  '<div class="col-md-3 form-group"><label> Value<div id="general_' + count + '"><input type="text" name="discount_rule[' + count + '][option_value]"></div>' +
326
  '<div id="user_div_' + count + '"><select id="cart_user_list_' + count + '" class="user_list selectpicker" multiple name="discount_rule[' + count + '][users_to_apply][]"></select></div>' +
helper/purchase.php CHANGED
@@ -84,7 +84,7 @@ if ( ! class_exists( 'woo_dicount_rules_purchase' ) ) {
84
  */
85
  public function isPro()
86
  {
87
- return false ;
88
  }
89
 
90
  /**
84
  */
85
  public function isPro()
86
  {
87
+ return false;
88
  }
89
 
90
  /**
includes/pricing-rules-3.php CHANGED
@@ -945,14 +945,73 @@ if (!class_exists('woo_dicount_rules_pricingRules')) {
945
  */
946
  public function generateTableHtml($table_data, $path)
947
  {
948
- ob_start();
949
  if (!isset($table_data)) return false;
950
  if (!isset($path) || empty($path) || is_null($path)) return false;
951
- if (!file_exists($path)) return false;
952
  $data = $this->getBaseConfig();
953
- include($path);
954
- $html = ob_get_contents();
955
- ob_clean();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
956
  return $html;
957
  }
958
 
945
  */
946
  public function generateTableHtml($table_data, $path)
947
  {
948
+ //ob_start();
949
  if (!isset($table_data)) return false;
950
  if (!isset($path) || empty($path) || is_null($path)) return false;
951
+ //if (!file_exists($path)) return false;
952
  $data = $this->getBaseConfig();
953
+ //include($path);
954
+ //$html = ob_get_contents();
955
+ // ob_clean();
956
+ //ob_get_clean();
957
+ $html = $this->getDiscountTableContentInHTML($table_data, $data);
958
+ return $html;
959
+ }
960
+
961
+ /**
962
+ * get Discount table content in html
963
+ * */
964
+ private function getDiscountTableContentInHTML($table_data, $data){
965
+ $html = '';
966
+ if (!isset($table_data) || empty($table_data)) return false;
967
+ $base_config = (is_string($data)) ? json_decode($data, true) : (is_array($data) ? $data : array());
968
+ $html .= '<table>';
969
+ $html .= '<thead>';
970
+ $html .= '<tr>';
971
+ if (isset($base_config['show_discount_title_table'])) {
972
+ if ($base_config['show_discount_title_table'] == 'show') {
973
+ $html .= '<td>Name</td>';
974
+ }
975
+ }
976
+ $html .= '<td>Range</td>';
977
+ $html .= '<td>Discount</td>';
978
+ $html .= '</tr>
979
+ </thead>
980
+ <tbody>';
981
+ $have_discount = false;
982
+ $table = $table_data;
983
+ foreach ($table as $index => $item) {
984
+ if ($item) {
985
+ foreach ($item as $id => $value) {
986
+
987
+ $title = isset($value->title) ? $value->title : '';
988
+ $min = isset($value->min_qty) ? $value->min_qty : 0;
989
+ $max = isset($value->max_qty) ? $value->max_qty : 0;
990
+ $discount_type = isset($value->discount_type) ? $value->discount_type : 0;
991
+ $to_discount = isset($value->to_discount) ? $value->to_discount : 0;
992
+ $html .= '<tr>';
993
+ if (isset($base_config['show_discount_title_table'])) {
994
+ if ($base_config['show_discount_title_table'] == 'show') {
995
+ $html .= '<td>'.$title.'</td>';
996
+ }
997
+ }
998
+ $html .= '<td>'.$min .' - ' . $max.'</td>';
999
+ if ($discount_type == 'percentage_discount') {
1000
+ $html .= '<td>'.$to_discount . ' %'.'</td>';
1001
+ } else {
1002
+ $html .= '<td>'.wc_price($to_discount) . ' %'.'</td>';
1003
+ }
1004
+ $html .= '</tr>';
1005
+ }
1006
+ $have_discount = true;
1007
+ }
1008
+ }
1009
+ if (!$have_discount) {
1010
+ $html .= '<tr><td colspan="2">No Active Discounts.</td></tr>';
1011
+ }
1012
+ $html .= '</tbody>';
1013
+ $html .= '</table>';
1014
+
1015
  return $html;
1016
  }
1017
 
includes/pricing-rules.php CHANGED
@@ -945,14 +945,73 @@ if (!class_exists('woo_dicount_rules_pricingRules')) {
945
  */
946
  public function generateTableHtml($table_data, $path)
947
  {
948
- ob_start();
949
  if (!isset($table_data)) return false;
950
  if (!isset($path) || empty($path) || is_null($path)) return false;
951
- if (!file_exists($path)) return false;
952
  $data = $this->getBaseConfig();
953
- include($path);
954
- $html = ob_get_contents();
955
- ob_clean();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
956
  return $html;
957
  }
958
 
945
  */
946
  public function generateTableHtml($table_data, $path)
947
  {
948
+ //ob_start();
949
  if (!isset($table_data)) return false;
950
  if (!isset($path) || empty($path) || is_null($path)) return false;
951
+ //if (!file_exists($path)) return false;
952
  $data = $this->getBaseConfig();
953
+ //include($path);
954
+ //$html = ob_get_contents();
955
+ // ob_clean();
956
+ //ob_get_clean();
957
+ $html = $this->getDiscountTableContentInHTML($table_data, $data);
958
+ return $html;
959
+ }
960
+
961
+ /**
962
+ * get Discount table content in html
963
+ * */
964
+ private function getDiscountTableContentInHTML($table_data, $data){
965
+ $html = '';
966
+ if (!isset($table_data) || empty($table_data)) return false;
967
+ $base_config = (is_string($data)) ? json_decode($data, true) : (is_array($data) ? $data : array());
968
+ $html .= '<table>';
969
+ $html .= '<thead>';
970
+ $html .= '<tr>';
971
+ if (isset($base_config['show_discount_title_table'])) {
972
+ if ($base_config['show_discount_title_table'] == 'show') {
973
+ $html .= '<td>Name</td>';
974
+ }
975
+ }
976
+ $html .= '<td>Range</td>';
977
+ $html .= '<td>Discount</td>';
978
+ $html .= '</tr>
979
+ </thead>
980
+ <tbody>';
981
+ $have_discount = false;
982
+ $table = $table_data;
983
+ foreach ($table as $index => $item) {
984
+ if ($item) {
985
+ foreach ($item as $id => $value) {
986
+
987
+ $title = isset($value->title) ? $value->title : '';
988
+ $min = isset($value->min_qty) ? $value->min_qty : 0;
989
+ $max = isset($value->max_qty) ? $value->max_qty : 0;
990
+ $discount_type = isset($value->discount_type) ? $value->discount_type : 0;
991
+ $to_discount = isset($value->to_discount) ? $value->to_discount : 0;
992
+ $html .= '<tr>';
993
+ if (isset($base_config['show_discount_title_table'])) {
994
+ if ($base_config['show_discount_title_table'] == 'show') {
995
+ $html .= '<td>'.$title.'</td>';
996
+ }
997
+ }
998
+ $html .= '<td>'.$min .' - ' . $max.'</td>';
999
+ if ($discount_type == 'percentage_discount') {
1000
+ $html .= '<td>'.$to_discount . ' %'.'</td>';
1001
+ } else {
1002
+ $html .= '<td>'.wc_price($to_discount) . ' %'.'</td>';
1003
+ }
1004
+ $html .= '</tr>';
1005
+ }
1006
+ $have_discount = true;
1007
+ }
1008
+ }
1009
+ if (!$have_discount) {
1010
+ $html .= '<tr><td colspan="2">No Active Discounts.</td></tr>';
1011
+ }
1012
+ $html .= '</tbody>';
1013
+ $html .= '</table>';
1014
+
1015
  return $html;
1016
  }
1017
 
readme.txt CHANGED
@@ -4,18 +4,14 @@ Donate link: https://flycart.org/
4
  Tags: woocommerce, ecommerce, discounts, coupons, promotion, campaigns, sales, price rules, advanced coupons, advanced discounts
5
  Requires at least: 4.4.1
6
  Tested up to: 4.8.1
7
- Stable tag: 1.4.17
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
11
  Create simple to complex discount rules, promotions for your WooCommerce online store.
12
  == Description ==
13
 
14
- Like this plugin? Consider leaving a [5 star review](https://wordpress.org/support/plugin/woo-discount-rules/reviews/?filter=5).
15
-
16
- Create any type of discount and pricing rules in your WooCommerce Store. Run flexible promotions and sell more!
17
- Increase your sales multifold by offering flexible, customised discounts in your WooCommerce online store. Attract more customers.
18
- Encourage bulk purchases by providing discounts.
19
 
20
  [View Demo](http://demo.flycart.org/woo-discount-rules) | [Documentation with real examples](https://www.flycart.org/docs/wordpress/woo-discount-rules) | [Ask Questions](https://www.flycart.org/support/6-wordpress-plugins)
21
 
@@ -111,6 +107,9 @@ More information could be found in the documentation
111
 
112
  == Changelog ==
113
 
 
 
 
114
  = 1.4.17 - 07/09/17 =
115
  * Fix – Cart rule based on billing city for pro version
116
 
4
  Tags: woocommerce, ecommerce, discounts, coupons, promotion, campaigns, sales, price rules, advanced coupons, advanced discounts
5
  Requires at least: 4.4.1
6
  Tested up to: 4.8.1
7
+ Stable tag: 1.4.18
8
  License: GPLv3 or later
9
  License URI: http://www.gnu.org/licenses/gpl-3.0.html
10
 
11
  Create simple to complex discount rules, promotions for your WooCommerce online store.
12
  == Description ==
13
 
14
+ WooCommerce discount rules helps you to create any type of discount and pricing rules in your WooCommerce store. Increase your sales multifold by offering flexible, customised discounts to your customers. Encourage your customers to purchase more by providing bulk discounts.
 
 
 
 
15
 
16
  [View Demo](http://demo.flycart.org/woo-discount-rules) | [Documentation with real examples](https://www.flycart.org/docs/wordpress/woo-discount-rules) | [Ask Questions](https://www.flycart.org/support/6-wordpress-plugins)
17
 
107
 
108
  == Changelog ==
109
 
110
+ = 1.4.18 - 12/09/17 =
111
+ * Fix – OWl Carousel compatibility issue
112
+
113
  = 1.4.17 - 07/09/17 =
114
  * Fix – Cart rule based on billing city for pro version
115
 
woo-discount-rules.php CHANGED
@@ -5,7 +5,7 @@
5
  * Description: Simple Discount Rules for WooCommerce.
6
  * Author: Flycart Technologies LLP
7
  * Author URI: https://www.flycart.org
8
- * Version: 1.4.17
9
  * Slug: woo-discount-rules
10
  * Text Domain: woo-discount-rules
11
  * Requires at least: 4.6.1
5
  * Description: Simple Discount Rules for WooCommerce.
6
  * Author: Flycart Technologies LLP
7
  * Author URI: https://www.flycart.org
8
+ * Version: 1.4.18
9
  * Slug: woo-discount-rules
10
  * Text Domain: woo-discount-rules
11
  * Requires at least: 4.6.1