Jump to content

Featured products in my homepage-smartnewproducts modul


krecko

Recommended Posts

I'll appreciate little help about Featured products on homepage. I have a Simple great theme and this theme has it own modul for featured products on homepage (smartnewproducts). I have checked all the topics for random products on my homepage and I manage to put random in my smartnewproducts.php . I need help making all my products from home category showing randomly in smartnewproducts modul. What kind of code do I need to put inside to make this work?

 

Thanks

 

 

 

post-838115-0-94896200-1412604670_thumb.jpg

Link to comment
Share on other sites

Here is php

 

smartnewproducts.php

 

and tpl I couldn't upload. Only like this:

 

<section id="latest" class="latest span">
<h2>Latest</h2>
 
 
<div id="carousel-latest-0" class="es-carousel-wrapper">
    <div class="es-carousel">     
            {if $new_products !== false}
                {assign var='liHeight' value=250}
                {assign var='nbItemsPerLine' value=4}
                {assign var='nbLi' value=$new_products|@count}
                {math equation="nbLi/nbItemsPerLine" nbLi=$nbLi nbItemsPerLine=$nbItemsPerLine assign=nbLines}
                {math equation="nbLines*liHeight" nbLines=$nbLines|ceil liHeight=$liHeight assign=ulHeight}
        <ul>
                    {foreach from=$new_products item=newproduct name=myLoop}
            {math equation="(total%perLine)" total=$smarty.foreach.myLoop.total perLine=$nbItemsPerLine assign=totModulo}
            {if $totModulo == 0}{assign var='totModulo' value=$nbItemsPerLine}{/if}
                <li><div class="pbox">
                <div class="image"><a href="{$newproduct.link}"  class="product_image"><img src="{$link->getImageLink($newproduct.link_rewrite, $newproduct.id_image, 'home_default')}" alt="{$newproduct.name|truncate:50:'...'|escape:'htmlall':'UTF-8'}" /></a></div>
                <div class="description hidden-phone hidden-tablet">
    {$newproduct.description_short|strip_tags|truncate:65:'...'}</div>     
        <div class="name"><a href="{$newproduct.link}">{$newproduct.name|truncate:50:'...'|escape:'htmlall':'UTF-8'}</a></div>
        {if ($newproduct.id_product_attribute == 0 OR (isset($add_prod_display) AND ($add_prod_display == 1))) AND $newproduct.available_for_order AND !isset($restricted_country_mode) AND $newproduct.minimal_quantity == 1 AND $newproduct.customizable != 2 AND !$PS_CATALOG_MODE}
                        {if ($newproduct.quantity > 0 OR $newproduct.allow_oosp)}
                <div class="price">
                {if $newproduct.show_price AND !isset($restricted_country_mode) AND !$PS_CATALOG_MODE}{if !$priceDisplay}{convertPrice price=$newproduct.price}{else}{convertPrice price=$newproduct.price_tax_exc}{/if}{/if}        </div>
                <!--  -->
        <div class="cart">
             
             <a class="button exclusive ajax_add_to_cart_button" rel="ajax_id_product_{$newproduct.id_product}" href="{$link->getPageLink('cart')}?qty=1&id_product={$newproduct.id_product}&token={$static_token}&add" title="{l s='Add to cart' mod='homefeatured'}">{l s='Add to cart' mod='homefeatured'}</a>
             
        
        </div>
          {/if} {/if}
        </div></li>
            {/foreach}
                </ul>
 {else}
    <p>{l s='No new products at this time' mod='smartnewproducts'}</p>
{/if}
    </div>
</div>
</section>

<script type="text/javascript">

    $('#carousel-latest-0').elastislide({

        speed       : 450,    // animation speed
        easing      : '',    // animation easing effect


        // the minimum number of items to show. When we resize the window, this will make sure minItems are always shown (unless of course minItems is higher than the total number of elements)
                minItems    : 1
            });

    //Fix to adjust on windows resize
    $(window).triggerHandler('resize.elastislide');

</script>

 

 

Thank you Vekia!

Link to comment
Share on other sites

×
×
  • Create New...