category_left, category_right, category_depth

  • Posts: 107
  • Thank you received: 0
12 years 4 weeks ago #70460

Hello,
I set data in the table cn_hikashop_category self.
It works.
But I set no data for fileds category_left, category_right, category_depth
So I have no tree for categories left up.
I want that Hikashop recalculate my imported data, that fileds category_left, category_right, category_depth filled.
Is it possible?

Thanks

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

  • Posts: 82796
  • Thank you received: 13357
  • MODERATOR
12 years 4 weeks ago #70605

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

  • Posts: 107
  • Thank you received: 0
12 years 3 weeks ago #70706

Hello,

and how can I the script execute?
In joomla? On the shell?
What is a simple way?

Thanks

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

  • Posts: 82796
  • Thank you received: 13357
  • MODERATOR
12 years 3 weeks ago #70708

You can add it in a view file via the menu Display->Views, display the page of that view and that will run the code.

PS: do not post the same message on several threads.

Last edit: 12 years 3 weeks ago by nicolas.
The following user(s) said Thank You: cobinet_edv

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

  • Posts: 107
  • Thank you received: 0
12 years 3 weeks ago #70710

I don't understand, what a view for wich page is
Another way?

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

  • Posts: 82796
  • Thank you received: 13357
  • MODERATOR
12 years 3 weeks ago #70712

You can use sourcerer to add that code anywhere on your website:
extensions.joomla.org/extensions/core-en...code-in-content/5051

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

  • Posts: 107
  • Thank you received: 0
12 years 3 weeks ago #70891

I started code
It does'nt work.
No errors
One Idea?

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

  • Posts: 82796
  • Thank you received: 13357
  • MODERATOR
12 years 3 weeks ago #70896

I've no idea. That code works fine. We use it in HikaShop to recalculate the category tree when you change the parent category of categories. You might want to try to do that instead with a fake category.

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

  • Posts: 107
  • Thank you received: 0
12 years 3 weeks ago #71362

Does'nt work
I set my code as first - Echo "Anfang"; and last - Echo "Ende";
I see "Anfang" as output but not "Ende"
I set Echo $database; after $database =& JFactory::getDBO(); but I see nothing.
I think "& JFactory::getDBO()" does'nt work
With fake categorie does'nt work too

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

  • Posts: 82796
  • Thank you received: 13357
  • MODERATOR
12 years 3 weeks ago #71365

It's normal that there is nothing in $database... It's a database object. There is nothing to display in it.
if you don't see the "ende" text, it means that there is an error in the code you have.

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

  • Posts: 107
  • Thank you received: 0
12 years 3 weeks ago #71376

<?php
echo "Anfang";
$database =& JFactory::getDBO();
$categoryClass = hikashop::get('class.category');
$query = 'SELECT category_left,category_right,category_depth,category_id,category_parent_id FROM '.hikashop::table('category').' ORDER BY category_left ASC';
$database->setQuery($query);
$categories = $database->loadObjectList();
$root = null;
$categoryClass->categories = array();
foreach($categories as $cat){
$categoryClass->categories[$cat->category_parent_id][]=$cat;
echo $cat->categoriy_parent_id;
if(empty($cat->category_parent_id)){
$root = $cat;
}
}
$categoryClass->rebuildTree($root,0,1);
echo "Erfolg!";
I copied code from internet

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

  • Posts: 82796
  • Thank you received: 13357
  • MODERATOR
12 years 3 weeks ago #71532

That sounds fine.

Do you have the category_parent_id properly set for each of your categories ?

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

  • Posts: 107
  • Thank you received: 0
12 years 3 weeks ago #71547

Yes
That does'nt work with one single category, that I in Hikashop Menu set

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

  • Posts: 107
  • Thank you received: 0
11 years 9 months ago #86909

Ok
I have it
It is not fine solution, but it works
I have inserted the code in category/lising.php
It works

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

Time to create page: 0.078 seconds
Powered by Kunena Forum