Plugin Directory

Changeset 3050178


Ignore:
Timestamp:
03/13/2024 05:00:17 AM (2 years ago)
Author:
dedidata
Message:

Version 5.0.3

Location:
woocommerce-iran-post-shipping
Files:
19 added
6 edited

Legend:

Unmodified
Added
Removed
  • woocommerce-iran-post-shipping/trunk/includes/IranPostShipping/class-wc-shipping-bike.php

    r3049844 r3050178  
    213213                $this->title .= sprintf( esc_html_x( ' (Only for the province of %s)', 'The source province', 'woocommerce-iran-post-shipping' ), $this->form_fields['source_state']['options'][ $this->source_state ] );
    214214            }
     215
     216            $package_cost = $package['contents_cost'];
     217            // Convert current currency to rial
     218            if ( 'IRT' === $this->current_currency ) {
     219                $package_cost = $package['contents_cost'] * 10;
     220            } elseif ( 'IRHT' === $this->current_currency ) {
     221                $package_cost = $package['contents_cost'] * 10000;
     222            }
     223
     224            $this->free_for_price = '' !== $this->free_for_price ? intval( $this->free_for_price ) : '';
     225            if ( '' !== $this->free_for_price && $package_cost >= $this->free_for_price ) {
     226                $shipping_total = 0;
     227            }
     228
    215229            // Register the rate
    216230            $rate = array(
  • woocommerce-iran-post-shipping/trunk/includes/IranPostShipping/class-wc-shipping-certified.php

    r3045170 r3050178  
    355355        }
    356356       
     357        $package_cost = $package['contents_cost'];
    357358        // Convert current currency to rial
    358359        if ( 'IRT' === $this->current_currency ) {
     
    362363        }
    363364
    364         $this->free_for_price = isset( $this->free_for_price ) ? intval( $this->free_for_price ) : '';
     365        $this->free_for_price = '' !== $this->free_for_price ? intval( $this->free_for_price ) : '';
    365366        if ( '' === $this->free_for_price || $package_cost < $this->free_for_price ) {
    366367            $rate_price = array();
  • woocommerce-iran-post-shipping/trunk/includes/IranPostShipping/class-wc-shipping-cod.php

    r3045170 r3050178  
    5656
    5757        // Define user set variables
    58         $this->enabled        = $this->get_option( 'enabled' );
    59         $this->title          = $this->get_option( 'title' );
    60         $this->minimum_weight = $this->get_option( 'minimum_weight' );
     58        $this->enabled            = $this->get_option( 'enabled' );
     59        $this->title              = $this->get_option( 'title' );
     60        $this->extra_cost         = intval( $this->get_option( 'extra_cost' ) );
     61        $this->extra_cost_percent = intval( $this->get_option( 'extra_cost_percent' ) );
     62        // IRR or IRT or IRHT
     63        $this->current_currency = get_woocommerce_currency();
     64        $this->minimum_weight   = $this->get_option( 'minimum_weight' );
    6165        // g or kg
    6266        $this->current_weight_unit = get_option( 'woocommerce_weight_unit' );
    63 
    6467        // Save settings in admin if you have any defined
    6568        add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) );
     
    7376    public function init_form_fields() {
    7477        $this->form_fields = array(
    75             'enabled'        => array(
     78            'enabled'            => array(
    7679                'title'   => esc_html__( 'Active/Inactive', 'woocommerce-iran-post-shipping' ),
    7780                'type'    => 'checkbox',
     
    7982                'default' => 'no',
    8083            ),
    81             'title'          => array(
     84            'title'              => array(
    8285                'title'       => esc_html__( 'Method Title', 'woocommerce-iran-post-shipping' ),
    8386                'type'        => 'text',
     
    8689                'desc_tip'    => true,
    8790            ),
    88             'minimum_weight' => array(
     91            'extra_cost'         => array(
     92                'title'       => esc_html__( 'Additional costs in Iranian Rial', 'woocommerce-iran-post-shipping' ),
     93                'type'        => 'text',
     94                'description' => esc_html__( 'In this section, you can enter additional costs in addition to the postage rate, such as packaging costs, etc. Enter the fixed amount in Iranian Rial.', 'woocommerce-iran-post-shipping' ),
     95                'default'     => '',
     96                'desc_tip'    => true,
     97            ),
     98            'extra_cost_percent' => array(
     99                'title'       => esc_html__( 'Additional costs as a percentage', 'woocommerce-iran-post-shipping' ),
     100                'type'        => 'text',
     101                'description' => esc_html__( 'In this section, you can enter additional costs as a percentage in addition to the postage rate. Enter only the numeric value in this section. For example, for 2%, enter the number 2.', 'woocommerce-iran-post-shipping' ),
     102                'default'     => '',
     103                'desc_tip'    => true,
     104            ),
     105            'minimum_weight'     => array(
    89106                'title'       => esc_html__( 'Active only for a weight greater than or equal to this amount (in grams)', 'woocommerce-iran-post-shipping' ),
    90107                'type'        => 'text',
     
    112129            $cart_weight *= 1000;
    113130        }
    114        
     131
    115132        // Detect the weight plan
    116133        if ( '' === $this->minimum_weight ) {
     
    120137        if ( $cart_weight < $this->minimum_weight ) {
    121138            return;
     139        }
     140
     141        $package_cost = $package['contents_cost'];
     142        // Convert current currency to rial
     143        if ( 'IRT' === $this->current_currency ) {
     144            $package_cost = $package['contents_cost'] * 10;
     145        } elseif ( 'IRHT' === $this->current_currency ) {
     146            $package_cost = $package['contents_cost'] * 10000;
     147        }
     148
     149        $shipping_total  += ceil( $package_cost * $this->extra_cost_percent / 100 );
     150        $this->extra_cost = intval( $this->extra_cost );
     151        $shipping_total  += $this->extra_cost;
     152
     153        // convert currency to current selected currency
     154        if ( 'IRT' === $this->current_currency ) {
     155            $shipping_total = ceil( $shipping_total / 10 );
     156        } elseif ( 'IRHT' === $this->current_currency ) {
     157            $shipping_total = ceil( $shipping_total / 10000 );
    122158        }
    123159
  • woocommerce-iran-post-shipping/trunk/includes/IranPostShipping/class-wc-shipping-express.php

    r3045170 r3050178  
    355355        }
    356356       
     357        $package_cost = $package['contents_cost'];
    357358        // Convert current currency to rial
    358359        if ( 'IRT' === $this->current_currency ) {
     
    362363        }
    363364
    364         $this->free_for_price = isset( $this->free_for_price ) ? intval( $this->free_for_price ) : '';
     365        $this->free_for_price = '' !== $this->free_for_price ? intval( $this->free_for_price ) : '';
    365366        if ( '' === $this->free_for_price || $package_cost < $this->free_for_price ) {
    366367            $rate_price = array();
  • woocommerce-iran-post-shipping/trunk/iran-post-shipping.php

    r3049844 r3050178  
    11<?php
    22/**
    3  * Plugin Name: Express & Certified Post, Bike Delivery and Iranian Postal Companies for WooCommerce
     3 * Plugin Name: Express, Certified Post, Bike Delivery and Iranian Postal Companies for WooCommerce
    44 * Description: Calculates and adds Express & Certified Post shipping methods, Bike Delivery, and other Iranian Postal Companies
    55 * Plugin URI: https://parsmizban.com/%D9%88%D9%88%DA%A9%D8%A7%D9%85%D8%B1%D8%B3-%D9%BE%D8%B3%D8%AA
    66 * Author: DediData
    77 * Author URI: https://dedidata.com
    8  * Version: 5.0.2
     8 * Version: 5.0.3
    99 * Requires at least: 6.0
    1010 * Tested up to: 6.4
  • woocommerce-iran-post-shipping/trunk/readme.txt

    r3049844 r3050178  
    1 === Express & Certified Post, Bike Delivery and Iranian Postal Companies for WooCommerce ===
     1=== Express, Certified Post, Bike Delivery and Iranian Postal Companies for WooCommerce ===
    22Contributors: dedidata, parsmizban, farhad0
    33Tags: woocommerce, shipping, order, weight based shipping, woocommerce shipping
     
    55Tested up to: 6.4
    66Requires PHP: 7.0
    7 Stable tag: 5.0.2
     7Stable tag: 5.0.3
    88License: GPLv3
    99License URI: https://www.gnu.org/licenses/gpl-3.0.html
Note: See TracChangeset for help on using the changeset viewer.