Sokolov39 Опубліковано: 6 грудня 2023 Share Опубліковано: 6 грудня 2023 (змінено) Підкажіть, шукаю варіант як зробити - для Ocstore 3 МОЖЛиво є готові модулі! 1. щоб назви картинок у великому обємі (прописані кирилицею ) перегенерувати на латиницю 2. Якщо загружаю картинку де назва на кирилиці - щоб їх автоматично перегерувало на латиницю (на сервері) Змінено 6 грудня 2023 користувачем Sokolov39 Надіслати Поділитися на інших сайтах More sharing options...
chukcha Опубліковано: 6 грудня 2023 Share Опубліковано: 6 грудня 2023 э невеликий скріпт котрий SELECT image from product file get_content CURL translit file_put_content UPDATE product $sql ="SELECT product_id, image FROM " . DB_PREFIX . "product"; $result = $this->db->query($sql); foreach ($result->rows as $p) { $curl = curl_init('Адрес Сайта/image/' . rawurlencode($p['image'])); curl_setopt($curl, CURLOPT_HEADER, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_FORBID_REUSE, 1); curl_setopt($curl, CURLOPT_FRESH_CONNECT, 1); $response = curl_exec($curl); $file_name = strtolower($this->translit(str_replace('data/', '',$p['image']))); $directories = explode('/', dirname($file_name)); $path = ''; foreach ($directories as $directory) { $path = $path . '/' . $directory; if (!is_dir(DIR_IMAGE . 'catalog/' . $path)) { @mkdir(DIR_IMAGE . 'catalog/' . $path, 0777); } } file_put_contents(DIR_IMAGE . 'catalog/' . $file_name, $response); var_dump($file_name, $p['product_id']); $this->db->query("UPDATE " . DB_PREFIX . "product SET `image` = '" . $this->db->escape('catalog/' . $file_name) . "' WHERE `product_id` = " . (int)$p['product_id']); код не далек от совершенства, но 10гиг фото пробежал 1 Надіслати Поділитися на інших сайтах More sharing options... Sokolov39 Опубліковано: 6 грудня 2023 Автор Share Опубліковано: 6 грудня 2023 дякую спробую Надіслати Поділитися на інших сайтах More sharing options... Eldaeron Опубліковано: 6 грудня 2023 Share Опубліковано: 6 грудня 2023 В 06.12.2023 в 21:08, chukcha сказав: э невеликий скріпт котрий SELECT image from product file get_content CURL translit file_put_content UPDATE product $sql ="SELECT product_id, image FROM " . DB_PREFIX . "product"; $result = $this->db->query($sql); foreach ($result->rows as $p) { $curl = curl_init('Адрес Сайта/image/' . rawurlencode($p['image'])); curl_setopt($curl, CURLOPT_HEADER, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_FORBID_REUSE, 1); curl_setopt($curl, CURLOPT_FRESH_CONNECT, 1); $response = curl_exec($curl); $file_name = strtolower($this->translit(str_replace('data/', '',$p['image']))); $directories = explode('/', dirname($file_name)); $path = ''; foreach ($directories as $directory) { $path = $path . '/' . $directory; if (!is_dir(DIR_IMAGE . 'catalog/' . $path)) { @mkdir(DIR_IMAGE . 'catalog/' . $path, 0777); } } file_put_contents(DIR_IMAGE . 'catalog/' . $file_name, $response); var_dump($file_name, $p['product_id']); $this->db->query("UPDATE " . DB_PREFIX . "product SET `image` = '" . $this->db->escape('catalog/' . $file_name) . "' WHERE `product_id` = " . (int)$p['product_id']); код не далек от совершенства, но 10гиг фото пробежал $curl = curl_init('Адрес Сайта/image/' . rawurlencode($p['image'])); $file_name = strtolower($this->translit(str_replace('data/', '',$p['image']))); Невистарчає методу $this->translit) Ну і в curl_init свій адрес сайту потрібно вписати) 1 Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 6 грудня 2023 Share Опубліковано: 6 грудня 2023 06.12.2023 в 21:58, Eldaeron сказал: Невистарчає методу $this->translit) Ну.. в мене там складний трансліт - бібліотечний Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 6 грудня 2023 Share Опубліковано: 6 грудня 2023 тут э нюанс str_replace('data/', '',$p['image']))); можна прибрати $this->db->escape('catalog/' . $file_name) . "' прибрати catalog Це переносилось з 1.5 Надіслати Поділитися на інших сайтах More sharing options... spectre Опубліковано: 6 грудня 2023 Share Опубліковано: 6 грудня 2023 Старый древний относительно рабочий скрипт Скрытый текст <?php class ControllerCommonCyrlat extends Controller { public function index(){ print "<br><br>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Product !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br><br><br>"; $numnum = 0; $query = $this->db->query("select image, product_id from " . DB_PREFIX . "product"); $results_a = $query->rows; foreach ($results_a as $result_at) { if ($result_at['image'] && file_exists(DIR_IMAGE . $result_at['image'])) { $unic_flag = true; $old_image = $result_at['image']; if (preg_match('#[^A-Za-z0-9_\-/\.]#', $old_image)) { $numnum = $numnum +1; print "<br>- ".$numnum." -<br>"; $image_new = $this->translitIt($old_image); $image_new = preg_replace('#[^A-Za-z0-9_\-/\.]#', '', $image_new); $info = pathinfo($image_new); $extension = $info['extension']; $name_body = substr($image_new, 0, strrpos($image_new, '.')); $new_image = $name_body . '.' . $extension; $directories = explode('/', dirname(str_replace('../', '', $new_image))); array_shift($directories); $path = 'data'; foreach ($directories as $directory) { $path = $path . '/' . $directory; if (!file_exists(DIR_IMAGE . $path)) { @mkdir(DIR_IMAGE . $path, 0777); } } if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x91'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x92'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x93'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x94'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x95'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x96'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x97'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x98'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x99'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {print "<br>__________!!!!!! mnogo copiy takogo faila ".$old_image." --- ". $new_image . " __pid=(".$result['product_id'].")<br>";} if ($unic_flag && rename(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image)) { print $old_image." = p = ".$new_image . " __pid=(".$result_at['product_id'].")<br>"; $unic_flag = false; } else {print "<br>__________!!! ERRORcopyFile ".$old_image." === ". $new_image. " __pid=(".$result['product_id'].")<br>";} // ищем в Продуктах $query = $this->db->query("select product_id, image from " . DB_PREFIX . "product where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "p(". $result['product_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product SET image='".$this->db->escape($new_image)."' where product_id ='".(int)$result['product_id']."'"); } } // теперь это же ищем в Продукт_Картинках $query = $this->db->query("select product_image_id, image from " . DB_PREFIX . "product_image where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "i(". $result['product_image_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product_image SET image='".$this->db->escape($new_image)."' where product_image_id ='".(int)$result['product_image_id']."'"); } } } } else if (!file_exists(DIR_IMAGE . $result_at['image'])) { print "<br>__________file NOT found______". $result_at['image'] . " __pid=(".$result_at['product_id'].")<br>"; } } print "<br><br><br>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Product_Image !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br><br><br>"; // перебор Прод_картинок $query = $this->db->query("select image, product_image_id from " . DB_PREFIX . "product_image"); $results_a = $query->rows; foreach ($results_a as $result_at) { if ($result_at['image'] && file_exists(DIR_IMAGE . $result_at['image'])) { $unic_flag = true; $old_image = $result_at['image']; if (preg_match('#[^A-Za-z0-9_\-/\.]#', $old_image)) { $numnum = $numnum +1; print "<br>- ".$numnum." -<br>"; $image_new = $this->translitIt($old_image); $image_new = preg_replace('#[^A-Za-z0-9_\-/\.]#', '', $image_new); $info = pathinfo($image_new); $extension = $info['extension']; $name_body = substr($image_new, 0, strrpos($image_new, '.')); $new_image = $name_body . '.' . $extension; $directories = explode('/', dirname(str_replace('../', '', $new_image))); array_shift($directories); $path = 'data'; foreach ($directories as $directory) { $path = $path . '/' . $directory; if (!file_exists(DIR_IMAGE . $path)) { @mkdir(DIR_IMAGE . $path, 0777); } } if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x91'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x92'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x93'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x94'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x95'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x96'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x97'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x98'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x99'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {print "<br>__________!!!!!! mnogo copiy takogo faila ".$old_image." --- ". $new_image . " __piid=(".$result['product_image_id'].")<br>";} if ($unic_flag && rename(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image)) { print $old_image." = i = ".$new_image . " __piid=(".$result_at['product_image_id'].")<br>"; $unic_flag = false; } else {print "<br>__________!!! ERRORcopyFile ".$old_image." === ". $new_image. " __piid=(".$result['product_image_id'].")<br>";} // ищем в Продукт_image $query = $this->db->query("select product_image_id, image from " . DB_PREFIX . "product_image where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "i(". $result['product_image_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product_image SET image='".$this->db->escape($new_image)."' where product_image_id ='".(int)$result['product_image_id']."'"); } } // теперь это же ищем в Продуктах $query = $this->db->query("select product_id, image from " . DB_PREFIX . "product where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "p(". $result['product_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product SET image='".$this->db->escape($new_image)."' where product_id ='".(int)$result['product_id']."'"); } } } } else if (!file_exists(DIR_IMAGE . $result_at['image'])) { print "<br>__________file NOT found______". $result_at['image'] . " __piid=(".$result_at['product_image_id'].")<br>"; } } } private function translitIt($str) { $tr = array( "А"=>"A","Б"=>"B","В"=>"V","Г"=>"G", "Д"=>"D","Е"=>"E","Ж"=>"J","З"=>"Z","И"=>"I", "Й"=>"Y","К"=>"K","Л"=>"L","М"=>"M","Н"=>"N", "О"=>"O","П"=>"P","Р"=>"R","С"=>"S","Т"=>"T", "У"=>"U","Ф"=>"F","Х"=>"H","Ц"=>"TS","Ч"=>"CH", "Ш"=>"SH","Щ"=>"SCH","Ъ"=>"","Ы"=>"YI","Ь"=>"", "Э"=>"E","Ю"=>"YU","Я"=>"YA","а"=>"a","б"=>"b", "в"=>"v","г"=>"g","д"=>"d","е"=>"e","ж"=>"j", "з"=>"z","и"=>"i","й"=>"y","к"=>"k","л"=>"l", "м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r", "с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"h", "ц"=>"ts","ч"=>"ch","ш"=>"sh","щ"=>"sch","ъ"=>"", "ы"=>"yi","ь"=>"","э"=>"e","ю"=>"yu","я"=>"ya", " "=> "_","+"=>"_plus_","!"=>"_i_","%20"=>"_","Ё"=>"IO", "ё"=>"io", "$"=>"_", ","=>"_", "&"=>"_", "!"=>"_", "("=>"_", ")"=>"_", ";"=>"_", ); return strtr($str,$tr); } } ?> 2 Надіслати Поділитися на інших сайтах More sharing options... Sokolov39 Опубліковано: 7 грудня 2023 Автор Share Опубліковано: 7 грудня 2023 А готового модуля нема, щоб мав такий функціонал Або можливо у пакетном редакторі він є якомусь ? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 7 грудня 2023 Share Опубліковано: 7 грудня 2023 06.12.2023 в 22:24, spectre сказал: Старый древний относительно рабочий скрипт Показать содержимое <?php class ControllerCommonCyrlat extends Controller { public function index(){ print "<br><br>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Product !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br><br><br>"; $numnum = 0; $query = $this->db->query("select image, product_id from " . DB_PREFIX . "product"); $results_a = $query->rows; foreach ($results_a as $result_at) { if ($result_at['image'] && file_exists(DIR_IMAGE . $result_at['image'])) { $unic_flag = true; $old_image = $result_at['image']; if (preg_match('#[^A-Za-z0-9_\-/\.]#', $old_image)) { $numnum = $numnum +1; print "<br>- ".$numnum." -<br>"; $image_new = $this->translitIt($old_image); $image_new = preg_replace('#[^A-Za-z0-9_\-/\.]#', '', $image_new); $info = pathinfo($image_new); $extension = $info['extension']; $name_body = substr($image_new, 0, strrpos($image_new, '.')); $new_image = $name_body . '.' . $extension; $directories = explode('/', dirname(str_replace('../', '', $new_image))); array_shift($directories); $path = 'data'; foreach ($directories as $directory) { $path = $path . '/' . $directory; if (!file_exists(DIR_IMAGE . $path)) { @mkdir(DIR_IMAGE . $path, 0777); } } if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x91'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x92'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x93'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x94'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x95'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x96'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x97'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x98'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x99'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {print "<br>__________!!!!!! mnogo copiy takogo faila ".$old_image." --- ". $new_image . " __pid=(".$result['product_id'].")<br>";} if ($unic_flag && rename(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image)) { print $old_image." = p = ".$new_image . " __pid=(".$result_at['product_id'].")<br>"; $unic_flag = false; } else {print "<br>__________!!! ERRORcopyFile ".$old_image." === ". $new_image. " __pid=(".$result['product_id'].")<br>";} // ищем в Продуктах $query = $this->db->query("select product_id, image from " . DB_PREFIX . "product where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "p(". $result['product_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product SET image='".$this->db->escape($new_image)."' where product_id ='".(int)$result['product_id']."'"); } } // теперь это же ищем в Продукт_Картинках $query = $this->db->query("select product_image_id, image from " . DB_PREFIX . "product_image where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "i(". $result['product_image_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product_image SET image='".$this->db->escape($new_image)."' where product_image_id ='".(int)$result['product_image_id']."'"); } } } } else if (!file_exists(DIR_IMAGE . $result_at['image'])) { print "<br>__________file NOT found______". $result_at['image'] . " __pid=(".$result_at['product_id'].")<br>"; } } print "<br><br><br>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Product_Image !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br><br><br>"; // перебор Прод_картинок $query = $this->db->query("select image, product_image_id from " . DB_PREFIX . "product_image"); $results_a = $query->rows; foreach ($results_a as $result_at) { if ($result_at['image'] && file_exists(DIR_IMAGE . $result_at['image'])) { $unic_flag = true; $old_image = $result_at['image']; if (preg_match('#[^A-Za-z0-9_\-/\.]#', $old_image)) { $numnum = $numnum +1; print "<br>- ".$numnum." -<br>"; $image_new = $this->translitIt($old_image); $image_new = preg_replace('#[^A-Za-z0-9_\-/\.]#', '', $image_new); $info = pathinfo($image_new); $extension = $info['extension']; $name_body = substr($image_new, 0, strrpos($image_new, '.')); $new_image = $name_body . '.' . $extension; $directories = explode('/', dirname(str_replace('../', '', $new_image))); array_shift($directories); $path = 'data'; foreach ($directories as $directory) { $path = $path . '/' . $directory; if (!file_exists(DIR_IMAGE . $path)) { @mkdir(DIR_IMAGE . $path, 0777); } } if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x91'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x92'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x93'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x94'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x95'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x96'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x97'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x98'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x99'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {print "<br>__________!!!!!! mnogo copiy takogo faila ".$old_image." --- ". $new_image . " __piid=(".$result['product_image_id'].")<br>";} if ($unic_flag && rename(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image)) { print $old_image." = i = ".$new_image . " __piid=(".$result_at['product_image_id'].")<br>"; $unic_flag = false; } else {print "<br>__________!!! ERRORcopyFile ".$old_image." === ". $new_image. " __piid=(".$result['product_image_id'].")<br>";} // ищем в Продукт_image $query = $this->db->query("select product_image_id, image from " . DB_PREFIX . "product_image where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "i(". $result['product_image_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product_image SET image='".$this->db->escape($new_image)."' where product_image_id ='".(int)$result['product_image_id']."'"); } } // теперь это же ищем в Продуктах $query = $this->db->query("select product_id, image from " . DB_PREFIX . "product where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "p(". $result['product_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product SET image='".$this->db->escape($new_image)."' where product_id ='".(int)$result['product_id']."'"); } } } } else if (!file_exists(DIR_IMAGE . $result_at['image'])) { print "<br>__________file NOT found______". $result_at['image'] . " __piid=(".$result_at['product_image_id'].")<br>"; } } } private function translitIt($str) { $tr = array( "А"=>"A","Б"=>"B","В"=>"V","Г"=>"G", "Д"=>"D","Е"=>"E","Ж"=>"J","З"=>"Z","И"=>"I", "Й"=>"Y","К"=>"K","Л"=>"L","М"=>"M","Н"=>"N", "О"=>"O","П"=>"P","Р"=>"R","С"=>"S","Т"=>"T", "У"=>"U","Ф"=>"F","Х"=>"H","Ц"=>"TS","Ч"=>"CH", "Ш"=>"SH","Щ"=>"SCH","Ъ"=>"","Ы"=>"YI","Ь"=>"", "Э"=>"E","Ю"=>"YU","Я"=>"YA","а"=>"a","б"=>"b", "в"=>"v","г"=>"g","д"=>"d","е"=>"e","ж"=>"j", "з"=>"z","и"=>"i","й"=>"y","к"=>"k","л"=>"l", "м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r", "с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"h", "ц"=>"ts","ч"=>"ch","ш"=>"sh","щ"=>"sch","ъ"=>"", "ы"=>"yi","ь"=>"","э"=>"e","ю"=>"yu","я"=>"ya", " "=> "_","+"=>"_plus_","!"=>"_i_","%20"=>"_","Ё"=>"IO", "ё"=>"io", "$"=>"_", ","=>"_", "&"=>"_", "!"=>"_", "("=>"_", ")"=>"_", ";"=>"_", ); return strtr($str,$tr); } } ?> 07.12.2023 в 11:44, Sokolov39 сказал: А готового модуля нема, щоб мав такий функціонал Або можливо у пакетном редакторі він є якомусь ? Надіслати Поділитися на інших сайтах More sharing options... Eldaeron Опубліковано: 7 грудня 2023 Share Опубліковано: 7 грудня 2023 В 07.12.2023 в 11:44, Sokolov39 сказав: А готового модуля нема, щоб мав такий функціонал Або можливо у пакетном редакторі він є якомусь ? @spectre вам надав. Створюєте новий файл cyrlat.php в admin/controller/common Вставляєте весь код в файл В Правах груп користувачів надаєте доступ до common/cyrlat Запускаєте скрипт через браузер - https://ваш_сайт/admin/index.php?route=common/cyrlat 1 Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 7 грудня 2023 Share Опубліковано: 7 грудня 2023 07.12.2023 в 13:24, Eldaeron сказал: в admin/ в catalog/ Надіслати Поділитися на інших сайтах More sharing options... Створіть аккаунт або увійдіть для коментування Ви повинні бути користувачем, щоб залишити коментар Створити обліковий запис Зареєструйтеся для отримання облікового запису. Це просто! Зареєструвати аккаунт Вхід Уже зареєстровані? Увійдіть тут. Вхід зараз Share More sharing options... Передплатники 2 Перейти до списку тем Зараз на сторінці 0 користувачів Ні користувачів, які переглядиють цю сторінку Последние темы Последние дополнения Последние новости Вся активність Головна Форум Opencart 3.x Opencart 3.x: Пошук модулів Транслітерація назв картинок OpenCartForum Форум Модулі Шаблони Безкоштовні шаблониПлатні шаблони Блоги Новини ocStore Офіційний сайтДемо ocStore 3.0.3.2Демо ocStore 2.3.0.2.4Завантажити ocStoreДокументаціяІсторія версій ocStore Гість Українська Русский English Уже зареєстровані? Ввійти Реєстрація × Створити... Important Information На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність. Я даю згоду
Sokolov39 Опубліковано: 6 грудня 2023 Автор Share Опубліковано: 6 грудня 2023 дякую спробую Надіслати Поділитися на інших сайтах More sharing options...
Eldaeron Опубліковано: 6 грудня 2023 Share Опубліковано: 6 грудня 2023 В 06.12.2023 в 21:08, chukcha сказав: э невеликий скріпт котрий SELECT image from product file get_content CURL translit file_put_content UPDATE product $sql ="SELECT product_id, image FROM " . DB_PREFIX . "product"; $result = $this->db->query($sql); foreach ($result->rows as $p) { $curl = curl_init('Адрес Сайта/image/' . rawurlencode($p['image'])); curl_setopt($curl, CURLOPT_HEADER, 0); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, 0); curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1); curl_setopt($curl, CURLOPT_FORBID_REUSE, 1); curl_setopt($curl, CURLOPT_FRESH_CONNECT, 1); $response = curl_exec($curl); $file_name = strtolower($this->translit(str_replace('data/', '',$p['image']))); $directories = explode('/', dirname($file_name)); $path = ''; foreach ($directories as $directory) { $path = $path . '/' . $directory; if (!is_dir(DIR_IMAGE . 'catalog/' . $path)) { @mkdir(DIR_IMAGE . 'catalog/' . $path, 0777); } } file_put_contents(DIR_IMAGE . 'catalog/' . $file_name, $response); var_dump($file_name, $p['product_id']); $this->db->query("UPDATE " . DB_PREFIX . "product SET `image` = '" . $this->db->escape('catalog/' . $file_name) . "' WHERE `product_id` = " . (int)$p['product_id']); код не далек от совершенства, но 10гиг фото пробежал $curl = curl_init('Адрес Сайта/image/' . rawurlencode($p['image'])); $file_name = strtolower($this->translit(str_replace('data/', '',$p['image']))); Невистарчає методу $this->translit) Ну і в curl_init свій адрес сайту потрібно вписати) 1 Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 6 грудня 2023 Share Опубліковано: 6 грудня 2023 06.12.2023 в 21:58, Eldaeron сказал: Невистарчає методу $this->translit) Ну.. в мене там складний трансліт - бібліотечний Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 6 грудня 2023 Share Опубліковано: 6 грудня 2023 тут э нюанс str_replace('data/', '',$p['image']))); можна прибрати $this->db->escape('catalog/' . $file_name) . "' прибрати catalog Це переносилось з 1.5 Надіслати Поділитися на інших сайтах More sharing options... spectre Опубліковано: 6 грудня 2023 Share Опубліковано: 6 грудня 2023 Старый древний относительно рабочий скрипт Скрытый текст <?php class ControllerCommonCyrlat extends Controller { public function index(){ print "<br><br>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Product !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br><br><br>"; $numnum = 0; $query = $this->db->query("select image, product_id from " . DB_PREFIX . "product"); $results_a = $query->rows; foreach ($results_a as $result_at) { if ($result_at['image'] && file_exists(DIR_IMAGE . $result_at['image'])) { $unic_flag = true; $old_image = $result_at['image']; if (preg_match('#[^A-Za-z0-9_\-/\.]#', $old_image)) { $numnum = $numnum +1; print "<br>- ".$numnum." -<br>"; $image_new = $this->translitIt($old_image); $image_new = preg_replace('#[^A-Za-z0-9_\-/\.]#', '', $image_new); $info = pathinfo($image_new); $extension = $info['extension']; $name_body = substr($image_new, 0, strrpos($image_new, '.')); $new_image = $name_body . '.' . $extension; $directories = explode('/', dirname(str_replace('../', '', $new_image))); array_shift($directories); $path = 'data'; foreach ($directories as $directory) { $path = $path . '/' . $directory; if (!file_exists(DIR_IMAGE . $path)) { @mkdir(DIR_IMAGE . $path, 0777); } } if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x91'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x92'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x93'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x94'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x95'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x96'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x97'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x98'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x99'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {print "<br>__________!!!!!! mnogo copiy takogo faila ".$old_image." --- ". $new_image . " __pid=(".$result['product_id'].")<br>";} if ($unic_flag && rename(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image)) { print $old_image." = p = ".$new_image . " __pid=(".$result_at['product_id'].")<br>"; $unic_flag = false; } else {print "<br>__________!!! ERRORcopyFile ".$old_image." === ". $new_image. " __pid=(".$result['product_id'].")<br>";} // ищем в Продуктах $query = $this->db->query("select product_id, image from " . DB_PREFIX . "product where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "p(". $result['product_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product SET image='".$this->db->escape($new_image)."' where product_id ='".(int)$result['product_id']."'"); } } // теперь это же ищем в Продукт_Картинках $query = $this->db->query("select product_image_id, image from " . DB_PREFIX . "product_image where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "i(". $result['product_image_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product_image SET image='".$this->db->escape($new_image)."' where product_image_id ='".(int)$result['product_image_id']."'"); } } } } else if (!file_exists(DIR_IMAGE . $result_at['image'])) { print "<br>__________file NOT found______". $result_at['image'] . " __pid=(".$result_at['product_id'].")<br>"; } } print "<br><br><br>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Product_Image !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br><br><br>"; // перебор Прод_картинок $query = $this->db->query("select image, product_image_id from " . DB_PREFIX . "product_image"); $results_a = $query->rows; foreach ($results_a as $result_at) { if ($result_at['image'] && file_exists(DIR_IMAGE . $result_at['image'])) { $unic_flag = true; $old_image = $result_at['image']; if (preg_match('#[^A-Za-z0-9_\-/\.]#', $old_image)) { $numnum = $numnum +1; print "<br>- ".$numnum." -<br>"; $image_new = $this->translitIt($old_image); $image_new = preg_replace('#[^A-Za-z0-9_\-/\.]#', '', $image_new); $info = pathinfo($image_new); $extension = $info['extension']; $name_body = substr($image_new, 0, strrpos($image_new, '.')); $new_image = $name_body . '.' . $extension; $directories = explode('/', dirname(str_replace('../', '', $new_image))); array_shift($directories); $path = 'data'; foreach ($directories as $directory) { $path = $path . '/' . $directory; if (!file_exists(DIR_IMAGE . $path)) { @mkdir(DIR_IMAGE . $path, 0777); } } if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x91'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x92'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x93'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x94'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x95'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x96'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x97'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x98'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x99'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {print "<br>__________!!!!!! mnogo copiy takogo faila ".$old_image." --- ". $new_image . " __piid=(".$result['product_image_id'].")<br>";} if ($unic_flag && rename(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image)) { print $old_image." = i = ".$new_image . " __piid=(".$result_at['product_image_id'].")<br>"; $unic_flag = false; } else {print "<br>__________!!! ERRORcopyFile ".$old_image." === ". $new_image. " __piid=(".$result['product_image_id'].")<br>";} // ищем в Продукт_image $query = $this->db->query("select product_image_id, image from " . DB_PREFIX . "product_image where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "i(". $result['product_image_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product_image SET image='".$this->db->escape($new_image)."' where product_image_id ='".(int)$result['product_image_id']."'"); } } // теперь это же ищем в Продуктах $query = $this->db->query("select product_id, image from " . DB_PREFIX . "product where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "p(". $result['product_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product SET image='".$this->db->escape($new_image)."' where product_id ='".(int)$result['product_id']."'"); } } } } else if (!file_exists(DIR_IMAGE . $result_at['image'])) { print "<br>__________file NOT found______". $result_at['image'] . " __piid=(".$result_at['product_image_id'].")<br>"; } } } private function translitIt($str) { $tr = array( "А"=>"A","Б"=>"B","В"=>"V","Г"=>"G", "Д"=>"D","Е"=>"E","Ж"=>"J","З"=>"Z","И"=>"I", "Й"=>"Y","К"=>"K","Л"=>"L","М"=>"M","Н"=>"N", "О"=>"O","П"=>"P","Р"=>"R","С"=>"S","Т"=>"T", "У"=>"U","Ф"=>"F","Х"=>"H","Ц"=>"TS","Ч"=>"CH", "Ш"=>"SH","Щ"=>"SCH","Ъ"=>"","Ы"=>"YI","Ь"=>"", "Э"=>"E","Ю"=>"YU","Я"=>"YA","а"=>"a","б"=>"b", "в"=>"v","г"=>"g","д"=>"d","е"=>"e","ж"=>"j", "з"=>"z","и"=>"i","й"=>"y","к"=>"k","л"=>"l", "м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r", "с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"h", "ц"=>"ts","ч"=>"ch","ш"=>"sh","щ"=>"sch","ъ"=>"", "ы"=>"yi","ь"=>"","э"=>"e","ю"=>"yu","я"=>"ya", " "=> "_","+"=>"_plus_","!"=>"_i_","%20"=>"_","Ё"=>"IO", "ё"=>"io", "$"=>"_", ","=>"_", "&"=>"_", "!"=>"_", "("=>"_", ")"=>"_", ";"=>"_", ); return strtr($str,$tr); } } ?> 2 Надіслати Поділитися на інших сайтах More sharing options... Sokolov39 Опубліковано: 7 грудня 2023 Автор Share Опубліковано: 7 грудня 2023 А готового модуля нема, щоб мав такий функціонал Або можливо у пакетном редакторі він є якомусь ? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 7 грудня 2023 Share Опубліковано: 7 грудня 2023 06.12.2023 в 22:24, spectre сказал: Старый древний относительно рабочий скрипт Показать содержимое <?php class ControllerCommonCyrlat extends Controller { public function index(){ print "<br><br>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Product !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br><br><br>"; $numnum = 0; $query = $this->db->query("select image, product_id from " . DB_PREFIX . "product"); $results_a = $query->rows; foreach ($results_a as $result_at) { if ($result_at['image'] && file_exists(DIR_IMAGE . $result_at['image'])) { $unic_flag = true; $old_image = $result_at['image']; if (preg_match('#[^A-Za-z0-9_\-/\.]#', $old_image)) { $numnum = $numnum +1; print "<br>- ".$numnum." -<br>"; $image_new = $this->translitIt($old_image); $image_new = preg_replace('#[^A-Za-z0-9_\-/\.]#', '', $image_new); $info = pathinfo($image_new); $extension = $info['extension']; $name_body = substr($image_new, 0, strrpos($image_new, '.')); $new_image = $name_body . '.' . $extension; $directories = explode('/', dirname(str_replace('../', '', $new_image))); array_shift($directories); $path = 'data'; foreach ($directories as $directory) { $path = $path . '/' . $directory; if (!file_exists(DIR_IMAGE . $path)) { @mkdir(DIR_IMAGE . $path, 0777); } } if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x91'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x92'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x93'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x94'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x95'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x96'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x97'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x98'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x99'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {print "<br>__________!!!!!! mnogo copiy takogo faila ".$old_image." --- ". $new_image . " __pid=(".$result['product_id'].")<br>";} if ($unic_flag && rename(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image)) { print $old_image." = p = ".$new_image . " __pid=(".$result_at['product_id'].")<br>"; $unic_flag = false; } else {print "<br>__________!!! ERRORcopyFile ".$old_image." === ". $new_image. " __pid=(".$result['product_id'].")<br>";} // ищем в Продуктах $query = $this->db->query("select product_id, image from " . DB_PREFIX . "product where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "p(". $result['product_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product SET image='".$this->db->escape($new_image)."' where product_id ='".(int)$result['product_id']."'"); } } // теперь это же ищем в Продукт_Картинках $query = $this->db->query("select product_image_id, image from " . DB_PREFIX . "product_image where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "i(". $result['product_image_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product_image SET image='".$this->db->escape($new_image)."' where product_image_id ='".(int)$result['product_image_id']."'"); } } } } else if (!file_exists(DIR_IMAGE . $result_at['image'])) { print "<br>__________file NOT found______". $result_at['image'] . " __pid=(".$result_at['product_id'].")<br>"; } } print "<br><br><br>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Product_Image !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br><br><br>"; // перебор Прод_картинок $query = $this->db->query("select image, product_image_id from " . DB_PREFIX . "product_image"); $results_a = $query->rows; foreach ($results_a as $result_at) { if ($result_at['image'] && file_exists(DIR_IMAGE . $result_at['image'])) { $unic_flag = true; $old_image = $result_at['image']; if (preg_match('#[^A-Za-z0-9_\-/\.]#', $old_image)) { $numnum = $numnum +1; print "<br>- ".$numnum." -<br>"; $image_new = $this->translitIt($old_image); $image_new = preg_replace('#[^A-Za-z0-9_\-/\.]#', '', $image_new); $info = pathinfo($image_new); $extension = $info['extension']; $name_body = substr($image_new, 0, strrpos($image_new, '.')); $new_image = $name_body . '.' . $extension; $directories = explode('/', dirname(str_replace('../', '', $new_image))); array_shift($directories); $path = 'data'; foreach ($directories as $directory) { $path = $path . '/' . $directory; if (!file_exists(DIR_IMAGE . $path)) { @mkdir(DIR_IMAGE . $path, 0777); } } if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x91'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x92'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x93'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x94'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x95'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x96'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x97'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x98'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x99'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {print "<br>__________!!!!!! mnogo copiy takogo faila ".$old_image." --- ". $new_image . " __piid=(".$result['product_image_id'].")<br>";} if ($unic_flag && rename(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image)) { print $old_image." = i = ".$new_image . " __piid=(".$result_at['product_image_id'].")<br>"; $unic_flag = false; } else {print "<br>__________!!! ERRORcopyFile ".$old_image." === ". $new_image. " __piid=(".$result['product_image_id'].")<br>";} // ищем в Продукт_image $query = $this->db->query("select product_image_id, image from " . DB_PREFIX . "product_image where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "i(". $result['product_image_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product_image SET image='".$this->db->escape($new_image)."' where product_image_id ='".(int)$result['product_image_id']."'"); } } // теперь это же ищем в Продуктах $query = $this->db->query("select product_id, image from " . DB_PREFIX . "product where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "p(". $result['product_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product SET image='".$this->db->escape($new_image)."' where product_id ='".(int)$result['product_id']."'"); } } } } else if (!file_exists(DIR_IMAGE . $result_at['image'])) { print "<br>__________file NOT found______". $result_at['image'] . " __piid=(".$result_at['product_image_id'].")<br>"; } } } private function translitIt($str) { $tr = array( "А"=>"A","Б"=>"B","В"=>"V","Г"=>"G", "Д"=>"D","Е"=>"E","Ж"=>"J","З"=>"Z","И"=>"I", "Й"=>"Y","К"=>"K","Л"=>"L","М"=>"M","Н"=>"N", "О"=>"O","П"=>"P","Р"=>"R","С"=>"S","Т"=>"T", "У"=>"U","Ф"=>"F","Х"=>"H","Ц"=>"TS","Ч"=>"CH", "Ш"=>"SH","Щ"=>"SCH","Ъ"=>"","Ы"=>"YI","Ь"=>"", "Э"=>"E","Ю"=>"YU","Я"=>"YA","а"=>"a","б"=>"b", "в"=>"v","г"=>"g","д"=>"d","е"=>"e","ж"=>"j", "з"=>"z","и"=>"i","й"=>"y","к"=>"k","л"=>"l", "м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r", "с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"h", "ц"=>"ts","ч"=>"ch","ш"=>"sh","щ"=>"sch","ъ"=>"", "ы"=>"yi","ь"=>"","э"=>"e","ю"=>"yu","я"=>"ya", " "=> "_","+"=>"_plus_","!"=>"_i_","%20"=>"_","Ё"=>"IO", "ё"=>"io", "$"=>"_", ","=>"_", "&"=>"_", "!"=>"_", "("=>"_", ")"=>"_", ";"=>"_", ); return strtr($str,$tr); } } ?> 07.12.2023 в 11:44, Sokolov39 сказал: А готового модуля нема, щоб мав такий функціонал Або можливо у пакетном редакторі він є якомусь ? Надіслати Поділитися на інших сайтах More sharing options... Eldaeron Опубліковано: 7 грудня 2023 Share Опубліковано: 7 грудня 2023 В 07.12.2023 в 11:44, Sokolov39 сказав: А готового модуля нема, щоб мав такий функціонал Або можливо у пакетном редакторі він є якомусь ? @spectre вам надав. Створюєте новий файл cyrlat.php в admin/controller/common Вставляєте весь код в файл В Правах груп користувачів надаєте доступ до common/cyrlat Запускаєте скрипт через браузер - https://ваш_сайт/admin/index.php?route=common/cyrlat 1 Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 7 грудня 2023 Share Опубліковано: 7 грудня 2023 07.12.2023 в 13:24, Eldaeron сказал: в admin/ в catalog/ Надіслати Поділитися на інших сайтах More sharing options... Створіть аккаунт або увійдіть для коментування Ви повинні бути користувачем, щоб залишити коментар Створити обліковий запис Зареєструйтеся для отримання облікового запису. Це просто! Зареєструвати аккаунт Вхід Уже зареєстровані? Увійдіть тут. Вхід зараз Share More sharing options... Передплатники 2 Перейти до списку тем Зараз на сторінці 0 користувачів Ні користувачів, які переглядиють цю сторінку Последние темы Последние дополнения Последние новости Вся активність Головна Форум Opencart 3.x Opencart 3.x: Пошук модулів Транслітерація назв картинок OpenCartForum Форум Модулі Шаблони Безкоштовні шаблониПлатні шаблони Блоги Новини ocStore Офіційний сайтДемо ocStore 3.0.3.2Демо ocStore 2.3.0.2.4Завантажити ocStoreДокументаціяІсторія версій ocStore Гість Українська Русский English Уже зареєстровані? Ввійти Реєстрація × Створити... Important Information На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність. Я даю згоду
chukcha Опубліковано: 6 грудня 2023 Share Опубліковано: 6 грудня 2023 06.12.2023 в 21:58, Eldaeron сказал: Невистарчає методу $this->translit) Ну.. в мене там складний трансліт - бібліотечний Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 6 грудня 2023 Share Опубліковано: 6 грудня 2023 тут э нюанс str_replace('data/', '',$p['image']))); можна прибрати $this->db->escape('catalog/' . $file_name) . "' прибрати catalog Це переносилось з 1.5 Надіслати Поділитися на інших сайтах More sharing options... spectre Опубліковано: 6 грудня 2023 Share Опубліковано: 6 грудня 2023 Старый древний относительно рабочий скрипт Скрытый текст <?php class ControllerCommonCyrlat extends Controller { public function index(){ print "<br><br>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Product !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br><br><br>"; $numnum = 0; $query = $this->db->query("select image, product_id from " . DB_PREFIX . "product"); $results_a = $query->rows; foreach ($results_a as $result_at) { if ($result_at['image'] && file_exists(DIR_IMAGE . $result_at['image'])) { $unic_flag = true; $old_image = $result_at['image']; if (preg_match('#[^A-Za-z0-9_\-/\.]#', $old_image)) { $numnum = $numnum +1; print "<br>- ".$numnum." -<br>"; $image_new = $this->translitIt($old_image); $image_new = preg_replace('#[^A-Za-z0-9_\-/\.]#', '', $image_new); $info = pathinfo($image_new); $extension = $info['extension']; $name_body = substr($image_new, 0, strrpos($image_new, '.')); $new_image = $name_body . '.' . $extension; $directories = explode('/', dirname(str_replace('../', '', $new_image))); array_shift($directories); $path = 'data'; foreach ($directories as $directory) { $path = $path . '/' . $directory; if (!file_exists(DIR_IMAGE . $path)) { @mkdir(DIR_IMAGE . $path, 0777); } } if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x91'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x92'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x93'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x94'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x95'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x96'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x97'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x98'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x99'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {print "<br>__________!!!!!! mnogo copiy takogo faila ".$old_image." --- ". $new_image . " __pid=(".$result['product_id'].")<br>";} if ($unic_flag && rename(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image)) { print $old_image." = p = ".$new_image . " __pid=(".$result_at['product_id'].")<br>"; $unic_flag = false; } else {print "<br>__________!!! ERRORcopyFile ".$old_image." === ". $new_image. " __pid=(".$result['product_id'].")<br>";} // ищем в Продуктах $query = $this->db->query("select product_id, image from " . DB_PREFIX . "product where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "p(". $result['product_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product SET image='".$this->db->escape($new_image)."' where product_id ='".(int)$result['product_id']."'"); } } // теперь это же ищем в Продукт_Картинках $query = $this->db->query("select product_image_id, image from " . DB_PREFIX . "product_image where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "i(". $result['product_image_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product_image SET image='".$this->db->escape($new_image)."' where product_image_id ='".(int)$result['product_image_id']."'"); } } } } else if (!file_exists(DIR_IMAGE . $result_at['image'])) { print "<br>__________file NOT found______". $result_at['image'] . " __pid=(".$result_at['product_id'].")<br>"; } } print "<br><br><br>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Product_Image !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br><br><br>"; // перебор Прод_картинок $query = $this->db->query("select image, product_image_id from " . DB_PREFIX . "product_image"); $results_a = $query->rows; foreach ($results_a as $result_at) { if ($result_at['image'] && file_exists(DIR_IMAGE . $result_at['image'])) { $unic_flag = true; $old_image = $result_at['image']; if (preg_match('#[^A-Za-z0-9_\-/\.]#', $old_image)) { $numnum = $numnum +1; print "<br>- ".$numnum." -<br>"; $image_new = $this->translitIt($old_image); $image_new = preg_replace('#[^A-Za-z0-9_\-/\.]#', '', $image_new); $info = pathinfo($image_new); $extension = $info['extension']; $name_body = substr($image_new, 0, strrpos($image_new, '.')); $new_image = $name_body . '.' . $extension; $directories = explode('/', dirname(str_replace('../', '', $new_image))); array_shift($directories); $path = 'data'; foreach ($directories as $directory) { $path = $path . '/' . $directory; if (!file_exists(DIR_IMAGE . $path)) { @mkdir(DIR_IMAGE . $path, 0777); } } if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x91'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x92'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x93'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x94'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x95'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x96'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x97'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x98'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x99'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {print "<br>__________!!!!!! mnogo copiy takogo faila ".$old_image." --- ". $new_image . " __piid=(".$result['product_image_id'].")<br>";} if ($unic_flag && rename(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image)) { print $old_image." = i = ".$new_image . " __piid=(".$result_at['product_image_id'].")<br>"; $unic_flag = false; } else {print "<br>__________!!! ERRORcopyFile ".$old_image." === ". $new_image. " __piid=(".$result['product_image_id'].")<br>";} // ищем в Продукт_image $query = $this->db->query("select product_image_id, image from " . DB_PREFIX . "product_image where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "i(". $result['product_image_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product_image SET image='".$this->db->escape($new_image)."' where product_image_id ='".(int)$result['product_image_id']."'"); } } // теперь это же ищем в Продуктах $query = $this->db->query("select product_id, image from " . DB_PREFIX . "product where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "p(". $result['product_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product SET image='".$this->db->escape($new_image)."' where product_id ='".(int)$result['product_id']."'"); } } } } else if (!file_exists(DIR_IMAGE . $result_at['image'])) { print "<br>__________file NOT found______". $result_at['image'] . " __piid=(".$result_at['product_image_id'].")<br>"; } } } private function translitIt($str) { $tr = array( "А"=>"A","Б"=>"B","В"=>"V","Г"=>"G", "Д"=>"D","Е"=>"E","Ж"=>"J","З"=>"Z","И"=>"I", "Й"=>"Y","К"=>"K","Л"=>"L","М"=>"M","Н"=>"N", "О"=>"O","П"=>"P","Р"=>"R","С"=>"S","Т"=>"T", "У"=>"U","Ф"=>"F","Х"=>"H","Ц"=>"TS","Ч"=>"CH", "Ш"=>"SH","Щ"=>"SCH","Ъ"=>"","Ы"=>"YI","Ь"=>"", "Э"=>"E","Ю"=>"YU","Я"=>"YA","а"=>"a","б"=>"b", "в"=>"v","г"=>"g","д"=>"d","е"=>"e","ж"=>"j", "з"=>"z","и"=>"i","й"=>"y","к"=>"k","л"=>"l", "м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r", "с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"h", "ц"=>"ts","ч"=>"ch","ш"=>"sh","щ"=>"sch","ъ"=>"", "ы"=>"yi","ь"=>"","э"=>"e","ю"=>"yu","я"=>"ya", " "=> "_","+"=>"_plus_","!"=>"_i_","%20"=>"_","Ё"=>"IO", "ё"=>"io", "$"=>"_", ","=>"_", "&"=>"_", "!"=>"_", "("=>"_", ")"=>"_", ";"=>"_", ); return strtr($str,$tr); } } ?> 2 Надіслати Поділитися на інших сайтах More sharing options... Sokolov39 Опубліковано: 7 грудня 2023 Автор Share Опубліковано: 7 грудня 2023 А готового модуля нема, щоб мав такий функціонал Або можливо у пакетном редакторі він є якомусь ? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 7 грудня 2023 Share Опубліковано: 7 грудня 2023 06.12.2023 в 22:24, spectre сказал: Старый древний относительно рабочий скрипт Показать содержимое <?php class ControllerCommonCyrlat extends Controller { public function index(){ print "<br><br>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Product !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br><br><br>"; $numnum = 0; $query = $this->db->query("select image, product_id from " . DB_PREFIX . "product"); $results_a = $query->rows; foreach ($results_a as $result_at) { if ($result_at['image'] && file_exists(DIR_IMAGE . $result_at['image'])) { $unic_flag = true; $old_image = $result_at['image']; if (preg_match('#[^A-Za-z0-9_\-/\.]#', $old_image)) { $numnum = $numnum +1; print "<br>- ".$numnum." -<br>"; $image_new = $this->translitIt($old_image); $image_new = preg_replace('#[^A-Za-z0-9_\-/\.]#', '', $image_new); $info = pathinfo($image_new); $extension = $info['extension']; $name_body = substr($image_new, 0, strrpos($image_new, '.')); $new_image = $name_body . '.' . $extension; $directories = explode('/', dirname(str_replace('../', '', $new_image))); array_shift($directories); $path = 'data'; foreach ($directories as $directory) { $path = $path . '/' . $directory; if (!file_exists(DIR_IMAGE . $path)) { @mkdir(DIR_IMAGE . $path, 0777); } } if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x91'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x92'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x93'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x94'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x95'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x96'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x97'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x98'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x99'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {print "<br>__________!!!!!! mnogo copiy takogo faila ".$old_image." --- ". $new_image . " __pid=(".$result['product_id'].")<br>";} if ($unic_flag && rename(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image)) { print $old_image." = p = ".$new_image . " __pid=(".$result_at['product_id'].")<br>"; $unic_flag = false; } else {print "<br>__________!!! ERRORcopyFile ".$old_image." === ". $new_image. " __pid=(".$result['product_id'].")<br>";} // ищем в Продуктах $query = $this->db->query("select product_id, image from " . DB_PREFIX . "product where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "p(". $result['product_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product SET image='".$this->db->escape($new_image)."' where product_id ='".(int)$result['product_id']."'"); } } // теперь это же ищем в Продукт_Картинках $query = $this->db->query("select product_image_id, image from " . DB_PREFIX . "product_image where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "i(". $result['product_image_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product_image SET image='".$this->db->escape($new_image)."' where product_image_id ='".(int)$result['product_image_id']."'"); } } } } else if (!file_exists(DIR_IMAGE . $result_at['image'])) { print "<br>__________file NOT found______". $result_at['image'] . " __pid=(".$result_at['product_id'].")<br>"; } } print "<br><br><br>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Product_Image !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br><br><br>"; // перебор Прод_картинок $query = $this->db->query("select image, product_image_id from " . DB_PREFIX . "product_image"); $results_a = $query->rows; foreach ($results_a as $result_at) { if ($result_at['image'] && file_exists(DIR_IMAGE . $result_at['image'])) { $unic_flag = true; $old_image = $result_at['image']; if (preg_match('#[^A-Za-z0-9_\-/\.]#', $old_image)) { $numnum = $numnum +1; print "<br>- ".$numnum." -<br>"; $image_new = $this->translitIt($old_image); $image_new = preg_replace('#[^A-Za-z0-9_\-/\.]#', '', $image_new); $info = pathinfo($image_new); $extension = $info['extension']; $name_body = substr($image_new, 0, strrpos($image_new, '.')); $new_image = $name_body . '.' . $extension; $directories = explode('/', dirname(str_replace('../', '', $new_image))); array_shift($directories); $path = 'data'; foreach ($directories as $directory) { $path = $path . '/' . $directory; if (!file_exists(DIR_IMAGE . $path)) { @mkdir(DIR_IMAGE . $path, 0777); } } if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x91'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x92'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x93'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x94'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x95'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x96'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x97'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x98'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x99'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {print "<br>__________!!!!!! mnogo copiy takogo faila ".$old_image." --- ". $new_image . " __piid=(".$result['product_image_id'].")<br>";} if ($unic_flag && rename(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image)) { print $old_image." = i = ".$new_image . " __piid=(".$result_at['product_image_id'].")<br>"; $unic_flag = false; } else {print "<br>__________!!! ERRORcopyFile ".$old_image." === ". $new_image. " __piid=(".$result['product_image_id'].")<br>";} // ищем в Продукт_image $query = $this->db->query("select product_image_id, image from " . DB_PREFIX . "product_image where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "i(". $result['product_image_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product_image SET image='".$this->db->escape($new_image)."' where product_image_id ='".(int)$result['product_image_id']."'"); } } // теперь это же ищем в Продуктах $query = $this->db->query("select product_id, image from " . DB_PREFIX . "product where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "p(". $result['product_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product SET image='".$this->db->escape($new_image)."' where product_id ='".(int)$result['product_id']."'"); } } } } else if (!file_exists(DIR_IMAGE . $result_at['image'])) { print "<br>__________file NOT found______". $result_at['image'] . " __piid=(".$result_at['product_image_id'].")<br>"; } } } private function translitIt($str) { $tr = array( "А"=>"A","Б"=>"B","В"=>"V","Г"=>"G", "Д"=>"D","Е"=>"E","Ж"=>"J","З"=>"Z","И"=>"I", "Й"=>"Y","К"=>"K","Л"=>"L","М"=>"M","Н"=>"N", "О"=>"O","П"=>"P","Р"=>"R","С"=>"S","Т"=>"T", "У"=>"U","Ф"=>"F","Х"=>"H","Ц"=>"TS","Ч"=>"CH", "Ш"=>"SH","Щ"=>"SCH","Ъ"=>"","Ы"=>"YI","Ь"=>"", "Э"=>"E","Ю"=>"YU","Я"=>"YA","а"=>"a","б"=>"b", "в"=>"v","г"=>"g","д"=>"d","е"=>"e","ж"=>"j", "з"=>"z","и"=>"i","й"=>"y","к"=>"k","л"=>"l", "м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r", "с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"h", "ц"=>"ts","ч"=>"ch","ш"=>"sh","щ"=>"sch","ъ"=>"", "ы"=>"yi","ь"=>"","э"=>"e","ю"=>"yu","я"=>"ya", " "=> "_","+"=>"_plus_","!"=>"_i_","%20"=>"_","Ё"=>"IO", "ё"=>"io", "$"=>"_", ","=>"_", "&"=>"_", "!"=>"_", "("=>"_", ")"=>"_", ";"=>"_", ); return strtr($str,$tr); } } ?> 07.12.2023 в 11:44, Sokolov39 сказал: А готового модуля нема, щоб мав такий функціонал Або можливо у пакетном редакторі він є якомусь ? Надіслати Поділитися на інших сайтах More sharing options... Eldaeron Опубліковано: 7 грудня 2023 Share Опубліковано: 7 грудня 2023 В 07.12.2023 в 11:44, Sokolov39 сказав: А готового модуля нема, щоб мав такий функціонал Або можливо у пакетном редакторі він є якомусь ? @spectre вам надав. Створюєте новий файл cyrlat.php в admin/controller/common Вставляєте весь код в файл В Правах груп користувачів надаєте доступ до common/cyrlat Запускаєте скрипт через браузер - https://ваш_сайт/admin/index.php?route=common/cyrlat 1 Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 7 грудня 2023 Share Опубліковано: 7 грудня 2023 07.12.2023 в 13:24, Eldaeron сказал: в admin/ в catalog/ Надіслати Поділитися на інших сайтах More sharing options... Створіть аккаунт або увійдіть для коментування Ви повинні бути користувачем, щоб залишити коментар Створити обліковий запис Зареєструйтеся для отримання облікового запису. Це просто! Зареєструвати аккаунт Вхід Уже зареєстровані? Увійдіть тут. Вхід зараз Share More sharing options... Передплатники 2 Перейти до списку тем Зараз на сторінці 0 користувачів Ні користувачів, які переглядиють цю сторінку Последние темы Последние дополнения Последние новости Вся активність Головна Форум Opencart 3.x Opencart 3.x: Пошук модулів Транслітерація назв картинок OpenCartForum Форум Модулі Шаблони Безкоштовні шаблониПлатні шаблони Блоги Новини ocStore Офіційний сайтДемо ocStore 3.0.3.2Демо ocStore 2.3.0.2.4Завантажити ocStoreДокументаціяІсторія версій ocStore Гість Українська Русский English Уже зареєстровані? Ввійти Реєстрація × Створити... Important Information На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність. Я даю згоду
chukcha Опубліковано: 6 грудня 2023 Share Опубліковано: 6 грудня 2023 тут э нюанс str_replace('data/', '',$p['image']))); можна прибрати $this->db->escape('catalog/' . $file_name) . "' прибрати catalog Це переносилось з 1.5 Надіслати Поділитися на інших сайтах More sharing options... spectre Опубліковано: 6 грудня 2023 Share Опубліковано: 6 грудня 2023 Старый древний относительно рабочий скрипт Скрытый текст <?php class ControllerCommonCyrlat extends Controller { public function index(){ print "<br><br>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Product !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br><br><br>"; $numnum = 0; $query = $this->db->query("select image, product_id from " . DB_PREFIX . "product"); $results_a = $query->rows; foreach ($results_a as $result_at) { if ($result_at['image'] && file_exists(DIR_IMAGE . $result_at['image'])) { $unic_flag = true; $old_image = $result_at['image']; if (preg_match('#[^A-Za-z0-9_\-/\.]#', $old_image)) { $numnum = $numnum +1; print "<br>- ".$numnum." -<br>"; $image_new = $this->translitIt($old_image); $image_new = preg_replace('#[^A-Za-z0-9_\-/\.]#', '', $image_new); $info = pathinfo($image_new); $extension = $info['extension']; $name_body = substr($image_new, 0, strrpos($image_new, '.')); $new_image = $name_body . '.' . $extension; $directories = explode('/', dirname(str_replace('../', '', $new_image))); array_shift($directories); $path = 'data'; foreach ($directories as $directory) { $path = $path . '/' . $directory; if (!file_exists(DIR_IMAGE . $path)) { @mkdir(DIR_IMAGE . $path, 0777); } } if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x91'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x92'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x93'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x94'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x95'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x96'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x97'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x98'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x99'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {print "<br>__________!!!!!! mnogo copiy takogo faila ".$old_image." --- ". $new_image . " __pid=(".$result['product_id'].")<br>";} if ($unic_flag && rename(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image)) { print $old_image." = p = ".$new_image . " __pid=(".$result_at['product_id'].")<br>"; $unic_flag = false; } else {print "<br>__________!!! ERRORcopyFile ".$old_image." === ". $new_image. " __pid=(".$result['product_id'].")<br>";} // ищем в Продуктах $query = $this->db->query("select product_id, image from " . DB_PREFIX . "product where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "p(". $result['product_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product SET image='".$this->db->escape($new_image)."' where product_id ='".(int)$result['product_id']."'"); } } // теперь это же ищем в Продукт_Картинках $query = $this->db->query("select product_image_id, image from " . DB_PREFIX . "product_image where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "i(". $result['product_image_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product_image SET image='".$this->db->escape($new_image)."' where product_image_id ='".(int)$result['product_image_id']."'"); } } } } else if (!file_exists(DIR_IMAGE . $result_at['image'])) { print "<br>__________file NOT found______". $result_at['image'] . " __pid=(".$result_at['product_id'].")<br>"; } } print "<br><br><br>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Product_Image !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br><br><br>"; // перебор Прод_картинок $query = $this->db->query("select image, product_image_id from " . DB_PREFIX . "product_image"); $results_a = $query->rows; foreach ($results_a as $result_at) { if ($result_at['image'] && file_exists(DIR_IMAGE . $result_at['image'])) { $unic_flag = true; $old_image = $result_at['image']; if (preg_match('#[^A-Za-z0-9_\-/\.]#', $old_image)) { $numnum = $numnum +1; print "<br>- ".$numnum." -<br>"; $image_new = $this->translitIt($old_image); $image_new = preg_replace('#[^A-Za-z0-9_\-/\.]#', '', $image_new); $info = pathinfo($image_new); $extension = $info['extension']; $name_body = substr($image_new, 0, strrpos($image_new, '.')); $new_image = $name_body . '.' . $extension; $directories = explode('/', dirname(str_replace('../', '', $new_image))); array_shift($directories); $path = 'data'; foreach ($directories as $directory) { $path = $path . '/' . $directory; if (!file_exists(DIR_IMAGE . $path)) { @mkdir(DIR_IMAGE . $path, 0777); } } if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x91'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x92'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x93'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x94'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x95'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x96'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x97'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x98'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x99'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {print "<br>__________!!!!!! mnogo copiy takogo faila ".$old_image." --- ". $new_image . " __piid=(".$result['product_image_id'].")<br>";} if ($unic_flag && rename(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image)) { print $old_image." = i = ".$new_image . " __piid=(".$result_at['product_image_id'].")<br>"; $unic_flag = false; } else {print "<br>__________!!! ERRORcopyFile ".$old_image." === ". $new_image. " __piid=(".$result['product_image_id'].")<br>";} // ищем в Продукт_image $query = $this->db->query("select product_image_id, image from " . DB_PREFIX . "product_image where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "i(". $result['product_image_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product_image SET image='".$this->db->escape($new_image)."' where product_image_id ='".(int)$result['product_image_id']."'"); } } // теперь это же ищем в Продуктах $query = $this->db->query("select product_id, image from " . DB_PREFIX . "product where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "p(". $result['product_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product SET image='".$this->db->escape($new_image)."' where product_id ='".(int)$result['product_id']."'"); } } } } else if (!file_exists(DIR_IMAGE . $result_at['image'])) { print "<br>__________file NOT found______". $result_at['image'] . " __piid=(".$result_at['product_image_id'].")<br>"; } } } private function translitIt($str) { $tr = array( "А"=>"A","Б"=>"B","В"=>"V","Г"=>"G", "Д"=>"D","Е"=>"E","Ж"=>"J","З"=>"Z","И"=>"I", "Й"=>"Y","К"=>"K","Л"=>"L","М"=>"M","Н"=>"N", "О"=>"O","П"=>"P","Р"=>"R","С"=>"S","Т"=>"T", "У"=>"U","Ф"=>"F","Х"=>"H","Ц"=>"TS","Ч"=>"CH", "Ш"=>"SH","Щ"=>"SCH","Ъ"=>"","Ы"=>"YI","Ь"=>"", "Э"=>"E","Ю"=>"YU","Я"=>"YA","а"=>"a","б"=>"b", "в"=>"v","г"=>"g","д"=>"d","е"=>"e","ж"=>"j", "з"=>"z","и"=>"i","й"=>"y","к"=>"k","л"=>"l", "м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r", "с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"h", "ц"=>"ts","ч"=>"ch","ш"=>"sh","щ"=>"sch","ъ"=>"", "ы"=>"yi","ь"=>"","э"=>"e","ю"=>"yu","я"=>"ya", " "=> "_","+"=>"_plus_","!"=>"_i_","%20"=>"_","Ё"=>"IO", "ё"=>"io", "$"=>"_", ","=>"_", "&"=>"_", "!"=>"_", "("=>"_", ")"=>"_", ";"=>"_", ); return strtr($str,$tr); } } ?> 2 Надіслати Поділитися на інших сайтах More sharing options... Sokolov39 Опубліковано: 7 грудня 2023 Автор Share Опубліковано: 7 грудня 2023 А готового модуля нема, щоб мав такий функціонал Або можливо у пакетном редакторі він є якомусь ? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 7 грудня 2023 Share Опубліковано: 7 грудня 2023 06.12.2023 в 22:24, spectre сказал: Старый древний относительно рабочий скрипт Показать содержимое <?php class ControllerCommonCyrlat extends Controller { public function index(){ print "<br><br>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Product !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br><br><br>"; $numnum = 0; $query = $this->db->query("select image, product_id from " . DB_PREFIX . "product"); $results_a = $query->rows; foreach ($results_a as $result_at) { if ($result_at['image'] && file_exists(DIR_IMAGE . $result_at['image'])) { $unic_flag = true; $old_image = $result_at['image']; if (preg_match('#[^A-Za-z0-9_\-/\.]#', $old_image)) { $numnum = $numnum +1; print "<br>- ".$numnum." -<br>"; $image_new = $this->translitIt($old_image); $image_new = preg_replace('#[^A-Za-z0-9_\-/\.]#', '', $image_new); $info = pathinfo($image_new); $extension = $info['extension']; $name_body = substr($image_new, 0, strrpos($image_new, '.')); $new_image = $name_body . '.' . $extension; $directories = explode('/', dirname(str_replace('../', '', $new_image))); array_shift($directories); $path = 'data'; foreach ($directories as $directory) { $path = $path . '/' . $directory; if (!file_exists(DIR_IMAGE . $path)) { @mkdir(DIR_IMAGE . $path, 0777); } } if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x91'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x92'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x93'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x94'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x95'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x96'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x97'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x98'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x99'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {print "<br>__________!!!!!! mnogo copiy takogo faila ".$old_image." --- ". $new_image . " __pid=(".$result['product_id'].")<br>";} if ($unic_flag && rename(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image)) { print $old_image." = p = ".$new_image . " __pid=(".$result_at['product_id'].")<br>"; $unic_flag = false; } else {print "<br>__________!!! ERRORcopyFile ".$old_image." === ". $new_image. " __pid=(".$result['product_id'].")<br>";} // ищем в Продуктах $query = $this->db->query("select product_id, image from " . DB_PREFIX . "product where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "p(". $result['product_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product SET image='".$this->db->escape($new_image)."' where product_id ='".(int)$result['product_id']."'"); } } // теперь это же ищем в Продукт_Картинках $query = $this->db->query("select product_image_id, image from " . DB_PREFIX . "product_image where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "i(". $result['product_image_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product_image SET image='".$this->db->escape($new_image)."' where product_image_id ='".(int)$result['product_image_id']."'"); } } } } else if (!file_exists(DIR_IMAGE . $result_at['image'])) { print "<br>__________file NOT found______". $result_at['image'] . " __pid=(".$result_at['product_id'].")<br>"; } } print "<br><br><br>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Product_Image !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br><br><br>"; // перебор Прод_картинок $query = $this->db->query("select image, product_image_id from " . DB_PREFIX . "product_image"); $results_a = $query->rows; foreach ($results_a as $result_at) { if ($result_at['image'] && file_exists(DIR_IMAGE . $result_at['image'])) { $unic_flag = true; $old_image = $result_at['image']; if (preg_match('#[^A-Za-z0-9_\-/\.]#', $old_image)) { $numnum = $numnum +1; print "<br>- ".$numnum." -<br>"; $image_new = $this->translitIt($old_image); $image_new = preg_replace('#[^A-Za-z0-9_\-/\.]#', '', $image_new); $info = pathinfo($image_new); $extension = $info['extension']; $name_body = substr($image_new, 0, strrpos($image_new, '.')); $new_image = $name_body . '.' . $extension; $directories = explode('/', dirname(str_replace('../', '', $new_image))); array_shift($directories); $path = 'data'; foreach ($directories as $directory) { $path = $path . '/' . $directory; if (!file_exists(DIR_IMAGE . $path)) { @mkdir(DIR_IMAGE . $path, 0777); } } if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x91'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x92'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x93'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x94'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x95'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x96'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x97'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x98'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x99'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {print "<br>__________!!!!!! mnogo copiy takogo faila ".$old_image." --- ". $new_image . " __piid=(".$result['product_image_id'].")<br>";} if ($unic_flag && rename(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image)) { print $old_image." = i = ".$new_image . " __piid=(".$result_at['product_image_id'].")<br>"; $unic_flag = false; } else {print "<br>__________!!! ERRORcopyFile ".$old_image." === ". $new_image. " __piid=(".$result['product_image_id'].")<br>";} // ищем в Продукт_image $query = $this->db->query("select product_image_id, image from " . DB_PREFIX . "product_image where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "i(". $result['product_image_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product_image SET image='".$this->db->escape($new_image)."' where product_image_id ='".(int)$result['product_image_id']."'"); } } // теперь это же ищем в Продуктах $query = $this->db->query("select product_id, image from " . DB_PREFIX . "product where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "p(". $result['product_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product SET image='".$this->db->escape($new_image)."' where product_id ='".(int)$result['product_id']."'"); } } } } else if (!file_exists(DIR_IMAGE . $result_at['image'])) { print "<br>__________file NOT found______". $result_at['image'] . " __piid=(".$result_at['product_image_id'].")<br>"; } } } private function translitIt($str) { $tr = array( "А"=>"A","Б"=>"B","В"=>"V","Г"=>"G", "Д"=>"D","Е"=>"E","Ж"=>"J","З"=>"Z","И"=>"I", "Й"=>"Y","К"=>"K","Л"=>"L","М"=>"M","Н"=>"N", "О"=>"O","П"=>"P","Р"=>"R","С"=>"S","Т"=>"T", "У"=>"U","Ф"=>"F","Х"=>"H","Ц"=>"TS","Ч"=>"CH", "Ш"=>"SH","Щ"=>"SCH","Ъ"=>"","Ы"=>"YI","Ь"=>"", "Э"=>"E","Ю"=>"YU","Я"=>"YA","а"=>"a","б"=>"b", "в"=>"v","г"=>"g","д"=>"d","е"=>"e","ж"=>"j", "з"=>"z","и"=>"i","й"=>"y","к"=>"k","л"=>"l", "м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r", "с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"h", "ц"=>"ts","ч"=>"ch","ш"=>"sh","щ"=>"sch","ъ"=>"", "ы"=>"yi","ь"=>"","э"=>"e","ю"=>"yu","я"=>"ya", " "=> "_","+"=>"_plus_","!"=>"_i_","%20"=>"_","Ё"=>"IO", "ё"=>"io", "$"=>"_", ","=>"_", "&"=>"_", "!"=>"_", "("=>"_", ")"=>"_", ";"=>"_", ); return strtr($str,$tr); } } ?> 07.12.2023 в 11:44, Sokolov39 сказал: А готового модуля нема, щоб мав такий функціонал Або можливо у пакетном редакторі він є якомусь ? Надіслати Поділитися на інших сайтах More sharing options... Eldaeron Опубліковано: 7 грудня 2023 Share Опубліковано: 7 грудня 2023 В 07.12.2023 в 11:44, Sokolov39 сказав: А готового модуля нема, щоб мав такий функціонал Або можливо у пакетном редакторі він є якомусь ? @spectre вам надав. Створюєте новий файл cyrlat.php в admin/controller/common Вставляєте весь код в файл В Правах груп користувачів надаєте доступ до common/cyrlat Запускаєте скрипт через браузер - https://ваш_сайт/admin/index.php?route=common/cyrlat 1 Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 7 грудня 2023 Share Опубліковано: 7 грудня 2023 07.12.2023 в 13:24, Eldaeron сказал: в admin/ в catalog/ Надіслати Поділитися на інших сайтах More sharing options... Створіть аккаунт або увійдіть для коментування Ви повинні бути користувачем, щоб залишити коментар Створити обліковий запис Зареєструйтеся для отримання облікового запису. Це просто! Зареєструвати аккаунт Вхід Уже зареєстровані? Увійдіть тут. Вхід зараз Share More sharing options... Передплатники 2 Перейти до списку тем Зараз на сторінці 0 користувачів Ні користувачів, які переглядиють цю сторінку Последние темы Последние дополнения Последние новости Вся активність Головна Форум Opencart 3.x Opencart 3.x: Пошук модулів Транслітерація назв картинок OpenCartForum Форум Модулі Шаблони Безкоштовні шаблониПлатні шаблони Блоги Новини ocStore Офіційний сайтДемо ocStore 3.0.3.2Демо ocStore 2.3.0.2.4Завантажити ocStoreДокументаціяІсторія версій ocStore Гість Українська Русский English Уже зареєстровані? Ввійти Реєстрація × Створити... Important Information На нашому сайті використовуються файли cookie і відбувається обробка деяких персональних даних користувачів, щоб поліпшити користувальницький інтерфейс. Щоб дізнатися для чого і які персональні дані ми обробляємо перейдіть за посиланням . Якщо Ви натиснете «Я даю згоду», це означає, що Ви розумієте і приймаєте всі умови, зазначені в цьому Повідомленні про конфіденційність. Я даю згоду
spectre Опубліковано: 6 грудня 2023 Share Опубліковано: 6 грудня 2023 Старый древний относительно рабочий скрипт Скрытый текст <?php class ControllerCommonCyrlat extends Controller { public function index(){ print "<br><br>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Product !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br><br><br>"; $numnum = 0; $query = $this->db->query("select image, product_id from " . DB_PREFIX . "product"); $results_a = $query->rows; foreach ($results_a as $result_at) { if ($result_at['image'] && file_exists(DIR_IMAGE . $result_at['image'])) { $unic_flag = true; $old_image = $result_at['image']; if (preg_match('#[^A-Za-z0-9_\-/\.]#', $old_image)) { $numnum = $numnum +1; print "<br>- ".$numnum." -<br>"; $image_new = $this->translitIt($old_image); $image_new = preg_replace('#[^A-Za-z0-9_\-/\.]#', '', $image_new); $info = pathinfo($image_new); $extension = $info['extension']; $name_body = substr($image_new, 0, strrpos($image_new, '.')); $new_image = $name_body . '.' . $extension; $directories = explode('/', dirname(str_replace('../', '', $new_image))); array_shift($directories); $path = 'data'; foreach ($directories as $directory) { $path = $path . '/' . $directory; if (!file_exists(DIR_IMAGE . $path)) { @mkdir(DIR_IMAGE . $path, 0777); } } if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x91'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x92'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x93'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x94'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x95'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x96'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x97'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x98'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x99'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {print "<br>__________!!!!!! mnogo copiy takogo faila ".$old_image." --- ". $new_image . " __pid=(".$result['product_id'].")<br>";} if ($unic_flag && rename(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image)) { print $old_image." = p = ".$new_image . " __pid=(".$result_at['product_id'].")<br>"; $unic_flag = false; } else {print "<br>__________!!! ERRORcopyFile ".$old_image." === ". $new_image. " __pid=(".$result['product_id'].")<br>";} // ищем в Продуктах $query = $this->db->query("select product_id, image from " . DB_PREFIX . "product where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "p(". $result['product_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product SET image='".$this->db->escape($new_image)."' where product_id ='".(int)$result['product_id']."'"); } } // теперь это же ищем в Продукт_Картинках $query = $this->db->query("select product_image_id, image from " . DB_PREFIX . "product_image where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "i(". $result['product_image_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product_image SET image='".$this->db->escape($new_image)."' where product_image_id ='".(int)$result['product_image_id']."'"); } } } } else if (!file_exists(DIR_IMAGE . $result_at['image'])) { print "<br>__________file NOT found______". $result_at['image'] . " __pid=(".$result_at['product_id'].")<br>"; } } print "<br><br><br>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Product_Image !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br><br><br>"; // перебор Прод_картинок $query = $this->db->query("select image, product_image_id from " . DB_PREFIX . "product_image"); $results_a = $query->rows; foreach ($results_a as $result_at) { if ($result_at['image'] && file_exists(DIR_IMAGE . $result_at['image'])) { $unic_flag = true; $old_image = $result_at['image']; if (preg_match('#[^A-Za-z0-9_\-/\.]#', $old_image)) { $numnum = $numnum +1; print "<br>- ".$numnum." -<br>"; $image_new = $this->translitIt($old_image); $image_new = preg_replace('#[^A-Za-z0-9_\-/\.]#', '', $image_new); $info = pathinfo($image_new); $extension = $info['extension']; $name_body = substr($image_new, 0, strrpos($image_new, '.')); $new_image = $name_body . '.' . $extension; $directories = explode('/', dirname(str_replace('../', '', $new_image))); array_shift($directories); $path = 'data'; foreach ($directories as $directory) { $path = $path . '/' . $directory; if (!file_exists(DIR_IMAGE . $path)) { @mkdir(DIR_IMAGE . $path, 0777); } } if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x91'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x92'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x93'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x94'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x95'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x96'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x97'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x98'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x99'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {print "<br>__________!!!!!! mnogo copiy takogo faila ".$old_image." --- ". $new_image . " __piid=(".$result['product_image_id'].")<br>";} if ($unic_flag && rename(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image)) { print $old_image." = i = ".$new_image . " __piid=(".$result_at['product_image_id'].")<br>"; $unic_flag = false; } else {print "<br>__________!!! ERRORcopyFile ".$old_image." === ". $new_image. " __piid=(".$result['product_image_id'].")<br>";} // ищем в Продукт_image $query = $this->db->query("select product_image_id, image from " . DB_PREFIX . "product_image where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "i(". $result['product_image_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product_image SET image='".$this->db->escape($new_image)."' where product_image_id ='".(int)$result['product_image_id']."'"); } } // теперь это же ищем в Продуктах $query = $this->db->query("select product_id, image from " . DB_PREFIX . "product where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "p(". $result['product_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product SET image='".$this->db->escape($new_image)."' where product_id ='".(int)$result['product_id']."'"); } } } } else if (!file_exists(DIR_IMAGE . $result_at['image'])) { print "<br>__________file NOT found______". $result_at['image'] . " __piid=(".$result_at['product_image_id'].")<br>"; } } } private function translitIt($str) { $tr = array( "А"=>"A","Б"=>"B","В"=>"V","Г"=>"G", "Д"=>"D","Е"=>"E","Ж"=>"J","З"=>"Z","И"=>"I", "Й"=>"Y","К"=>"K","Л"=>"L","М"=>"M","Н"=>"N", "О"=>"O","П"=>"P","Р"=>"R","С"=>"S","Т"=>"T", "У"=>"U","Ф"=>"F","Х"=>"H","Ц"=>"TS","Ч"=>"CH", "Ш"=>"SH","Щ"=>"SCH","Ъ"=>"","Ы"=>"YI","Ь"=>"", "Э"=>"E","Ю"=>"YU","Я"=>"YA","а"=>"a","б"=>"b", "в"=>"v","г"=>"g","д"=>"d","е"=>"e","ж"=>"j", "з"=>"z","и"=>"i","й"=>"y","к"=>"k","л"=>"l", "м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r", "с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"h", "ц"=>"ts","ч"=>"ch","ш"=>"sh","щ"=>"sch","ъ"=>"", "ы"=>"yi","ь"=>"","э"=>"e","ю"=>"yu","я"=>"ya", " "=> "_","+"=>"_plus_","!"=>"_i_","%20"=>"_","Ё"=>"IO", "ё"=>"io", "$"=>"_", ","=>"_", "&"=>"_", "!"=>"_", "("=>"_", ")"=>"_", ";"=>"_", ); return strtr($str,$tr); } } ?> 2 Надіслати Поділитися на інших сайтах More sharing options... Sokolov39 Опубліковано: 7 грудня 2023 Автор Share Опубліковано: 7 грудня 2023 А готового модуля нема, щоб мав такий функціонал Або можливо у пакетном редакторі він є якомусь ? Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 7 грудня 2023 Share Опубліковано: 7 грудня 2023 06.12.2023 в 22:24, spectre сказал: Старый древний относительно рабочий скрипт Показать содержимое <?php class ControllerCommonCyrlat extends Controller { public function index(){ print "<br><br>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Product !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br><br><br>"; $numnum = 0; $query = $this->db->query("select image, product_id from " . DB_PREFIX . "product"); $results_a = $query->rows; foreach ($results_a as $result_at) { if ($result_at['image'] && file_exists(DIR_IMAGE . $result_at['image'])) { $unic_flag = true; $old_image = $result_at['image']; if (preg_match('#[^A-Za-z0-9_\-/\.]#', $old_image)) { $numnum = $numnum +1; print "<br>- ".$numnum." -<br>"; $image_new = $this->translitIt($old_image); $image_new = preg_replace('#[^A-Za-z0-9_\-/\.]#', '', $image_new); $info = pathinfo($image_new); $extension = $info['extension']; $name_body = substr($image_new, 0, strrpos($image_new, '.')); $new_image = $name_body . '.' . $extension; $directories = explode('/', dirname(str_replace('../', '', $new_image))); array_shift($directories); $path = 'data'; foreach ($directories as $directory) { $path = $path . '/' . $directory; if (!file_exists(DIR_IMAGE . $path)) { @mkdir(DIR_IMAGE . $path, 0777); } } if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x91'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x92'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x93'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x94'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x95'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x96'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x97'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x98'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x99'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {print "<br>__________!!!!!! mnogo copiy takogo faila ".$old_image." --- ". $new_image . " __pid=(".$result['product_id'].")<br>";} if ($unic_flag && rename(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image)) { print $old_image." = p = ".$new_image . " __pid=(".$result_at['product_id'].")<br>"; $unic_flag = false; } else {print "<br>__________!!! ERRORcopyFile ".$old_image." === ". $new_image. " __pid=(".$result['product_id'].")<br>";} // ищем в Продуктах $query = $this->db->query("select product_id, image from " . DB_PREFIX . "product where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "p(". $result['product_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product SET image='".$this->db->escape($new_image)."' where product_id ='".(int)$result['product_id']."'"); } } // теперь это же ищем в Продукт_Картинках $query = $this->db->query("select product_image_id, image from " . DB_PREFIX . "product_image where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "i(". $result['product_image_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product_image SET image='".$this->db->escape($new_image)."' where product_image_id ='".(int)$result['product_image_id']."'"); } } } } else if (!file_exists(DIR_IMAGE . $result_at['image'])) { print "<br>__________file NOT found______". $result_at['image'] . " __pid=(".$result_at['product_id'].")<br>"; } } print "<br><br><br>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Product_Image !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br><br><br>"; // перебор Прод_картинок $query = $this->db->query("select image, product_image_id from " . DB_PREFIX . "product_image"); $results_a = $query->rows; foreach ($results_a as $result_at) { if ($result_at['image'] && file_exists(DIR_IMAGE . $result_at['image'])) { $unic_flag = true; $old_image = $result_at['image']; if (preg_match('#[^A-Za-z0-9_\-/\.]#', $old_image)) { $numnum = $numnum +1; print "<br>- ".$numnum." -<br>"; $image_new = $this->translitIt($old_image); $image_new = preg_replace('#[^A-Za-z0-9_\-/\.]#', '', $image_new); $info = pathinfo($image_new); $extension = $info['extension']; $name_body = substr($image_new, 0, strrpos($image_new, '.')); $new_image = $name_body . '.' . $extension; $directories = explode('/', dirname(str_replace('../', '', $new_image))); array_shift($directories); $path = 'data'; foreach ($directories as $directory) { $path = $path . '/' . $directory; if (!file_exists(DIR_IMAGE . $path)) { @mkdir(DIR_IMAGE . $path, 0777); } } if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x91'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x92'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x93'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x94'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x95'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x96'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x97'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x98'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x99'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {print "<br>__________!!!!!! mnogo copiy takogo faila ".$old_image." --- ". $new_image . " __piid=(".$result['product_image_id'].")<br>";} if ($unic_flag && rename(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image)) { print $old_image." = i = ".$new_image . " __piid=(".$result_at['product_image_id'].")<br>"; $unic_flag = false; } else {print "<br>__________!!! ERRORcopyFile ".$old_image." === ". $new_image. " __piid=(".$result['product_image_id'].")<br>";} // ищем в Продукт_image $query = $this->db->query("select product_image_id, image from " . DB_PREFIX . "product_image where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "i(". $result['product_image_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product_image SET image='".$this->db->escape($new_image)."' where product_image_id ='".(int)$result['product_image_id']."'"); } } // теперь это же ищем в Продуктах $query = $this->db->query("select product_id, image from " . DB_PREFIX . "product where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "p(". $result['product_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product SET image='".$this->db->escape($new_image)."' where product_id ='".(int)$result['product_id']."'"); } } } } else if (!file_exists(DIR_IMAGE . $result_at['image'])) { print "<br>__________file NOT found______". $result_at['image'] . " __piid=(".$result_at['product_image_id'].")<br>"; } } } private function translitIt($str) { $tr = array( "А"=>"A","Б"=>"B","В"=>"V","Г"=>"G", "Д"=>"D","Е"=>"E","Ж"=>"J","З"=>"Z","И"=>"I", "Й"=>"Y","К"=>"K","Л"=>"L","М"=>"M","Н"=>"N", "О"=>"O","П"=>"P","Р"=>"R","С"=>"S","Т"=>"T", "У"=>"U","Ф"=>"F","Х"=>"H","Ц"=>"TS","Ч"=>"CH", "Ш"=>"SH","Щ"=>"SCH","Ъ"=>"","Ы"=>"YI","Ь"=>"", "Э"=>"E","Ю"=>"YU","Я"=>"YA","а"=>"a","б"=>"b", "в"=>"v","г"=>"g","д"=>"d","е"=>"e","ж"=>"j", "з"=>"z","и"=>"i","й"=>"y","к"=>"k","л"=>"l", "м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r", "с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"h", "ц"=>"ts","ч"=>"ch","ш"=>"sh","щ"=>"sch","ъ"=>"", "ы"=>"yi","ь"=>"","э"=>"e","ю"=>"yu","я"=>"ya", " "=> "_","+"=>"_plus_","!"=>"_i_","%20"=>"_","Ё"=>"IO", "ё"=>"io", "$"=>"_", ","=>"_", "&"=>"_", "!"=>"_", "("=>"_", ")"=>"_", ";"=>"_", ); return strtr($str,$tr); } } ?> 07.12.2023 в 11:44, Sokolov39 сказал: А готового модуля нема, щоб мав такий функціонал Або можливо у пакетном редакторі він є якомусь ? Надіслати Поділитися на інших сайтах More sharing options... Eldaeron Опубліковано: 7 грудня 2023 Share Опубліковано: 7 грудня 2023 В 07.12.2023 в 11:44, Sokolov39 сказав: А готового модуля нема, щоб мав такий функціонал Або можливо у пакетном редакторі він є якомусь ? @spectre вам надав. Створюєте новий файл cyrlat.php в admin/controller/common Вставляєте весь код в файл В Правах груп користувачів надаєте доступ до common/cyrlat Запускаєте скрипт через браузер - https://ваш_сайт/admin/index.php?route=common/cyrlat 1 Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 7 грудня 2023 Share Опубліковано: 7 грудня 2023 07.12.2023 в 13:24, Eldaeron сказал: в admin/ в catalog/ Надіслати Поділитися на інших сайтах More sharing options... Створіть аккаунт або увійдіть для коментування Ви повинні бути користувачем, щоб залишити коментар Створити обліковий запис Зареєструйтеся для отримання облікового запису. Це просто! Зареєструвати аккаунт Вхід Уже зареєстровані? Увійдіть тут. Вхід зараз Share More sharing options... Передплатники 2 Перейти до списку тем Зараз на сторінці 0 користувачів Ні користувачів, які переглядиють цю сторінку Последние темы Последние дополнения Последние новости Вся активність Головна Форум Opencart 3.x Opencart 3.x: Пошук модулів Транслітерація назв картинок
Sokolov39 Опубліковано: 7 грудня 2023 Автор Share Опубліковано: 7 грудня 2023 А готового модуля нема, щоб мав такий функціонал Або можливо у пакетном редакторі він є якомусь ? Надіслати Поділитися на інших сайтах More sharing options...
chukcha Опубліковано: 7 грудня 2023 Share Опубліковано: 7 грудня 2023 06.12.2023 в 22:24, spectre сказал: Старый древний относительно рабочий скрипт Показать содержимое <?php class ControllerCommonCyrlat extends Controller { public function index(){ print "<br><br>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Product !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br><br><br>"; $numnum = 0; $query = $this->db->query("select image, product_id from " . DB_PREFIX . "product"); $results_a = $query->rows; foreach ($results_a as $result_at) { if ($result_at['image'] && file_exists(DIR_IMAGE . $result_at['image'])) { $unic_flag = true; $old_image = $result_at['image']; if (preg_match('#[^A-Za-z0-9_\-/\.]#', $old_image)) { $numnum = $numnum +1; print "<br>- ".$numnum." -<br>"; $image_new = $this->translitIt($old_image); $image_new = preg_replace('#[^A-Za-z0-9_\-/\.]#', '', $image_new); $info = pathinfo($image_new); $extension = $info['extension']; $name_body = substr($image_new, 0, strrpos($image_new, '.')); $new_image = $name_body . '.' . $extension; $directories = explode('/', dirname(str_replace('../', '', $new_image))); array_shift($directories); $path = 'data'; foreach ($directories as $directory) { $path = $path . '/' . $directory; if (!file_exists(DIR_IMAGE . $path)) { @mkdir(DIR_IMAGE . $path, 0777); } } if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x91'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x92'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x93'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x94'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x95'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x96'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x97'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x98'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x99'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {print "<br>__________!!!!!! mnogo copiy takogo faila ".$old_image." --- ". $new_image . " __pid=(".$result['product_id'].")<br>";} if ($unic_flag && rename(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image)) { print $old_image." = p = ".$new_image . " __pid=(".$result_at['product_id'].")<br>"; $unic_flag = false; } else {print "<br>__________!!! ERRORcopyFile ".$old_image." === ". $new_image. " __pid=(".$result['product_id'].")<br>";} // ищем в Продуктах $query = $this->db->query("select product_id, image from " . DB_PREFIX . "product where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "p(". $result['product_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product SET image='".$this->db->escape($new_image)."' where product_id ='".(int)$result['product_id']."'"); } } // теперь это же ищем в Продукт_Картинках $query = $this->db->query("select product_image_id, image from " . DB_PREFIX . "product_image where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "i(". $result['product_image_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product_image SET image='".$this->db->escape($new_image)."' where product_image_id ='".(int)$result['product_image_id']."'"); } } } } else if (!file_exists(DIR_IMAGE . $result_at['image'])) { print "<br>__________file NOT found______". $result_at['image'] . " __pid=(".$result_at['product_id'].")<br>"; } } print "<br><br><br>!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! Product_Image !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!<br><br><br>"; // перебор Прод_картинок $query = $this->db->query("select image, product_image_id from " . DB_PREFIX . "product_image"); $results_a = $query->rows; foreach ($results_a as $result_at) { if ($result_at['image'] && file_exists(DIR_IMAGE . $result_at['image'])) { $unic_flag = true; $old_image = $result_at['image']; if (preg_match('#[^A-Za-z0-9_\-/\.]#', $old_image)) { $numnum = $numnum +1; print "<br>- ".$numnum." -<br>"; $image_new = $this->translitIt($old_image); $image_new = preg_replace('#[^A-Za-z0-9_\-/\.]#', '', $image_new); $info = pathinfo($image_new); $extension = $info['extension']; $name_body = substr($image_new, 0, strrpos($image_new, '.')); $new_image = $name_body . '.' . $extension; $directories = explode('/', dirname(str_replace('../', '', $new_image))); array_shift($directories); $path = 'data'; foreach ($directories as $directory) { $path = $path . '/' . $directory; if (!file_exists(DIR_IMAGE . $path)) { @mkdir(DIR_IMAGE . $path, 0777); } } if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x91'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x92'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x93'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x94'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x95'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x96'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x97'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x98'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {$new_image = $name_body . '_x99'. '.' . $extension; print "* ";} if ($unic_flag && file_exists(DIR_IMAGE . $new_image)) {print "<br>__________!!!!!! mnogo copiy takogo faila ".$old_image." --- ". $new_image . " __piid=(".$result['product_image_id'].")<br>";} if ($unic_flag && rename(DIR_IMAGE . $old_image, DIR_IMAGE . $new_image)) { print $old_image." = i = ".$new_image . " __piid=(".$result_at['product_image_id'].")<br>"; $unic_flag = false; } else {print "<br>__________!!! ERRORcopyFile ".$old_image." === ". $new_image. " __piid=(".$result['product_image_id'].")<br>";} // ищем в Продукт_image $query = $this->db->query("select product_image_id, image from " . DB_PREFIX . "product_image where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "i(". $result['product_image_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product_image SET image='".$this->db->escape($new_image)."' where product_image_id ='".(int)$result['product_image_id']."'"); } } // теперь это же ищем в Продуктах $query = $this->db->query("select product_id, image from " . DB_PREFIX . "product where image='".$old_image."'"); $results = $query->rows; foreach ($results as $result) { if ($result['image'] && ($result['image'] = $old_image)) { print "p(". $result['product_id'] .")<br>"; $this->db->query("UPDATE " . DB_PREFIX . "product SET image='".$this->db->escape($new_image)."' where product_id ='".(int)$result['product_id']."'"); } } } } else if (!file_exists(DIR_IMAGE . $result_at['image'])) { print "<br>__________file NOT found______". $result_at['image'] . " __piid=(".$result_at['product_image_id'].")<br>"; } } } private function translitIt($str) { $tr = array( "А"=>"A","Б"=>"B","В"=>"V","Г"=>"G", "Д"=>"D","Е"=>"E","Ж"=>"J","З"=>"Z","И"=>"I", "Й"=>"Y","К"=>"K","Л"=>"L","М"=>"M","Н"=>"N", "О"=>"O","П"=>"P","Р"=>"R","С"=>"S","Т"=>"T", "У"=>"U","Ф"=>"F","Х"=>"H","Ц"=>"TS","Ч"=>"CH", "Ш"=>"SH","Щ"=>"SCH","Ъ"=>"","Ы"=>"YI","Ь"=>"", "Э"=>"E","Ю"=>"YU","Я"=>"YA","а"=>"a","б"=>"b", "в"=>"v","г"=>"g","д"=>"d","е"=>"e","ж"=>"j", "з"=>"z","и"=>"i","й"=>"y","к"=>"k","л"=>"l", "м"=>"m","н"=>"n","о"=>"o","п"=>"p","р"=>"r", "с"=>"s","т"=>"t","у"=>"u","ф"=>"f","х"=>"h", "ц"=>"ts","ч"=>"ch","ш"=>"sh","щ"=>"sch","ъ"=>"", "ы"=>"yi","ь"=>"","э"=>"e","ю"=>"yu","я"=>"ya", " "=> "_","+"=>"_plus_","!"=>"_i_","%20"=>"_","Ё"=>"IO", "ё"=>"io", "$"=>"_", ","=>"_", "&"=>"_", "!"=>"_", "("=>"_", ")"=>"_", ";"=>"_", ); return strtr($str,$tr); } } ?> 07.12.2023 в 11:44, Sokolov39 сказал: А готового модуля нема, щоб мав такий функціонал Або можливо у пакетном редакторі він є якомусь ? Надіслати Поділитися на інших сайтах More sharing options... Eldaeron Опубліковано: 7 грудня 2023 Share Опубліковано: 7 грудня 2023 В 07.12.2023 в 11:44, Sokolov39 сказав: А готового модуля нема, щоб мав такий функціонал Або можливо у пакетном редакторі він є якомусь ? @spectre вам надав. Створюєте новий файл cyrlat.php в admin/controller/common Вставляєте весь код в файл В Правах груп користувачів надаєте доступ до common/cyrlat Запускаєте скрипт через браузер - https://ваш_сайт/admin/index.php?route=common/cyrlat 1 Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 7 грудня 2023 Share Опубліковано: 7 грудня 2023 07.12.2023 в 13:24, Eldaeron сказал: в admin/ в catalog/ Надіслати Поділитися на інших сайтах More sharing options... Створіть аккаунт або увійдіть для коментування Ви повинні бути користувачем, щоб залишити коментар Створити обліковий запис Зареєструйтеся для отримання облікового запису. Це просто! Зареєструвати аккаунт Вхід Уже зареєстровані? Увійдіть тут. Вхід зараз Share More sharing options... Передплатники 2 Перейти до списку тем Зараз на сторінці 0 користувачів Ні користувачів, які переглядиють цю сторінку Последние темы Последние дополнения Последние новости Вся активність Головна Форум Opencart 3.x Opencart 3.x: Пошук модулів Транслітерація назв картинок
Eldaeron Опубліковано: 7 грудня 2023 Share Опубліковано: 7 грудня 2023 В 07.12.2023 в 11:44, Sokolov39 сказав: А готового модуля нема, щоб мав такий функціонал Або можливо у пакетном редакторі він є якомусь ? @spectre вам надав. Створюєте новий файл cyrlat.php в admin/controller/common Вставляєте весь код в файл В Правах груп користувачів надаєте доступ до common/cyrlat Запускаєте скрипт через браузер - https://ваш_сайт/admin/index.php?route=common/cyrlat 1 Надіслати Поділитися на інших сайтах More sharing options... chukcha Опубліковано: 7 грудня 2023 Share Опубліковано: 7 грудня 2023 07.12.2023 в 13:24, Eldaeron сказал: в admin/ в catalog/ Надіслати Поділитися на інших сайтах More sharing options... Створіть аккаунт або увійдіть для коментування Ви повинні бути користувачем, щоб залишити коментар Створити обліковий запис Зареєструйтеся для отримання облікового запису. Це просто! Зареєструвати аккаунт Вхід Уже зареєстровані? Увійдіть тут. Вхід зараз Share More sharing options... Передплатники 2 Перейти до списку тем Зараз на сторінці 0 користувачів Ні користувачів, які переглядиють цю сторінку
chukcha Опубліковано: 7 грудня 2023 Share Опубліковано: 7 грудня 2023 07.12.2023 в 13:24, Eldaeron сказал: в admin/ в catalog/ Надіслати Поділитися на інших сайтах More sharing options... Створіть аккаунт або увійдіть для коментування Ви повинні бути користувачем, щоб залишити коментар Створити обліковий запис Зареєструйтеся для отримання облікового запису. Це просто! Зареєструвати аккаунт Вхід Уже зареєстровані? Увійдіть тут. Вхід зараз Share More sharing options... Передплатники 2
Recommended Posts