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.

Quant

Members
  • Content Count

    5
  • Joined

  • Last visited

Community Reputation

1 Neutral

Recent Profile Visitors

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

  1. Quant

    Multiplefeatures?

    When will MULTIPLEFEATURES from the kernel be implemented? How long to wait?
  2. There is a bug with displaying colors on the categories page when SmartyCache is enabled. It is not fixed in TB and PS (1.6.x). Here is an example of how to fix it. public function addColorsToProductList(&$products) { if (!is_array($products) || !count($products) || !file_exists(_PS_THEME_DIR_.'product-list-colors.tpl')) { return; } $productsNeedCache = []; foreach ($products as &$product) { if (!$this->isCached(_PS_THEME_DIR_.'product-list-colors.tpl', $this->getColorsListCacheId($product['id_product']))) { $productsNeedCache[] = (int) $product['id_product']; } else { $product['color_list'] = $this->context->smarty->fetch(_PS_THEME_DIR_.'product-list-colors.tpl', $this->getColorsListCacheId($product['id_product'])); } } unset($product); $colors = false; if (count($productsNeedCache)) { $colors = Product::getAttributesColorList($productsNeedCache); } else { return; } Tools::enableCache(); foreach ($products as &$product) { if (isset($colors[$product['id_product']])) { $tpl = $this->context->smarty->createTemplate(_PS_THEME_DIR_.'product-list-colors.tpl', $this->getColorsListCacheId($product['id_product'])); $tpl->assign( [ 'id_product' => $product['id_product'], 'colors_list' => $colors[$product['id_product']], 'link' => $this->context->link, 'img_col_dir' => _THEME_COL_DIR_, 'col_img_dir' => _PS_COL_IMG_DIR_, ] ); $product['color_list'] = $tpl->fetch(_PS_THEME_DIR_.'product-list-colors.tpl', $this->getColorsListCacheId($product['id_product'])); } if (in_array($product['id_product'], $productsNeedCache) && !isset($colors[$product['id_product']])) { $product['color_list'] = ''; } } Tools::restoreCacheSettings(); }
  3. The blocknewproducts module (ver 2.1.3) does not show products on the categories page when I enable Smarty cache. It seems to me that in hookRightColumn() the BlockNewProducts::$cache_new_products is not checked there. I changed the function a bit, and then everything works: public function hookRightColumn() { if (!$this->isCached('blocknewproducts.tpl', $this->getCacheId())) { if (!isset(BlockNewProducts::$cache_new_products)) BlockNewProducts::$cache_new_products = $this->getNewProducts(); if (!BlockNewProducts::$cache_new_products) { return false; } $this->smarty->assign([ 'new_products' => BlockNewProducts::$cache_new_products, 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), ]); } return $this->display(__FILE__, 'blocknewproducts.tpl', $this->getCacheId()); } Also in hookdisplayHomeTab(), the BlockNewProducts::$cache_new_products check should be used in the IF block, and in hookdisplayHomeTabContent(), the check is generally meaningless. public function hookdisplayHomeTab() { if (!$this->isCached('tab.tpl', $this->getCacheId('blocknewproducts-tab'))) { BlockNewProducts::$cache_new_products = $this->getNewProducts(); if (!BlockNewProducts::$cache_new_products) return false; } return $this->display(__FILE__, 'tab.tpl', $this->getCacheId('blocknewproducts-tab')); } public function hookdisplayHomeTabContent() { if (!$this->isCached( 'blocknewproducts_home.tpl', $this->getCacheId('blocknewproducts-home')) ) { $this->smarty->assign([ 'new_products' => BlockNewProducts::$cache_new_products, 'mediumSize' => Image::getSize(ImageType::getFormatedName('medium')), 'homeSize' => Image::getSize(ImageType::getFormatedName('home')), ]); } return $this->display( __FILE__, 'blocknewproducts_home.tpl', $this->getCacheId('blocknewproducts-home') ); } Tell me, my corrections are correct?
  4. The problem disappears if you update the TB via CoreUpdater. Then the errors disappear. Ps. I use php5.6, only for the test, while I transfer PS1.6.1.23 to TB.
  5. The productscategory module gives errors if you enable FullPageCache and disable caching for displayFooterProduct. [Mon Apr 22 18:26:22.209248 2019] [:error] [pid 25072] [client 127.0.0.1:53663] PHP Notice: Undefined index: product in /home/shop/www/modules/productscategory/productscategory.php on line 110, referer: http://tb.local/19-laki [Mon Apr 22 18:26:22.209278 2019] [:error] [pid 25072] [client 127.0.0.1:53663] PHP Notice: Trying to get property of non-object in /home/shop/www/modules/productscategory/productscategory.php on line 110, referer: http://tb.local/19-laki [Mon Apr 22 18:26:22.209294 2019] [:error] [pid 25072] [client 127.0.0.1:53663] PHP Notice: Undefined index: product in /home/shop/www/modules/productscategory/productscategory.php on line 111, referer: http://tb.local/19-laki [Mon Apr 22 18:26:22.209698 2019] [:error] [pid 25072] [client 127.0.0.1:53663] PHP Notice: Trying to get property of non-object in /home/shop/www/modules/productscategory/productscategory.php on line 113, referer: http://tb.local/19-laki Im use TB ver 1.0.8 (community theme) and php5.6. How to fix it?
×
×
  • Create New...