Jump to content

Frontpage Categories Module for v1.3 and below


ejectcore
 Share

Recommended Posts

3 column layout:

div.mainpage{ padding-left:20px; margin:5px 0;}
div.mainpage ul {list-style:none;}
div.mainpage li { float: left; width: 173px; margin-right:5px;}
div.mainpage li img{width:168px; border: 1px solid #000;}

Share this post


Link to post
Share on other sites

Dave,

I installed your module and for some reason the images aren't appearing, any idea why?

Thanks,

Chris.


Any one else with this problem able to sort it out, I contacted the people who made the module and I'd rather not pay for the solution.

Share this post


Link to post
Share on other sites

Please can you explain your issue further.
Also it would help us if you can paste your source code & link to your site ;)

We have plans to release the new "Categories Interface" v1.0 (3-in-1 Categories Module) some time in April.
Also we have had several requests to develop this into a plug-in to implement with Filter Search.
see below - preview of the new categories interface panel.

20064_9fiYwNnmDWjj5baJj2tN_t

Share this post


Link to post
Share on other sites

  • 3 weeks later...

Bonjour
je souhaiterais savoir si ce module pourrait etre applique a la liste des produits ?

En fait je voudrais avoir ma liste d'article au milieu de la page mais 6 par 6

Quelqu'un saurait ?

Merci d'avance

Share this post


Link to post
Share on other sites

Bonjour
je souhaiterais savoir si ce module pourrait etre applique a la liste des produits ?

En fait je voudrais avoir ma liste d'article au milieu de la page mais 6 par 6

Quelqu'un saurait ?

Merci d'avance


english?:)

Share this post


Link to post
Share on other sites

Should be complete some time in April.
Can be completed sooner if more people contribute!


Unfortunatly we have not had enough interest from the community with our categories interface module
Currently we are extremely busy with other projects including Filter Search & Fast Checkout Pro.

However we do plan to continue this, we will need people to contribute towards development.
Due to are current schedule we can't complete development now until next month!

Share this post


Link to post
Share on other sites

  • 3 weeks later...

i am very interested in this module. It appears some have figured out how to do a 3 column configuration, but I cannot seem to figure it out. Does anyone have some complete code they could post? I would also like to change the image size.


Edit: I was able to get this working using someone elses code on one of the pages.

Share this post


Link to post
Share on other sites

It is possible to resize the category images? I use large images on each category and on the first page I would like the same image but in a tiny dimension, how can I do?

C'est possible de redimensionner les images des catégories? J'utilise pour chaque catégorie une image assez grande, en première page je voudrais une version petite de la même image...

Share this post


Link to post
Share on other sites

I FOUND THE SOLUTION!!! TROUVE LA SOLUTION! (on prestashop 1.2.5)

I installed the/jai installé le thumbgenerator : http://www.prestashop.com/forums/viewthread/2040/third_party_modules/generateur_dimage_pour_template/

Then on homecategories.tpl replace this line - Dans le fichier homecategories.tpl remplacer cette ligne :
{$category.name}

by this one/par celle-ci:
{"$img_cat_dir`$category.id_category`.jpg"|picture_resize:140:86:'dontCrop':'#FFFFFF'}

Set the image dimension as you want. Adapter la taille de l'image à vos besoins ;)
(change the values/changer les valeurs 140(largeur/width) 86 (hauteur/height)

Share this post


Link to post
Share on other sites

Then to place categories images/title on the same line, one beside the other add this to global.css:
Puis pour mettre les images des catégories une à côté de l'autre sur la même ligne ajouter cette ligne à global.css :

#homeCatWrapper #homeCat {float:left;width:140px; margin-right:3px;text-align:center;}

And add in/et ajouter dans homecategories.tpl

just after the/juste après le of the image/de l'image.


width= same width of the resized image. Each category will be next to the other one
width= même width/largeur que la valeur utilisée pour redimensionner l'image.

Final result: résultat final:

                    

   {"$img_cat_dir`$category.id_category`.jpg"|picture_resize:140:86:'dontCrop':'#FFFFFF'}




Share this post


Link to post
Share on other sites

  • 1 month later...

I found a solution :)
This is my new homecategories.tpl code

<!-- MODULE Home categories created by Alpha Media (09 May 2008) -->
{if isset($categories) AND $categories}


{foreach from=$categories item=category name=homeCategories}
{assign var='categoryLink' value=$link->getcategoryLink($category.id_category, $category.link_rewrite)}
       {if $category.id_category != '22'}    
                

   {"$img_cat_dir`$category.id_category`.jpg"|picture_resize:142:86:'dontCrop':'#FFFFFF'}



  
   {/if}


{/foreach}

{else}

{l s='No categories' mod='homecategories'}
{/if}
<!-- END MODULE Home categories -->



On line 7 i added this line with the number of the category i want to hide:

 {if $category.id_category != '22'}    



And on line 14 I close with {/if}

Marevellous!

Share this post


Link to post
Share on other sites

  • 3 weeks later...

Thought you might be interested in a modification I did to this module. It displays the categories horizontally, in 4 columns.
I',m trying to find a way to display only 4 or 8 random categories.


<!-- MODULE Home categories -->


{l s='Categories' mod='homecategories'}


{if isset($categories) AND $categories}

{assign var="cellcount" value=1}

{assign var='categoryLink' value=$link->getcategoryLink($category.id_category, $category.link_rewrite)}



{else}

{l s='No categories' mod='homecategories'}


{/if}

<!-- /MODULE Home categories -->

Share this post


Link to post
Share on other sites

  • 3 weeks later...

thank for share module, but my problem is when i want to show 1 category on the home page, and fillin 1 in "Number of categories displayed", on the home page still show all my category. Please hepl me to show 1 category on the home page .

Thanks so much!

Share this post


Link to post
Share on other sites

  • 4 weeks later...

Hello !

Thank you for this module, and I'm sorry for my bad english.

It workd, but category description is in english instead of french.
This text is in french and english, but when the shop is in french the description category is in english.

How can I fix that?

Thank you for your help

Share this post


Link to post
Share on other sites

  • 5 weeks later...

Hello Everyone,

I have some trouble with this great module. As you can see on the picture attached.

There are 2 empty slots while it should contain 2 categories.

EG: Product 1 , Product 2, Product 3, Empty, Empty, Product 4, Product 5, ...

Can anyone help me?

Here is the code for homecategories.php

<?php
class Homecategories extends Module
{
   private $_html = '';
   private $_postErrors = array();

   function __construct()
   {
       $this->name = 'homecategories';
       $this->tab = 'Home';
       $this->version = 0.1; // Module created by Alpha Media (09 May 2008)

       parent::__construct(); // The parent construct is required for translations

       $this->page = basename(__FILE__, '.php');
       $this->displayName = $this->l('Frontpage Categories');
       $this->description = $this->l('Displays categories in the middle of your homepage');
   }

   function install()
   {
       if (!Configuration::updateValue('HOME_categories_NBR', 10) OR !parent::install() OR !$this->registerHook('home'))
           return false;
       return true;
   }

   public function getContent()
   {
       $output = ''.$this->displayName.'';
       if (Tools::isSubmit('submitHomecategories'))
       {
           $nbr = intval(Tools::getValue('nbr'));
           if (!$nbr OR $nbr <= 0 OR !Validate::isInt($nbr))
               $errors[] = $this->l('Invalid number of categories');
           else
               Configuration::updateValue('HOME_categories_NBR', $nbr);
           if (isset($errors) AND sizeof($errors))
               $output .= $this->displayError(implode('
', $errors));
           else
               $output .= $this->displayConfirmation($this->l('Settings updated'));
       }
       return $output.$this->displayForm();
   }

   public function displayForm()
   {
       $output = '
       <form action="'.$_SERVER['REQUEST_URI'].'" method="post">
_path.'logo.gif" alt="" title="" />'.$this->l('Settings').'
'.$this->l('Number of categories displayed').'

                   <input type="text" size="5" name="nbr" value="'.Tools::getValue('nbr', Configuration::get('HOME_categories_NBR')).'" />

'.$this->l('The number of catgeories displayed on homepage (default: 10)').'


<input type="submit" name="submitHomecategories" value="'.$this->l('Save').'" class="button" />

       </form>';
       return $output;
   }

   function hookHome($params)
   {
       global $smarty;
       $category = new Category(1);
       $nb = intval(Configuration::get('HOME_categories_NBR'));

       $smarty->assign(array(
           'category' => $category,
           'lang' => Language::getIsoById(intval($params['cookie']->id_lang)),
       ));
       return $this->display(__FILE__, 'homecategories.tpl');
   }

}
?>




Here is the code for homecategories.tpl

<!-- MODULE Home categories -->

   {if isset($categories) AND $categories}

           {foreach from=$categories item=category name=homeCategories}
               {assign var='categoryLink' value=$link->getcategoryLink($category.id_category, $category.link_rewrite)}


{$category.name|truncate:15}

           {/foreach}

   {else}

{l s='No categories' mod='homecategories'}
   {/if}

<!-- /MODULE Home categories --> 




Here is the code for global.css

/*------------------------------------------------Meant to be homepage categories block--------------------*/
#homeCatWrapper {
    margin-left: 0px; 
}
#homeCat {
   float: left;
   width: 185px; 
}

#homeCat h5 {
   text-align: center; 
}

/*------------------------------------------------Meant to be homepage categories block END--------------------*/ 


/*** Home Categories Module  ***/

div.home_categories ul {
text-align: center;
list-style: none;
}
div.home_categories li {
float: left;
padding: 0px;
width: 185px; 
}
div.home_categories h5 a {
font-size: x-small;
color: #999;
}
div.home_categories h5 a:hover {
text-decoration:underline;
color: #444;
}
div.home_categories div {
width: 185px; 
filter:alpha(opacity=80); 
opacity: 0.8;
-moz-opacity:0.8;
border: 1px solid white; 
}
div.home_categories div:hover {
filter:alpha(opacity=100); 
opacity: 1;
-moz-opacity:1;
border: 1px solid orange; 
}

/*** Home Categories Module  END ***/

30576_ZWbL3tlYABlbZ10i1kff_t

30577_RnNHvgaT3L5dzg9NRjxz_t

Share this post


Link to post
Share on other sites

  • 3 weeks later...
  • 4 weeks later...
fulviods
Auriez vous une solution pour la version de prestashop 1.3
car j'ai essayer de tester votre solution et je me retrouver sans colonne droite ni sans le menu catégorie
Aurais je fait une fausse manip
Cordialement,


Il faut activer le menu catégorie à gauche pour que les catégories apparaissent au milieu.

Share this post


Link to post
Share on other sites

  • 2 weeks later...
  • 3 weeks later...

OK, as this is my first prestashop website, this module was really usefull, many thanx for building it.

I made a few modifications based on this and the homefeatured module to fit allmost any template design using CSS rules. I thougt I would be better to show categories in the same way than the products when you use both of these modules on the main page.

Here is the .tpl file I used, just backup your old homecategories.tpl and replace the code provided here if you want to try this version.
To edit the template (number of columns etc ...) just do it in the same way you would do for the homefeatured module.

<!-- MODULE Home categories created by Alpha Media (09 May 2008) -->
{if isset($categories) AND $categories}

{l s='Categories' mod='homecategories'}




{foreach from=$categories item=category name=homeCategories}
{assign var='categoryLink' value=$link->getcategoryLink($category.id_category, $category.link_rewrite)}
{assign var='liHeightCat' value=342}
           {assign var='nbItemsPerLineCat' value=4}
           {assign var='nbLiCat' value=$categories|@count}
           {assign var='nbLinesCat' value=$nbLiCat/$nbItemsPerLineCat|ceil}
           {assign var='ulHeightCat' value=$nbLinesCat*$liHeightCat}



{$category.name}




{l s='See more' mod='homecategories'}



           {/foreach}



{else}

{l s='No categories' mod='homecategories'}
{/if}


 
<!-- END MODULE Home categories -->



I know this isn't perfect, but I hope this will be usefull.

You can see what it looks like here :
materiel electrique shopelec
Hope you dont bother the link but 2 hours re coding it worths a backlink ;)

Cheers - Chris

Share this post


Link to post
Share on other sites

  • 3 weeks later...

no its very simple
u can add random product to main category...

add style css is simple in panel u setting how much depp of category will be how much category will show and add or not random product from all mail nategory etc> acesories ipod ...

Share this post


Link to post
Share on other sites

  • 2 weeks later...
  • 2 weeks later...

Hi all,

Does any one know if this module has been finished or if there is a completed version.

I have read all of this post, tried to install the module and am having the same trouble that a few other posters are having. All categories appear as a single line gooing down the page on the left hand side.

I saw a few posts buy the same user and others, over a period of time asking if any one knows how to fix this but can't find a solution that works.

It appears some have figured out how to do a 3 column configuration, but I cannot seem to figure it out. Does anyone have some complete code they could post?


can somebody post the CORRECT code to display a 2 or 3 column layout for the module ? please help !


I have tried modifying CSS and homecategories.tpl as suggested but the changes/additions did nothing.

The last post I saw from the author mentioned something about finishing the module around April 2009 but since then, not real posts from the author anymore.

Should be complete some time in April.
Can be completed sooner if more people contribute!


Then there are many posts that went "French" and I had to check a few times to make sure I was still in the English forums.

The last two pages, a poster is now offering to sell a module but it is different from the one that this post was started on. Does anyone know of a completed version of this module to be used with Presta v1.3.2.

I have tried a lot of the suggestions posted but many people are just posting several lines of code and there is no real mention of where to put it, in what order etc, etc.

3 column layout:
div.mainpage{ padding-left:20px; margin:5px 0;}
div.mainpage ul {list-style:none;}
div.mainpage li { float: left; width: 173px; margin-right:5px;}
div.mainpage li img{width:168px; border: 1px solid #000;}



Sorry but I am a complete novice with programming, (why I use Presta because its great for people like me) and with over 1000 files in the site, trying to figure out where to put several lines of code is becoming very time comsuming and I am just about ready to give up on this module even though I really want to use it.

Any one with a little more experience that has got this working, I would really appreciate your advice and I think a few posters on this thread might as well, especially if the original author could join back in.

Thanks

SED

Share this post


Link to post
Share on other sites

  • 2 weeks later...

Home Featured Categories Block

I wanted mine to look sort of like the home featured products box. But cleaner, with a small button on under the text. I also wanted 4 across and used a 3 column theme. I also used the modified homecategories2.zip posted earlier in this thread I believe by VIP. You can see an example at: http://www.ledlites4rvs.com I am not a programmer just messing with code posted here. Hope this helps those who are trying to do this.

So here is my code and result..

For the homecategories.tpl code:

<!-- MODULE Home categories -->

   {if isset($categories) AND $categories}

           {foreach from=$categories item=category name=homeCategories}
               {assign var='categoryLink' value=$link->getcategoryLink($category.id_category, $category.link_rewrite)}


                

{$category.name|truncate:17}



           {/foreach}

   {else}

{l s='No categories' mod='homecategories'}
   {/if}

<!-- /MODULE Home categories --> 



For the Global.css page under my theme (I entered this right in the very bottom)

/*------------------------------------------------Meant to be homepage categories block--------------------*/
#homeCatWrapper {
margin-left: 0px; /* You may not need this unless you want to try to center categories */
}
#homeCat {
float: left;
width: 138px; 
}
#homeCat h5 {
text-align: center; 
}
/*------------------------------------------------Meant to be homepage categories block END--------------------*/ 
/*** Home Categories Module  ***/

div.home_categories ul {
text-align: center;
list-style: none;
}
div.home_categories li {
float: left;
padding: 0px;
width: 138px; 
}
div.home_categories h5 a {
   font-size: large;
   color: #000;
}
div.home_categories h5 a:hover {
   text-decoration:underline;
   color: #999;
}
div.home_categories div {
width: 138px; 
filter:alpha(opacity=80); 
opacity: 0.8;
-moz-opacity:0.8;

border: 1px solid white; 
}
div.home_categories div:hover {
filter:alpha(opacity=100); 
opacity: 1;
-moz-opacity:1;
border: 1px solid black; 
}

Share this post


Link to post
Share on other sites

This is my homecatergories.tpl file

<!-- MODULE Home categories -->

{l s='Shop by Brand' mod='homecategories'}
   {if isset($categories) AND $categories}

           {foreach from=$categories item=category name=homeCategories}
               {assign var='categoryLink' value=$link->getcategoryLink($category.id_category, $category.link_rewrite)}



           {/foreach}

   {else}

{l s='No categories' mod='homecategories'}
   {/if}





<!-- /MODULE Home categories --> 



and my css

div.home_categories{height:220px}
div.home_categories ul{text-align:center;list-style:none}
div.home_categories img{width:100px;height:100px}
div.home_categories li{float:left;margin:5px;width:100px}
div.home_categories h5 a:hover{text-decoration:underline;color:#444}
div.home_categories div{width:100px;filter:alpha(opacity=70);opacity:0.7;-moz-opacity:0.7;border:1px outset black}
div.home_categories div:hover{filter:alpha(opacity=100);opacity:1;-moz-opacity:1;border:1px inset black}



which proides the result below

39591_aG0pKHPPMolDf1mGKIyl_t

  • Like 1

Share this post


Link to post
Share on other sites

  • 3 weeks later...

In 1.4 version there is a nice view of categories on a center column when you click CATEGORIES (see attached image).

Maybe it is possible somehow, to implement the same view to be displayed on fronpage?

41260_7Gks1EeYCVig8MY2RzKK_t

Share this post


Link to post
Share on other sites

i have Version 1.3.2.3 of Presta. and the module have only one column, and looks so sucks. Made all what u had said. ((((


Read through the rest of the previous comments and you'll find the correct CSS to use to make it into how ever many columsn you need and then it won't suck :)

Share this post


Link to post
Share on other sites

  • 2 weeks later...

Zenith from here has been helping me today to sort the get around for this mod in 1.4 all credit to Zenith for this im just posting it as he is a busy man updating is site.

in blockcategories.php find:

       $id_customer = (int)($params['cookie']->id_customer);


add before:

       /*  ONLY FOR HOMECATEGORIES MODULE */
       global $link;
       $smarty->assign(array(
           'categories' => Category::getHomeCategories(intval($params['cookie']->id_lang), true),
           'link' => $link
       ));



this is needed as it use to be coded in to 1.3 and in 1.4 they took it out as it wasnt needed..... well they didnt know we were using this modual, once that is done use the updated homecategories.zip file

homecategories.zip

Share this post


Link to post
Share on other sites

To have a better look of categories on Frontpage, i used chris[c01]'s code for homecategories.tpl:

<!-- MODULE Home categories created by Alpha Media (09 May 2008) -->
{if isset($categories) AND $categories}

{l s='Categories' mod='homecategories'}




{foreach from=$categories item=category name=homeCategories}
{assign var='categoryLink' value=$link->getcategoryLink($category.id_category, $category.link_rewrite)}
{assign var='liHeightCat' value=342}
           {assign var='nbItemsPerLineCat' value=4}
           {assign var='nbLiCat' value=$categories|@count}
           {assign var='nbLinesCat' value=$nbLiCat/$nbItemsPerLineCat|ceil}
           {assign var='ulHeightCat' value=$nbLinesCat*$liHeightCat}



{$category.name}




{l s='See more' mod='homecategories'}



           {/foreach}



{else}

{l s='No categories' mod='homecategories'}
{/if}


 
<!-- END MODULE Home categories -->



Didnt edited any css files.

I have an almost nice display of categories on frontpage now, but there is one problem - i dunno how to describe width and height of category images to make them display correctly - please see attached image.

Anyone could help me to solve this problem?

42232_J2NLduRKIFpnpb41E3Qs_t

Share this post


Link to post
Share on other sites

Once you have the images saved as the right size you need to go to preferences and then that size option, save for categories, and then regenerate thumbnails.. all in preferences. that should fix your problem :)


Temporary solved: just changed category image width to 39 in .tpl file :)

Share this post


Link to post
Share on other sites

Hello Spidermax,
I've downloaded your file in my PS 1.4.0.17 and in my home, i've "No Category"...??? And i've 4 in my BO.
What is the problem ?


Hello,

I have the same problem too.

Share this post


Link to post
Share on other sites