Plugin Directory

Changeset 3308462


Ignore:
Timestamp:
06/09/2025 11:53:15 AM (10 months ago)
Author:
bitsstech
Message:

improvements in edd checker

Location:
shipment-tracker-for-woocommerce/trunk
Files:
1 added
9 edited

Legend:

Unmodified
Added
Removed
  • shipment-tracker-for-woocommerce/trunk/admin/js/bt-sync-shipment-tracking-admin.js

    r3301611 r3308462  
    182182        jQuery(document).on('change', 'input[name="carbon_fields_compact_input[_bt_sst_message_text_template]"]', function () {
    183183            var selectedValue = $(this).val();
     184            let timeline_img_url = bt_sync_shipment_track_data.plugin_public_url + 'images/shipping timeline.png';
    184185            const replacements = {
    185186                '#min_date#': 'Oct 08, 2024',
     
    190191                '#max_date_charges#': '80',
    191192                '#cutoff_time#': 'If ordered within 10 hrs 52 mins',
    192                 '#edit#': '<a href="#">Change</a>'
     193                '#edit#': '<a href="#">Change</a>',
     194                '#shipping_timeline#': '<img style="width: 350px;" src="'+timeline_img_url+'"/>'
    193195            };
    194196            for (const [key, value] of Object.entries(replacements)) {
  • shipment-tracker-for-woocommerce/trunk/bt-sync-shipment-tracking.php

    r3307882 r3308462  
    1717 * Plugin URI:        https://shipment-tracker-for-woocommerce.bitss.tech/
    1818 * Description:       Most comprehensive shipment tracking plugin that extends your woocommerce store with shipment related features. Keeps you & your customers informed about shipment movement.
    19  * Version:           1.4.24.14
     19 * Version:           1.4.24.15
    2020 * Author:            Bitss Techniques
    2121 * Author URI:        https://shipment-tracker-for-woocommerce.bitss.tech
     
    5959
    6060define( 'Carbon_Fields\URL', trailingslashit( plugin_dir_url( __FILE__ ) ) . 'vendor/htmlburger/carbon-fields/' );//fix for Bitnami installations.
    61 define( 'BT_SYNC_SHIPMENT_TRACKING_VERSION', '1.4.24.14' );
     61define( 'BT_SYNC_SHIPMENT_TRACKING_VERSION', '1.4.24.15' );
    6262define( 'BT_SHIPPING_PROVIDERS', array('delhivery' =>'Delhivery','nimbuspost' => 'Nimbuspost (Deprecated)','nimbuspost_new' => 'Nimbuspost','shipmozo'=>'Shipmozo','shiprocket' => 'Shiprocket', 'xpressbees' => 'Xpressbees', 'manual' =>'Custom Shipping') );
    6363define( 'BT_SHIPPING_PROVIDERS_WITH_NONE', array('none' =>'none','delhivery' =>'Delhivery', 'nimbuspost' => 'Nimbuspost (OLD)','nimbuspost_new' => 'Nimbuspost(NEW)','shipmozo'=>'Shipmozo','shiprocket' => 'Shiprocket', 'xpressbees' => 'Xpressbees','manual' =>'Custom Shipping') );
  • shipment-tracker-for-woocommerce/trunk/includes/class-bt-sync-shipment-tracking.php

    r3307882 r3308462  
    17521752       
    17531753        $container = $container->add_tab( __( 'Product Page' ), array(
    1754             Field::make( 'html', 'product_message', __( 'Custom HTML Field' ) )
    1755             ->set_html( '
    1756                     <div class="notification is-warning">This is a premium feature. <em>Administrators can test all premium features on product, checkout, and tracking pages while logged in.</em> </div>
    1757             ' ),
     1754            Field::make( 'html', 'product_message', __( 'Custom HTML Field' ) ),
    17581755            Field::make( 'checkbox', 'bt_sst_shiprocket_pincode_checker', __( 'Enable "Estimated Delivery Date Checker" widget.') )
    17591756                ->set_classes( 'title is-6' )
     
    17651762                ->set_options( array(
    17661763                    'classic' => 'Classic',
    1767                     'realistic' => 'Realistic',
    1768                     'prime_x' => 'Prime_x',
     1764                    'realistic' => 'Realistic (Premium)',
     1765                    'prime_x' => 'Prime_x (Premium)',
    17691766                ) )
    17701767                ->set_default_value('classic')
     
    17781775                            <img id="template-preview-img" src="" style="display: none;" alt="Template Preview">
    17791776                         </div>'),
    1780             Field::make('checkbox', 'bt_sst_enable_auto_postcode_fill', __('Automatically get visitor\'s postcode from ip address'))
     1777            Field::make('checkbox', 'bt_sst_enable_auto_postcode_fill', __('Automatically get visitor\'s postcode from ip address (Premium)'))
    17811778                ->set_classes( 'title is-6' )
    17821779                ->set_option_value('no')
     
    18141811                ) )
    18151812                ->set_default_value( 'woocommerce_after_add_to_cart_form' ),
    1816             Field::make( 'time', 'bt_sst_cutoff_time', __( 'Cut Off Time(Default time will be 6:00 PM)' ) )
     1813            Field::make( 'time', 'bt_sst_cutoff_time', __( 'Cut Off Time(Default time will be 6:00 PM) (Premium)' ) )
    18171814            ->set_default_value(  '18:00:00' )
    18181815            ->set_conditional_logic( array(
     
    19811978                ->set_min( 1 )
    19821979                ->set_max( 2),
    1983             Field::make( 'text', 'bt_sst_shiprocket_processing_days', __( 'Global Processing Days' ) )
     1980            Field::make( 'text', 'bt_sst_shiprocket_processing_days', __( 'Global Processing Days (Premium)' ) )
    19841981                ->set_help_text( 'Required. Processing days to improve the accuracy of estimated delivery date. This will be added to the EDD of couriers.
    19851982                <br>You can set this at "Product Category" or "Product" or "Variations" level as well.
     
    20352032                ) ),
    20362033            Field::make( 'text', 'bt_sst_message_text_template', __( 'Message Text Template' ) )
    2037                 ->set_help_text( 'Available variables: #city#, #pincode#, #min_date#, #max_date#, #min_date_charges#, #max_date_charges#, #cutoff_time#. Html is allowed.
     2034                ->set_help_text( 'Available variables: #city#, #pincode#, #min_date#, #max_date#, #min_date_charges#, #max_date_charges#, #cutoff_time#, #shipping_timeline#. Html is allowed.
    20382035                <br>
    20392036                Sample Templates:<br>
     
    20412038                2. Get it by &lt;b&gt;#min_date#&lt;/b&gt; at #city#. &lt;br&gt;#cutoff_time#<br>
    20422039                3. 🚚 Delivery by &lt;b&gt;#min_date#&lt;/b&gt; to #city# - #pincode# &lt;br&gt; #cutoff_time#.
     2040                4. #shipping_timeline#
    20432041                <br><br>
    20442042                Apply a preset:<br>
     
    20482046                    <option value="Get it by &lt;b&gt;#min_date#&lt;/b&gt; at #city#. &lt;br&gt;#cutoff_time#">Message Text Template - 2</option>
    20492047                    <option value="🚚 Delivery by &lt;b&gt;#min_date#&lt;/b&gt; to #city# - #pincode# &lt;br&gt; #cutoff_time#">Message Text Template -3 </option>
     2048                    <option value="🚚 Delivery by &lt;b&gt;#min_date#&lt;/b&gt; to #city# - #pincode# &lt;br&gt; #cutoff_time# <br> #shipping_timeline#">Shipping Timeline </option>
    20502049                </select>
    20512050                <p>Message Text Template Preview:</p>
  • shipment-tracker-for-woocommerce/trunk/includes/shipping_providers/delhivery.php

    r3299743 r3308462  
    3838    }
    3939
    40     public function get_rate_calcultor_and_date($md, $ss, $d_pin, $o_pin, $cgm){
     40    public function get_rate_calcultor_and_date($md, $ss, $d_pin, $o_pin, $cgm,$payment_mode){
    4141        $this->init_params();
    4242        if(!empty($this->public_key)){
     
    4646                'd_pin'=>$d_pin,
    4747                'o_pin'=>$o_pin,
    48                 'cgm'=>$cgm
     48                'cgm'=>$cgm,
     49                'pt'=>$payment_mode
    4950               
    5051            );
     
    348349   
    349350            // Call for Express
    350             $body_express = $this->getDataForExpressAndSurface('E', $delivery_pincode, $pickup_pincode, $weight_in_kg, $auth_key);
     351            $body_express = $this->getDataForExpressAndSurface('E', $delivery_pincode, $pickup_pincode, $weight_in_kg, $auth_key,  $pm);
    351352   
    352353            // Call for Surface
    353             $body_surface = $this->getDataForExpressAndSurface('S', $delivery_pincode, $pickup_pincode, $weight_in_kg, $auth_key);
     354            $body_surface = $this->getDataForExpressAndSurface('S', $delivery_pincode, $pickup_pincode, $weight_in_kg, $auth_key,  $pm);
    354355           
    355356            if(isset($body_express['error']) || isset($body_surface['error'])){
     
    416417    }
    417418
    418     function getDataForExpressAndSurface($mode, $delivery_pincode, $pickup_pincode, $weight_in_kg, $auth_key) {
     419    function getDataForExpressAndSurface($mode, $delivery_pincode, $pickup_pincode, $weight_in_kg, $auth_key, $payment_mode) {
    419420        $body = array(
    420421            'md' => $mode,
     
    422423            'd_pin' => $delivery_pincode,
    423424            'o_pin' => $pickup_pincode,
    424             'cgm' => $weight_in_kg*1000//convert to gm
     425            'cgm' => $weight_in_kg*1000, //convert to gm
     426            'pt' => $payment_mode
    425427        );
    426428   
  • shipment-tracker-for-woocommerce/trunk/includes/shipping_providers/shipmozo.php

    r3229619 r3308462  
    1313        $public_key=carbon_get_theme_option( 'bt_sst_shipmozo_apipublickey' );
    1414        $private_key=carbon_get_theme_option( 'bt_sst_shipmozo_apiprivatekey' );
    15 
    16         $this->public_key=trim($public_key);
    17         $this->private_key=trim($private_key);
     15        if(!empty($public_key) && !empty($private_key)){
     16            $this->public_key=trim($public_key);
     17            $this->private_key=trim($private_key);
     18        }
    1819    }
    1920
  • shipment-tracker-for-woocommerce/trunk/public/class-bt-sync-shipment-tracking-public.php

    r3305118 r3308462  
    140140        wp_register_script('bt-sync-shipment-tracking-public-checkout-blocks', plugin_dir_url(__FILE__) . 'js/bt-sync-shipment-tracking-public-checkout-block.js', array('wp-data', 'wc-blocks-checkout'), $this->version, true);
    141141        $post_code_auto_fill = carbon_get_theme_option('bt_sst_enable_auto_postcode_fill');
    142 
     142        $is_premium = $this->licenser->should_activate_premium_features();
     143        $post_code_auto_fill = ($post_code_auto_fill && $is_premium) ? true : false;
    143144        $script_data = array(
    144145            "ajax_url" => admin_url('admin-ajax.php'),
     
    149150        wp_localize_script('bt-sync-shipment-tracking-public', 'bt_sync_shipment_tracking_data', $script_data);
    150151
    151         $is_premium = $this->licenser->should_activate_premium_features();
     152       
    152153
    153154        if (is_checkout() && $is_premium) {
     
    277278        if ($product && !$product->is_virtual()) {
    278279            $is_premium = $this->licenser->should_activate_premium_features();
    279             if (!$is_premium)
    280                 return;
     280           
    281281            $pincode_checker = carbon_get_theme_option('bt_sst_shiprocket_pincode_checker');
    282282            if ($pincode_checker != 1) {
     
    286286
    287287            $check_templet = carbon_get_theme_option('bt_sst_pincode_box_template');
     288            if (!$is_premium)
     289                $check_templet = "classic"; //if not premium, then use classic template.
    288290            // $check_templet = "prime_x";
    289291            $post_code_auto_fill = carbon_get_theme_option('bt_sst_enable_auto_postcode_fill');
     
    320322    }
    321323
     324    //[bt_estimated_delivery_widget] shortcode handler
    322325    function bt_estimated_delivery_widget()
    323326    {
     
    325328
    326329        $is_premium = $this->licenser->should_activate_premium_features();
    327         if (!$is_premium)
    328             return "";
     330   
    329331        $pincode_checker = carbon_get_theme_option('bt_sst_shiprocket_pincode_checker');
    330332        if ($pincode_checker != 1) {
     
    335337        wp_enqueue_script('bt-sync-shipment-tracking-public');
    336338        $check_templet = carbon_get_theme_option('bt_sst_pincode_box_template');
     339        if (!$is_premium)
     340            $check_templet = "classic"; //if not premium, then use classic template.
    337341
    338342        ob_start();
     
    341345        } else if ($check_templet == "classic") {
    342346            include plugin_dir_path(dirname(__FILE__)) . 'public/partials/input_box_pincode_show_data.php';
     347        }else if ($check_templet == "prime_x") {
     348            wp_enqueue_style('input_box_pincode_show_prime_x');
     349            wp_enqueue_script('bt_sst_input_box_pincode_show_prime_x');
     350            include plugin_dir_path(dirname(__FILE__)) . 'public/partials/input_box_pincode_show_prime_x.php';
    343351        } else {
    344352            include plugin_dir_path(dirname(__FILE__)) . 'public/partials/input_box_pincode_show_data.php';
     
    376384        );
    377385        $is_premium = $this->licenser->should_activate_premium_features();
    378         if ($is_premium) {
     386        $city = "";
     387        $min_hours = 100000;
     388        $min_days = 0;
     389        $max_days = 0;
     390        $min_days_charges = 0;
     391        $max_days_charges = 0;
     392        $min_date = '';
     393        $min_date_charges = -1;
     394        $min_courier_name = '';
     395        $max_hours = 0;
     396        $max_date = '';
     397        $max_date_charges = -1;
     398        $max_courier_name = '';
     399        $should_activate = true;//
     400        if ($should_activate) {
    379401
    380402            $pickup_data_provider = carbon_get_theme_option(
     
    389411                $variation_id = trim($_POST['value']['variation_id']);
    390412            }
    391             $city = "";
    392             $min_hours = 100000;
    393             $min_date = '';
    394             $min_date_charges = -1;
    395             $min_courier_name = '';
    396 
    397             $max_hours = 0;
    398             $max_date = '';
    399             $max_date_charges = -1;
    400             $max_courier_name = '';
     413       
    401414            $bt_sst_message_text_template = carbon_get_theme_option('bt_sst_message_text_template');
    402415            $push_resp = [];
     
    605618                        //if not found, get processing days set at global level.
    606619                        $processing_days = carbon_get_theme_option("bt_sst_shiprocket_processing_days");
     620                    }
     621                    if(!$is_premium){
     622                        $processing_days = 0; //if not premium, then no processing days.
    607623                    }
    608624
     
    733749                        $processing_days = carbon_get_theme_option("bt_sst_shiprocket_processing_days");
    734750                    }
     751                    if(!$is_premium){
     752                        $processing_days = 0; //if not premium, then no processing days.
     753                    }
    735754
    736755                    if ($processing_days && $processing_days > 0) {
     
    845864                    }
    846865                    //$processing_days = 9;
    847 
     866                    if(!$is_premium){
     867                        $processing_days = 0; //if not premium, then no processing days.
     868                    }
    848869
    849870                    if ($processing_days && $processing_days > 0) {
     
    872893                        if (isset($bt_sst_cached_delivery_estimates_delhivery[$cached_pincode_key])) {
    873894                            $push_resp = $bt_sst_cached_delivery_estimates_delhivery[$cached_pincode_key][0];
    874                             $express_tat = $$bt_sst_cached_delivery_estimates_delhivery[$cached_pincode_key][1];
     895                            $express_tat = $bt_sst_cached_delivery_estimates_delhivery[$cached_pincode_key][1];
    875896                            $response["message"] = "Data fetched from cache.";
    876897                        } else {
    877                             $push_resp = $this->delhivery->get_rate_calcultor_and_date('E', 'Delivered', $pickup_pin, $delivery_pincode, '500');
     898                            $push_resp = $this->delhivery->get_rate_calcultor_and_date('E', 'Delivered', $pickup_pin, $delivery_pincode, '500','PREPAID');
    878899
    879900                            if ($push_resp != null && !empty($push_resp) && sizeof($push_resp) > 0) {
     
    935956                        $processing_days = carbon_get_theme_option("bt_sst_shiprocket_processing_days");
    936957                    }
     958
     959                    if(!$is_premium){
     960                        $processing_days = 0; //if not premium, then no processing days.
     961                    }
    937962                    if ($processing_days && $processing_days > 0) {
    938963                        $min_date = $this->addDayswithdate($min_date, $processing_days);
     
    959984            }
    960985
    961             $cutoff_time_str = carbon_get_theme_option('bt_sst_cutoff_time');
    962986            $message = "";
    963 
    964             if (!$cutoff_time_str) {
    965                 $cutoff_time_str = '18:00:00';
    966             }
    967             $timezone_string = get_option('timezone_string');
    968             if (!$timezone_string) {
    969                 $timezone_string = 'Asia/Kolkata';
    970             }
    971 
    972             try {
    973                 $wp_timezone = new DateTimeZone($timezone_string);
    974             } catch (Exception $e) {
    975                 // Handle the exception if the timezone is still invalid
    976                 $wp_timezone = new DateTimeZone('UTC'); // Fallback to UTC
    977             }
    978 
    979             // Get the current time in the WordPress timezone
    980             $current_time = new DateTime('now', $wp_timezone);
    981 
    982             // Create the cutoff time in the WordPress timezone
    983             $cutoff_time = new DateTime($cutoff_time_str, $wp_timezone);
    984 
    985             // Calculate the time difference
    986             $time_diff = $cutoff_time->getTimestamp() - $current_time->getTimestamp();
    987 
    988             if ($time_diff > 0) {
    989                 $hours = floor($time_diff / 3600);
    990                 $minutes = floor(($time_diff % 3600) / 60);
    991                 $message = "If ordered within <strong>" . $hours . " hrs " . $minutes . " mins</strong>";
    992             } else {
    993                 // If the current time is past the cutoff, move the cutoff time to the next day
    994                 $cutoff_time->modify('+1 day');
     987            //cut off time processing for premium users
     988            if($is_premium){
     989                $cutoff_time_str = carbon_get_theme_option('bt_sst_cutoff_time');
     990               
     991
     992                if (!$cutoff_time_str) {
     993                    $cutoff_time_str = '18:00:00';
     994                }
     995                $timezone_string = get_option('timezone_string');
     996                if (!$timezone_string) {
     997                    $timezone_string = 'Asia/Kolkata';
     998                }
     999
     1000                try {
     1001                    $wp_timezone = new DateTimeZone($timezone_string);
     1002                } catch (Exception $e) {
     1003                    // Handle the exception if the timezone is still invalid
     1004                    $wp_timezone = new DateTimeZone('UTC'); // Fallback to UTC
     1005                }
     1006
     1007                // Get the current time in the WordPress timezone
     1008                $current_time = new DateTime('now', $wp_timezone);
     1009
     1010                // Create the cutoff time in the WordPress timezone
     1011                $cutoff_time = new DateTime($cutoff_time_str, $wp_timezone);
     1012
     1013                // Calculate the time difference
    9951014                $time_diff = $cutoff_time->getTimestamp() - $current_time->getTimestamp();
    996                 $hours = floor($time_diff / 3600);
    997                 $minutes = floor(($time_diff % 3600) / 60);
    998                 $message = "If ordered within <strong>" . $hours . " hrs " . $minutes . " mins</strong>";
    999             }
    1000 
     1015
     1016                if ($time_diff > 0) {
     1017                    $hours = floor($time_diff / 3600);
     1018                    $minutes = floor(($time_diff % 3600) / 60);
     1019                    $message = "If ordered within <strong>" . $hours . " hrs " . $minutes . " mins</strong>";
     1020                } else {
     1021                    // If the current time is past the cutoff, move the cutoff time to the next day
     1022                    $cutoff_time->modify('+1 day');
     1023                    $time_diff = $cutoff_time->getTimestamp() - $current_time->getTimestamp();
     1024                    $hours = floor($time_diff / 3600);
     1025                    $minutes = floor(($time_diff % 3600) / 60);
     1026                    $message = "If ordered within <strong>" . $hours . " hrs " . $minutes . " mins</strong>";
     1027                }
     1028            }
    10011029            $cut_of_time = $message;
    10021030            $edit_postcode = '<div id="bt_sst_pincode_box_change_button" style=""><a href="#">Change</a></div>';
    1003             $processing_time = carbon_get_theme_option('bt_sst_shiprocket_processing_days');
    1004             if ($processing_time) {
    1005                 $processing_time = "<div class='bt_sst_processing_time'>Processing time: " . esc_html($processing_time) . " days</div>";
    1006             }
    1007 
     1031
     1032            //processing time calculation for premium users
     1033            $processing_time = "";
    10081034            $ordered_date = new DateTime(); // create DateTime object
    1009             $processing_time_min = carbon_get_theme_option('bt_sst_shiprocket_processing_days');
    1010 
    10111035            // Clone the DateTime object to calculate the shipped date
    10121036            $shipped_date = clone $ordered_date;
    1013             $shipped_date->modify("+{$processing_time_min} days");
     1037            if($is_premium){
     1038                $processing_time = carbon_get_theme_option('bt_sst_shiprocket_processing_days');
     1039                if ($processing_time) {
     1040                    $processing_time = "<div class='bt_sst_processing_time'>Processing time: " . esc_html($processing_time) . " days</div>";
     1041                }
     1042                $processing_time_min = carbon_get_theme_option('bt_sst_shiprocket_processing_days',0);
     1043                if(!empty($processing_time_min) && $processing_time_min > 0) {
     1044                    $shipped_date->modify("+{$processing_time_min} days");
     1045                }
     1046            }
    10141047
    10151048            // Format both dates
     
    11091142        $mess_text = str_ireplace("#edit#", $edit_postcode, $mess_text);
    11101143        $mess_text = str_ireplace("#processing_time#", $processing_time, $mess_text);
    1111         $mess_text = str_ireplace("#shippingTimeline#", $shippingTimeline, $mess_text);
     1144        $mess_text = str_ireplace("#shipping_timeline#", $shippingTimeline, $mess_text);
    11121145
    11131146
  • shipment-tracker-for-woocommerce/trunk/public/css/bt-sync-shipment-tracking-public.css

    r3305118 r3308462  
    8888}
    8989
     90.bt_sync_shimpent_track_pincode_checker_wrap.realistic #pin_input_box {
     91  border: none;;
     92}
     93
     94.bt_sync_shimpent_track_pincode_checker_wrap.realistic #pin_input_box:focus{
     95  outline-width: 0px;
     96}
     97
    9098#bt_sync_shimpent_track_pincode_checker div:nth-child(1) {
    9199  flex-basis: 100%;/*  make first take full width  */
     
    140148        padding: 20px;
    141149        background-color: #fff;
    142         max-width: 600px;
     150        max-width: 400px;
    143151        /* margin: 20px auto; */
    144152        font-family: Arial, sans-serif;
    145153        gap: 10px;
    146154        font-size: 15px;
     155        width: fit-content;
     156        min-width: 320px;
    147157    }
    148158
  • shipment-tracker-for-woocommerce/trunk/public/css/bt_sst_input_box_pincode_show_prime_x.css

    r3305118 r3308462  
    11
    22.bt_sync_shimpent_track_pincode_checker_wrap.print_x {
    3     width: 100%;
    4     max-width: 500px;
     3    width: fit-content;
     4    max-width: 450px;
    55    /* margin: 20px auto; */
    66    border-radius: 12px;
     
    2626    color: #000000;
    2727    padding: 18px 20px;
    28     font-size: 18px;
    29     font-weight: 600;
     28    font-size: 14px;
     29    font-weight: 400;
    3030}
    3131
  • shipment-tracker-for-woocommerce/trunk/public/js/bt-sync-shipment-tracking-public.js

    r3301611 r3308462  
    9393    $("#delivery-form").hide();
    9494    $("#loading-spinner").show();
    95     $.post(
    96       bt_sync_shipment_tracking_data.ajax_url,
    97       { action: "get_pincode_data_product_page", value: { p: pin, n: nounce,c:country, product_id:product_id,variation_id:variation_id} },
    98       function (abc) {
     95    $.ajax({
     96      type: "POST",
     97      url: bt_sync_shipment_tracking_data.ajax_url,
     98      data: {
     99      action: "get_pincode_data_product_page",
     100      value: {
     101        p: pin,
     102        n: nounce,
     103        c: country,
     104        product_id: product_id,
     105        variation_id: variation_id
     106      }
     107      },
     108      dataType: "json",
     109      success: function (abc) {
    99110        $("#data_of_pin").show();
    100111        if (abc.status) {
    101112          $("#data_of_pin").show();
    102               $("#delivery-form").show();
    103     $("#loading-spinner").hide();
     113          $("#delivery-form").show();
     114          $("#loading-spinner").hide();
    104115          var resp = abc.data;
    105116          $("#data_of_pin").html(resp);
    106           if (abc.check_error.data) {
    107               $('#bt_sync_shimpent_track_pincode_checker').css('display', 'none');
    108               $("#bt_sst_pincode_box_change_button").show();
    109             }else{
    110               $('#bt_sst_pincode_box_change_button').css('display', 'none');
     117          if (abc.check_error && abc.check_error.data) {
     118          $('#bt_sync_shimpent_track_pincode_checker').css('display', 'none');
     119          $("#bt_sst_pincode_box_change_button").show();
     120          } else {
     121          $('#bt_sst_pincode_box_change_button').css('display', 'none');
    111122          }
    112123        } else {
    113124          var message = abc.message;
    114125          $("#data_of_pin").html(message);
    115 
    116126        }
    117127        if (abc.error) {
     
    119129        }
    120130        $("#pin_input_box").attr("style", "background-image: inherit");
    121       }
    122     );
     131      },
     132      error: function (xhr, status, error) {
     133        $("#loading-spinner").hide();
     134        $("#data_of_pin").show().html("An error occurred. Please try again or contact support.");
     135        $("#pin_input_box").attr("style", "background-image: inherit");
     136      }
     137    });
    123138  }
    124139
Note: See TracChangeset for help on using the changeset viewer.