Viewing 15 replies - 1 through 15 (of 17 total)
  • Plugin Contributor Mike Jolley

    (@mikejolley)

    Can you screenshot what you’re looking at?

    Thread Starter Halyra

    (@harasse)

    Thanks.
    First image, the shipping panel where we can see that my privateshipping tab exists?: https://www.dropbox.com/s/bqh95xjai5xix5w/img1.png?dl=0
    Second image, when I open this tab?: https://www.dropbox.com/s/2umzdjwzoeqf6xr/img2.png?dl=0
    Nothing seen in my debug log.

    Plugin Contributor Mike Jolley

    (@mikejolley)

    What method is collismo? Is that an extension?

    Thread Starter Halyra

    (@harasse)

    It is a private plugin to add and calculate a private shipping method. It is in classic mode, not in shipping zone mode. It works well with anterior WC.
    My init sequence is :

    function WC_shipping_method_choice_init() {
      if (!class_exists('Class_Colissimo_Shipping')) {
        class Class_Colissimo_Shipping extends WC_Shipping_Method {
          public $ColissimoInstance;
    
          public function __construct() {
            $this->id = 'Colissimo_Method';
            $this->method_title = __('Colissimo', 'cdi-colissimo-shipping');
            $this->method_description = __('Colissimo multi purpose shipping method', 'cdi-colissimo-shipping');
            $this->table_rate_option = 'cdi_colissimo_table_rate';
            $this->ColissimoInstance = new Class_Colissimo_Shipping_Function();
            $this->init();
          }
    
          public function init() {
            $this->init_form_fields();
            $this->init_settings();
    
            $this->enabled = $this->get_option('enabled');
            $this->title = $this->get_option( 'title' );
            $this->prefixshipping = $this->get_option( 'prefixshipping' );
            $this->pickup_method_name = $this->get_option( 'pickup_method_name' );
            $this->forced_product_code = $this->get_option( 'forced_product_code' );
    
    	add_action( 'woocommerce_update_options_shipping_' . $this->id, array( $this, 'process_admin_options' ) );
            add_action('woocommerce_update_options_shipping_' . $this->id, array($this, 'process_table_rates'));
    
            $this->load_table_rates();
            cdi_debug(__LINE__ ,__FILE__ , $this);
          }

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been damaged by the forum’s parser.]

    At the cdi_debug line, I store “this” print in debug log which seems well filled with set variables and my current tables.
    But none of that is seen in the panel neither in the source html.

    Plugin Contributor Mike Jolley

    (@mikejolley)

    Does your above class have a ‘init_form_fields’ method? If it does not, remove the line.

    Thread Starter Halyra

    (@harasse)

    Yes I have a ‘init_form_fields’ function in that class (And I correctly see the [form_fields] variables in my “this” debug print) :

    public function init_form_fields() {
            $this->form_fields = array(
              'enabled' => array(
                'title' => __('Enable Shipping', 'cdi-colissimo-shipping') ,
                'type' => 'checkbox',
                'label' => __('Enable "Colissimo shipping method"', 'cdi-colissimo-shipping') ,
                'default' => 'no'
              ) ,
              'title' => array(
                'title' => __( 'Title','cdi-colissimo-shipping'),
                'type' => 'text',
                'description' => __( 'Title shown in admin shipping options', 'cdi-colissimo-shipping' ),
                'default' => __( 'Colissimo','cdi-colissimo-shipping'),
              ),
              'prefixshipping' => array(
                'title' => __( 'Prefix ','cdi-colissimo-shipping'),
                'type' => 'text',
                'description' => __( 'Optional - Prefix of shipping title which will be seen by customer.', 'cdi-colissimo-shipping' ),
                'default' => __( 'Colissimo','cdi-colissimo-shipping'),
              ),
              'setting_shipping_table' => array(
               'type' => 'shipping_table',
              ) ,
              'tax_status' => array(
                'title' => __('Tax Status', 'woocommerce') ,
                'type' => 'select',
                'class' => 'wc-enhanced-select',
                'default' => 'taxable',
                'options' => array(
                  'taxable' => __('Taxable', 'woocommerce') ,
                  'none' => _x('None', 'Tax status', 'woocommerce')
                ) ,
              ) ,
              'pickuplocations' => array(
                'title' => __('Enable Pickup', 'cdi-colissimo-shipping') ,
                'type' => 'checkbox',
                'label' => __('Enable "Colissimo Choix livraison - Pickup locations"', 'cdi-colissimo-shipping') ,
                'description' => __( 'Pickup location setting can be checked and operational even with Colissimo shipping method not checked.', 'cdi-colissimo-shipping' ),
                'default' => 'yes'
              ) ,
              'pickup_method_name' => array(
                'title' => __('Pickup Methods', 'woocommerce') ,
                'type' => 'text',
                'default' => 'Colissimo_Method_pick1, Colissimo_Method_pick2,',
                'description' => __( 'Optional - Comma separated list of Method names which activate the Colissimo pickup location choice process. May be methods of this Colissimo shipping or external methods.', 'cdi-colissimo-shipping' ),
              ) ,
              'forced_product_code' => array(
                'title' => __('Product codes', 'woocommerce') ,
                'type' => 'text',
                'default' => 'Colissimo_Method_home2=DOS,',
                'description' => __( 'Optional - Comma separated list of relations "Method names = Colissimo product code" to be use for Colissimo expedition. May be methods of this Colissimo shipping or external methods.', 'cdi-colissimo-shipping' ),
              ) ,
    
            );
          }

    [Moderator Note: Please post code & markup between backticks or use the code button. Your posted code may now have been damaged by the forum’s parser.]

    Plugin Contributor Mike Jolley

    (@mikejolley)

    Thread Starter Halyra

    (@harasse)

    Below, my debug file (shot of “this” at the end of the init sequence) with no notice or error seen in the log :

    [16-Jun-2016 11:42:02 UTC] *** Debug CDI - Line 49 file /home/fanjamag/public_html/fanjamag/fjmgbd99/wp-content/plugins/colissimo-delivery-integration (1.7.1)/includes/WC-colissimo-shipping.php ***: Class_Colissimo_Shipping Object
    (
        [ColissimoInstance] => Class_Colissimo_Shipping_Function Object
            (
            )
    
        [supports] => Array
            (
                [0] => settings
            )
    
        [id] => Colissimo_Method
        [method_title] => Colissimo
        [method_description] => Colissimo multi purpose shipping method
        [enabled] => yes
        [title] => Colissimo
        [rates] => Array
            (
            )
    
        [tax_status] => taxable
        [fee] =>
        [minimum_fee] =>
        [instance_id] => 0
        [instance_form_fields] => Array
            (
            )
    
        [instance_settings] => Array
            (
            )
    
        [availability] =>
        [countries] => Array
            (
            )
    
        [plugin_id] => woocommerce_
        [errors] => Array
            (
            )
    
        [settings] => Array
            (
                [enabled] => yes
                [title] => Colissimo
                [prefixshipping] =>
                [setting_shipping_table] =>
                [tax_status] => taxable
                [pickuplocations] => yes
                [pickup_method_name] => Colissimo_Method_pick1, Colissimo_Method_pick2,
                [forced_product_code] => Colissimo_Method_home2=DOS,
            )
    
        [form_fields] => Array
            (
                [enabled] => Array
                    (
                        [title] => Enable Shipping
                        [type] => checkbox
                        [label] => Enable "Colissimo shipping method"
                        [default] => no
                    )
    
                [title] => Array
                    (
                        [title] => Title
                        [type] => text
                        [description] => Title shown in admin shipping options
                        [default] => Colissimo
                    )
    
                [prefixshipping] => Array
                    (
                        [title] => Prefix
                        [type] => text
                        [description] => Optional - Prefix of shipping title which will be seen by customer.
                        [default] => Colissimo
                    )
    
                [setting_shipping_table] => Array
                    (
                        [type] => shipping_table
                    )
    
                [tax_status] => Array
                    (
                        [title] => état de la TVA
                        [type] => select
                        [class] => wc-enhanced-select
                        [default] => taxable
                        [options] => Array
                            (
                                [taxable] => Taxable
                                [none] => Aucun
                            )
    
                    )
    
                [pickuplocations] => Array
                    (
                        [title] => Enable Pickup
                        [type] => checkbox
                        [label] => Enable "Colissimo Choix livraison - Pickup locations"
                        [description] => Pickup location setting can be checked and operational even with Colissimo shipping method not checked.
                        [default] => yes
                    )
    
                [pickup_method_name] => Array
                    (
                        [title] => Pickup Methods
                        [type] => text
                        [default] => Colissimo_Method_pick1, Colissimo_Method_pick2,
                        [description] => Optional - Comma separated list of Method names which activate the Colissimo pickup location choice process. May be methods of this Colissimo shipping or external methods.
                    )
    
                [forced_product_code] => Array
                    (
                        [title] => Product codes
                        [type] => text
                        [default] => Colissimo_Method_home2=DOS,
                        [description] => Optional - Comma separated list of relations "Method names = Colissimo product code" to be use for Colissimo expedition. May be methods of this Colissimo shipping or external methods.
                    )
    
            )
    
        [data:protected] => Array
            (
            )
    
        [table_rate_option] => cdi_colissimo_table_rate
        [prefixshipping] =>
        [pickup_method_name] => Colissimo_Method_pick1, Colissimo_Method_pick2,
        [forced_product_code] => Colissimo_Method_home2=DOS,
        [table_rates] => Array
            (
                [0] => Array
                    (
                        [class] => all
                        [methods] => home1
                        [pricemin] => 0
                        [pricemax] => 125
                        [weightmin] => 0
                        [weightmax] => 30000
                        [fare] => 6.25
                        [country] => FR,AD,MC
                        [method_name] => France
                    )
    
                [1] => Array
                    (
                        [class] => all
                        [methods] => home1
                        [pricemin] => 125
                        [pricemax] => 5000
                        [weightmin] => 0
                        [weightmax] => 30000
                        [fare] => 0
                        [country] => FR,AD,MC
                        [method_name] => France
                    )
    
                [2] => Array
                    (
                        [class] => all
                        [methods] => home1
                        [pricemin] => 0
                        [pricemax] => 5000
                        [weightmin] => 0
                        [weightmax] => 30000
                        [fare] => 15
                        [country] => DE,AT,BE,BG,CY,HR,DK,ES,EE,FI,GR,HU,IS,IT,LV,LI,LT,LU,MT,MC,NO,NL,PL,PT,RO,GB,CZ,IE,SK,SI,CH,SE,IM
                        [method_name] => Europe
                    )
    
                [3] => Array
                    (
                        [class] => all
                        [methods] => home1
                        [pricemin] => 0
                        [pricemax] => 5000
                        [weightmin] => 0
                        [weightmax] => 30000
                        [fare] => 30
                        [country] => *,-FR,-AD,-MC,-DE,-AT,-BE,-BG,-CY,-HR,-DK,-ES,-EE,-FI,-GR,-HU,-IS,-IT,-LV,-LI,-LT,-LU,-MT,-MC,-NO,-NL,-PL,-PT,-RO,-GB,-CZ,-IE,-SK,-SI,-CH,-SE,-IM
                        [method_name] => International
                    )
    
            )
    
    )

    And page source is :

    <form method="post" id="mainform" action="" enctype="multipart/form-data">
    		<nav class="nav-tab-wrapper woo-nav-tab-wrapper">
    			<a href="https://fanjamag.net/wp-admin/admin.php?page=wc-settings&tab=general" class="nav-tab ">Général</a><a href="https://fanjamag.net/wp-admin/admin.php?page=wc-settings&tab=products" class="nav-tab ">Produits</a><a href="https://fanjamag.net/wp-admin/admin.php?page=wc-settings&tab=tax" class="nav-tab ">TVA</a><a href="https://fanjamag.net/wp-admin/admin.php?page=wc-settings&tab=shipping" class="nav-tab nav-tab-active">Livraison&nbsp;</a><a href="https://fanjamag.net/wp-admin/admin.php?page=wc-settings&tab=checkout" class="nav-tab ">Commande</a><a href="https://fanjamag.net/wp-admin/admin.php?page=wc-settings&tab=account" class="nav-tab ">Comptes</a><a href="https://fanjamag.net/wp-admin/admin.php?page=wc-settings&tab=email" class="nav-tab ">E-mails</a><a href="https://fanjamag.net/wp-admin/admin.php?page=wc-settings&tab=api" class="nav-tab ">API</a><a href="https://fanjamag.net/wp-admin/admin.php?page=wc-settings&tab=settings_tab_colissimo" class="nav-tab ">Colissimo</a><a href="https://fanjamag.net/wp-admin/admin.php?page=wc-settings&tab=woocommerce-delivery-notes" class="nav-tab ">Impression</a>		</nav>
    		<h1 class="screen-reader-text">Livraison&nbsp;</h1>
    		<ul class="subsubsub"><li><a href="https://fanjamag.net/wp-admin/admin.php?page=wc-settings&tab=shipping&section=" class="">Zones de livraison</a> | </li><li><a href="https://fanjamag.net/wp-admin/admin.php?page=wc-settings&tab=shipping&section=options" class="">Options de livraison</a> | </li><li><a href="https://fanjamag.net/wp-admin/admin.php?page=wc-settings&tab=shipping&section=classes" class="">Classes de livraison</a> | </li><li><a href="https://fanjamag.net/wp-admin/admin.php?page=wc-settings&tab=shipping&section=legacy_free_shipping" class="">Livraison gratuite (obsolète)</a> | </li><li><a href="https://fanjamag.net/wp-admin/admin.php?page=wc-settings&tab=shipping&section=colissimo_method" class="current">Colissimo</a>  </li></ul><br class="clear" />		<p class="submit">
    							<input name="save" class="button-primary woocommerce-save-button" type="submit" value="Enregistrer les changements" />
    						<input type="hidden" id="_wpnonce" name="_wpnonce" value="49079ba6fa" /><input type="hidden" name="_wp_http_referer" value="/wp-admin/admin.php?page=wc-settings&tab=shipping&section=colissimo_method" />		</p>
    	</form>

    Plugin Contributor Mike Jolley

    (@mikejolley)

    I cannot give you answer from the information provided. Clearly that shipping method is not 2.6 compatible and without seeing the full source I cannot even begin to guess to why. Maybe you can compare to the legacy methods in WC core which still function fine even after zones.

    Thread Starter Halyra

    (@harasse)

    Thanks.
    But will a shipping method 2.6 compatible be also compatible with anterior WC ?

    Plugin Contributor Mike Jolley

    (@mikejolley)

    Mostly, unless you add shipping zone support in which case it will be 2.6+

    Thread Starter Halyra

    (@harasse)

    This means that I must test the WC on which my code run, to decide if I add shipping zone support or not. In I don’t the risk is to have something working only with 2.6+ . Right ?

    Plugin Contributor Mike Jolley

    (@mikejolley)

    I don’t understand your question?

    Thread Starter Halyra

    (@harasse)

    Sorry, I was not very clear.
    Suppose I update my plugin to be at the 2.6 standard, with “$instance_id” and “supports = array(‘shipping-zones’, ‘instance-settings’, ‘instance-settings-modal’,)” correctly declared in __construct .
    I understood that this will work on WC 2.6 and further, with the shipping zone facilities, but will not work on WC 2.5.
    Is it that ?

    Plugin Contributor Mike Jolley

    (@mikejolley)

    Yes thats correct.

Viewing 15 replies - 1 through 15 (of 17 total)
  • The topic ‘Lost of my custom Method-shipping settings’ is closed to new replies.