diff --git a/advanced-shipping-by-rules.php b/advanced-shipping-by-rules.php index ee62bfd9c785e718b8d52e797de537ba21c2ddf7..f77d7045c5ad5596981d8563f06fd73e08b7fcff 100644 --- a/advanced-shipping-by-rules.php +++ b/advanced-shipping-by-rules.php @@ -129,7 +129,7 @@ class WooCommerce_Shipping_By_Rules_Advanced { } - protected function shippingbyrules_row_meta($links, $file ) { + public function shippingbyrules_row_meta($links, $file ) { if ($file==plugin_basename(__FILE__)) { $links['docs'] = '<a href="' . esc_url( 'http://open-tools.net/documentation/advanced-shipping-by-rules-for-woocommerce.html' ) . '" title="' . esc_attr( $this->helper->__( 'Plugin Documentation' ) ) . '">' . $this->helper->__( 'Plugin Documentation' ) . '</a>'; $links['support'] = '<a href="' . esc_url( 'http://open-tools.net/support-forum/shiping-by-rules-for-woocommerce.html' ) . '" title="' . esc_attr( $this->helper->__( 'Support Forum' ) ) . '">' . $this->helper->__( 'Support Forum' ) . '</a>'; @@ -139,7 +139,7 @@ class WooCommerce_Shipping_By_Rules_Advanced { /** * Add settings link to plugins page */ - protected function shippingbyrules_add_settings_link( $links ) { + public function shippingbyrules_add_settings_link( $links ) { $link = '<a href="admin.php?page=wc-settings&tab=shipping§ion=shipping_by_rules">'. $this->helper->__( 'Settings' ) . '</a>'; array_push( $links, $link ); return $links; @@ -218,7 +218,7 @@ class WooCommerce_Shipping_By_Rules_Advanced { public function shipping_by_rules_init() { require_once plugin_dir_path( __FILE__ ) . 'includes/rules-shipping-method.php'; $this->rule_shipping_method = new Shipping_by_Rules(); - $this->rule_shipping_method->helper = $this->helper; + $this->rule_shipping_method->setHelper($this->helper); } diff --git a/assets/css/admin-styles.css b/assets/css/admin-styles.css index 94ac88b8ee0bfce0438d2a3f55fe28f338476f03..7a0d3505612132c43fddf3b0bf0d9744bad707b2 100644 --- a/assets/css/admin-styles.css +++ b/assets/css/admin-styles.css @@ -140,4 +140,19 @@ div#opentools-shippingbyrules-upgrade .logoleft { } div#opentools-shippingbyrules-upgrade .contents { padding-left: 120px; +} +ul.otsr_list, ul.otsr_list ul { + list-style: disc; + padding-left: 10px; +} +ul.otsr_list ul { + list-style: circle; +} +ul.otsr_list li { + margin-bottom: 2px; +} +ul.otsr_list blockquote { + background: #f0f0f0; + margin: 0; + padding: 0.2em 0.5em; } \ No newline at end of file diff --git a/includes/admin/settings/meta-box-help.php b/includes/admin/settings/meta-box-help.php index 3ab6f9a26760545fc4818a51c36717793617e8ad..7094338daa4d34303cb61ed34c1a90e664f910a2 100644 --- a/includes/admin/settings/meta-box-help.php +++ b/includes/admin/settings/meta-box-help.php @@ -12,29 +12,22 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly ?><div class='rules_shipping rules_shipping_help rules_shipping_meta_box rules_shipping_help_meta_box'> - <ul> + <p>See also the the <a href='http://open-tools.net/documentation/shipping-by-rules-plugins-for-virtuemart.html'>Plugin's documentation</a> and <a href='http://open-tools.net/component/content/article.html?id=46'>Rules Examples</a>.</p> + <ul class='otsr_list'> <li>One rule per line, rule parts separated by Semicolon (;)</li> <li>Rules are evaluated sequentially, first matching rule is offered</li> <li>Typical form of a rule: <blockquote> - Name="Rule name"; Condition1; Condition2; Shipping=123 + Name="Rule name"; Amount<50; 1000<=ZIP<2000; Shipping=123 </blockquote></li> <li>Setting costs to NoShipping prevents method from offering any shipping</li> <li>Conditions can contain <strong>comparison operators (<, <=, =<, ==, !=, <>, >=, =>, >)</strong>, variables and functions.</li> <li>Some <strong>variables (case-insensitive)</strong>: <ul> - <li><strong><tt>Amount</tt></strong>, </li> - <li><strong><tt>Weight</tt></strong>, </li> - <li><strong><tt>ZIP</tt></strong>, </li> - <li><strong><tt>Products</tt></strong> (number of different products), </li> - <li><strong><tt>Articles</tt></strong> (counted with quantity), </li> - <li><strong><tt>Volume</tt></strong> (total volume of the order)</li> - <li><strong><tt>MinVolume</tt>, <tt>MinLength</tt>, <tt>MinWidth</tt>, <tt>MinHeight</tt></strong> </li> - <li>as well as the same variables with <tt>Max</tt> instead of <tt>Min</tt>.</li> + <li><tt>Amount</tt>, <tt>Weight</tt>, <tt>ZIP</tt>, <tt>Products</tt> (number of products), <tt>Articles</tt> (counted with quantity), <tt>Volume</tt> (total volume of the order), <tt>Min/MaxVolume</tt>, <tt>Min/MaxLength</tt>, <tt>Min/MaxWidth</tt>, <tt>Min/MaxHeight</tt>, ....</li> </ul> </li> - <li>A condition can consist of multiple chained comparisons. In the advanced version, the OR operator is available.</li> - <li>All rule parts of the form <strong><tt>[VARIABLE]=VALUE</tt> are assignments</strong>; allowed variables are + <!--li>All rule parts of the form <strong><tt>[VARIABLE]=VALUE</tt> are assignments</strong>; allowed variables are <ul> <li><strong><tt>Name</tt></strong> (of the rule), </li> <li><strong><tt>Shipping</tt></strong>, </li> @@ -46,13 +39,13 @@ if ( ! defined( 'ABSPATH' ) ) exit; // Exit if accessed directly <li><strong><tt>Value</tt></strong>, </li> <li><strong><tt>Comment</tt></strong>.</li> </ul> - The '<tt>Shipping='</tt> can be left out.</li> + The '<tt>Shipping='</tt> can be left out.</li--> <li>In the advanced version, all expressions may contain <strong>arbitrary basic arithmetic expressions (+, -, *, /, %, ^ and parentheses)</strong> of the above variables and functions like max(..), min(..), round(..), ceil(..), floor(..), day(), month(), etc..</li> - <li><strong>Alphanumeric postal codes</strong> are supported by the variables <tt>UK_Outward, UK_Area, UK_District, UK_Subdistrict, Canada_FSA, Canada_Area, Canada_Urban, Canada_Subarea, ZIP1, ZIP2, ZIP3, ZIP4, ZIP5</tt> and <tt>ZIP6</tt> in the advanced version.</li> + <li><strong>Alphanumeric postal codes</strong>: variables <tt>UK_Outward, UK_Area, UK_District, UK_Subdistrict, Canada_FSA, Canada_Area, Canada_Urban, Canada_Subarea, ZIP1, ZIP2, ZIP3, ZIP4, ZIP5</tt> and <tt>ZIP6</tt> in the advanced version.</li> </ul> <p>EXAMPLE: A rule named 'Europe' that sets shipping costs of 5€ plus 1.50€ per article for order amounts from 50 to less than 100, and free shipping from 100€ on would be:</p> <blockquote><tt>Name=Free Shipping; 100<= Amount; 0<br/>Name=Europe; 50<=Amount<100; Shipping=5+1.50*Articles</tt></blockquote> - <p>See also the the <a href='http://open-tools.net/documentation/shipping-by-rules-plugins-for-virtuemart.html'>Plugin's documentation</a> and <a href='http://open-tools.net/component/content/article.html?id=46'>Rules Examples</a>.</p> + </div> <?php \ No newline at end of file diff --git a/includes/rules-shipping-method.php b/includes/rules-shipping-method.php index 8d2cc10d5434021092f185af598f89068fb29441..337b971c320dda9a25dd55247d906321087dcae1 100644 --- a/includes/rules-shipping-method.php +++ b/includes/rules-shipping-method.php @@ -26,12 +26,16 @@ class Shipping_by_Rules extends WC_Shipping_Method { $this->helper = RulesShippingFrameworkWooCommerce::getHelper(); } $this->id = 'shipping_by_rules'; // Id for your shipping method. Should be uunique. - $this->title = $this->helper->__( 'Shipping By Rules <small>(displayed title changes according to configured methods)</small>'); + $this->title = $this->helper->__( 'Shipping By Rules'); $this->method_title = $this->helper->__( 'Shipping by Rules' ); // Title shown in admin $this->method_description = $this->helper->__( 'Define shipping costs by general, text-based rules.' ); // Description shown in admin $this->init(); } + + public function setHelper($helper) { + $this->helper = $helper; + } /** * Init your settings diff --git a/includes/rules_shipping_framework_woocommerce.php b/includes/rules_shipping_framework_woocommerce.php index 0cf67c609b2d5addcdebc973b12e75813596908b..1d2aab8db7b33301411e088548e9ab1dd96d4ed6 100644 --- a/includes/rules_shipping_framework_woocommerce.php +++ b/includes/rules_shipping_framework_woocommerce.php @@ -354,15 +354,15 @@ class RulesShippingFrameworkWooCommerce extends RulesShippingFramework { <?php if (isset($settings['title'])) { ?><h3><?php echo esc_html($settings['title']); ?></h3><? } ?> <div class="contents"> <div class="logoleft"><a href="<?php echo esc_html($settings['link']); ?>"><img src="<?php echo plugins_url('../assets/images/advlogo100.png', __FILE__); ?>"></a></div> - <p>Advanced features not included in the free plugin include:</p> + <!--p>Advanced features not included in the free plugin include:</p--> <ul> - <li><b>Mathematical expressions</b>: shipping costs can be calculated from arbitrary mathematical expressions (depending on e.g. weight, dimensions, amount, etc.), e.g.: - <ul> + <li><b>Mathematical expressions</b>: shipping costs calculated from mathematical expressions (depending on weight, dimensions, amount, etc.): + <ul style="font-size: smaller"> <li>Shipping costs per kg</li> - <li>Percentage shipping cost on the amount</li> + <li>Percentage shipping cost on the amount, etc.</li> </ul> <li><b>List functions</b>: conditions on certain products, categories, tags or shipping classes</li> - <li><b>Conditions for product subsets</b>: Conditions and shippind costs depending on values evaluated only for particular products, categories, tags or shipping classes + <li><b>Conditions for product subsets</b>: Conditions and shipping costs depending on values evaluated only for particular products, categories, tags or shipping classes <li><b>Alphanumeric Postcodes</b>: Conditions on UK and Canadian postcodes</li> <li><b>Coupon Codes</b>: conditions on coupon codes</li> <li>...</li> diff --git a/includes/rules_shipping_framework_woocommerce_advanced.php b/includes/rules_shipping_framework_woocommerce_advanced.php index 8db8ea5af39f2763758728552770feea75cde688..c53f5c279cc21d1e3a327173f836065aa7b9b898 100644 --- a/includes/rules_shipping_framework_woocommerce_advanced.php +++ b/includes/rules_shipping_framework_woocommerce_advanced.php @@ -31,7 +31,7 @@ class RulesShippingFrameworkWooCommerceAdvanced extends RulesShippingFrameworkWo $data = parent::getOrderAddress($this, $cart, $method); $zip = isset($address['postcode'])?trim($address['postcode']):''; if (isset($zip) && $zip!='') { - $data = array_merge($data, $this->getAddressZIP($zip); + $data = array_merge($data, $this->getAddressZIP($zip)); } return $data; }