my wrong category tree

  • Posts: 10
  • Thank you received: 0
11 years 8 months ago #93502

Hello, my wrong category tree. The breadcrumbs do not work well.

I saw in a post:

As expected, there was no issue in HikaShop. The problem was the category tree data which was completely screwed up in the database. So the system wasn't able to load the categories properly on your website to calculate the breacrumb.
I've fixed the data in the database via a hidden category tree rebuild function and the breadcrumb now works properly on your website as far as I can see.


How I can rebuild category tree?.


Thanks

www.mrodriguez.es
Hikashop 1.5.7
Joomla 2.5.9

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
11 years 8 months ago #93580

A button will be present in next version of HikaShop to rebuild the category tree automatically.
We're currently working towards the release and we plan on doing it next week.

In the mean time, you would have to add the code:

<?php 		$class = hikashop_get('class.category');
		$database = JFactory::getDBO();
		$query = 'SELECT category_left,category_right,category_depth,category_id,category_parent_id FROM #__hikashop_category ORDER BY category_left ASC';
		$database->setQuery($query);
		$root = null;
		$categories = $database->loadObjectList();
		$class->categories = array();
		foreach($categories as $cat){
			$class->categories[$cat->category_parent_id][]=$cat;
			if(empty($cat->category_parent_id)){
							$root = $cat;
			}
		}
		$class->rebuildTree($root,0,1);
 ?>
in a view file via the menu Display->Views and display that view so that the code gets executed and that the category tree gets rebuilt.

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

  • Posts: 10
  • Thank you received: 0
11 years 8 months ago #93654

I do not think I understand correctly.

in menu Display-> Views, in any file paste the code

apply

And now this?


This is what I've done, but it does not work.


1. How could execute the code?

or

2.You can make it through the database, how?

Thank

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
11 years 8 months ago #93749

You need to add it in a view that you will then display so that the code gets executed.
For example, you can add it at the beginning of the "config" file of the "config" view for your backend template and each time you access the configuration page the script will be run.

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

  • Posts: 10
  • Thank you received: 0
11 years 8 months ago #93781

I added the code in my template config file. Dispaly -> view

Then I went into system settings. But the categories still fail in the bread crumbs.

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

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
11 years 8 months ago #93794

That code is to rebuild the category tree if it has a problem. It doesn't magically fix issues with breadcrumbs. It only fix the fact that if the category tree is out of synch, the system cannot retrieve properly the breadcrumb categories.
So your properly is probably elsewhere. For example, an issue in the SEF options of the HikaShop configuration ?
Also, I see that you're using an old version of HikaShop. Maybe it's something that we already fixed which is causing that.

The following user(s) said Thank You: manolo2119

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

  • Posts: 1055
  • Thank you received: 11
  • Hikashop Business
11 years 7 months ago #96265

Nicolas I confirm that it has to do with breadrumbs.
I pasted the code in the config / config.php
I clicked and navigated in the backend configuration page, but script didn t run. When I manually change values category_left and category_right, breadcrumbs give many paths (i dont know the right values so I copied the values from category_parent_id and pasted in category_left and category_right, to see if something changes in breadcrumbs. It changes.
What am I doing wrong?
Why the script doesnt work for me. I saw in phpmyadmin, values are still like I pasted them even if I navigate in hikashop configuration page.

Thanks!

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

  • Posts: 1055
  • Thank you received: 11
  • Hikashop Business
11 years 7 months ago #96270

Sorry!
It works perfect... breadcumbs too.!!

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

Time to create page: 0.075 seconds
Powered by Kunena Forum