Jump to content
0c3aN

[SOLVED & Solution] Only sub-subcategory in a block

Recommended Posts

Hi,i have a little question. I would like to make the categories block to only show sub-subcategory.
Example: Home is the main category,then i have 8 subcategories (all with subcategories).Is it possible to edit the blockcategories to only show specified subsubcategories ? So i can duplicate the blockcategories module and create 8 separate blocks with subcategories?

Category1
-subcat1
-subcat2
-etc...

Category2 (new block,duplicated from blockcategories)
-subcat2
-subcat2
-etc...

Thanks and sorry for my bad english !!!

PS: I attached an image so you can see what i mean.These two blocks are created with the blocklinks module but i want to make the same in tree mode like the blockcategories module because some of these subcategories have subsubcategories.

18773_22DR9KDfA78rwJbbT9Iv_t

  • Like 1

Share this post


Link to post
Share on other sites

Solved it self by me.Now i have 8 different categories blocks with different subcategories.
If anyone needs the solution you can ask me via pm or in this same forum.

Thanks !!!

Share this post


Link to post
Share on other sites

plz!!!!

post the solution

Actually i need two categories block for my shopping cart

May be ur solution help me

thanks

Share this post


Link to post
Share on other sites

You ask community for help, and when you find it you don`t share it? Something seems to be wrong, do you think so? Post the solution...

Share this post


Link to post
Share on other sites
You ask community for help, and when you find it you don`t share it? Something seems to be wrong, do you think so? Post the solution...


Please don´t miss understand me,i have asked if anybody needs the solution because i´m not sure if it was posted by other user in the forums or if anybody is interested in this.My english is very bad so i will do my best to give the explication:

1. Go to your modules folder and make a copy/duplicate of your blockcategories folder and rename it with blockcategories2 for example.
2. Enter in the blockcategories2 folder and rename the blockcategories.tpl and blockcategories.php to blockcategories2.tpl and blockcategories2.php.
3. Open up your blockcategories2.php and replace all blockcategories words to blockcategories2.
4. In blockcategories2.php find this string:
function getTree($resultParents, $resultIds, $maxDepth, $id_category = 1, $currentDepth = 0)



In $id_category = 1 replace the 1 with your desired subcategory id number

5.Open your blockcategories2.tpl and in line 5 replace the Categories string with your desired block name.For example i have used this for one of my blocks:

{l s='Perifericos' mod='blockcategories'}



That´s all,if you use a language that is not english open up your languague file in the blockcategories2 folder and rename all the blockcategories strings to blockcategories2

Hope you understand my bad english !!!

Share this post


Link to post
Share on other sites

Here you can see the results of my first two blocks.I have replaced the - and + icons with two different bullets and edited a little bit the font size in globall.css under cantegories

18816_IekJEAIgbP0SnRy2Gzau_t

Share this post


Link to post
Share on other sites
You ask community for help, and when you find it you don`t share it? Something seems to be wrong, do you think so? Post the solution...


Please don´t miss understand me,i have asked if anybody needs the solution because i´m not sure if it was posted by other user in the forums or if anybody is interested in this.My english is very bad so i will do my best to give the explication:

1. Go to your modules folder and make a copy/duplicate of your blockcategories folder and rename it with blockcategories2 for example.
2. Enter in the blockcategories2 folder and rename the blockcategories.tpl and blockcategories.php to blockcategories2.tpl and blockcategories2.php.
3. Open up your blockcategories2.php and replace all blockcategories words to blockcategories2.
4. In blockcategories2.php find this string:
function getTree($resultParents, $resultIds, $maxDepth, $id_category = 1, $currentDepth = 0)



In $id_category = 1 replace the 1 with your desired subcategory id number

5.Open your blockcategories2.tpl and in line 5 replace the Categories string with your desired block name.For example i have used this for one of my blocks:

{l s='Perifericos' mod='blockcategories'}



That´s all,if you use a language that is not english open up your languague file in the blockcategories2 folder and rename all the blockcategories strings to blockcategories2

Hope you understand my bad english !!!

Share this post


Link to post
Share on other sites
You ask community for help, and when you find it you don`t share it? Something seems to be wrong, do you think so? Post the solution...


Please don´t miss understand me,i have asked if anybody needs the solution because i´m not sure if it was posted by other user in the forums or if anybody is interested in this.My english is very bad so i will do my best to give the explication:

1. Go to your modules folder and make a copy/duplicate of your blockcategories folder and rename it with blockcategories2 for example.
2. Enter in the blockcategories2 folder and rename the blockcategories.tpl and blockcategories.php to blockcategories2.tpl and blockcategories2.php.
3. Open up your blockcategories2.php and replace all blockcategories words to blockcategories2.
4. In blockcategories2.php find this string:
function getTree($resultParents, $resultIds, $maxDepth, $id_category = 1, $currentDepth = 0)



In $id_category = 1 replace the 1 with your desired subcategory id number

5.Open your blockcategories2.tpl and in line 5 replace the Categories string with your desired block name.For example i have used this for one of my blocks:

{l s='Perifericos' mod='blockcategories'}



That´s all,if you use a language that is not english open up your languague file in the blockcategories2 folder and rename all the blockcategories strings to blockcategories2

Hope you understand my bad english !!!


Thank you for sharing it. I just learned something....

Share this post


Link to post
Share on other sites

Your english is good. Don't be shy. =D This is actually a very useful trick. Thanks mate.

Share this post


Link to post
Share on other sites

One more thing. If you need to set a higher maximum depth value you must configure every duplicated module because it takes the lower number in global.
For example i have set my maximum depth to 5 in all blocks so it shows the sub sub sub categories with the + and -

Bye !!!

Share this post


Link to post
Share on other sites

@Oc3aN
I tried ur steps to get two category blocks ,but got failure in my results.
i got two blocks in my front office thats ok!! but the categories will displayed in the old block only not in my new block
even i specifid the category id number in the php code of the new block.
whats going wrong? here
help me in the issue

Share this post


Link to post
Share on other sites

Got it 50%

Block displays the sub categories now,

but it also displays the same category in the main block as well, i dont want to display that in the main block.
I need that category in a separate block.

where to edit?

Share this post


Link to post
Share on other sites

@phantomeye
sorry i dont have any demo site.
currently im doing that in local only.

Share this post


Link to post
Share on other sites

The main block is not necesary, if you want 2 different blocks just edit the main block as your first categories block with subs and the duplicated as your second.
One more thing, i have tested this trick only in prestashop 1.2.5 but i think it should work in all versions.

Bye !!!

Share this post


Link to post
Share on other sites

Sorry but it doen't work for me... with this blockcategories folder and after follow your explanations i still have all my categories with this "new" module...

Share this post


Link to post
Share on other sites

Dharani, how did you make it work? Would you mind sharing? On my Game Accessories shop I had to use Manufacturer block as a separate category but it cannot have subcategories. Duplicated blockcategory module will solve my problem.

Share this post


Link to post
Share on other sites

Hey
sorry for the late reply
@netman
i didnt do any changes in the steps that provided by 0c3an
just follow the same steps given by him.the small change youve to done is that to give the second block category as a sub sub category in BO
consider your shop
Sub category1 accesory
subcategory2- games
give subcategories under accesory and games and give the id category of accesory in the first block and give the id category of the games in the sec duplicate block
that will work!!!

Share this post


Link to post
Share on other sites

Hi.Is there is a way to change only Categories font and keep subcategories font as before?
Thanks

Share this post


Link to post
Share on other sites
Here you can see the results of my first two blocks.I have replaced the - and + icons with two different bullets and edited a little bit the font size in globall.css under cantegories


Hi!

First of all thanks for very good guide. I ve been looking this solution for months.

I have one more question.

How did you insert pictures in front of the category name? can you give us a guide?

Se the attached pic for the reference.

Thanks a lot.

22988_hJThJBR0wxxPeuEjnbSH_t

Share this post


Link to post
Share on other sites

Hi!

First of all thanks for very good guide. I ve been looking this solution for months.

I have one more question.

How did you insert pictures in front of the category name? can you give us a guide?

Se the attached pic for the reference.

Thanks a lot.


Sorry for my english, I use google translator.

You need to create a new class in the file global.css
The first step is duplicate the BLOCK class and rename to BLOCK2.
Now, you modify the class BLOCK2 to show a different image in the header block.
In the file blockcategories2.tpl change class="block" to class="block2"

I have a question please:
How can I do dynamic subcategories for change when change the category?

Share this post


Link to post
Share on other sites
@Oc3aN
I tried ur steps to get two category blocks ,but got failure in my results.
i got two blocks in my front office thats ok!! but the categories will displayed in the old block only not in my new block
even i specifid the category id number in the php code of the new block.
whats going wrong? here
help me in the issue


how did you solved this problem? Please mind you help me?

Share this post


Link to post
Share on other sites
Guest

It works for me.Thank you.

One more question, how can I get the parent category's ID dynamically and replace the value "1" in code

$id_category = 1

automatically?

function getTree($resultParents, $resultIds, $maxDepth, $id_category = 1, $currentDepth = 0) 



I just want to put the parent categories on the horizontal navigation bar ,then when click one of the parent categories, the subcategories show in the categories block correspondingly (don't show subcategories from other parent categories)

Any idea?

Share this post


Link to post
Share on other sites
Guest
It works for me.Thank you.

One more question, how can I get the parent category's ID dynamically and replace the value "1" in code
$id_category = 1

automatically?

function getTree($resultParents, $resultIds, $maxDepth, $id_category = 1, $currentDepth = 0) 



I just want to put the parent categories on the horizontal navigation bar ,then when click one of the parent categories, the subcategories show in the categories block correspondingly (don't show subcategories from other parent categories)

Any idea?



does anybody know how to do with this?

Share this post


Link to post
Share on other sites

Hi there,
Thank you for this solution. There is still something that I don't understand:

How do you tell which content goes in which block?

Share this post


Link to post
Share on other sites

Very good trick!!
I tryed it minutes ago and it´s works very good.

Share this post


Link to post
Share on other sites

Please someone upload a working file blockcategory2 :(


its not working for me . atm i have 1.4.2 ver.

Share this post


Link to post
Share on other sites

It works for me.Thank you.

 

One more question, how can I get the parent category's ID dynamically and replace the value "1" in code

$id_category = 1

automatically?

 

function getTree($resultParents, $resultIds, $maxDepth, $id_category = 1, $currentDepth = 0) 

 

I just want to put the parent categories on the horizontal navigation bar ,then when click one of the parent categories, the subcategories show in the categories block correspondingly (don't show subcategories from other parent categories)

 

Any idea?

 

Apologies for picking up this old post but, does anybody know hot to get dinamically the parent category and pass the id to $id_category in getTree function?

 

 

Regards,

tzatzo

Share this post


Link to post
Share on other sites

Hello, I tried this solution but it doesn't work. Please help me. I'm using current version of Prestashop. 1.6.

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More