Jump to content

[TUTORIAL]Two Block Categories


illohacker
 Share

Recommended Posts

Ok, in first step, i want to tell us that my english its so poor, and i hate google translate :D

1.- Acces by FTP to /modules
2.- Copy Blockcategories folder, to your PC.
3.- Rename Blockcategories folder to Blockcategories2
4.- In the Blockcategories2 folder, rename blockcategories.tpl to blockcategories2.php and blockcategories2.tpl to blockcategories2.php
5.- Edit your blockcategories2.php, find and replace “blockcategories” to “blockcategories2”. (ALL WORD).
6.- WARNING here is the problmen :D
7.- if you have got the category, no problem, you must to create a father category for example categories2
8.- You have to edit your category to show in the second block and choose the father categori (categories2)
9.- Before: Initial ——> 1 Computer + ——————-> 10 Case ——————-> 11 Sound
10.- After: Initial ——>Computer + ——————-> 2 Categories2 + ——————-> 10 Case + ——————-> 11 Sound
11.- Edit your blockcategories2.php and find this “function getTree($resultParents, $resultIds, $maxDepth, $id_category = 1, $currentDepth = 0)” when the $id_category= 1 is the number of the category. In this example is 2.

12.- Up the folder blockcategories2 to /modules and install.

13.- Thanks for All, and if u have got same problem, please contact with me.

DEMO: http://home-pc.es

  • Like 1

Share this post


Link to post
Share on other sites

  • 7 months later...

Hello,

 

I don't know if anyone is still following this topic but i have a problem with the second parent category. After following all the steps indicated above, I managed to have a second category block on front office but this new parent category doesn't show up in the back office so I am not able to create a sub-category for the new block.

 

Do you have any idea about why isn't it working?

 

Thank you all.

Share this post


Link to post
Share on other sites

I just figured it out! Oh yeaaaaaaaaaaah! :D

 

So here are the steps, I resume a little what illohacker said:

 

1. We duplicate blockcategories adding a new block with the name blockcategories2. We enter in the second block and change blockcategories.tpl name into blockcategories2.tpl and blockcategories.php name into blockcategories2.php

2. We enter in blockcategories2.php and find and replace all blockcategories to blockcategories2. Proceed installing the second module in backoffice-modules (it will now appear a second block in front office).

3. Go to back office and create 2 main sub-categories in the home parent (you can create more) which will show on front office (I did Category 1 and Category 2). These 2 categories must be linked to the 2 category modules we have currently installed in backoffice, ok? How do we do that?

Each category has an ID, a name, a description, position etc and that ID is the SECRET for making the category modules work! I couldn't figure out before about what ID's were people talking. :D Using those IDs we can connect each module to a certaind category from front office.

4. So you take the first category's ID (its number) and insert it in blockcategories.php (the initial category module of prestashop) in the line "$resultParents, $resultIds, $maxDepth, $id_category = 1, $currentDepth = 0" adding it instead of "1". In my case, the category's number was 37 so I added that number in the first category module, connecting the first block on front office to that category from back office - Catalog.

5. Take the second category's ID (in my case the number was 38, the number given automatically when created this category in back office) and insert it in the duplicated categoryblock in the same line as above. In my case, that line became "$resultParents, $resultIds, $maxDepth, $id_category = 38, $currentDepth = 0".

We now have just linked the 2 category modules to the 2 categories created in back office (parent HOME).

6.You can procced creating now other categories and linking them either to first module or to the second one.

 

I am so happy I finally did it! Prestashop rules B)

  • Like 2

Share this post


Link to post
Share on other sites

  • 2 weeks later...
  • 1 month later...

I just figured it out! Oh yeaaaaaaaaaaah! :D

 

So here are the steps, I resume a little what illohacker said:

 

1. We duplicate blockcategories adding a new block with the name blockcategories2. We enter in the second block and change blockcategories.tpl name into blockcategories2.tpl and blockcategories.php name into blockcategories2.php

2. We enter in blockcategories2.php and find and replace all blockcategories to blockcategories2. Proceed installing the second module in backoffice-modules (it will now appear a second block in front office).

3. Go to back office and create 2 main sub-categories in the home parent (you can create more) which will show on front office (I did Category 1 and Category 2). These 2 categories must be linked to the 2 category modules we have currently installed in backoffice, ok? How do we do that?

Each category has an ID, a name, a description, position etc and that ID is the SECRET for making the category modules work! I couldn't figure out before about what ID's were people talking. :D Using those IDs we can connect each module to a certaind category from front office.

4. So you take the first category's ID (its number) and insert it in blockcategories.php (the initial category module of prestashop) in the line "$resultParents, $resultIds, $maxDepth, $id_category = 1, $currentDepth = 0" adding it instead of "1". In my case, the category's number was 37 so I added that number in the first category module, connecting the first block on front office to that category from back office - Catalog.

5. Take the second category's ID (in my case the number was 38, the number given automatically when created this category in back office) and insert it in the duplicated categoryblock in the same line as above. In my case, that line became "$resultParents, $resultIds, $maxDepth, $id_category = 38, $currentDepth = 0".

We now have just linked the 2 category modules to the 2 categories created in back office (parent HOME).

6.You can procced creating now other categories and linking them either to first module or to the second one.

 

I am so happy I finally did it! Prestashop rules B)

Can you upload pictures? i just can't see it working (o deja tu mail XD)

Share this post


Link to post
Share on other sites

  • 6 months later...
  • 2 months later...
  • 2 years later...

sorry to dig this up but, I've done the same method to create an extra category block but the second one I've create just kept showing the same categories in the the category 1. so they are both the same I don't know how to configure this also my original value in category_id is equal to "null" when I did the editing.

Share this post


Link to post
Share on other sites

  • 7 months later...

Everything is good, the second block is installed. But if i modified id category in blockcategories.php from "null" to "38" (is valid this id) nothing happening.

My code is "($resultParents, $resultIds, $maxDepth, $id_category = null, $currentDepth = 0)"

Location from which take blockcategories.php for modified is /public_html/modules/blockcategories

Can you help me with a solution?

Thank you for your help.

Share this post


Link to post
Share on other sites

Guest
This topic is now closed to further replies.
 Share

×
×
  • Create New...

Important Information

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