Jump to content

Welcome, Guest!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

Lathaneo

Members
  • Content Count

    46
  • Joined

  • Last visited

Community Reputation

22 Excellent

About Lathaneo

  • Rank
    Tanguy SALMON

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. Here a script a play with Levenshtein : <?php header('Content-type: text/html; charset=utf-8'); include('../config/config.inc.php'); include('../init.php'); ini_set("display_errors", 1); ini_set("track_errors", 1); ini_set("html_errors", 1); ini_set("realpath_cache_size", '5M'); ini_set('max_execution_time', 60000); error_reporting(E_ALL); $s = "chonney"; $s1 = "niche"; $s2 = "chien"; $s3 = "nicha"; $s4 = "niche"; $timeStart = microtime_float(); print("a. Distance : " . levenshtein_utf8($s1, $s2) . "\n"); $timeEnd = microtime_float(); print($timeEnd - $timeStart . "\n\n"); $timeStart = microtime_float(); print("b. Distance : " . levenshtein($s1, $s2) . "\n"); $timeEnd = microtime_float(); print($timeEnd - $timeStart . "\n\n"); $timeStart = microtime_float(); print("c. Distance : " . levenshtein_utf8($s3, $s4) . "\n"); $timeEnd = microtime_float(); print($timeEnd - $timeStart . "\n\n"); $timeStart = microtime_float(); print("d. Distance : " . levenshtein($s3, $s4) . "\n"); $timeEnd = microtime_float(); print($timeEnd - $timeStart . "\n\n"); $timeStart = microtime_float(); $words = getAllWords(); foreach ( $words as &$item ) { $item['leven'] = levenshtein_utf8($item['word'], $s); echo $item['word'] ." :: ". $item['leven'] . "\n"; } uasort($words, function ($a, $b) { return $a['leven'] > $b['leven'] ? 1 : -1; }); foreach ( $words as &$item ) { $item['leven'] = levenshtein_utf8($item['word'], $s); echo $item['word'] ." :: ". $item['leven'] . "\n"; } $timeEnd = microtime_float(); print($timeEnd - $timeStart); print(var_dump($words)); print(array_shift($words)['word']); function utf8_to_extended_ascii($str, &$map) { // find all multibyte characters (cf. utf-8 encoding specs) $matches = array(); if (!preg_match_all('/[\xC0-\xF7][\x80-\xBF]+/', $str, $matches)) return $str; // plain ascii string // update the encoding map with the characters not already met foreach ($matches[0] as $mbc) if (!isset($map[$mbc])) $map[$mbc] = chr(128 + count($map)); // finally remap non-ascii characters return strtr($str, $map); } function levenshtein_utf8($s1, $s2) { $charMap = array(); $s1 = utf8_to_extended_ascii($s1, $charMap); $s2 = utf8_to_extended_ascii($s2, $charMap); return levenshtein($s1, $s2); } function microtime_float() { list($usec, $sec) = explode(" ", microtime()); return ((float)$usec + (float)$sec); } function getAllWords() { $sql = "SELECT `word` FROM `tb_search_word` WHERE `id_lang` = 1;"; $result = Db::getInstance()->executeS($sql); return $result; }
  2. Hi, I just ask a merge request from a implementation of the Levenshtein algorithm in the search controller. What is Levenshtein algorithm : https://en.wikipedia.org/wiki/Levenshtein_distance Levenshtein algorithm with PHP : https://www.php.net/manual/en/function.levenshtein.php The merge request page : https://github.com/thirtybees/thirtybees/pull/970 As I writed in comment of the merge request, the goal is to find some products with the search functionality. Even if you get some miss spelling in the search input. That works perfectly with the vanilla ThirtyBees shop with default product. For example, you search "chonney" instead of "honey", search controller will be able to find the close word, here honey, and will display honey product in the result. Some precisions about the changes: a. In case there are many close words, we take the first of the list. b. The algorithm is really fast, only 0.005 - 0.010 second to check 2000 words b. The algorithm could find some words, really far for the original (schlzcolad -> chocolat). c. Later in a another commit, we could choose the better word following some requirements. How to try: Just copy/past the code in controllers/front/SearchController.php . Here the code https://github.com/thirtybees/thirtybees/pull/970/files Test it. Regards, Lathanao
  3. Hi, Can you try to put in php file in the root dir with this code, and execute the file : ``` <?php include('config/config.inc.php'); include('init.php'); $e = new Employee(1); $e->email = 'you@gmail.com'; $e->lastname = 'you'; $e->firstname = 'you'; $e->idprofile = '1'; $e->idlang = (Context::getContext())->language->id; $e->passwd = Tools::encrypt('12345678'); if (!$e->save()) echo 'Employee save: bad'; else echo 'Employee save: ok'; ```
  4. Oh ! that's right. But with my proposition, he can learn what the debug mode does :)
  5. Hi, I don't know if it's working or not, I would like to said "probably yes". But for debuging, instead of having '500 error', where you want in your app (e.g. at the end of config\defines.inc.php), you can add : ini_set("display_errors", 1); ini_set("track_errors", 1); ini_set("html_errors", 1); That will show you clearly what's the error. For dev env. you can add some stuff more like : ini_set('post_max_size', '64M'); ini_set('upload_max_filesize', '64M'); ini_set("realpath_cache_size", '5M'); ini_set("max_execution_time", '180'); Regards.
  6. Hi, Clearly, you can keep exact URL. But short Url are better for Seo, and the number in a product URL is not really necessary. How many products you have ? Don't you want get clean URL and make redirection from the old URL. You can use module, or do it manually by adding 301 redirection in you htaccess file. Regards.
  7. Hi, WordPress is still in jQuery@1.12.0 You can find more information why jQuery v1 is still in use here (and it's probably for a good reason): https://wordpress.stackexchange.com/questions/244537/why-does-wordpress-use-outdated-jquery-v1-12-4
  8. Hi, Just to add a contribution, some months ago, I read that: https://medium.com/mockupless/amazon-checkout-redesign-exercise-part-iii-shipping-and-payment-c351d13bbe9d Just a nice demo "amazon flavor" one page checkout. Regards.
  9. Hi, A premiere vue, Il faudrait avoir un server un peu plus puissant. Sur la home, tu es déjà à + de 9 secondes: https://tools.pingdom.com/#!/cti6x5/dynamic-web-shop.craym.eu/thbees La page admin produit a pas mal d'ajax, et demande plus de resource. Tu peux essayer d'augmenter le timeout de ton navigateur: https://support.mozilla.org/en-US/questions/1042479 Si t'es en local, tu peux activer opcache dans ton php.ini: opcache.enable=1 D'autres paramtètres sont également modifiable pour de meilleurs performances mais faudrait plus d'info sur ta config. Et le mieux, serait d'avoir un server plus rapide. Cordialement.
  10. Hi, I didn't understand every thing, but your almost right. Your "srcset" tag has too short ranges. On a great Wordpress template ( e.g. Buildico - Theme - Forest ), you can get examples. For miniature, ranges are bigger like that : <img src="picture/p-3.jpg" class="" alt="" srcset="http://website.com/picture/image.jpg 1140w, // image size 1140 x 640 http://website.com/picture/image-300x168.jpg 300w, http://website.com/picture/image-768x431.jpg 768w, http://website.com/picture/image-1024x575.jpg 1024w" sizes="(max-width: 360px) 100vw, 360px" width="360" height="202">
  11. Check your fontawesone file, it's writen the version. Go to fontawesone website, with the right version, copy/past the snippet. Regards
  12. You can, just don't forget to put the right snippet.
  13. Hi @tsoful I think you modified you CSS, cause, it's not like that in genuine file. Replace: .cat-title.active:after { content: "f068"; } By: .cat-title.active:after { content: "\f068"; } Tricky bug ! Regard
  14. @tsoful said in French theme translation problem, and optimization problem: maybe that’s the problem? No. It's no about the color. Unlock your shop and let me see it, I should to find a fix. Regards
×
×
  • Create New...