Jump to content
Sign in to follow this  
Abh

subcategorii in prima pagina

Recommended Posts

Cand apesi pe link-ul subcategoriei in breadcrumbs, apare ce se vede in poza. Din pacate nu-mi dau seama ce anume produce acel rezultat. Ce vreau eu e acelasi efect, dar cand apesi pe un buton, si sa apara continutul celor doua subcategorii pe care le am in Home.

Am instalat modulul Home Categories pe care stau de doua zile incercand sa-l fac sa afiseze subcategorii, fara succes. Din ce imi dau seama, codul din homecategories.php, in afara celui care tine de BO e:

    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');
   }



M-am tot invartit prin classes si category.php, am gasit niste metode cum ar fi getAllSubCats(), dar nu reusesc sa le folosesc.
Sugestii?

19478_Uo05t0eeL55kp7R4OAuB_t

Share this post


Link to post
Share on other sites

ok, cred ca am gasit oarecum functia,

$subcategories = $category->getChildren(18, 3);



unde 18 e id-ul categoriei. Cu ceva modificari pe orbeste in .tpl am reusit sa-mi afiseze numarul de subcategorii ale categoriei 18, fara nume, fara linkuri, toate duc inca spre /category.php?id_category=0

Share this post


Link to post
Share on other sites

Am reusit:

    function hookHome($params)
   {
       global $smarty;
       $category = new Category(1);
       $nb = intval(Configuration::get('HOME_categories_NBR'));
       $subcategories_al = $category->getChildren(9, 3);
       $subcategories_ne = $category->getChildren(13, 3);
       $smarty->assign(array(
           'category' => $category,
           'alimentare' => $subcategories_al,
           'nealimentare' => $subcategories_ne,
           'lang' => Language::getIsoById(intval($params['cookie']->id_lang)),
       ));
       return $this->display(__FILE__, 'homecategories.tpl');
   }



cele doua subcategorii principale, id 9 si id 13;
Pe urma, in homecategories.tpl:

    

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

{$category.name|truncate:35}

name}" title="{$category->name}" id="categoryImage" />


           {/foreach}





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

{$category.name|truncate:35}

name}" title="{$category->name}" id="categoryImage" />


           {/foreach}




cate un div pentru fiecare.
Si css-ul:

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



Rezultat final in poza.
Intrebare: cum pot face sa apara asta doar cand dau click pe un buton? :)
Daca fac link direct imi da: PHP Fatal error: Class 'Module' not found in C:\\Program Files\\EasyPHP5.3.0\\www\\prestashop\\modules\\homecategories\\homecategories.php on line 4, referer: http://localhost/prestashop/

19496_LhTWEf7ifr93j9fuZL2M_t

Share this post


Link to post
Share on other sites

N-am reusit sa-l fac sa functioneze direct de la buton (am un meniu orizontal), dar am creat un alt fisier cu urmatorul continut si am bagat link catre el:

<?php

include(dirname(__FILE__).'/../../config/config.inc.php');
include(dirname(__FILE__).'/../../header.php');
include(dirname(__FILE__).'/homecategories.php');
$homecategories = new homecategories();
echo $homecategories->hookHome();
include(dirname(__FILE__).'/../../footer.php');
?>

Share this post


Link to post
Share on other sites

Cred ca cel mai simplu ar fi sa folosesti o poza patrata din cele generate de Presta.
Ex: in loc de 17-category.jpg pui 17-medium.jpg sau 17-large.jpg. Tu stii cum ai codul in tpl.

Share this post


Link to post
Share on other sites

am rezolvat, am schimbat din

name}" title="{$category->name}" id="categoryImage" />


in

name}" title="{$category->name}" id="categoryImage" />



17-category era generata in 500x150, din cauza aia imi aparea ingustata, pentru ca pe margini era plin de alb.

Share this post


Link to post
Share on other sites
Sign in to follow this  

×
×
  • Create New...

Important Information

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