Jump to content

Modifying a Module - TM_Specials to show featured home items


berktoppie

Recommended Posts

Hello Everyone,

 

I have a problem with the Module TM_Specials. It is a module that came with my template. It shows the current specials on the home page.

The problem is I do not have any special prize drops and I do not want the specials displayed in this box but the Home Featured products or the newest added products. 1 of these 2. But not the specials because then the box would be empty most of the time.

 

This is the code of the .tpl file

 

 

 

{if $page_name == 'index'}

<!-- tmspecials -->

<div id="tmspecials">

{*<a class="tmspecials_title" href="{$link->getPageLink('prices-drop.php')}" title="{l s='Specials' mod='tmspecials'}">{l s='Specials' mod='tmspecials'} </a>*}

{*<h4><a href="{$link->getPageLink('prices-drop.php')}" title="{l s='Specials' mod='tmspecials'}">{l s='Specials' mod='tmspecials'}</a></h4>*}

<h4>{l s='Specials' mod='tmspecials'}</h4>

<div class="block_content">

<ul>

{foreach from=$specials item=special name=specials}

{if $smarty.foreach.specials.iteration<=8}

<li class="tmsp{$smarty.foreach.specials.iteration}">

{if $special.specific_prices}

{assign var='specific_prices' value=$special.specific_prices}

{if $specific_prices.reduction_type == 'percentage' && ($specific_prices.from == $specific_prices.to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $specific_prices.to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $specific_prices.from))}

<span class="reduction">(-{$specific_prices.reduction*100|floatval}%)</span>

{/if}

{/if}

<a class="product_image" href="{$special.link}"><img src="{$link->getImageLink($special.link_rewrite, $special.id_image, 'home')}" alt="{$special.legend|escape:html:'UTF-8'}" title="{$special.name|escape:html:'UTF-8'}" /></a>

<h5><a class="product_link" href="{$special.link}" title="{$special.name|escape:html:'UTF-8'}">{$special.name|escape:html:'UTF-8'|truncate:20:'...'}</a></h5>

<p><a class="product_descr" href="{$special.link}" title="{$special.name|escape:html:'UTF-8'}">{$special.description_short|strip_tags|truncate:30:'...'}</a></p>

<span class="price">{if !$priceDisplay}{displayWtPrice p=$special.price}{else}{displayWtPrice p=$special.price_tax_exc}{/if}</span>

<span class="price-discount">{displayWtPrice p=$special.price_without_reduction}</span>

<div>

<a class="exclusive ajax_add_to_cart_button" rel="ajax_id_product_{$special.id_product}" href="{$link->getPageLink('cart.php')}?qty=1&id_product={$special.id_product}&token={$static_token}&add" title="{l s='Add to cart' mod='tmspecial'}">{l s='Add to cart' mod='tmspecial'}</a>

</div>

</li>

 

 

 

{*

<!--li>

 

<div><a class="product_image" href="{$special.link}"><img src="{$link->getImageLink($special.link_rewrite, $special.id_image, 'home_small')}" alt="{$special.legend|escape:html:'UTF-8'}" title="{$special.name|escape:html:'UTF-8'}" /></a>

<h5><a href="{$special.link}" title="{$special.name|escape:html:'UTF-8'}">{$special.name|escape:html:'UTF-8'|truncate:20:'...'}</a></h5>

<p><a href="{$special.link}" title="{$special.name|escape:html:'UTF-8'}">{$special.description_short|escape:html:'UTF-8'|strip_tags|truncate:35:'...'}</a></p>

<span class="price">{if !$priceDisplay}{displayWtPrice p=$special.price}{else}{displayWtPrice p=$special.price_tax_exc}{/if}</span>

<span class="price-discount">{displayWtPrice p=$special.price_without_reduction}</span>

</div>

<span class="price">{if !$priceDisplay}{displayWtPrice p=$special.price}{else}{displayWtPrice p=$special.price_tax_exc}{/if}</span>

<div class="price-box">

{if $special.specific_prices}

{assign var='specific_prices' value=$special.specific_prices}

{if $specific_prices.reduction_type == 'percentage' && ($specific_prices.from == $specific_prices.to OR ($smarty.now|date_format:'%Y-%m-%d %H:%M:%S' <= $specific_prices.to && $smarty.now|date_format:'%Y-%m-%d %H:%M:%S' >= $specific_prices.from))}

<span class="reduction">(-{$specific_prices.reduction*100|floatval}%)</span>

{/if}

{/if}

<a class="exclusive ajax_add_to_cart_button" rel="ajax_id_product_{$special.id_product}" href="{$link->getPageLink('cart.php')}?qty=1&id_product={$special.id_product}&token={$static_token}&add" title="{l s='Add to cart' mod='tmspecial'}">{l s='Add to cart' mod='tmspecial'}</a>

 

</li-->*}

{/if}

{/foreach}

{*<!--a class="view_all" href="{$link->getPageLink('prices-drop.php')}">{l s='All specials' mod='tmspecials'}</a-->*}

</ul>

</div>

</div>

<!-- /tmspecials -->

{/if}

 

 

I tried to change:

*<a class="tmspecials_title" href="{$link->getPageLink('prices-drop.php')}" title="{l s='Specials' mod='tmspecials'}">{l s='Specials' mod='tmspecials'} </a>*}

{*<h4><a href="{$link->getPageLink('prices-drop.php')}" title="{l s='Specials' mod='tmspecials'}">{l s='Specials' mod='tmspecials'}</a></h4>*}

 

In to:

 

*<a class="tmspecials_title" href="{$link->getPageLink('new-products.php')}" title="{l s='Specials' mod='tmspecials'}">{l s='Specials' mod='tmspecials'} </a>*}

{*<h4><a href="{$link->getPageLink('new-products.php')}" title="{l s='Specials' mod='tmspecials'}">{l s='Specials' mod='tmspecials'}</a></h4>*}

 

But it did not have any result.

 

Can someone help me changing this code so that It will display the newest added products or the products that are in the Home - category ? I do not know what is easiest to make? I prefer having the Home products displayed, but if newest products is easier to make then that would be great as well!

 

Please help! If you want some money I can pay you with Paypal!

 

Thanks!

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...