Jump to content

Packs module in homepage (similar to homefeatured) - Doesn't show anything


ivangoti

Recommended Posts

Hi,

 

I'm trying to create a module which displays all packs assigned to my category called "Packs" for version 1.5, similar to homefeatured, but it doesn't display anything. I've created the following files: homepacks.php, homepacks.tpl and homepacks.css.

 

In homepacks.php I have this code:

 

 

...

public function hookDisplayHome($params)

{

$category = new Category(Context::getContext()->shop->getCategory(), Configuration::get('PS_LANG_DEFAULT'));

$nb = (int)(Configuration::get('HOME_PACKS_NBR'));

$packs = $category->getProducts($params['cookie']->id_lang, 13, ($nb ? $nb : 10));

 

$this->smarty->assign(array(

'packs' => $packs,

'add_prod_display' => Configuration::get('PS_ATTRIBUTE_CATEGORY_DISPLAY'),

'homePackSize' => Image::getSize('homePack'),

));

 

return $this->display(__FILE__, 'homepacks.tpl');

}

...

 

 

13 is the category's id where I place all packs I want to display in this module.

 

 

In homepacks.tpl I have this:

 

...

{if isset($packs) AND $packs}

 

...

{foreach from=$packs item=pack name=homepacksProducts}

...

<h5><a href="{$pack.link}" title="{$pack.name|truncate:50:'...'|escape:'htmlall':'UTF-8'}">{$pack.name|truncate:100:'...'|escape:'htmlall':'UTF-8'}</a></h5>

<span class="product_desc">{$pack.description_short|strip_tags|truncate:35:'...'}</span>

...

{/foreach}

{/if}

...

 

 

What is wrong or what else do I need?

Link to comment
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
×
×
  • Create New...