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.

braffas

Members
  • Content Count

    23
  • Joined

  • Last visited

Everything posted by braffas

  1. I noticed the same problem some time ago. For me it only happens with percentage quantity discounts from catalog price rules. For some reason the solution is to set the 'tax include' when creating the percentage price rule. (there was a log error hinting something about tax).
  2. In modules\ganalytics\views\templates\hook\analyticsjs.tpl function uuidv4() { return ([1e7]+-1e3+-4e3+-8e3+-1e11).replace(/[018]/g, c => (c ^ crypto.getRandomValues(new Uint8Array(1))[0] & 15 >> c / 4).toString(16) ) } This function throws a syntax error in IE 11 which in my case blocked customers from checking out on IE 11 (and probably lower versions also). TBH that function looks scary as hell, i have no idea how to fix it.
  3. Hello It would be nice if it was possible to exclude some URL patterns from the full page cache. I have had a few modules that refused to work even with dynamic hooks, so i had to disable them in the controller->run method Like this: if (stripos($_SERVER['REQUEST_URI'], 'gift-cards/gift-card') !== false) { unset($cacheableControllers[array_search('product', $cacheableControllers)]); } The comment on the method says "this method should not be overridden!" so right now I'm stuck with editing the core.
  4. Categories are not removed from the cache (Redis etc) when invalidated, because the cache keys are deleted before they are collected. See fix below. /** * Invalidate an entity from the cache * * @param string $entityType * @param int|null $idEntity * * @since 1.0.0 */ public static function invalidateEntity($entityType, $idEntity = null) { $keysToInvalidate = []; if ($entityType === 'product') { // Refresh the homepage $keysToInvalidate = array_merge( $keysToInvalidate, static::getKeysToInvalidate('index') ); Db::getInstance()->delete( 'page_cache', '`entity_type` = \'index\'' ); if ($idEntity) { // Invalidate product's categories only $product = new Product((int) $idEntity); if ($product) { $categories = $product->getCategories(); foreach ($categories as $idCategory) { //Edit by Kasper: Moved to the top in the loop to collect the keys before they are deleted. $keysToInvalidate = array_merge( $keysToInvalidate, static::getKeysToInvalidate('category', $idCategory) ); //Edit by Kasper: Moved to the bottom of the loop so we can delete the keys after they are collected. Db::getInstance()->delete( 'page_cache', '`entity_type` = \'category\' AND `id_entity` = '.(int) $idCategory ); } } } else { // Invalidate all parent categories Db::getInstance()->delete( 'page_cache', '`entity_type` = \'category\'' ); $keysToInvalidate = array_merge( $keysToInvalidate, static::getKeysToInvalidate('category') ); } } $keysToInvalidate = array_merge( $keysToInvalidate, static::getKeysToInvalidate($entityType, $idEntity) ); Db::getInstance()->delete( 'page_cache', '`entity_type` = \''.pSQL($entityType).'\''.($idEntity ? ' AND `id_entity` = '.(int) $idEntity : '') ); $cache = Cache::getInstance(); foreach ($keysToInvalidate as $item) { $cache->delete($item); } }
  5. Everything seems to work as expected when the blockuserinfo->displayNav is marked as dynamic. So it's not really a bug, but it a very important thing to change before you activate fullpage cache. Can anyone give a short explanation about how the dynamic hooks are handled, or is it documented somewhere?
  6. @wakabayashi Yes, that seems to work. But not caching a stock module like blockuserinfo, should probably be a default feature. Also when i look at the cached data inside redis, the page with username is still cached, that freaked me out a bit. When i get back to work, i have to check how exactly the dynamic module hooks are handled before i enable full page caching again. I don't want customer names in google search results etc :D
  7. Hello. I just noticed that a users name was cached in the nav section. That's pretty bad. I tested it by logging in and refreshing the cache, and yep my name was cached in the nav section when i was logged out (also tested in other browser). ~~It only happens on the index page.~~ it happens on all cached pages I will investigate further. But any idea how this can happen? It seems to help when i enable the 'user info block' in the cache settings.
  8. renderForm returns 'true' on the last line. This will display '1' in the admin template (/index.php?controller=AdminOrders&addorder).
  9. Nope, Braffas is also my GitHub name I will check GitHub first next time. Great that it's getting fixed :)
  10. I don't know if this is the right place to post this, but here goes. In the method below Customer->customerExists public static function customerExists($email, $returnId = false, $ignoreGuest = true) { if (!Validate::isEmail($email)) { if (defined('_PS_MODE_DEV_') && _PS_MODE_DEV_) { die(Tools::displayError('Invalid email')); } return false; } $sql = new DbQuery(); $sql->select('`id_customer`'); $sql->from(bqSQL(static::$definition['table'])); $sql->where('`email` = \''.pSQL($email).'\' '.Shop::addSqlRestriction(Shop::SHARE_CUSTOMER)); $sql->where('`is_guest` = 0'); $result = Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($sql); return ($returnId ? (int) $result : (bool) $result); } The $ignoreGuest param is not used by the DB query anymore. This may give some annoying problems (no errors) with modules that use the method.
  11. braffas

    Thank you!

    @mdekker It's mainly the database lookup (this call getManufacturers) i fixed it by adding cache to the lookup in these 2 methods (below) I delete the all cache every morning after our automatic updates. But one could delete the rewrites from cache on the manufacturer / supplier update/add hooks Another solution (probably better for compatibility) would adding the rewrite directly to the the manufacturer/supplier tables. (maybe in a future 30bz update? :)) Original versions (in Dispatcher.php) protected function supplierID($rewrite) { // Rewrite cannot be empty if (empty($rewrite)) { return 0; } $context = Context::getContext(); $suppliers = Supplier::getSuppliers(false, $context->language->id, true); foreach ($suppliers as $supplier) { if (Tools::link_rewrite($supplier['name']) === $rewrite) { return (int) $supplier['id_supplier']; } } return 0; } protected function manufacturerID($rewrite) { // Rewrite cannot be empty if (empty($rewrite)) { return 0; } $context = Context::getContext(); $manufacturers = Manufacturer::getManufacturers(false, $context->language->id, true); foreach ($manufacturers as $manufacturer) { if (Tools::link_rewrite($manufacturer['name']) === $rewrite) { return (int) $manufacturer['id_manufacturer']; } } return 0; } My overrides with cache. Speed increase ~3 sec to ~0.90 protected function manufacturerID($rewrite) { if (empty($rewrite)) { return 0; } $context = Context::getContext(); if (!$manufacturer_rewrites = Cache::getInstance()->get('manufacturer_rewrites')) { $manufacturers = Manufacturer::getManufacturers(false, $context->language->id, true); foreach ($manufacturers as $manufacturer) { $manufacturer_rewrites[Tools::link_rewrite($manufacturer['name'])] = $manufacturer['id_manufacturer']; } Cache::getInstance()->set("manufacturer_rewrites", $manufacturer_rewrites, 86400); } $id_manufacturer = (int)$manufacturer_rewrites[$rewrite]; return $id_manufacturer; } protected function supplierID($rewrite) { if (empty($rewrite)) { return 0; } $context = Context::getContext(); if (!$supplier_rewrites = Cache::getInstance()->get('supplier_rewrites')) { $suppliers = Supplier::getSuppliers(false, $context->language->id, true); foreach ($suppliers as $supplier) { $supplier_rewrites[Tools::link_rewrite($supplier['name'])] = $supplier['id_supplier']; } Cache::getInstance()->set("supplier_rewrites", $supplier_rewrites, 86400); } $id_supplier = (int)$supplier_rewrites[$rewrite]; return $id_supplier; }
  12. braffas

    Thank you!

    Production server is a dedicated box with 64gb / E5-1650 Running: Debian 8 / Apache 2.4 / PHP 5.6 (FPM) / Mariadb 10.1 / Redis 3.2.9 The shop also runs fine with the same setup on a 2gb Vagrant box (what i use for development). I had to do overrides to some core classes and tweak some modules to make it work with 200k products. Mostly limits to ajax calls / pagination (back office) One thing i had to change after migrating to 30bz was the way that supplier and manufacturer rewrites are handled. That slowed down the site quite a bit (on those pages). i will post the change i made when i get back to work, since it may be useful for someone else with 40k+ manufactures / suppliers.
  13. braffas

    Thank you!

    Yep. That's the one :)
  14. braffas

    Thank you!

    I just wanted to say thank you to the 30bz team. I was thrilled when i first learned about the project 2 weeks ago, and now our shop has finally migrated to 30bz :) The migration gave me no problems with the modules i wrote myself, and only minor problems with some of the modules i purchased. We ship about 250 orders each days, and we got around 200k products in the database, and i must say, 30bz runs like a dream! So thank you so much for turning this project in the right direction. Keep up the good work!
  15. braffas

    Delete Cache

    Are you 100% sure that there is no overrides? I previously used Page Cache from Jpresta (the class is called PageCache) it's included in the dispatcher override and it's still included when you chose to disable all overrides in the TB config AND it will also remain included when you uninstall the module. The module seems to have a hard time cleaning up. So check your overrides maybe there is something left behind. Just search your override folder for "/pagecache.php'"
  16. I ran into this issue myself. It's pretty easy to fix this rewrite error. You need to change 2 lines: In: modules/phsimpleblog/phsimpleblog.php -> hookModuleRoutes 'module-ph_simpleblog-single' => array( 'controller' => 'single', 'rule' => $blog_slug.'/{sb_category}/{rewrite}', 'keywords' => array( 'sb_category' => array('regexp' => '[_a-zA-Z0-9-\pL]*', 'param' => 'sb_category'), 'rewrite' => array('regexp' => '[_a-zA-Z0-9-\pL]*', 'param' => 'sb_rewrite'), //<--- change 'rewrite' to 'sb_rewrite' //'rewrite' => array('regexp' => '[_a-zA-Z0-9-\pL]*', 'param' => 'rewrite'), ), 'params' => array( 'fc' => 'module', 'module' => 'ph_simpleblog', ), ), In: modules/ph_simpleblog/controllers/front/single.php -> init $simpleblog_post_rewrite = Tools::getValue('sb_rewrite', 0); //<--- change 'rewrite' to 'sb_rewrite' //$simpleblog_post_rewrite = Tools::getValue('rewrite', 0); Thats it :)
  17. I totally agree. It was just a quick fix (I'm only using 1 lang so it worked for me). But you are totally right about the can of worms :) I think the routes are better stored with no language dependency. It should be a pretty easy fix.
  18. I just looked at my notes. I'm pretty sure the config is still stored in configuration_lang without the patch (AdminMetaController.php ~ 711 - 715), but the default values are shown because 'type' => 'text' are not handled by generateOptions in HelperOptions.php which fills the form. (textLang is handled)
  19. The problem for me was that my changes did not show in the admin section, but they were applied. The problem seems to be with the method below in AdminMetaController /** * @param string $routeId * @param string $title * * @since 1.0.0 */ public function addFieldRoute($routeId, $title) { $keywords = array(); foreach (Dispatcher::getInstance()->default_routes[$routeId]['keywords'] as $keyword => $data) { $keywords[] = ((isset($data['param'])) ? '<span class="red">'.$keyword.'*</span>' : $keyword); } $this->fields_options['routes']['fields']['PS_ROUTE_'.$routeId] = array( 'title' => $title, 'desc' => sprintf($this->l('Keywords: %s'), implode(', ', $keywords)), 'validation' => 'isString', 'type' => 'text', //<----- that needs to be 'textLang' 'size' => 70, 'defaultValue' => Dispatcher::getInstance()->default_routes[$routeId]['rule'], ); }
  20. Hello First of all: Thanks for doing this! I really like the code changes in have seen in TB so far :) There seems to be a problem with saving SEO url routes (nothing is saved in configuration). The default values from the dispatcher class is used when the form is reloaded. I have upgradede a PS shop (1.6.1.11) to TB (1.0.1). I have tried with no overrides and only native modules.
×
×
  • Create New...