Skip to main content

category_left, category_right, category_depth

More
13 years 11 months ago #70460 by cobinet_edv
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.

More
13 years 11 months ago #70605 by nicolas

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

More
13 years 11 months ago #70706 by cobinet_edv
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.

More
13 years 11 months ago - 13 years 11 months ago #70708 by nicolas
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: 13 years 11 months ago by nicolas.
The following user(s) said Thank You: cobinet_edv

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

More
13 years 11 months ago #70710 by cobinet_edv
I don't understand, what a view for wich page is
Another way?

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

More
13 years 11 months ago #70712 by nicolas
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.

More
13 years 11 months ago #70891 by cobinet_edv
I started code
It does'nt work.
No errors
One Idea?

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

More
13 years 11 months ago #70896 by nicolas
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.

More
13 years 11 months ago #71362 by cobinet_edv
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.

More
13 years 11 months ago #71365 by nicolas
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.

More
13 years 11 months ago #71376 by cobinet_edv
<?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.

More
13 years 11 months ago #71532 by nicolas
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.

More
13 years 11 months ago #71547 by cobinet_edv
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.

More
13 years 8 months ago #86909 by cobinet_edv
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.337 seconds
Powered by Kunena Forum