Plugin Directory

Changeset 3347096


Ignore:
Timestamp:
08/19/2025 02:52:13 PM (5 months ago)
Author:
aarsiv
Message:

Canada post ne options released

Location:
a2z-canada-post-automated-shipping
Files:
32 added
4 edited

Legend:

Unmodified
Added
Removed
  • a2z-canada-post-automated-shipping/trunk/controllors/hit_canadapost_auto_init.php

    r3110727 r3347096  
    365365                        $parcel .= '<weight>'.$package['Weight']['Value'].'</weight>';
    366366                        $parcel .= '</parcel-characteristics>';
     367
     368                        // Build options XML if needed
     369                        $options_xml = '';
     370                        if(isset($general_settings['hit_cp_auto_cod']) && $general_settings['hit_cp_auto_cod'] == 'yes' ||
     371                        isset($general_settings['hit_cp_auto_sig_req']) && $general_settings['hit_cp_auto_sig_req'] == 'yes' ||
     372                        (isset($general_settings['hit_cp_auto_ndh']) && $general_settings['hit_cp_auto_ndh'] !== 'N') ||
     373                        (isset($general_settings['hit_cp_auto_insurance']) && $general_settings['hit_cp_auto_insurance'] == 'yes') ||
     374                        (isset($general_settings['hit_cp_auto_hfp']) && $general_settings['hit_cp_auto_hfp'] == 'yes') ||
     375                        (isset($general_settings['hit_cp_auto_dns']) && $general_settings['hit_cp_auto_dns'] == 'yes') ||
     376                        (isset($general_settings['hit_cp_auto_lad']) && $general_settings['hit_cp_auto_lad'] == 'yes')) {
     377                           
     378                            $options_xml = '<options>';
     379                           
     380                            // COD
     381                            if(isset($general_settings['hit_cp_auto_cod']) && $general_settings['hit_cp_auto_cod'] == 'yes') {
     382                                $options_xml .= '<option>
     383                                    <option-code>COD</option-code>
     384                                    <option-amount>'.round($package['InsuredValue']['Amount'],2).'</option-amount>
     385                                </option>';
     386                            }
     387                           
     388                            // Signature
     389                            if(isset($general_settings['hit_cp_auto_sig_req']) && $general_settings['hit_cp_auto_sig_req'] == 'yes') {   
     390                                $options_xml .= '<option><option-code>SO</option-code></option>';
     391                            }
     392                           
     393                            // Non-Delivery Handling
     394                            $ndh = '';
     395                            if(isset($general_settings['hit_cp_auto_ndh']) && $general_settings['hit_cp_auto_ndh'] !== 'N') {
     396                                $ndh = $general_settings['hit_cp_auto_ndh'];
     397                            }
     398                            if($des_coun == 'US') {
     399                                $ndh = 'RASE';
     400                            }
     401                            if(!empty($ndh)) {
     402                                $options_xml .= '<option><option-code>'.$ndh.'</option-code></option>';
     403                            }
     404                           
     405                            // Insurance
     406                            if(isset($general_settings['hit_cp_auto_insurance']) && $general_settings['hit_cp_auto_insurance'] == 'yes') {
     407                                $options_xml .= '<option>
     408                                    <option-code>COV</option-code>
     409                                    <option-amount>'.round($package['InsuredValue']['Amount'],2).'</option-amount>
     410                                </option>';
     411                            }
     412                           
     413                            // Card for Pickup
     414                            if(isset($general_settings['hit_cp_auto_hfp']) && $general_settings['hit_cp_auto_hfp'] == 'yes') {
     415                                $options_xml .= '<option><option-code>HFP</option-code></option>';
     416                            }
     417                           
     418                            // Do Not Safe Drop
     419                            if(isset($general_settings['hit_cp_auto_dns']) && $general_settings['hit_cp_auto_dns'] == 'yes') {
     420                                $options_xml .= '<option><option-code>DNS</option-code></option>';
     421                            }
     422                           
     423                            // Leave at Door
     424                            if(isset($general_settings['hit_cp_auto_lad']) && $general_settings['hit_cp_auto_lad'] == 'yes') {
     425                                $options_xml .= '<option><option-code>LAD</option-code></option>';
     426                            }
     427                           
     428                            $options_xml .= '</options>';
     429                        }
     430
    367431               
    368432                        $cont_id = !empty($general_settings['hit_cp_auto_access_key']) ? '<contract-id>'.$general_settings['hit_cp_auto_access_key'].'</contract-id>' : '';
     
    372436                        $xmlRequest = str_replace('{$originPostalCode}',$general_settings['hit_cp_auto_zip'],$xmlRequest);
    373437                        $xmlRequest = str_replace('{$postalCode}',strtoupper(str_replace(" ", "", $postalcode)),$xmlRequest);
     438
     439                        // Add options if they exist
     440                        if(!empty($options_xml)) {
     441                            $xmlRequest = str_replace('</mailing-scenario>', $options_xml.'</mailing-scenario>', $xmlRequest);
     442                        }
    374443                       
    375444                        // echo "<pre>";
  • a2z-canada-post-automated-shipping/trunk/controllors/views/hit_canadapost_auto_settings_view.php

    r3178221 r3347096  
    601601        $general_settings['hit_cp_auto_cod'] = sanitize_text_field(isset($_POST['hit_cp_auto_cod']) ? 'yes' :'no');
    602602        $general_settings['hit_cp_auto_sig_req'] = sanitize_text_field(isset($_POST['hit_cp_auto_sig_req']) ? 'yes' :'no');
     603
     604        $general_settings['hit_cp_auto_insurance'] = sanitize_text_field(isset($_POST['hit_cp_auto_insurance']) ? 'yes' :'no');
     605        $general_settings['hit_cp_auto_dns'] = sanitize_text_field(isset($_POST['hit_cp_auto_dns']) ? 'yes' :'no');
     606        $general_settings['hit_cp_auto_lad'] = sanitize_text_field(isset($_POST['hit_cp_auto_lad']) ? 'yes' :'no');
     607        $general_settings['hit_cp_auto_hfp'] = sanitize_text_field(isset($_POST['hit_cp_auto_hfp']) ? 'yes' :'no');
     608       
    603609        $general_settings['hit_cp_auto_ndh'] = sanitize_text_field(isset($_POST['hit_cp_auto_ndh']) ? $_POST['hit_cp_auto_ndh'] : 'RTS');
    604        
    605610        $general_settings['hit_cp_auto_sat'] = sanitize_text_field(isset($_POST['hit_cp_auto_sat']) ? 'yes' :'no');
    606611        $general_settings['hit_cp_auto_ppt'] = sanitize_text_field(isset($_POST['hit_cp_auto_ppt']) ? 'yes' :'no');
     
    11581163    <table style="padding-left:10px;padding-right:10px;">
    11591164        <td><span style="float:left;padding-right:10px;"><input type="checkbox" name="hit_cp_auto_cod" <?php echo (isset($general_settings['hit_cp_auto_cod']) && $general_settings['hit_cp_auto_cod'] == 'yes') ? 'checked="true"' : ''; ?> value="yes" ><small style="color:gray"> Cash on Delivery.</small></span></td>
     1165        <td><span style="float:left;padding-right:10px;"><input type="checkbox" name="hit_cp_auto_sig_req" <?php echo (isset($general_settings['hit_cp_auto_sig_req']) && $general_settings['hit_cp_auto_sig_req'] == 'yes') ? 'checked="true"' : ''; ?> value="yes" ><small style="color:gray"> Signature.</small></span></td>
     1166        <td><span style="float:left;padding-right:10px;"><input type="checkbox" name="hit_cp_auto_insurance" <?php echo (isset($general_settings['hit_cp_auto_insurance']) && $general_settings['hit_cp_auto_insurance'] == 'yes') ? 'checked="true"' : ''; ?> value="yes" ><small style="color:gray"> Insurance.</small></span></td>
     1167        <td><span style="float:left;padding-right:10px;"><input type="checkbox" name="hit_cp_auto_dns" <?php echo (isset($general_settings['hit_cp_auto_dns']) && $general_settings['hit_cp_auto_dns'] == 'yes') ? 'checked="true"' : ''; ?> value="yes" ><small style="color:gray"> Do not safe drop.</small></span></td>
     1168        <td><span style="float:left;padding-right:10px;"><input type="checkbox" name="hit_cp_auto_lad" <?php echo (isset($general_settings['hit_cp_auto_lad']) && $general_settings['hit_cp_auto_lad'] == 'yes') ? 'checked="true"' : ''; ?> value="yes" ><small style="color:gray"> Leave at door.</small></span></td>
     1169        <td><span style="float:left;padding-right:10px;"><input type="checkbox" name="hit_cp_auto_hfp" <?php echo (isset($general_settings['hit_cp_auto_hfp']) && $general_settings['hit_cp_auto_hfp'] == 'yes') ? 'checked="true"' : ''; ?> value="yes" ><small style="color:gray"> Card for pickup.</small></span></td>
    11601170        <td><span style="float:right;padding-right:10px;"><input type="checkbox" name="hit_cp_auto_uostatus" <?php echo (isset($general_settings['hit_cp_auto_uostatus']) && $general_settings['hit_cp_auto_uostatus'] == 'yes') ? 'checked="true"' : ''; ?> value="yes" ><small style="color:gray"> Update order status by tracking</small></span></td>
    11611171        </table></center>
  • a2z-canada-post-automated-shipping/trunk/hit_canadapost_auto_basic.php

    r3178221 r3347096  
    44 * Plugin URI: https://wordpress.org/plugins/a2z-canada-post-automated-shipping/#developers
    55 * Description: Realtime Shipping Rates, Shipping label, commercial invoice automation included.
    6  * Version: 3.0.1
     6 * Version: 3.0.2
    77 * Author: Shipi
    88 * Author URI: https://myshipi.com/
     
    262262                   
    263263                    // echo '</select>';
     264
     265                    echo '<br/><b>Signature</b>';
     266                    echo '<br/><select name="hit_cp_auto_sig_req_m">';
     267                    echo "<option value='N' " . ($general_settings['hit_cp_auto_sig_req'] == 'yes' ? '' : 'selected') . ">disabled</option>";
     268                    echo "<option value='Y' " . ($general_settings['hit_cp_auto_sig_req'] == 'yes' ? 'selected' : '') . ">enabled</option>";
     269                    echo '</select>';
     270
     271                    echo '<br/><b>Insurance</b>';
     272                    echo '<br/><select name="hit_cp_auto_insurance_m">';
     273                    echo "<option value='N' " . ($general_settings['hit_cp_auto_insurance'] == 'yes' ? '' : 'selected') . ">disabled</option>";
     274                    echo "<option value='Y' " . ($general_settings['hit_cp_auto_insurance'] == 'yes' ? 'selected' : '') . ">enabled</option>";
     275                    echo '</select>';
     276
     277                    echo '<br/><b>Do not safe drop</b>';
     278                    echo '<br/><select name="hit_cp_auto_dns_m">';
     279                    echo "<option value='N' " . ($general_settings['hit_cp_auto_dns'] == 'yes' ? '' : 'selected') . ">disabled</option>";
     280                    echo "<option value='Y' " . ($general_settings['hit_cp_auto_dns'] == 'yes' ? 'selected' : '') . ">enabled</option>";
     281                    echo '</select>';
     282
     283                    echo '<br/><b>Leave at door</b>';
     284                    echo '<br/><select name="hit_cp_auto_lad_m">';
     285                    echo "<option value='N' " . ($general_settings['hit_cp_auto_lad'] == 'yes' ? '' : 'selected') . ">disabled</option>";
     286                    echo "<option value='Y' " . ($general_settings['hit_cp_auto_lad'] == 'yes' ? 'selected' : '') . ">enabled</option>";
     287                    echo '</select>';
     288
     289                    echo '<br/><b>Card for pickup</b>';
     290                    echo '<br/><select name="hit_cp_auto_hfp_m">';
     291                    echo "<option value='N' " . ($general_settings['hit_cp_auto_hfp'] == 'yes' ? '' : 'selected') . ">disabled</option>";
     292                    echo "<option value='Y' " . ($general_settings['hit_cp_auto_hfp'] == 'yes' ? 'selected' : '') . ">enabled</option>";
     293                    echo '</select>';
    264294                   
    265295                    echo '<br/><b>Shipment Content</b>';
     
    567597                        "s_phone" => $general_settings['hit_cp_auto_mob_num'],
    568598                        "s_email" => $general_settings['hit_cp_auto_email'],
    569                         "sig_req" => ($general_settings['hit_cp_auto_sig_req'] == 'yes') ? "Y" : "N",           
     599                        "sig_req" => ($general_settings['hit_cp_auto_sig_req'] == 'yes') ? "Y" : "N",
     600                        "insurance" => ($general_settings['hit_cp_auto_insurance'] == 'yes') ? "Y" : "N",
     601                        "dns" => ($general_settings['hit_cp_auto_dns'] == 'yes') ? "Y" : "N",
     602                        "lad" => ($general_settings['hit_cp_auto_lad'] == 'yes') ? "Y" : "N",
     603                        "hfp" => ($general_settings['hit_cp_auto_hfp'] == 'yes') ? "Y" : "N",
    570604                        "label_format" => "PDF",
    571605                        "label_size" => $general_settings['hit_cp_auto_print_size'],
     
    616650                   $service_code = str_replace("cp_","",$_POST['hit_cp_auto_service_code']);
    617651                   $ship_content = !empty($_POST['hit_cp_auto_shipment_content']) ? $_POST['hit_cp_auto_shipment_content'] : 'Shipment Content';
     652
     653                   $sig_req = !empty($_POST['hit_cp_auto_sig_req_m']) ? $_POST['hit_cp_auto_sig_req_m'] : 'N';
     654                   $insurance = !empty($_POST['hit_cp_auto_insurance_m']) ? $_POST['hit_cp_auto_insurance_m'] : 'N';
     655                   $dns = !empty($_POST['hit_cp_auto_dns_m']) ? $_POST['hit_cp_auto_dns_m'] : 'N';
     656                   $lad = !empty($_POST['hit_cp_auto_lad_m']) ? $_POST['hit_cp_auto_lad_m'] : 'N';
     657                   $hfp = !empty($_POST['hit_cp_auto_hfp_m']) ? $_POST['hit_cp_auto_hfp_m'] : 'N';
     658
    618659                   $order = wc_get_order( $order_id );
    619660                   if($order){
     
    749790                                "t_email" => $order_shipping_email,
    750791                                "dutiable" => $general_settings['hit_cp_auto_duty_payment'],
    751                                 "insurance" => $general_settings['hit_cp_auto_insure'],
     792                                // "insurance" => $general_settings['hit_cp_auto_insure'],
    752793                                "pack_this" => "Y",
    753794                                "residential" => 'false',
     
    777818                                "s_email" => $general_settings['hit_cp_auto_email'],
    778819                                "label_format" => "PDF",
    779                                 "sig_req" => ($general_settings['hit_cp_auto_sig_req'] == 'yes') ? "Y" : "N",
     820                                "sig_req" => $sig_req,
     821                                "insurance" => $insurance,
     822                                "dns" => $dns,
     823                                "lad" => $lad,
     824                                "hfp" => $hfp,
    780825                                "label_size" => $general_settings['hit_cp_auto_print_size'],
    781826                                "sent_email_to" => $general_settings['hit_cp_auto_label_email'],
  • a2z-canada-post-automated-shipping/trunk/readme.txt

    r3336110 r3347096  
    55Tested up to: 6.8
    66Requires PHP: 5.6
    7 Stable tag: 3.0.1
     7Stable tag: 3.0.2
    88License: GPLv3 or later License
    99URI: http://www.gnu.org/licenses/gpl-3.0.html
     
    8080
    8181== Changelog ==
    82 
     82= 3.0.2 =
     83    > Added New services in configuration page
    8384= 3.0.1 =
    8485    > New Wordpress version tested
Note: See TracChangeset for help on using the changeset viewer.