Example #1
0
        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;
}
echo "\n";