We offer professional Design/Code Customisation and Website Optimisation Service Request Customisation
  • Status: Closed
  • Closed by: Marek (marek)
  • Closed on: 02.01.19, 14:48
  • Reason: Closed
  • Comment: Glad to help!

Ticket #13322 - Titles and description not displayed on category pages

Dear Marek,

The displaying of products on the category page of Alysum seems to have crashed: titles and product descriptions are not shown, and some products are displayed twice.

Example:
https://www.bioseblab.com/en/2-bioseblab-equipment

Could you please have a look and let me know what seems to be the problem?

Thanks in advance for your help,

Julien

This ticket does not depend on any other tickets.

Marek (marek) 05 Dec 2018, 10:42

Hi, Julien.
How it happens? maybe you have installed some additional module?

Julien (bioseb) 05 Dec 2018, 22:52

Hi Marek,

Thanks for the quick reply. No, nothing has new has been installed recently - which baffles me.

Cheers,

Julien

Marek (marek) 06 Dec 2018, 09:21

Ok, I see. Working to find a solution as soon as possible

Marek (marek) 07 Dec 2018, 17:22

Try to restore original file "/themes/alysum/templates/catalog/_partials/miniatures/product.tpl"

Julien (bioseb) 10 Dec 2018, 05:21

Just tried that - does not help. Same problem...

Marek (marek) 12 Dec 2018, 13:24

I have found out there is no names even in deep code what generates inside prestashop → http://take.ms/0TnF0 so I'm not sure it's a theme's issue
Do you remember what have you done before the issue appeared?

Julien (bioseb) 17 Dec 2018, 04:44

Dear Marek, I have checked everything - nothing special has been done on the website the past few weeks. No changes in the code, nothing.

I have no clue what could cause this problem, especially since the product titles are displayed properly on the product page - just not on the Category page, even when resetting it to the original version.

Any idea?

Julien (bioseb) 17 Dec 2018, 05:54

Update: the problem seems to come from the fact that classes/category.php is not able to read the content of $id_lang in following command:

$sql = 'SELECT p.*, product_shop.*, stock.out_of_stock, IFNULL(stock.quantity, 0) AS quantity'.(Combination::isFeatureActive() ? ', IFNULL(product_attribute_shop.id_product_attribute, 0) AS id_product_attribute,

				product_attribute_shop.minimal_quantity AS product_attribute_minimal_quantity' : '').', pl.`description`, pl.`description_short`, pl.`available_now`,
				pl.`available_later`, pl.`link_rewrite`, pl.`meta_description`, pl.`meta_keywords`, pl.`meta_title`, pl.`name`, image_shop.`id_image` id_image,
				il.`legend` as legend, m.`name` AS manufacturer_name, cl.`name` AS category_default,
				DATEDIFF(product_shop.`date_add`, DATE_SUB("'.date('Y-m-d').' 00:00:00",
				INTERVAL '.(int)$nb_days_new_product.' DAY)) > 0 AS new, product_shop.price AS orderprice
			FROM `'._DB_PREFIX_.'category_product` cp
			LEFT JOIN `'._DB_PREFIX_.'product` p
				ON p.`id_product` = cp.`id_product`
			'.Shop::addSqlAssociation('product', 'p').
			(Combination::isFeatureActive() ? ' LEFT JOIN `'._DB_PREFIX_.'product_attribute_shop` product_attribute_shop
			ON (p.`id_product` = product_attribute_shop.`id_product` AND product_attribute_shop.`default_on` = 1 AND product_attribute_shop.id_shop='.(int)$context->shop->id.')':'').'
			'.Product::sqlStock('p', 0).'
			LEFT JOIN '._DB_PREFIX_.'category c ON (c.id_category = cp.id_category)
			LEFT JOIN `'._DB_PREFIX_.'category_lang` cl
				ON (product_shop.`id_category_default` = cl.`id_category`
				AND cl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('cl').')
			LEFT JOIN `'._DB_PREFIX_.'product_lang` pl
				ON (p.`id_product` = pl.`id_product`
				AND pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').')
			LEFT JOIN `'._DB_PREFIX_.'image_shop` image_shop
				ON (image_shop.`id_product` = p.`id_product` AND image_shop.cover=1 AND image_shop.id_shop='.(int)$context->shop->id.')
			LEFT JOIN `'._DB_PREFIX_.'image_lang` il
				ON (image_shop.`id_image` = il.`id_image`
				AND il.`id_lang` = '.(int)$id_lang.')
			LEFT JOIN `'._DB_PREFIX_.'manufacturer` m
				ON m.`id_manufacturer` = p.`id_manufacturer`
			WHERE product_shop.`id_shop` = '.(int)$context->shop->id.'
				AND c.nleft >= '.(int)$parent->nleft.' AND c.nright <= '.(int)$parent->nright.' AND c.active = 1
				'.($active ? ' AND product_shop.`active` = 1' : '')
				.($front ? ' AND product_shop.`visibility` IN ("both", "catalog")' : '')
				.($id_supplier ? ' AND p.id_supplier = '.(int)$id_supplier : '');

If I change pl.`id_lang` = '.(int)$id_lang.Shop::addSqlRestrictionOnLang('pl').' into pl.`id_lang` = 1

Then the category page displays everything (but of course only in language 1, which is English).

Any idea why the page would not be able to access $id_lang all of a sudden?

Thanks a lot in advance...

Julien (bioseb) 17 Dec 2018, 06:20

So it happens that the variable used in the category.php file should have been $idLang, and not $id_lang.
We never touched this, and I have no clue how this could have happened.

Marek (marek) 17 Dec 2018, 10:25

What is your Prestabhop version? maybe it's a known bug

Julien (bioseb) 17 Dec 2018, 13:34

1.7.4.3

I've looked for a known bug, could not find anything.

Anyway - it seems fixed now - but I thought you'd want to know what it was, as you might have other customers with the same issue.

Marek (marek) 17 Dec 2018, 14:32

Thank you for sharing the solution!

Loading...