Advertisement
treska

GLS ParcelShop

Mar 20th, 2018
168
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 2.75 KB | None | 0 0
  1. <?php
  2.                         $chosen_methods = WC()->session->get('chosen_shipping_methods');
  3.                         $chosen_shipping = $chosen_methods[0];
  4.                         global $woocommerce;
  5.                         if (($chosen_shipping == "flat_rate:10" && $method->id == "flat_rate:10" && is_checkout()) OR ($chosen_shipping == "flat_rate:11" && $method->id == "flat_rate:11" && is_checkout())) :
  6.                             $customer = new WC_Customer();
  7.                             $shipping_country = WC()->customer->get_shipping_country();
  8.                             //var_dump ($_GET['id']);
  9.                             if (isset($_GET['id'])) {
  10.                                 $gls_id = htmlentities(rawurldecode($_GET['id']));
  11.                                 $gls_name = htmlentities(rawurldecode($_GET['name_gls']), ENT_QUOTES );
  12.                                 $gls_address = htmlentities(rawurldecode($_GET['address']));
  13.                                 $gls_city = htmlentities(rawurldecode($_GET['city']));
  14.                                 $gls_zipcode = htmlentities(rawurldecode($_GET['zipcode']));
  15.  
  16.                                 //rozlisuje ci je PSC CZ alebo SK
  17.                                     $sk_psc = array(0, 8, 9);
  18.                                     if (in_array(substr($gls_zipcode, 0, 1), $sk_psc)) {
  19.                                         $gls_country = "SK";
  20.                                         }
  21.                                     else {
  22.                                         $gls_country = "CZ";
  23.                                         }
  24.                                 if ($gls_country == $shipping_country) {
  25.                                 ?>
  26.                                     <p class="shippingDescription"><u><strong>Odběrné místo vybráno:<strong></u></p>
  27.                                     <p class="shippingDescription"><?php echo $gls_id; ?></p>                            
  28.                                     <p class="shippingDescription"><?php echo $gls_name; ?></p>                          
  29.                                     <p class="shippingDescription"><?php echo $gls_address; ?></p>                           
  30.                                     <p class="shippingDescription"><?php echo $gls_city; ?></p>                          
  31.                                     <p class="shippingDescription"><?php echo $gls_zipcode; ?></p>
  32.  
  33.                                     <input type="hidden" name="gls_parcelshop_id" value="<?php echo  htmlspecialchars($gls_id); ?>" required>  
  34.                                     <input type="hidden" name="gls_parcelshop_name" value="<?php echo htmlspecialchars($gls_name); ?>">
  35.                                     <input type="hidden" name="gls_parcelshop_address" value="<?php echo  htmlspecialchars($gls_address); ?>"> 
  36.                                     <input type="hidden" name="gls_parcelshop_city" value="<?php echo  htmlspecialchars($gls_city); ?>">   
  37.                                     <input type="hidden" name="gls_parcelshop_zipcode" value="<?php echo  htmlspecialchars($gls_zipcode); ?>"> 
  38.                             <?  }
  39.                                 else {
  40.                                     wc_clear_notices();
  41.                                     wc_add_notice(  'Vyberte si GLS ParcelShop dostupný ve Vašem regionu.',  $notice_type = 'error' ); ?>
  42.                                     <p class="shippingDescription"><a href="https://help.gls-czech.cz/cs/maps">Vyberte odběrné místo</a></p>
  43.                                 <?}
  44.                                
  45.                             } else { ?>
  46.                                 <p class="shippingDescription"><a href="https://help.gls-czech.cz/cs/maps">Vyberte odběrné místo</a></p>
  47.                             <?}?>
  48.                         <?php endif; ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement