Guest User

Yandex Fast order

a guest
Jul 25th, 2013
315
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.59 KB | None | 0 0
  1. //In template.php
  2. function themename_url_outbound_alter(&$path, &$options, $original_path) {
  3.  
  4.   if($original_path==NULL) {
  5.     if(isset($_POST["operation_id"]) && isset($_POST["street"])) {
  6.       //Значит пришло что то от «Быстрого заказа»
  7.       if(!empty($_POST["city"])) $_SESSION["yfo_city"] = $_POST["city"];
  8.       if(!empty($_POST["phone"])) $_SESSION["yfo_phone"] = $_POST["phone"];
  9.       if(!empty($_POST["email"])) $_SESSION["yfo_email"] = $_POST["email"];      
  10.  
  11.       $addr = "";
  12.       if(!empty($_POST["street"])) $addr.=" ул. ".$_POST["street"];
  13.       if(!empty($_POST["building"])) $addr.=" д. ".$_POST["building"];
  14.       if(!empty($_POST["suite"])) $addr.=" корпус ".$_POST["suite"];
  15.       if(!empty($_POST["flat"])) $addr.=" кв. ".$_POST["flat"];
  16.       if(!empty($_POST["entrance"])) $addr.=" подъезд ".$_POST["entrance"];
  17.       if(!empty($_POST["floor"])) $addr.=" этаж ".$_POST["floor"];
  18.       if(!empty($_POST["intercom"])) $addr.=" домофон ".$_POST["intercom"];
  19.       if(!empty($_POST["zip"])) $addr.=" почтовый индекс ".$_POST["zip"];
  20.       if(!empty($_POST["metro"])) $addr.=" ст. метро ".$_POST["metro"];
  21.  
  22.       if(!empty($addr)) $_SESSION["yfo_addr"] = $addr;
  23.  
  24.       $name = "";
  25.       if(!empty($_POST["firstname"])) $name.=$_POST["firstname"];
  26.       if(!empty($_POST["fathersname"])) $name.=" ".$_POST["fathersname"];
  27.       if(!empty($_POST["lastname"])) $name.=" ".$_POST["lastname"];
  28.  
  29.       if(!empty($name)) $_SESSION["yfo_name"] = $name;  
  30.  
  31.       drupal_goto('checkout/');
  32.     }
  33.   }
  34.  
  35. }
Advertisement
Add Comment
Please, Sign In to add comment