Plugin Directory

Changeset 861591


Ignore:
Timestamp:
02/20/2014 12:56:17 PM (12 years ago)
Author:
Shipster
Message:

changes

Location:
baggage-freight/trunk
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • baggage-freight/trunk/class-wc-baggagefreight.php

    r857221 r861591  
    11<?php
    22
    3 
    4 
    53 
    6 
    7  add_action('plugins_loaded', 'init_baggage_shipping', 0);
    8 
     4 //add_action('plugins_loaded', 'init_baggage_shipping', 0);
    95 
    10 
    11 
     6 
     7 
    128
    139function init_baggage_shipping() {
    1410
    15 
    16 
    1711    if ( ! class_exists( 'WC_Shipping_Method' ) ) return;
    18 
    1912class WC_BF_Shipping extends WC_Shipping_Method {
    2013
    21 
    22 
    2314    /**
    24 
    2515     * __construct function.
    26 
    2716     *
    28 
    2917     * @access public
    30 
    3118     * @return void
    32 
    3319     */
    34 
    3520    function __construct() {
    36 
    3721        $this->id           = 'bf_shipping';
    38 
    3922        $this->method_title = __('Baggage Freight Shipping', 'woocommerce');
    40 
    4123        $this->init();
    42 
    4324    }
    4425
    45 
    46 
    4726    /**
    48 
    4927     * init function.
    50 
    5128     *
    52 
    5329     * @access public
    54 
    5530     * @return void
    56 
    5731     */
    58 
    5932    function init() {
    60 
    6133        // Load the form fields.
    62 
    6334        $this->init_form_fields();
    6435
    65 
    66 
    6736        // Load the settings.
    68 
    6937        $this->init_settings();
    7038
    71 
    72 
    7339        // Define user set variables
    74 
    7540       /* $this->enabled        = $this->settings['enabled'];
    76 
    7741        $this->title        = $this->settings['title'];
    78 
    7942        $this->min_amount   = $this->settings['min_amount'];
    80 
    8143        $this->availability = $this->settings['availability'];
    82 
    8344        $this->countries    = $this->settings['countries'];
    84 
    8545        $this->requires_coupon  = $this->settings['requires_coupon'];
    86 
    8746        */
    88 
    89        
    90 
     47       
    9148        $this->title        = $this->get_option( 'title' );
    92 
    9349        $this->type         = $this->get_option( 'type' );
    94 
    9550        $this->fee          = $this->get_option( 'fee' );
    96 
    9751        $this->type         = $this->get_option( 'type' );
    98 
    9952        $this->codes        = $this->get_option( 'codes' );
    100 
    10153        $this->availability = $this->get_option( 'availability' );
    102 
    10354        $this->countries    = $this->get_option( 'countries' );
    104 
    10555        // Actions
    106 
    10756        add_action('woocommerce_update_options_shipping_'.$this->id, array(&$this, 'process_admin_options'));
    108 
    10957    }
    11058
    11159
    112 
    113 
    114 
    11560    /**
    116 
    11761     * Initialise Gateway Settings Form Fields
    118 
    11962     *
    120 
    12163     * @access public
    122 
    12364     * @return void
    124 
    12565     */
    126 
    12766    function init_form_fields() {
    128 
    12967        global $woocommerce;
    13068
    131 
    132 
    13369        $this->form_fields = array(
    134 
    13570            'enabled' => array(
    136 
    13771                            'title'         => __( 'Enable/Disable', 'woocommerce' ),
    138 
    13972                            'type'          => 'checkbox',
    140 
    14173                            'label'         => __( 'Enable Baggage Freight Shipping', 'woocommerce' ),
    142 
    14374                            'default'       => 'yes'
    144 
    14575                        ),
    146 
    14776            'title' => array(
    148 
    14977                            'title'         => __( 'Method Title', 'woocommerce' ),
    150 
    15178                            'type'          => 'text',
    152 
    15379                            'description'   => __( 'This controls the title which the user sees during checkout.', 'woocommerce' ),
    154 
    15580                            'default'       => __( 'Baggage Freight Shipping', 'woocommerce' )
    156 
    15781                        ),
    158 
    15982           
    160 
    16183            'availability' => array(
    162 
    16384                            'title'         => __( 'Method availability', 'woocommerce' ),
    164 
    16585                            'type'          => 'select',
    166 
    16786                            'default'       => 'all',
    168 
    16987                            'class'         => 'availability',
    170 
    17188                            'options'       => array(
    172 
    17389                                'all'       => __('All allowed countries', 'woocommerce'),
    174 
    17590                                'specific'  => __('Specific Countries', 'woocommerce')
    176 
    17791                            )
    178 
    17992                        ),
    180 
    18193            'countries' => array(
    182 
    18394                            'title'         => __( 'Specific Countries', 'woocommerce' ),
    184 
    18595                            'type'          => 'multiselect',
    186 
    18796                            'class'         => 'chosen_select',
    188 
    18997                            'css'           => 'width: 450px;',
    190 
    19198                            'default'       => '',
    192 
    19399                            'options'       => $woocommerce->countries->countries
    194 
    195100                        )
    196 
    197101            );
    198102
    199 
    200 
    201103    }
    202104
    203105
    204 
    205 
    206 
    207106    /**
    208 
    209107     * Admin Panel Options
    210 
    211108     * - Options for bits like 'title' and availability on a country-by-country basis
    212 
    213109     *
    214 
    215110     * @since 1.0.0
    216 
    217111     * @access public
    218 
    219112     * @return void
    220 
    221113     */
    222 
    223114    public function admin_options() {
    224115
    225 
    226 
    227116        ?>
    228 
    229117        <h3><?php _e('Baggage Freight Shipping', 'woocommerce'); ?></h3>
    230 
    231118        <p><?php _e('Baggage Freight Shipping ', 'woocommerce'); ?></p>
    232 
    233119        <table class="form-table">
    234 
    235120        <?php
    236 
    237121            $this->generate_settings_html();
    238 
    239122        ?>
    240 
    241123        </table>
    242 
    243124        <?php
    244 
    245        
    246 
     125       
    247126    }
    248127
    249128
    250 
    251 
    252 
    253129 
    254 
    255130    function is_available( $package ) {
    256 
    257131        global $woocommerce;
    258132
    259 
    260 
    261133        if ( $this->enabled == "no" ) return false;
    262134
    263 
    264 
    265135        $ship_to_countries = '';
    266136
    267 
    268 
    269137        if ( $this->availability == 'specific' ) {
    270 
    271138            $ship_to_countries = $this->countries;
    272 
    273139        } else {
    274 
    275140            if ( get_option('woocommerce_allowed_countries') == 'specific' )
    276 
    277141                $ship_to_countries = get_option('woocommerce_specific_allowed_countries');
    278 
    279         }
    280 
    281 
     142        }
    282143
    283144        if ( is_array( $ship_to_countries ) )
    284 
    285145            if ( ! in_array( $package['destination']['country'], $ship_to_countries ) )
    286 
    287146                return false;
    288147
    289 
    290 
    291148        // Enabled logic
    292 
    293149        $is_available = true;
    294150
    295 
    296 
    297151        if ( $this->requires_coupon == "yes" ) {
    298152
    299 
    300 
    301153            if ( $woocommerce->cart->applied_coupons ) {
    302 
    303154                foreach ($woocommerce->cart->applied_coupons as $code) {
    304 
    305155                    $coupon = new WC_Coupon( $code );
    306156
    307 
    308 
    309157                    if ( $coupon->enable_free_shipping() )
    310 
    311158                        return true;
    312 
    313159                }
    314 
    315160            }
    316161
    317 
    318 
    319162            // No coupon found, as it stands, free shipping is disabled
    320 
    321163            $is_available = false;
    322164
    323 
    324 
    325         }
    326 
    327 
     165        }
    328166
    329167        if ( isset( $woocommerce->cart->cart_contents_total ) && ! empty( $this->min_amount ) ) {
    330168
    331 
    332 
    333169            if ( $woocommerce->cart->prices_include_tax )
    334 
    335170                $total = $woocommerce->cart->tax_total + $woocommerce->cart->cart_contents_total;
    336 
    337171            else
    338 
    339172                $total = $woocommerce->cart->cart_contents_total;
    340173
    341 
    342 
    343174            if ( $this->min_amount > $total )
    344 
    345175                $is_available = false;
    346 
    347176            else
    348 
    349177                $is_available = true;
    350178
    351 
    352 
    353         }
    354 
    355 
     179        }
    356180
    357181        return apply_filters( 'woocommerce_shipping_' . $this->id . '_is_available', $is_available );
    358 
    359182    }
    360183
    361184
    362 
    363 
    364 
    365185    /**
    366 
    367186     * calculate_shipping function.
    368 
    369187     *
    370 
    371188     * @access public
    372 
    373189     * @return array
    374 
    375190     */
    376 
    377191    function calculate_shipping($package = array() )
    378 
    379     {
    380 
    381        
     192    {
    382193
    383194        global $woocommerce;
    384 
    385195        global $wpdb;
    386 
    387196        $prefix = $wpdb->prefix;
    388 
    389197        $sql = "select * from baggage_storeowner";
    390 
    391198        $res = mysql_query($sql);
    392 
    393199        $row = mysql_fetch_assoc($res);
    394 
    395        
    396 
    397        
    398 
    399        
    400 
     200       
     201       
     202       
    401203        $sql_setting = "select * from baggage_settings";
    402 
    403204        $res_setting = mysql_query($sql_setting);
    404 
    405        
    406 
     205       
    407206        if(mysql_num_rows($res_setting))
    408 
    409         {
    410 
     207        {
    411208            $row_setting = mysql_fetch_assoc($res_setting);
    412 
    413209            $package_type = $row_setting["package_type"];
    414 
    415210            $hfee = floatval($row_setting["hfee"]);
    416 
    417         }
    418 
     211        }
    419212        else
    420 
    421         {
    422 
    423             $package_type = "0";
    424 
     213        {
     214            $package_type = "1";
    425215            $hfee = "0.00";
    426 
    427         }
    428 
    429        
    430 
     216        }
     217       
     218        $Email = trim($row["Email"]);
     219        $Password = trim($row["Password"]);
     220       
    431221        $sql_dimension = "select * from baggage_dimensions";
    432 
    433222        $res_dimension = mysql_query($sql_dimension);
    434 
    435223        if(mysql_num_rows($res_dimension))
    436 
    437         {
    438 
     224        {
    439225          $row_dimension = mysql_fetch_assoc($res_dimension);
    440 
    441226          $d_Height = $row_dimension["height"];
    442 
    443227          $d_width  = $row_dimension["width"];
    444 
    445228          $d_length = $row_dimension["length"];
    446 
    447         }
    448 
     229        }
    449230        else
    450 
    451         {
    452 
     231        {
    453232          $d_Height = "10";
    454 
    455233          $d_width = "10";
    456 
    457234          $d_length = "10"; 
    458 
    459         }
    460 
    461    
    462 
    463        
    464         $Email = trim($row["Email"]);
    465         $Password = trim($row["Password"]);
    466    
    467 
     235        }
     236   
     237       
     238   
    468239        $CollectCountry = $row["CollectCountry"];
    469 
    470240        $strUrl = "http://www.baggagefreight.com.au/api/getCountryName.aspx?countryid=".$CollectCountry;
    471 
    472241        $cCountry = trim(file_get_contents($strUrl));
    473 
    474242        $cCity = trim($row["CollectCity"]);
    475 
    476243        $cState = trim($row["CollectState"]);
    477 
    478244        $cPin = trim($row["CollectZip"]);
    479 
    480        
    481 
     245       
    482246        $Weight = "";
    483 
    484247        $Length = "";
    485 
    486248        $Width  = "";
    487 
    488249        $Height = "";
    489 
    490250        $Unit = "";
    491 
    492251        $Desc = "";
    493 
    494        
    495 
    496        
    497 
     252       
     253       
    498254        $packedsku = '';
    499 
    500255        $totweight = 0;
    501 
    502256        $j=1;
    503 
    504257        $k=0;
    505 
    506258        $packeditem = NULL;
    507 
    508        
    509 
    510        
    511 
     259       
     260       
    512261        $Amount =$woocommerce->cart->subtotal;
    513 
    514    
    515 
    516        
    517 
     262   
     263       
    518264        $loop = 0;
    519 
    520        
    521 
     265       
    522266        foreach ( $woocommerce->cart->get_cart() as $itms )
    523 
    524         {
    525 
     267        {
    526268           $product_id = $itms["product_id"];
    527 
    528269           $quantity = $itms["quantity"];
    529 
    530    
    531 
    532            
    533 
     270   
     271           
    534272           $post_data = get_post($product_id);
    535 
    536273           $product_title = $post_data->post_title;
    537 
    538            
    539 
     274           
    540275           $sql_SKU = "select meta_value from ".$prefix."postmeta where post_id=".$product_id." and meta_key='_sku'";
    541 
    542276           $res_Sku = mysql_query($sql_SKU);
    543 
    544277           $row_sku = mysql_fetch_assoc($res_Sku);
    545 
    546278           $sku = $row_sku["meta_value"];
    547 
    548            
    549 
     279           
    550280           $strDestCountry = get_post_meta($product_id, '_shipping_country', true);
    551 
    552            
    553          
    554            
    555 
     281           
     282           
    556283           if($package_type=="1")
    557 
    558284           {
    559 
    560285              $W = get_post_meta($product_id, '_weight', true);
    561 
    562286              $L = get_post_meta($product_id, '_length', true);
    563 
    564287              $Wi = get_post_meta($product_id, '_width', true);
    565 
    566288              $H = get_post_meta($product_id, '_height', true);
    567 
    568289           }
    569 
    570290           else
    571 
    572291           {
    573 
    574292               $sql = "select * from baggage_excel where SKU='$sku'";
    575 
    576293               $res = mysql_query($sql);
    577 
    578294               $row = mysql_fetch_assoc($res);
    579 
    580295               
    581 
    582296               $W = $row["Weight"];
    583 
    584297               $L = $row["Length"];
    585 
    586298               $Wi = $row["Width"];
    587 
    588299               $H = $row["Height"];
    589 
    590300           }
    591 
    592            
    593 
    594            
    595 
     301           
     302           
    596303           if($L == "")
    597 
    598304           {
    599 
    600305              $L = $d_length; 
    601 
    602306           }
    603 
    604            
    605 
     307           
    606308           if($Wi == "")
    607 
    608309           {
    609 
    610310              $Wi = $d_width; 
    611 
    612311           }
    613 
    614            
    615 
     312           
    616313           if($H == "")
    617 
    618314           {
    619 
    620315              $H = $d_height; 
    621 
    622316           }
    623 
    624            
    625 
    626            $row_packtype = mysql_fetch_array(mysql_query("select * from baggage_product_pack where SKU='$sku'"));
    627            
    628        
    629          
    630    
    631 
    632            if($row_packtype['packType']==1)
    633 
    634            {
    635 
    636                
    637 
    638               $packeditem[$loop] = array(
    639 
    640                     "sku" => $sku,
    641 
    642                     "l" => $L,
    643 
    644                     "w" => $Wi,
    645 
    646                     "h" => $H,
    647 
    648                     "weight" => $W,
    649 
    650                     "type" =>$row_packtype['packType'],
    651 
    652                     "qty" =>$quantity,
    653 
    654                  );
    655 
    656                  
    657 
    658                  $loop++;
    659 
    660              
    661 
    662            }
    663 
    664            else
    665 
    666            {
    667 
     317           
     318           
     319           
    668320                for($i=1;$i<=$quantity;$i++)
    669 
    670321                {
    671 
    672322                         $Weight = $Weight.$W.",";
    673 
    674323                         $Length = $Length.$L.",";
    675 
    676324                         $Width  = $Width.$Wi.",";
    677 
    678325                         $Height = $Height.$H.",";
    679 
    680326                         $Unit   = $Unit."cm,";
    681 
    682327                         $strDescription = $sku;
    683 
    684328                         if(strlen($strDescription) > 30)
    685 
    686329                         {
    687 
    688330                            $strDescription = substr($strDescription, 0, 29);
    689 
    690331                         }
    691 
    692332                         
    693 
    694333                         $strDescription = str_replace(",","",$strDescription);
    695 
    696334                         
    697 
    698335                         $Desc   = $Desc.$strDescription.",";   
    699 
    700336                             
    701 
    702337                 }
    703 
    704            }
    705 
    706        
    707 
    708    
    709 
    710         }
    711 
    712        
    713 
    714        
    715 
    716         /*********************** Start Calculation for packed***********************/
    717 
    718          
    719 
    720           if(count($packeditem)>0)
    721 
    722           {
    723 
    724                 /*for($p=0; $p<count($product);$p++)
    725 
    726                 {
    727 
    728                     if($product[$p]['type']==1){ $packeditem[] = $product[$p];}
    729 
    730                     if($product[$p]['type']==0){$unpackeditem[] = $product[$p];}
    731 
    732                 }*/
    733 
    734    
    735 
    736                 for($pkd=0; $pkd<count($packeditem);$pkd++)
    737 
    738                 {
    739 
    740                     if($packeditem[$pkd]["qty"]>1) {$packedsku .= $j.".".$packeditem[$pkd]["sku"]."(".$packeditem[$pkd]["qty"]."items) ";}
    741 
    742                     else{ $packedsku .= $j.".".$packeditem[$pkd]["sku"]." "; }
    743 
    744                    
    745 
    746                     $totweight = $totweight+($packeditem[$pkd]["weight"]*$packeditem[$pkd]["qty"]);
    747 
    748                    
    749 
    750                     for($q=1; $q<=$packeditem[$pkd]['qty'];$q++)
    751 
    752                     {
    753 
    754                         $numbers = array($packeditem[$pkd]['l'],$packeditem[$pkd]['w'],$packeditem[$pkd]['h']);
    755 
    756                         rsort($numbers);
    757 
    758                        
    759 
    760                         foreach ($numbers as $key => $val)
    761 
    762                         {  $sortdimension[$k][$key] = $val; }
    763 
    764                         $k++;   
    765 
    766                     }
    767 
    768                     $j++;   
    769 
    770                 }
    771 
    772                
    773 
    774                
    775 
    776                 for($sort = 0; $sort<count($sortdimension); $sort++)
    777 
    778                 {
    779 
    780                     $alllength[] =  $sortdimension[$sort][0];
    781 
    782                     $allwidth[] =  $sortdimension[$sort][1];
    783 
    784                     $allheight[] =  $sortdimension[$sort][2];
    785 
    786                 }
    787 
    788              
    789 
    790                 $tot_height = 0;
    791 
    792                 for($i = 0; $i<count($allheight); $i++)
    793 
    794                 {
    795 
    796                   $tot_height = $tot_height+$allheight[$i] ;
    797 
    798                 }
    799 
    800                
    801 
    802                 $item["packed"]["sku"] = $packedsku;
    803 
    804                 $item["packed"]["l"] =  max($alllength);
    805 
    806                 $item["packed"]["w"] =  max($allwidth);
    807 
    808                 $item["packed"]["h"] = $tot_height;
    809 
    810                 $item["packed"]["weight"] = $totweight;
    811 
    812                 $item["packed"]["unit"] = "cm";
    813 
    814        
    815 
    816           }
    817 
    818          
    819 
    820        
    821 
    822           /*********************** End Calculation for packed***********************/
    823 
    824        
    825 
     338           
     339       
     340   
     341        }
     342       
     343       
     344       
    826345        $Weight = $Weight.$item["packed"]["weight"].",";
    827 
    828346        $Length = $Length.$item["packed"]["l"].",";
    829 
    830347        $Width  = $Width.$item["packed"]["w"].",";
    831 
    832348        $Height = $Height.$item["packed"]["h"].",";
    833 
    834349        $Unit = $Unit.$item["packed"]["unit"].",";
    835 
    836350        $Desc   = $Desc.$item["packed"]["sku"].",";
    837 
    838        
    839 
     351       
     352        $Weight = substr($Weight, 0, -1);
     353        $Length = substr($Length, 0, -1);
     354        $Width  = substr($Width, 0, -1);
     355        $Height = substr($Height, 0, -1);
     356        $Unit   =  substr($Unit, 0, -1);
     357        $Desc   =  substr($Desc, 0, -1);
     358       
    840359        $Weight = substr($Weight, 0, -1);
    841360        if($Weight[strlen($Weight)-1]==",")
     
    868387           $Desc = substr($Desc, 0, -1);
    869388        }
    870 
    871    
    872 
    873        
    874 
     389   
     390       
    875391        $dCountry = trim($package["destination"]["country"]);   
    876 
    877392        $dState = trim($package["destination"]["state"]);
    878 
    879393        $dPin = trim($package["destination"]["postcode"]);
    880 
    881394        $dCity = trim($package["destination"]["city"]);
    882 
    883        
    884 
     395       
    885396        $address = trim($package["destination"]["address"]);
    886 
    887397        $address_2 = trim($package["destination"]["address_2"]);
    888 
    889        
    890 
     398       
    891399        $objC = new WC_Countries();
    892 
    893400        $dCountry = trim($objC->countries[$dCountry]);
    894 
    895        
    896 
    897        
    898 
    899        
    900 
     401       
     402       
     403       
    901404          if($dPin!="")
    902 
    903405          {
    904          
    905        
    906 
    907406                $data = array(
    908407
     
    911410                    'Password' => $Password,
    912411                   
     412                    'Tech' => 'Wordpress',
     413                   
    913414                    'cCountry' => $cCountry, 
    914415
     
    941442                    'Amount' => $Amount 
    942443
    943                 );   
     444                );
     445
     446
     447                   
     448
     449
    944450               
     451                $ch = curl_init('http://www.baggagefreight.com.au/api/apiminrate.aspx');                                                       
     452                curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
     453                curl_setopt($ch, CURLOPT_POST, 1);                                               
     454                curl_setopt($ch, CURLOPT_POSTFIELDS, $data);                                                 
     455                curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);                                                         
     456                $result = curl_exec($ch);
    945457               
    946 
    947 
     458   
    948459               
    949 
    950                 $ch = curl_init('http://www.baggagefreight.com.au/api/apiminrate.aspx');                                                       
    951 
    952                 curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
    953 
    954                 curl_setopt($ch, CURLOPT_POST, 1);                                               
    955 
    956                 curl_setopt($ch, CURLOPT_POSTFIELDS, $data);                                                 
    957 
    958                 curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);                                                         
    959 
    960                 $result = curl_exec($ch);
    961 
    962                
    963 
    964                
    965 
    966                
    967 
    968460         
    969 
    970461               if($result)
    971 
    972462               {
    973 
    974463               
    975 
    976464                    $arrBFIShipping = explode(":",$result);
    977 
    978465                    $ship_cost = floatval($arrBFIShipping[0]);
    979 
    980466                    $_SESSION["bf_strBookingAmount"] = $ship_cost;
    981 
    982467                    $carrier = $arrBFIShipping[1];
    983 
    984468                    $_SESSION["bf_strCarrier"] = $carrier;
    985 
    986469                    $service = $arrBFIShipping[2];
    987 
    988470                    $_SESSION["bf_strService"] = $service;
    989 
    990471                    $transit = $arrBFIShipping[4];
    991 
    992472                   
    993 
    994473                    $warranty = floatval($arrBFIShipping[5]);
    995 
    996474                   
    997 
    998475                    $arrTransit = explode(" ",$transit);
    999 
    1000476                    $transitTime = $arrTransit[0];
    1001 
    1002477                    $_SESSION["bf_strTransitTime"] = $transitTime;
    1003 
    1004478                    $_SESSION["bf_warranty"] = $warranty;
    1005 
    1006479               
    1007 
    1008480     
    1009 
    1010481                    if(floatval($ship_cost)>0)
    1011 
    1012482                    {
    1013 
    1014                        
    1015 
     483                       
    1016484                        $_SESSION["bf_Weight"] = $Weight;
    1017 
    1018485                        $_SESSION["bf_Length"] = $Length;
    1019 
    1020486                        $_SESSION["bf_Width"]  = $Width;
    1021 
    1022487                        $_SESSION["bf_Height"] = $Height;
    1023 
    1024488                        $_SESSION["bf_strDescription"]   = $Desc;
    1025 
    1026489                        $_SESSION["bf_Unit"]   = $Unit;
    1027 
    1028                        
    1029 
     490                       
    1030491                        $_SESSION["bf_booking"] = "1";
    1031 
    1032492                        $_SESSION["bf_strTotalBookingRate"] = $Amount;
    1033 
    1034                        
    1035 
    1036                        
    1037 
     493                       
     494                       
    1038495                        $args= array(
    1039 
    1040496                        'id'    => $this->id,
    1041 
    1042497                        'label' => $service." (Without Transit Warranty)",
    1043 
    1044498                        'cost'  => $ship_cost
    1045 
    1046499                          );
    1047 
    1048                        
    1049 
    1050                        
    1051 
     500                       
     501                       
    1052502                        $this->add_rate( $args );
    1053 
    1054                        
    1055 
    1056                        
    1057 
     503                       
     504                       
    1058505                        if($warranty>0)
    1059 
    1060506                        {
    1061 
    1062507                          $ship_cost = $ship_cost+$warranty;
    1063 
    1064                        
    1065 
     508                       
    1066509                        $args= array(
    1067 
    1068510                        'id'    => $this->id."1",
    1069 
    1070511                        'label' => $service." (With Transit Warranty)",
    1071 
    1072512                        'cost'  => $ship_cost
    1073 
    1074513                          );
    1075 
    1076514                          }
    1077 
    1078                        
    1079 
    1080                        
    1081 
     515                       
     516                       
    1082517                        $this->add_rate( $args );
    1083 
    1084518                    }
    1085 
    1086519                }
    1087 
    1088520            }
    1089 
    1090521           
    1091 
     522   
     523       
    1092524    }
    1093525
    1094 
    1095 
    1096526 }
    1097527
    1098 
    1099 
    1100528}
    1101529
    1102 
    1103 
    1104530function add_bf_shipping_method( $methods ) {
    1105 
    1106531    $methods[] = 'WC_BF_Shipping';
    1107 
    1108532    return $methods;
    1109 
    1110533}
    1111534
    1112 
    1113 
    1114535function custom_woocommerce_billing_fields( $fields ) {
    1115536
    1116537
    1117 
    1118 
    1119 
    1120538   /*$fields['billing_city']    = array(
    1121 
    1122539      'label'          => __('Town/City', 'woocommerce'),
    1123 
    1124540      'placeholder'    => _x('Town/City', 'placeholder', 'woocommerce'),
    1125 
    1126541      'required'       => true,
    1127 
    1128542      'class'          => array('form-row-first', 'update_totals_on_change')
    1129 
    1130543   );*/
    1131 
    1132544   
    1133 
    1134545   $fields['billing_city']['class'] = array('form-row-first', 'update_totals_on_change');
    1135 
    1136546   
    1137 
    1138547 
    1139548
    1140 
    1141 
    1142549 return $fields;
    1143 
    1144550}
    1145551
    1146 
    1147 
    1148552//add_filter( 'woocommerce_billing_fields', 'custom_woocommerce_billing_fields' );
    1149553
     
    1151555
    1152556
    1153 
    1154 
    1155 
    1156 
    1157 
    1158557function custom_woocommerce_shipping_fields( $fields ) {
    1159558
    1160 
    1161 
    1162559   /*$fields['shipping_city']   = array(
    1163 
    1164560     'label'          => __('Town/City', 'woocommerce'),
    1165 
    1166561      'placeholder'    => __('Town/City', 'placeholder', 'woocommerce'),
    1167 
    1168562      'required'       => true,
    1169 
    1170563      'class'          => array('form-row-first', 'update_totals_on_change')
    1171 
    1172564   );*/
    1173 
    1174565   
    1175 
    1176566   $fields['shipping_city']['class'] = array('form-row-first','update_totals_on_change');
    1177567
    1178 
    1179 
    1180568 return $fields;
    1181 
    1182569}
    1183570
    1184 
    1185 
    1186571//add_filter( 'woocommerce_shipping_fields', 'custom_woocommerce_shipping_fields');
    1187572
    1188573
    1189574
    1190 
    1191 
    1192 
    1193 
    1194 
    1195 
    1196 
     575add_action( 'woocommerce_shipping_init', 'init_baggage_shipping',0 );
    1197576
    1198577add_filter('woocommerce_shipping_methods', 'add_bf_shipping_method' );
  • baggage-freight/trunk/store-owner.php

    r820997 r861591  
    653653      <h3 class="hndle" style="height:35px; padding-top:20px;">
    654654
    655 <span ><strong>Upon completing this form, and pressing "submit" your details will be forwarded to Baggagefreight, and your account set up on our site.</strong></span>
     655<span ><strong>Please fill in the registration form below to gain permission to use and access our best shipping rates.  Our shipping module will not display rates or allow you to generate shipping labels without Baggage Freight's prior approval.</strong></span>
    656656
    657657</h3>
Note: See TracChangeset for help on using the changeset viewer.