Jump to content
Sign in to follow this  
Germán Oronoz Arbide

Favorite products hook on displayHome

Recommended Posts

Hello everyone,

 

I am trying to show on the displayHome hook a block with the logged user's favorite products.

 

I put this into the favoriteproducts.php from the module's folder:

				|| !$this->registerHook('displayHome')

and a few lines below this:

	public function hookDisplayHome($params)
	{
		$this->smarty->assign('in_footer', false);
		return $this->display(__FILE__, 'favoriteproducts-home.tpl');
	}

Then I created the template favoriteproducts-home.tpl and put it on mytheme/modules/favoriteproducts/views/templates/front

With the following content (picked from the original favoriteproducts-account.tpl):

<div id="favoriteproducts_block_account">
	<h1 class="page-header">{l s='My favorite products' mod='favoriteproducts'}</h1>

	{if $favoriteProducts}
    	<ul class="grid grid-2">
			{foreach from=$favoriteProducts item=favoriteProduct}
			<li class="item">
            	<div class="favoriteproduct inner-content box">
                    <a class="img-wrapper t-align-center" href="{$link->getProductLink($favoriteProduct.id_product, null, null, null, null, $favoriteProduct.id_shop)|escape:'html':'UTF-8'}">
                        <img class="item-image replace-retina" src="{$link->getImageLink($favoriteProduct.link_rewrite, $favoriteProduct.image, 'atmn_small')|escape:'html':'UTF-8'}" alt=""/>
                    </a>
                    <div class="item-details">
                        <a class="item-name-link" href="{$link->getProductLink($favoriteProduct.id_product, null, null, null, null, $favoriteProduct.id_shop)|escape:'html':'UTF-8'}">
                            {$favoriteProduct.name|escape:'html':'UTF-8'}
                        </a>
                        <div class="item-description">
                            {$favoriteProduct.description_short|strip_tags|escape:'html':'UTF-8'}
                        </div>
                    </div>
                    <div class="remove">
                    	<a href="#" onclick="return false" rel="ajax_id_favoriteproduct_{$favoriteProduct.id_product}">
                    		<span class="wpicon wpicon-close small"></span>
                    	</a>
                    </div>
                </div>
			</li>
			{/foreach}
        </ul>
	{else}
		<p class="alert alert-warning">{l s='No favorite products have been determined just yet. ' mod='favoriteproducts'}</p>
	{/if}

    <ul class="footer_links">
        <li class="back-to-myaccount">
            <a class="button-2 fill inline" href="{$link->getPageLink('my-account', true)|escape:'html':'UTF-8'}">
                <span class="wpicon wpicon-user"></span>{l s='Back to Your Account'}
            </a>
        </li>
    </ul>
</div>

After, from modules -> positions I put the module into displayHome.

 

This all done, I see the module working but not showing the favorite products list, only:

prueba.png

 

Any one knows how to make this work?

 

An help would be much appreciated.

 

Best regards to all!

Share this post


Link to post
Share on other sites
Guest
This topic is now closed to further replies.
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