SUPPORT EASTER BREAK!

Till April 7 - support is offline

Thanks for patience.

Okay
  Print

ps_categoryproducts/ps_viewedproducts - price only on first product

It is bug with prestashop cache itself, to fix it is needed to disable cache for module


For

ps_categoryproducts

modules/ps_categoryproducts/ps_categoryproducts.php

change renderWidget method to


public function renderWidget($hookName = null, array $configuration = array())
    {
        $params = $this->getInformationFromConfiguration($configuration);
        if ($params) {
            if ((int)Configuration::get('CATEGORYPRODUCTS_DISPLAY_PRODUCTS') > 0) {
                // Need variables only if this template isn't cached
                //if (!$this->isCached($this->templateFile, $params['cache_id'])) {
                    if (!empty($params['id_category'])) {
                        $category = new Category($params['id_category']);
                    }
                    if (empty($category) || !Validate::isLoadedObject($category) || !$category->active) {
                        return false;
                    }
                    $variables = $this->getWidgetVariables($hookName, $configuration);
                    if (empty($variables)) {
                        return false;
                    }
                    $this->smarty->assign($variables);
              //  }
                return $this->fetch(
                    $this->templateFile
                );
            }
        }
        return false;
    }

ps_viewedproducts

modules/ps_viewedproducts/ps_viewedproducts.php

change renderWidget method to

public function renderWidget($hookName = null, array $configuration = array())
    {
        if (isset($configuration['product']['id_product'])) {
            $this->currentProductId = $configuration['product']['id_product'];
        }
        if ('displayProductButtons' === $hookName || 'displayProductAdditionalInfo' === $hookName) {
            $this->addViewedProduct($this->currentProductId);
            return;
        }
        if (!isset($this->context->cookie->viewed) || empty($this->context->cookie->viewed)) {
            return;
        }
       // if (!$this->isCached($this->templateFile, $this->getCacheId())) {
            $variables = $this->getWidgetVariables($hookName, $configuration);
            if (empty($variables)) {
                return false;
            }
            $this->smarty->assign($variables);
       // }
       // return $this->fetch($this->templateFile, $this->getCacheId());
        return $this->fetch($this->templateFile);
    }