/** * The function returns Product object for current Item. * * @access public * @return object The Product object. */ public function getProduct() { if ($this->cachedProduct === null) { $Product = new Product_Unit(); $this->cachedProduct = $Product->findItem(array('Id = ' . $this->Product)); } return $this->cachedProduct; }
} else { if (count($models) == 0) { Console::writeln("Model not found: " . $name); $break = true; break; } else { $models[] = $name; } } } 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 . '"';
public function getUnit() { $Unit = new Product_Unit(); return $Unit->findItem(array('Id = ' . $this->Unit)); }
/** * The function returns maximum price of current Product. * * @access public * @return float The price. */ public function getMaxPrice() { $Unit = new Product_Unit(); foreach ($Unit->findList(array('ProductId = ' . $this->Id), 'Price desc', 0, 1) as $Unit) { } return $Unit->Price; }
/** * 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); } }