Example #1
0
    }
    /**
     * Returns a the string describing the units of length for the [mp_shipping][system] in effect
     *
     * @return string
     */
    private function get_units_length()
    {
        return $this->settings['shipping']['system'] == 'english' ? __('Inches', 'mp') : __('Centimeters', 'mp');
    }
}
if (!class_exists('FedEx_Service')) {
    class FedEx_Service
    {
        public $code;
        public $name;
        public $delivery;
        public $rate;
        function __construct($code, $name, $delivery, $rate = null)
        {
            $this->code = $code;
            $this->name = $name;
            $this->delivery = $delivery;
            $this->rate = $rate;
        }
    }
}
//register plugin only in US and US Possesions
$settings = get_option('mp_settings');
mp_register_shipping_plugin('MP_Shipping_FedEx', 'fedex', __('FedEx (beta)', 'mp'), true);
Example #2
0
                break;
            default:
                for ($i = $settings['shipping']['weight-rate']['rowcount'] - 1; $i >= 0; $i--) {
                    if ($totalweight >= $settings['shipping']['weight-rate'][$i]['minweight']) {
                        if (in_array($settings['base_country'], $mp->eu_countries)) {
                            if ($country == $settings['base_country']) {
                                $price = $settings['shipping']['weight-rate'][$i]['in_country'];
                            } else {
                                if (in_array($country, $mp->eu_countries)) {
                                    $price = $settings['shipping']['weight-rate'][$i]['eu'];
                                } else {
                                    $price = $settings['shipping']['weight-rate'][$i]['international'];
                                }
                            }
                        } else {
                            if ($country == $settings['base_country']) {
                                $price = $settings['shipping']['weight-rate'][$i]['in_country'];
                            } else {
                                $price = $settings['shipping']['weight-rate'][$i]['international'];
                            }
                        }
                        break;
                    }
                }
        }
        return $price;
    }
}
//register plugin - uncomment to register
mp_register_shipping_plugin('MP_Shipping_Weight_Rate', 'weight-rate', __('Weight Rate', 'mp'));
Example #3
0
     * Returns a the string describing the units of length for the [mp_shipping][system] in effect
     *
     * @return string
     */
    private function get_units_length()
    {
        return $this->settings['shipping']['system'] == 'english' ? __('Inches', 'mp') : __('Centimeters', 'mp');
    }
}
//End MP_Shipping_USPS
if (!class_exists('USPS_Service')) {
    class USPS_Service
    {
        public $code;
        public $name;
        public $delivery;
        public $max_weight;
        function __construct($code, $name, $delivery = '', $max_weight = null)
        {
            $this->code = $code;
            $this->name = $name;
            $this->delivery = $delivery;
            $this->max_weight = $max_weight;
        }
    }
}
//register plugin as calculated. Only in US and US Possesions
$settings = get_option('mp_settings');
if (in_array($settings['base_country'], array('US', 'UM', 'AS', 'FM', 'GU', 'MH', 'MP', 'PW', 'PR', 'PI', 'VI'))) {
    mp_register_shipping_plugin('MP_Shipping_USPS', 'usps', __('USPS', 'mp'), true);
}
Example #4
0
     */
    function calculate_shipping($price, $total, $cart, $address1, $address2, $city, $state, $zip, $country, $selected_option)
    {
        global $mp;
        $settings = $mp->get_setting('shipping');
        $fee = isset($settings['pickup']['processing-fee']) ? esc_attr($settings['pickup']['processing-fee']) : 0;
        return floatval($fee);
    }
    /**
     * For calculated shipping modules, use this method to return an associative array of the sub-options. The key will be what's saved as selected
     *  in the session. Note the shipping parameters won't always be set. If they are, add the prices to the labels for each option.
     *
     * @param array $cart, the contents of the shopping cart for advanced calculations
     * @param string $address1
     * @param string $address2
     * @param string $city
     * @param string $state, state/province/region
     * @param string $zip, postal code
     * @param string $country, ISO 3166-1 alpha-2 country code
     *
     * return array $shipping_options
     */
    function shipping_options($cart, $address1, $address2, $city, $state, $zip, $country)
    {
        $shipping_options = array('in-store' => __('In Store', 'mp'));
        return $shipping_options;
    }
}
//register plugin - uncomment to register
mp_register_shipping_plugin('MP_Shipping_Pickup', 'pickup', __('Pickup', 'mp'), true);
Example #5
0
                    }
                }
                break;
            default:
                //in european union
                if (in_array($settings['base_country'], $mp->eu_countries)) {
                    if ($country == $settings['base_country']) {
                        $price = $settings['shipping']['flat-rate']['in_country'];
                    } else {
                        if (in_array($country, $mp->eu_countries)) {
                            $price = $settings['shipping']['flat-rate']['eu'];
                        } else {
                            $price = $settings['shipping']['flat-rate']['international'];
                        }
                    }
                } else {
                    //all other countries
                    if ($country == $settings['base_country']) {
                        $price = $settings['shipping']['flat-rate']['in_country'];
                    } else {
                        $price = $settings['shipping']['flat-rate']['international'];
                    }
                }
                break;
        }
        return $price;
    }
}
//register plugin
mp_register_shipping_plugin('MP_Shipping_Flat_Rate', 'flat-rate', __('Flat Rate', 'mp'));
Example #6
0
        public $code;
        public $name;
        public $delivery;
        public $rate;
        function __construct($code, $name, $delivery, $rate = null)
        {
            $this->code = $code;
            $this->name = $name;
            $this->delivery = $delivery;
            $this->rate = $rate;
        }
    }
}
if (!class_exists('Box_Size')) {
    class Box_Size
    {
        public $length;
        public $width;
        public $height;
        function __construct($length, $width, $height)
        {
            $this->length = $length;
            $this->width = $width;
            $this->height = $height;
        }
    }
}
//register plugin only in US and US Possesions
$settings = get_option('mp_settings');
mp_register_shipping_plugin('MP_Shipping_UPS', 'ups', __('UPS (beta)', 'mp'), true);
Example #7
0
                break;
            default:
                for ($i = $mp->get_setting('shipping->table-rate->rowcount') - 1; $i >= 0; $i--) {
                    if ($total >= $mp->get_setting("shipping->table-rate->{$i}->mincost")) {
                        if (in_array($mp->get_setting('base_country'), $mp->eu_countries)) {
                            if ($country == $mp->get_setting('base_country')) {
                                $price = $mp->get_setting("shipping->table-rate->{$i}->in_country");
                            } else {
                                if (in_array($country, $mp->eu_countries)) {
                                    $price = $mp->get_setting("shipping->table-rate->{$i}->eu");
                                } else {
                                    $price = $mp->get_setting("shipping->table-rate->{$i}->international");
                                }
                            }
                        } else {
                            if ($country == $mp->get_setting('base_country')) {
                                $price = $mp->get_setting("shipping->table-rate->{$i}->in_country");
                            } else {
                                $price = $mp->get_setting("shipping->table-rate->{$i}->international");
                            }
                        }
                        break;
                    }
                }
        }
        return $price;
    }
}
//register plugin - uncomment to register
mp_register_shipping_plugin('MP_Shipping_Table_Rate', 'table-rate', __('Table Rate', 'mp'));