73 lines
1.3 KiB
PHP
73 lines
1.3 KiB
PHP
|
<?php
|
||
|
ini_set('display_errors', 1);
|
||
|
$_SERVER['SERVER_NAME'] = 'tk-ligat.ru';
|
||
|
require_once('/home/cloud/core/set/tk-ligat.ru.php');
|
||
|
require_once('/home/cloud/core/api/php/db.php');
|
||
|
|
||
|
require_once('/home/cloud/core/api/php/json.php');
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
function checkImgCat($sku, $cats)
|
||
|
{
|
||
|
|
||
|
|
||
|
for ($i = 0; $i < count($cats); $i++) {
|
||
|
|
||
|
@$mk=@$mk.' ---' . $cats[$i] . '--- ';
|
||
|
$id = DB::getValue("SELECT `id` FROM `tovar_category` WHERE `code`=? AND `partner`='samson'", $cats[$i]);
|
||
|
if ($id) {
|
||
|
|
||
|
DB::set("UPDATE `tovar` SET `category`=?, `status`=1 WHERE `code`=? AND `partner`='samson'", array(
|
||
|
$id,
|
||
|
$sku
|
||
|
)
|
||
|
);
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
}
|
||
|
DB::set("UPDATE `tovar` SET `category`=?, `status`=1, `multicat`=? WHERE `code`=? AND `partner`='samson'", array(
|
||
|
$id,
|
||
|
$mk,
|
||
|
$sku
|
||
|
)
|
||
|
);
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
$massiv = DB::getAll("SELECT * FROM `samsonj` WHERE `check`=0 ORDER BY RAND() LIMIT 1000");
|
||
|
|
||
|
|
||
|
|
||
|
for ($i = 0; $i < count($massiv); $i++) {
|
||
|
|
||
|
$cats = json::from_j($massiv[$i]['json'])['category_list'];
|
||
|
$sku = json::from_j($massiv[$i]['json'])['sku'];
|
||
|
print_r($cats);
|
||
|
print_r($sku);
|
||
|
checkImgCat($sku, $cats);
|
||
|
DB::set("UPDATE `samsonj` SET `check`=1 WHERE `id`=?", $massiv[$i]['id']);
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
?>
|