/** * The index handler. * * @access public * @return string The HTML code. */ public function index() { $Product = new Product(); $Category = new Product_Category(); foreach ($Category->findList(array(), 'Position asc', 0, 1) as $Category) { } $params = array(); $c = Request::get('c', $Category->Id); $params[] = 'CategoryId = ' . $c; $_GET['c'] = $c; $this->getView()->set('Products', $Product->findList($params, 'Position asc')); return $this->getView()->render(); }
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 { Console::writeln('Failed'); } break;
public function getSitemapNode() { $result = $params = array(); $Product = new Product(); $Categories = Product_Category::getCategories(); foreach ($Categories as $Category) { $result[] = URL::get($Category); $params = array(); $params[] = 'CategoryId = ' . $Category->Id; foreach ($Product->findList($params, 'Position asc') as $Item) { $result[] = URL::get($Item); } } return $result; }