Jump to content

[MODULE] Two Categories Block?


Ehinarr
 Share

Recommended Posts

Hi all,

I made this module and it seems to work fine. It is a modification of the original blockcategories.
It allows you to display the block of the categories on the right side and left side. But each side with different categories.

All you need is:

- Create a new category and put it ID on the module configuration.

- From then on, every category you want to be shown on the right side, you put it in this category.

- The categories on the right side do not appear on the left side

- If the function to show the categories on the right side is not enabled, the module will function as the blockcategories original.

I think that developers will quickly update this module.

I just tested it on PS v1.3.7.

Update v1.2:
- Fixed translations;
- Now can be set a main categorie different that the default one to be applied to the left column block as the right column block is.

esblockcategories.zip

esblockcategories12.zip

Share this post


Link to post
Share on other sites

This is fantastic, exactly what I needed.

I just have two question?

would I get anothe category if I try to duplicate the module? - I really need three

Also what would I need to modify to get the new category on the left, instead of on the right (as in my design I do not have a right column)

Thanks for sharing this great module

Share this post


Link to post
Share on other sites

Hi Ehinarr,

I am looking for something similar and wanted to test your contribution. Unfortunately, the zip file appears to be corrupt. :-S I already tried Firefox, IE and Chrome, just in case.

Could you please re-upload it and let us know?

Thanks in advance.

Share this post


Link to post
Share on other sites

Hi Ehinarr,

I am looking for something similar and wanted to test your contribution. Unfortunately, the zip file appears to be corrupt. :-S I already tried Firefox, IE and Chrome, just in case.

Could you please re-upload it and let us know?

Thanks in advance.


Just rename esblockcategories.zip to esblockcategories.rar.

Share this post


Link to post
Share on other sites

This is fantastic, exactly what I needed.

I just have two question?

would I get anothe category if I try to duplicate the module? - I really need three

Also what would I need to modify to get the new category on the left, instead of on the right (as in my design I do not have a right column)

Thanks for sharing this great module


The two blocks on the same side? And yet one more? I need some time to think about it, at this moment, it is not possible. But three blocks, two on one side, I think it's easier to do.

Share this post


Link to post
Share on other sites

how about four blocks, 3 left, one right, and then end up hidding the right column

the thing is, I need 3 categories, like: "cars", "bikes", "trucks" - each holding the types of each. and I have designed the layout without using the right column

thanks

Share this post


Link to post
Share on other sites

Thanks, I can install it now.

Apologies if I am missing the obvious, but I end up with another "Categories" block on the left hand column and an empty "Categories B" block on the right hand which I cannot populate.

In any case, I am looking for a way of showing two Category blocks, with a different list of categories, one from the other, but the same product maybe referred from either block.

For example, in my case, "Echinacea" belongs to "Medicinal Plants" and "Immune System" and I want a category block for "Body Systems" and another for the rest.

Is there a way to achieve it without complicated mods?

Cheers!

Share this post


Link to post
Share on other sites

Fireman28: this is what I did :

the way I understood it is that "category B" and one "categories" on the left hand side one belong to this script. Whereas one other "categories" box belongs to your main (normal) category module (so you just disable that module)

the "category B" block could belong to your "Medicinal Plants" (if you add its id to config) then if you place “Echinacea” as the child of "Medicinal Plants" then you will see “Echinacea” under "category B"

then you just need to modify line 5 of esblockcategories.tpl to change "category B" to "Medicinal Plants" (Unless there is another way)

of course the Ehinarr might explain it easier but thats how it worked for me

Share this post


Link to post
Share on other sites

@Fireman28:

The B Categories Block (Right Column), it does not populate itself. You must create a main categorie, put it in the module configuration and put as child of it all those categories you want to show on right column.

Share this post


Link to post
Share on other sites

@aurelkurtula:

Since you are testing, and I did not find yet a easy way to put all categories block on the same side, I will upload a version of the module that allows to choose the main categorie of the left column too. So if you duplicate this module, you will get as many categories as you want, I hope.

Share this post


Link to post
Share on other sites

this is fantastic, I can now disable category b and enable a (as I don't want both).

As I said before I would love to have 3 gategory blocks like category a - you said I just need to dublicate them but I don't know how to do it.

I tried to follow this link http://www.prestashop.com/forums/viewthread/26099/ but it does not work

Even better, I tried to buplicate you functions in order to get "category C" within the same module. I got the ne form showing in the admin area but when I it brakes the view pages.

would you bee able to suggest how I can achieve this?

Share this post


Link to post
Share on other sites

So far, so good. Thanks Ehinarr for all the effort, and aurelkurtula for your contribution.

I am trying the second version, using only the Category A block, and it shows the sub categories perfectly.

Now, my novice questions:

- How do I "remove" the category I am using as the parent of the "Category A" block from the main PS Category block?

- How do I change the heading of the "Category A" block ("Categories" as it shows now)? I tried the ES translation for "Category A" and some mod on the esblockcategories.tpl file, on line 5, but did not work.

Best wishes

Share this post


Link to post
Share on other sites

Translations are done in the usual way, via the BO-> Translations-> Modules Translations.

To remove the category A of Blockcategories original module, you must open the blockcategories.php file and search in it the hookLeftColumn function and modifies this function as follows:

After:

       if (isset($_GET['id_product']))
       {            
           if (!isset($cookie->last_visited_category) OR !Product::idIsOnCategoryId(intval($_GET['id_product']), array('0' => array('id_category' => $cookie->last_visited_category))))
           {
               $product = new Product(intval($_GET['id_product']));
               if (isset($product) AND Validate::isLoadedObject($product))
                   $cookie->last_visited_category = intval($product->id_category_default);
           }
           $smarty->assign('currentCategoryId', intval($cookie->last_visited_category));
       }    



Put this:

        foreach($blockCategTree['children'] AS $k => $v)
       {
           if($v['id'] == Configuration::get('ESBLOCK_CATEG_ACAT_ID'))
           unset($blockCategTree['children'][$k]);
       }



Eu não testei isso ainda, mas acho que ele funciona.

  • Like 1

Share this post


Link to post
Share on other sites

Woohooo!!! It works!! :lol:

I am on version 1.4.3 and could not find the code you told me, Ehinarr...BUT you gave me the clue about the php file.
I inserted the SQL code

(c.id_category <> XX AND c.id_parent <> XX) AND


being XX the Category ID I wanted to "vanish", just after the WHERE in each SELECT clause and Voila!! Gone!!
(this opens the door to a few other tricks I wanted to do.. ;-) )

And my problem with the block name was due to the Smarty's Cache and Force Compile settings. Changed them while I was making the modifications and it all worked...Now they are back to recommended settings and still alive...

:wow: BIG Thank you!!!!!!!!

Share this post


Link to post
Share on other sites

Can you please give me some tips on how I can dublicate category a (on the left) so I get 3 different categories on the left

I have managed to dublicate the module, but any modification I make to one module translates to the other product. So if I use id 1 in one module it would be the same in the other module

It seems that I have changed the appearance of the module - but I am still writing to the same database record and both modules read and write on the same database record
can you help

Share this post


Link to post
Share on other sites

  • 1 month later...
  • 4 months later...

Great module! But I am having some issues. I am currently using 1.4.5, I have set Categories A to ID 2 but there is no way for me to add any catagories in there. How do I fix this? It is not letting me add another parent catagory? what am I doing wrong?

Share this post


Link to post
Share on other sites

  • 4 months later...

Very good module, exactly what I was looking for, any ideas how to get both categories (A and B) on the left column? I can move it with live edit but than it disappear in the FO

Share this post


Link to post
Share on other sites

  • 2 months later...
  • 1 month later...

Hi all,

 

I've been using this great module for months but I've run into a small problem. I'm trying out the free mobile theme v0.36. When the module is enabled the theme doesn't load at all and I get the following error in error_log:

 

 

[06-Oct-2012 10:36:18] PHP Fatal error: Uncaught exception 'SmartyException' with message 'Unable to load template file '/home/dermalse/public_html/dermalsense.com/themes/prestashop_mobile/modules/blockcategories/category-tree-branch.tpl' in '/home/dermalse/public_html/dermalsense.com/modules/esblockcategories/esblockcategories.tpl'' in /home/dermalse/public_html/dermalsense.com/tools/smarty/sysplugins/smarty_internal_templatebase.php:127

Stack trace:

#0 /home/dermalse/public_html/dermalsense.com/tools/smarty/sysplugins/smarty_internal_template.php(286): Smarty_Internal_TemplateBase->fetch(NULL, NULL, NULL, NULL, false, false, true)

#1 /home/dermalse/public_html/dermalsense.com/tools/smarty/compile/538cf799c374e4e7a13b558bdbadd5696b74932e.file.esblockcategories.tpl.php(51): Smarty_Internal_Template->getSubTemplate('/home/dermalse/...', NULL, NULL, NULL, NULL, Array, 0)

#2 /home/dermalse/public_html/dermalsense.com/tools/smarty/sysplugins/smarty_internal_templatebase.php(180): content_506f907b4ebbe1_97352032(Object(Smarty_Internal_Template))

#3 /hom in /home/dermalse/public_html/dermalsense.com/tools/smarty/sysplugins/smarty_internal_templatebase.php on line 127

 

If I disable the module the theme works fine.

 

Is there any way to disable the module on the mobile version (m.mysite.com), but enable it on the full version?

 

Cheers

 

Paul

Share this post


Link to post
Share on other sites

  • 2 months later...
  • 2 months later...
  • 4 weeks later...
  • 2 weeks later...
  • 2 years later...

Hi there, 

I would like something similar to these two blocks, but it does not work for me. (the file must be corrupted). I'm using Prestashop 1.6.0.5

I have been reading other topics like this https://www.prestashop.com/forums/topic/92594-tutorialtwo-block-categories/ but it doesn't work in my version.

There is also another thread in the French forum https://www.prestashop.com/forums/topic/80390-module-2nd-block-categories/ but I couldn't even download the module.

 

Any other ideas, please? What I need, is to duplicate the categories block.

Thanks so much,

malloco

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...

Important Information

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