Plugin Directory

Changeset 3259042


Ignore:
Timestamp:
03/20/2025 10:12:55 AM (13 months ago)
Author:
fuvarhu
Message:

foxpost

Location:
fuvar-hu-api/trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • fuvar-hu-api/trunk/fuvarhu.php

    r3110987 r3259042  
    55      Plugin URI: https://app.fuvar.hu
    66      description: Bővítmény segítségével hozzáadhatod a fuvar.hu által kínált szolgáltatásokat a webshopodhoz
    7       Version: 2
     7      Version: 2.1
    88      Author: Fuvar.hu
    99      License: GPL2
  • fuvar-hu-api/trunk/inc/shipping_method.php

    r3110987 r3259042  
    1010    $methods[ 'fuvarhu_aut_dpd' ] = 'WC_Shipping_fuvarhu_AUT_DPD';
    1111    $methods[ 'fuvarhu_aut_pck' ] = 'WC_Shipping_fuvarhu_AUT_PCK';
     12    $methods[ 'fuvarhu_aut_fxp' ] = 'WC_Shipping_fuvarhu_AUT_FXP';
    1213
    1314    return $methods;
     
    243244    }
    244245
     246    if(!class_exists("WC_Shipping_fuvarhu_AUT_FXP")){
     247        class WC_Shipping_fuvarhu_AUT_PCK extends WC_Shipping_Method {
     248            public function __construct( $instance_id = 0 ) {
     249                $this->id                    = 'fuvarhu_aut_fxp';
     250                $this->instance_id           = absint( $instance_id );
     251                $this->method_title          = __( 'Fuvar.hu - Automata (Foxpost)' );
     252                $this->method_description    = __( 'Foxpost Automata a Fuvar.hu szerződött partnere által' );
     253                $this->supports              = array(
     254                    'shipping-zones',
     255                    'instance-settings',
     256                );
     257                $this->instance_form_fields = array(
     258                    'enabled' => array(
     259                        'title'         => __( 'Engedélyezve' ),
     260                        'type'          => 'checkbox',
     261                        'label'         => __( 'Szállítási mód engedélyezése' ),
     262                        'default'       => 'yes',
     263                    ),
     264                    'shipping_fee' => array(
     265                        'title'         => __( 'Szállítás összege' ),
     266                        'type'          => 'number',
     267                        'description'   => __( 'A vevőre terhelt szállítási díj' ),
     268                        'default'       => __( '0' ),
     269                        'desc_tip'      => true
     270                    )
     271                );
     272                $this->enabled              = $this->get_option( 'enabled' );
     273                $this->title                = 'Automata (Foxpost)';
     274
     275                add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) );
     276            }
     277
     278            public function calculate_shipping( $package = array() ) {
     279                $this->add_rate( array(
     280                    'id'    => $this->id . $this->instance_id,
     281                    'label' => $this->title,
     282                    'cost'  => $this->get_option('shipping_fee'),
     283                ) );
     284            }
     285        }
     286    }
     287
    245288
    246289    if(!class_exists("WC_Shipping_fuvarhu_POP")){
     
    411454    }
    412455
     456    if(strpos($chosen_method_id,"fuvarhu_aut_fxp") !== false){
     457        $selected = "aut";
     458    }
     459
    413460    if($selected != "haz" && ($selected == "pos" || $selected == "csp" || $selected = "pop" || $selected = "aut")){
    414461        if(!isset($_POST['pickup_store']) || empty($_POST['pickup_store'])){
     
    422469function fuvarhu_pickup_store_custom_field( $method, $index ) {
    423470
    424     if( is_cart() || !in_array($method->method_id, ["fuvarhu_csp","fuvarhu_pop","fuvarhu_pos","fuvarhu_aut_dpd","fuvarhu_aut_pck"]) )
     471    if( is_cart() || !in_array($method->method_id, ["fuvarhu_csp","fuvarhu_pop","fuvarhu_pos","fuvarhu_aut_dpd","fuvarhu_aut_pck","fuvarhu_aut_fxp"]) )
    425472        return;
    426473
     
    461508        $provider = "pck";
    462509        $show_for = "fuvarhu_aut_pck";
     510    }
     511
     512    if(strpos($chosen_method_id,"fuvarhu_aut_fxp") !== false){
     513        $selected = "aut";
     514        $provider = "fxp";
     515        $show_for = "fuvarhu_aut_fxp";
    463516    }
    464517
     
    499552        }
    500553
    501         if(sizeof($options) > 0){
    502             echo '<div class="wrapper-pickup_store" style="margin-top:8px; margin-bottom:16px">';
    503            
    504             echo "<p><small>max. 20kg súlyig</small></p>";
    505 
    506             echo'<label class="title">' . __("Kérlek, válassz kézbesítési pontot") . ':</label>
    507                 <select name="pickup_store" style="width: 100%; padding: 10px; border: 1px solid #000">';
    508                     echo"<option value='' disabled selected>Kérlek, válassz egy kézbesítési pontot</option>";
     554
     555        echo '<div class="wrapper-pickup_store" style="margin-top:8px; margin-bottom:16px">';
     556
     557        echo "<p><small>max. 20kg súlyig</small></p>";
     558
     559        echo'<label class="title">' . __("Kérlek, válassz kézbesítési pontot") . ':</label>
     560            <select name="pickup_store" style="width: 100%; padding: 10px; border: 1px solid #000" class="fuvarhu-select">';
     561                echo"<option value='' disabled selected>Kérlek, válassz egy kézbesítési pontot</option>";
     562                if(sizeof($options) > 0){
    509563                    foreach ($options as $key => $value) {
    510564                        echo "<option value='".$key."'>".$value."</option>";
    511565                    }
    512                 echo'</select>
    513             </div>';
    514         }
    515     }
    516 }
    517 
     566                }else{
     567                    echo"<option value='' disabled selected>A pontok lekérdezése sikertelen volt</option>";
     568                }
     569            echo'</select>
     570        </div>';
     571
     572        echo'<script>jQuery(document).ready(function() { if(jQuery.fn.select2) {jQuery(".fuvarhu-select").select2();}});</script>';
     573
     574    }
     575}
     576
  • fuvar-hu-api/trunk/readme.txt

    r3110992 r3259042  
    44Requires at least: 5.6.1
    55Tested up to: 6.1
    6 Stable tag: 2
     6Stable tag: 2.1
    77Requires PHP: 8.1
    88License: GPLv2 or later
Note: See TracChangeset for help on using the changeset viewer.