Exemple #1
0
         }
     }
     if ($break) {
         break;
     }
     break;
 case 'units':
     $Unit = new Product_Unit();
     foreach ($Unit->findList(array('Name <> -')) as $Unit) {
         $Unit->Name = rtrim($Unit->Name, 'м') . 'мм';
         $Unit->save();
     }
     break;
 case 'names':
     $Product = new Product();
     $Layout = new Product_Layout_Standard();
     $params = array();
     $params[] = 'CategoryId = ' . $Layout->getCategory()->Id;
     foreach ($Product->findList($params) as $Product) {
         if (strpos($Product->Name, 'поликарбонат') > 0) {
             continue;
         }
         $Product->Name .= ' поликарбонат "' . $Product->getBrand()->Name . '"';
         $Product->save();
     }
     break;
 case 'mail':
     Console::writeln(sprintf('%dMb', memory_get_peak_usage(true) / 1024 / 1024));
     if (mail($argv[2], 'Hello from ankor.com.ua', 'Here is the test email')) {
         Console::writeln('Email sent');
     } else {
Exemple #2
0
 /**
  * The function returns part of HTML code depends on method.
  * 
  * @access public
  * @return string The JSON response.
  */
 public function json()
 {
     switch (Request::get('method')) {
         case 'colors':
             $Layout = new Product_Layout_Standard();
             $Product = new Product();
             $Params = array();
             $params[] = 'CategoryId = ' . $Layout->getCategory()->Id;
             if (Request::get('brand')) {
                 $params[] = 'BrandId = ' . Request::get('brand');
             }
             return $this->getView()->htmlColors($Product->findShortList($params, 'Name asc'));
         case 'units':
             $Unit = new Product_Unit();
             $params = array();
             $params[] = 'ProductId = ' . Request::get('id');
             return $this->getView()->htmlUnits($Unit->findList($params, 'Position asc'));
         case 'order':
             $response = array('result' => 0);
             return $this->outputJSON($response);
     }
 }