Product Cron Update seems to filer LineFeeds from the product_description

  • Posts: 80
  • Thank you received: 8
4 years 10 months ago #314319

-- HikaShop version -- : 4.2.2
-- Joomla version -- : 3.9.14
-- PHP version -- : 7.2
-- Browser(s) name and version -- : Chrom latest
-- Error-message(debug-mod must be tuned on) -- : n/a

I'm testing with Hikashop - Product Cron Update and it works like a charm except for one thing.
The import of the product_description is missing the LineFeed characters. The csv file provided by my supplier uses LF characters to create new lines but the LF characters seem to be filtered by the Cron Update Plugin.
For me it is no option to change the csv file manualy because i download the csv file every hour from the supplier and I would like to keep the shop content in sync.

Update: I checked the product_description field in the database table and there the linefeeds are still okay (when copied to Notepad++ showing as CR LF). Why are these CR LF not visible in the editor?

Last edit: 4 years 10 months ago by bp54.

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
4 years 10 months ago #314353

Hi,

Note that the description uses HTML and the editor you have to edit the description of a product is a HTML editor.
In HTML, CR and LF characters are not "displayed". To have a line return in HTML you need to have a HTML tag

<br/>
So in that case, what you could do is change the "Description default format" setting to "markdown" instead of "HTML" in the HikaShop configuration.
In that case, for new products, the description will be added as markdown and the CR / LF characters will be taken into account. But you won't have a HTML editor when you edit these products anymore as you'll have instead just a text area with the use of the "markdown" format: en.wikipedia.org/wiki/Markdown

Please Log in or Create an account to join the conversation.

  • Posts: 80
  • Thank you received: 8
4 years 10 months ago #314362

Thanks you Nicolas. I think I missed something because I still do not see the LineFeeds.

What i did:

1. Deleted all the products
2. Under System>Configuration>Advanced Settings I changed Description format from HTML to Markdown.
3. Reimported all the products via the Cron Update plugin

Unfortunately I still see the editor and also the text without LineFeeds.

Update:: It seemed that only setting Markdown was not enough. I also had to set the editor to: plg_editors_none manualy.
Now the LineFeeds show up in the backend product_description however in the frontend the LineFeeds are not visible. I think this is because it is not html.

Update 2:
Finaly i think i solved it. In file product/show_default (around line 190) I enclosed the string representation of $this->element->product_description with nl2br:

<div id="hikashop_product_description_main" class="hikashop_product_description_main" itemprop="description"><?php
		echo nl2br(JHTML::_('content.prepare',preg_replace('#<hr *id="system-readmore" */>#i','',$this->element->product_description)));
	?></div>

Last edit: 4 years 10 months ago by bp54.
The following user(s) said Thank You: nicolas

Please Log in or Create an account to join the conversation.

Time to create page: 0.056 seconds
Powered by Kunena Forum