Category description in two parts

  • Posts: 222
  • Thank you received: 1
11 years 3 months ago #157627

-- url of the page with the problem -- : mywebsite.com/mypage
-- HikaShop version -- : x.x.x
-- Joomla version -- : x.x
-- PHP version -- : x.x.x
-- Browser(s) name and version -- : XXXXX x.x.x
-- Error-message(debug-mod must be tuned on) -- : Error_message

latest versions

Is it possible on category listing page the description of category into two parts:
1. a short description as it is now, on the top of the page, and
2. a more comprehensive description below the page
Purpose: to have more content on these pages?

Thanks,
Vero

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

  • Posts: 13201
  • Thank you received: 2322
11 years 3 months ago #157651

Hi,

This is available in the view "product / show_tabular", so if you want it in another view you can use the same kind of code.
For the short description:

			$resume = substr(strip_tags(preg_replace('#<hr *id="system-readmore" */>.*#is','',$this->element->product_description)),0,300);
			if (!empty($this->element->product_description) && strlen($this->element->product_description)>300)
				$resume .= " ...<a href='#hikashop_show_tabular_description'>".JText::_('READ_MORE')."</a>";
			echo JHTML::_('content.prepare',$resume);

And for the full description:
echo JHTML::_('content.prepare',preg_replace('#<hr *id="system-readmore" */>#i','',$this->element->product_description));

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

  • Posts: 222
  • Thank you received: 1
11 years 3 months ago #157747

Sorry Xavier,

But I don't need "read more" function. I need two parts of the same description, because both parts are on the same page.
If I goed understood you, I will have above a short description and below on the same page 'short+the rest' descriptions, than double short description on the same page?

Vero

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

  • Posts: 13201
  • Thank you received: 2322
11 years 3 months ago #157751

Hi,

The given code allow to have a short description at the top, and putting the second at the end allow to have the full description.

You can edit it to remove the read-more link, or to display one part at the top and another part at the end. It require PHP knowledges, mainly on the substr function.

The view to edit is "category / listing".

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

  • Posts: 222
  • Thank you received: 1
11 years 3 months ago #157800

Thanks Xavier
I am so sorry, but if you can understand I have not PHP knowledges, others I would not ask. I can not adapt the given code's and I don't know where exactly should I place each of those two code's in the category/listing.

Hi forum members,
Can sameone help me? I have not enough PHP knowledges. I understand if I read, but I can not write perfect the code myself. I can write only css and html code myself.
I need the php code for category description (on every category products listing page) in two parts: one (short) part of description on the top of page, and the rest of description on the same page at the end (more content is better to SEO, and less description on the top is better to customer, a page looks nicer).
Like that:
short category description
products listing
page pagination
the rest of the same description

Many thanks,
Vero

Last edit: 11 years 3 months ago by Vero.

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

  • Posts: 13201
  • Thank you received: 2322
11 years 3 months ago #158015

Hi,

In the view "product / listing", you have to replace the line:

<?php echo JHTML::_('content.prepare',$this->element->category_description); ?>
By:
<?php echo JHTML::_('content.prepare',substr($this->element->category_description,0,250)); ?>

And add the line:
echo JHTML::_('content.prepare',substr($this->element->category_description,250));
Before:
	$html = ob_get_clean();
	if(!empty($html)) {

This way the first description will only display the 250 first characters of the description, and the rest of the description will be displayed at the end of the page, after the pagination.

You can change "250" by any other value.

Last edit: 11 years 3 months ago by nicolas.

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

  • Posts: 222
  • Thank you received: 1
11 years 3 months ago #158057

It changes only first part and only in main category, other categories descriptions are not changed. The first part is smal.
I can't add second code, because if I add, I see blank page on my website.

Are you sure that second line has be added before "$html = ob_..."? Because I see that after adding is changed the colors of those two lines "$html = ob_..."

I tried too to add the second your code one line higher before "<?php }". Than colors of those two lines ($html = ob_...") no change but on front-end I see blank page.

I sent u e-mail with my inlog. Please help.

May be two more problems can you solve at the same time?

1. Only one product on main category listing ( www.adrialle-cadeau.com/kadokadootje/kadootjes ) 3 page, first row, 3 column (orange squirrel) is shown, but if I press them, I get not product page, but 404 page. The rest works goed.

2.I changed img "prev.png"and "next.png" via Fz. (the same names). Mybe the same orange squirrel caused that problem, mybe not, but now if go to brown squirrel (on the left by orange squirrel) product page en press "prev" button, than it is schowing prev product, than again brown squirrel and again prev ... So are showing only those two products. On the latest product page (earrings) - no prev, no next buttons. On the first product page are both buttons and after press on, there are showing random products, not in the correct order and so on every product page.
Mybe that happens after updating (yesterday updated) hikashop to 2.3.1??? On back-end no more move up or down product function...

Thanks in advance,
Vero

Last edit: 11 years 3 months ago by Vero.

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

  • Posts: 84298
  • Thank you received: 13694
  • MODERATOR
11 years 3 months ago #158249

Hi,

0. There was an issue with the code change Xavier provided you. I edited his message to fix it.

1. As far as I can see, the issue is that you entered a non working URL in the "canonical URL" parameter of that product. Empty the field and it should then work.

2. The next and previous links are working fine on that product page ( it is www.adrialle-cadeau.com/kadokadootje/kad...sleutelhanger-tijger right ?).

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

  • Posts: 222
  • Thank you received: 1
11 years 3 months ago #158269

Hi,

0. those two codes I have added:
a) to product / listing - it is not showing second part one main category "Kadootjes"
b) to category / listing - the second part is showing, but without styling, just through the whole page width (content + left sidebar + right sidebar) us one line.

My website is ofline. I sent my inlog to you via prive mail.

I am now trying to get in the second part the same style as in first part. But I don't know where I can do that.

2. That is not tijger, that is www.adrialle-cadeau.com/kadokadootje/kad...er-eekhoorntje-bruin
And this still not working perfect. I wrote: brown squirrel.

4. All "GEWENSTE PRIJS" categories - 404, but I found the mistake and fixed.

Many thanks,
Vero

Last edit: 11 years 3 months ago by Vero.

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

  • Posts: 222
  • Thank you received: 1
11 years 3 months ago #158557

Hallo forum members,

If you read the whole topic, you understand what is this. I ask your help.
You see my category listing page image. Category description runs through the whole page as one line without end.
This heppened after the introduction the php code, which I have received from hikashop team and now, after I got everything back (cleaned changes), is still the same..

My be somebody can me help, because hikashop team says in prive mail that is no problem and site works perfect.
My website is now offline, I can not put my website back online with such problem.

Please somebody help!



Thanks in advance,
Vero

Attachments:
Last edit: 11 years 3 months ago by Vero.

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

Time to create page: 0.097 seconds
Powered by Kunena Forum