Plugin Directory

Changeset 1810924


Ignore:
Timestamp:
01/29/2018 01:54:15 AM (8 years ago)
Author:
opentools
Message:

V2.0.4: Compat with WC vendors and variations; PHP warnings

Location:
shipping-by-rules-for-woocommerce
Files:
3 edited
22 copied

Legend:

Unmodified
Added
Removed
  • shipping-by-rules-for-woocommerce/tags/2.0.4/includes/rules_shipping_framework_woocommerce.php

    r1779938 r1810924  
    186186        foreach ($products as $product) {
    187187            $w = $product['data']->get_weight();
    188             $dimensions['maxweight'] = max ($dimensions['maxweight'], $w);
    189             $dimensions['minweight'] = min ($dimensions['minweight'], $w);
    190             $dimensions['weight'] += $w * $product['quantity'];
     188            if (is_numeric($w)) {
     189                $dimensions['maxweight'] = max ($dimensions['maxweight'], $w);
     190                $dimensions['minweight'] = min ($dimensions['minweight'], $w);
     191                $dimensions['weight'] += $w * $product['quantity'];
     192            }
    191193        }
    192194        return $dimensions;
     
    233235            $vendorids = array();
    234236            foreach ($products as $product) {
    235                 $vendorids[] = $product['data']->post->post_author;
     237                // Variations inherit the vendor from their parent product
     238                if (!isset($product['variation_id'])) {
     239                    // "Normal" product, not a variation
     240                    $vendorids[] = $product['data']->post->post_author;
     241                } else {
     242                    // A variation => load the parent product instead and use its vendor
     243                    $vendorids[] = get_post_field('post_author', $product['product_id']);
     244                }
    236245            }
    237246            $data['vendorids'] = array_unique($vendorids);
  • shipping-by-rules-for-woocommerce/tags/2.0.4/readme.txt

    r1779977 r1810924  
    33Tags: WooCommerce, Shipment, Shipping, Rules shipping
    44Requires at least: 4.0
    5 Tested up to: 4.9.1
    6 Stable tag: 2.0.3
     5Tested up to: 4.9.2
     6Stable tag: 2.0.4
    77License: GPLv3 or later
    88License URI: http://www.gnu.org/licenses/gpl.html
     
    7070== Changelog ==
    7171
     72= 2.0.4 =
     73* Compatibility with WC vendors in combination with product variations
     74* Fix PHP warnings
     75
    7276= 2.0.3 =
    7377* Fix warning when products have no length/width/height assigned (use 0 as default)
  • shipping-by-rules-for-woocommerce/tags/2.0.4/woocommerce-shipping-by-rules.php

    r1779938 r1810924  
    44 * Plugin URI: http://open-tools.net/woocommerce/advanced-shipping-by-rules-for-woocommerce.html
    55 * Description: Define Shipping cost by very general and flexible (text-based) rules.
    6  * Version: 2.0.3
     6 * Version: 2.0.4
    77 * Author: Open Tools, Reinhold Kainhofer
    88 * Author URI: http://open-tools.net
     
    1111 * License: GPL2+
    1212 * WC requires at least: 2.2
    13  * WC tested up to: 3.2.3
     13 * WC tested up to: 3.2.6
    1414 
    1515
  • shipping-by-rules-for-woocommerce/trunk/includes/rules_shipping_framework_woocommerce.php

    r1779938 r1810924  
    186186        foreach ($products as $product) {
    187187            $w = $product['data']->get_weight();
    188             $dimensions['maxweight'] = max ($dimensions['maxweight'], $w);
    189             $dimensions['minweight'] = min ($dimensions['minweight'], $w);
    190             $dimensions['weight'] += $w * $product['quantity'];
     188            if (is_numeric($w)) {
     189                $dimensions['maxweight'] = max ($dimensions['maxweight'], $w);
     190                $dimensions['minweight'] = min ($dimensions['minweight'], $w);
     191                $dimensions['weight'] += $w * $product['quantity'];
     192            }
    191193        }
    192194        return $dimensions;
     
    233235            $vendorids = array();
    234236            foreach ($products as $product) {
    235                 $vendorids[] = $product['data']->post->post_author;
     237                // Variations inherit the vendor from their parent product
     238                if (!isset($product['variation_id'])) {
     239                    // "Normal" product, not a variation
     240                    $vendorids[] = $product['data']->post->post_author;
     241                } else {
     242                    // A variation => load the parent product instead and use its vendor
     243                    $vendorids[] = get_post_field('post_author', $product['product_id']);
     244                }
    236245            }
    237246            $data['vendorids'] = array_unique($vendorids);
  • shipping-by-rules-for-woocommerce/trunk/readme.txt

    r1779977 r1810924  
    33Tags: WooCommerce, Shipment, Shipping, Rules shipping
    44Requires at least: 4.0
    5 Tested up to: 4.9.1
    6 Stable tag: 2.0.3
     5Tested up to: 4.9.2
     6Stable tag: 2.0.4
    77License: GPLv3 or later
    88License URI: http://www.gnu.org/licenses/gpl.html
     
    7070== Changelog ==
    7171
     72= 2.0.4 =
     73* Compatibility with WC vendors in combination with product variations
     74* Fix PHP warnings
     75
    7276= 2.0.3 =
    7377* Fix warning when products have no length/width/height assigned (use 0 as default)
  • shipping-by-rules-for-woocommerce/trunk/woocommerce-shipping-by-rules.php

    r1779938 r1810924  
    44 * Plugin URI: http://open-tools.net/woocommerce/advanced-shipping-by-rules-for-woocommerce.html
    55 * Description: Define Shipping cost by very general and flexible (text-based) rules.
    6  * Version: 2.0.3
     6 * Version: 2.0.4
    77 * Author: Open Tools, Reinhold Kainhofer
    88 * Author URI: http://open-tools.net
     
    1111 * License: GPL2+
    1212 * WC requires at least: 2.2
    13  * WC tested up to: 3.2.3
     13 * WC tested up to: 3.2.6
    1414 
    1515
Note: See TracChangeset for help on using the changeset viewer.