Example #1
0
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<?php 
require_once dirname(__FILE__) . '/menu.php';
require_once dirname(__FILE__) . "/lib/Product.php";
try {
    if (isset($_POST['import_relations']) && $_FILES["file_to_import"]["error"] == UPLOAD_ERR_OK) {
        Product::importRelations($_FILES["file_to_import"]);
        $min_peices_updated = Product::updateMinPrices();
        echo '<h2>Imported successfully.</h2>';
    }
} catch (Exception $e) {
    die($e->getMessage());
}
?>
<form action="" method="post" enctype="multipart/form-data">
<input type="file" name="file_to_import">
<input type="submit" name="import_relations" value="Импортировать">
</form>
</body>
</html>
Example #2
0
 switch ($_REQUEST['action']) {
     case 'getProvProds':
         $prov_id = (int) $_REQUEST['prov_id'];
         $our_prod_id = 0;
         if (isset($_REQUEST['our_prod_id']) && (int) $_REQUEST['our_prod_id'] > 0) {
             $our_prod_id = (int) $_REQUEST['our_prod_id'];
         }
         $names = null;
         if (isset($_REQUEST['names']) && strlen($_REQUEST['names'])) {
             $names = explode(' ', $_REQUEST['names']);
             $names = array_diff($names, array(''));
         }
         $res = Product::getProvProds($prov_id, $our_prod_id, $names);
         break;
     case 'update_min_prices':
         Product::updateMinPrices();
         $res = "Минимальные цены обновленны успешно.";
         break;
     case 'get_prods':
         $avaliable_fields = array("category" => array("filter_type" => "text", "column_name" => "categories"), "brand" => array("filter_type" => "text", "column_name" => "manufacturer"), "sku" => array("filter_type" => "text", "column_name" => "e.sku"), "price" => array("filter_type" => "text", "column_name" => "min_price"));
         $provs =& Providers::getProviders();
         foreach ($provs as $id => $prov) {
             $avaliable_fields["providers_products_{$id}_price"] = array("filter_type" => "float", "column_name" => "providers_products_{$id}.price");
         }
         $filter_str = "";
         if (isset($_REQUEST["filter_compare"]) && isset($_REQUEST["filter_values"]) && count($_REQUEST["filter_compare"]) && count($_REQUEST["filter_values"])) {
             $filter_str = buildFilterStr($avaliable_fields, $_REQUEST["filter_compare"], $_REQUEST["filter_values"]);
         }
         if ($_REQUEST['subaction']) {
             switch ($_REQUEST['subaction']) {
                 case 'getcount':