Jump to content
thirty bees forum

Lathaneo

Members
  • Posts

    46
  • Joined

  • Last visited

Everything posted by Lathaneo

  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
  15. For the phone number, you can overrive it with this code at the end of, e.g., global.css .phone-link { color: #fad629; } Or change it in themes/community-theme-default/css/modules/blockuserinfo/blockuserinfo.css Regard
  16. Hi @tsoful, go to Catalog -> Product -> Quantity Tab -> At the bottom on page, last area you have the field to display with translation.
  17. HI @mockob, Yes, put it in the header. Yes, the script look for @x2. As "@" doesn't works for image category name, we have to find a trick. So with the tag data-rjs, the script know that there is a second URL with hight-res image. And it's working. So, in my case, I use the script only on product-list image, cause most of the other image are already oversized and get a great rendering for mobile device screen. [...]shifted on @3x devices? Not with this method, there is only one hight-res image alternativ. You can test it on http://dathemebasic.lathanao.com Regards, Lathanao
  18. @mockob Hi, You can use the library http://imulus.github.io/retinajs/. E.g. for your product list image just : Load it where you want in you template the library Make a category image called homedefault2X put : data-rjs="{$product.cover.bySize.homedefault2x.url}" after the src attribut in img tag. So on http://imulus.github.io/retinajs/, they describe 2 method to load the script, I use the first (old) one. The script is really light, and easy to make working, so I recommande. Regards, Lathanao.
  19. Hi, I'll try to fix the name in ImageOptim-master. and looks for the integration in module store. @SLiCK_303, whouhaou, have 31208 results, it's really a lot, i will try a way for the ‘generation by lot’. I don't understand why you get so bad conversion rate, my test are only why default images but should be same with other images. @nickon, i'm not looking for a full compatibility with PS 1.6, but with only some few fixs, it's should working. Regards.
  20. Hi, admin-dev\themes\default\template\controllers\products\informations.tpl And as said @ssimard, you can override like that: -> /override/controllers/admin/templates/products/informations.tpl -> /override/classes/Tag.php -> /override/classes/Product.php Regards.
  21. Yes, It's a nice feature, for only some lines more. I'm trying the code, but i get a error of line"" illegal recursive call of "". Regards.
  22. Hi, Tagify doesn't work with jquery autocomplete. Tagify use only the widget factory of JqueryUI. Regards.
  23. Hi, It could be unsecure from trivial user, but like it's you who is writing the saved datas, it's ok. For example, don't remove HTML filter for datas from message boxes for the service after sale. Regards.
  24. I found a little icon a the right of URL bar, just have to click on it, and it's works.
×
×
  • Create New...