Jump to content

Order of products on the featured products block


Recommended Posts

Thanks Vekia for your response. I have done the position earlier on but i wasn't just getting the effect right as the item positioning was scattered. What i mean is that some items were 4 in a row, second row had 1, third row had 3 and so on. I discussed it with a friend who suggested i do a little of hard coding to the homefeatured.tpl file and a few other file. 

 

Please find below homefeatured.tpl file to see what i did.

 

{*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to [email protected] so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
*  @author PrestaShop SA <[email protected]>
*  @copyright  2007-2013 PrestaShop SA
*  @license    http://opensource.org/licenses/afl-3.0.php  Academic Free License (AFL 3.0)
*  International Registered Trademark & Property of PrestaShop SA
*}
 
<!-- MODULE Home Featured Products -->
 
<div>
 
<table style="width:757px;">
 
<tr>
<td style="width:757px;" colspan="2">
 
<table style="background-color:#efefef;border-style: solid;border-width: 1px;border-color: #cccccc;width:757px;">
 
<tr>
<img src="http://www.---.com/mainstore/697-large_default/lenovo-a369i.jpg" height="200" width="250" ></a>
 
<!--<td><p style="padding: 5px;font-size: 18px;color: #990000;padding-bottom:0;font-weight: bold;"></br>Samsung Solar-Powered Ultra Smart Mini Laptop</p>-->
 
<td><p style="padding: 5px;font-size: 18px;color: #990000;padding-bottom:0;font-weight: bold;"></br>Lenovo A369i</p>
 
<!--<div style="padding: 7px;font-size: 13px;color: #111;padding-bottom:0;line-height:16px;"><b>SAMSUNG SOLAR-POWERED ULTRA SMART MINI LAPTOP</b>-->
 
<!--<div style="padding: 10px 30px;font-size: 15px;color: #111;padding-bottom:0;line-height:20px;">
<ul>
                        <li>Dual Core Processor</li>
                        <li>Android Jelly Bean</li>
                        <li>Dual Sim</li>
                        <li>Wi-Fi Hotspot</li>
                        <li>Micro SD Storage</li>
                        <li>Social Networking</li>
                        </ul>-->
                        
                        <div style="padding: 0px 30px;font-size: 15px;color: #111;padding-bottom:0;line-height:20px;">
<ul>
                        <li>Dual Core Processor</li>
                        <li>Android Jelly Bean</li>
                        <li>Dual Sim</li>
                        <li>Wi-Fi Hotspot</li>
                        <li>Micro SD Storage</li>
                        <li>Social Networking</li>
                        </ul>
</div>
<!--<a style="padding: 5px;font-size: 14px;color: #d6394a;padding-bottom:0;" href="http://www.---.com/mainstore/index.php?id_roduct=272&controller=product">View</a>-->
 
<br /><p class="price_container"><span style="padding: 5px;font-size: 18px;color: #990000;padding-bottom:0;font-weight: bold;">N14,300</span> <a class="exclusive" style="width:100px;text-align:center;vertical-align:middle;" href="http://www.---.com/mainstore/smartphones-/256-lenovo-a369i.html" title="Buy Now"> Buy Now! </a></p>
 
</table>
 
<tr><td style="height:20px;"> 
<tr><td colspan="4">
 
<table><tr><td><a href="http://www.---.com/mainstore/index.php?id_product=237&controller=product"><img src="img/homepic250_1.png"></td><td> 
<!--<td><img src="img/homepic250.png"></td><td> -->
<td><a href="http://www.---.com/mainstore/computers-tablets/280-nokia-lumnia-2520.html"><img src="img/homepic21.jpg"></td><td> 
 
</table>
 
</table>
 
</div>
 
<p style="height:5px;"> </p>
 
 
 
 
<div id="featured-products_block_center" class="block products_block clearfix">
<p class="title_block">{l s='Featured products' mod='homefeatured'}</p>
{if isset($products) AND $products}
<div class="block_content">
{assign var='liHeight' value=250}
{assign var='nbItemsPerLine' value=4}
{assign var='nbLi' value=$products|@count}
{math equation="nbLi/nbItemsPerLine" nbLi=$nbLi nbItemsPerLine=$nbItemsPerLine assign=nbLines}
{math equation="nbLines*liHeight" nbLines=$nbLines|ceil liHeight=$liHeight assign=ulHeight}
 
 
<table>
<!--LINE 1-->
<tr>
<td style="padding:3px;border: 1px solid #ededed;">
<table>
<tr><td><a class="lnk_more" href="http://www.---.com/mainstore/ultrabooks/440-lenovo-thinkpad-x1-carbon-ultrabook.html"><img src="http://www.---.com/mainstore/984-large_default/lenovo-thinkpad-x1-carbon-ultrabook.jpg" height="170" width="170" ></a>
<tr><td><p class="s_title_block">ThinkPad X1 Carbon Ultrabook</p>
<tr><td><div class="product_desc">New 14" ThinkPad, Core i7, 4GB RAM, 8GB Solid Face Drive, Windows 8.1</div>
<tr><td><p class="price_container"><span class="price">N 299,000</span></p>
 
</table>
 
<td style="padding:3px;border: 1px solid #ededed;">
<table>
<tr><td><a class="lnk_more" href="http://www.---.com/mainstore/computers-tablets/210-dell-3521-4974-black-.html"><img src="http://www.---.com/mainstore/620-large_default/dell-3521-4974-black-.jpg" height="170" width="170" ></a>
<tr><td><p class="s_title_block">Dell Inspiron 3521</p>
<tr><td><div class="product_desc">Dell Inspiron 3521 Dual Core (4GB, 500GB HDD) Windows 8 15.6-Inch Laptop</div>
<tr><td><p class="price_container"><span class="price">N 65,000</span></p>
 
</table>
 
<td style="padding:3px;border: 1px solid #ededed;">
<table>
<tr><td><a class="lnk_more" href="http://www.---.com/mainstore/index.php?id_product=305&controller=product"><img src="http://www.---.com/mainstore/img/p/8/0/0/800-large_default.jpg" height="170" width="170" ></a>
<tr><td><p class="s_title_block">Apple iphone 5s (64GB)</p>
<tr><td><div class="product_desc">Back-illuminated sensor (BSI), Autofocus, Touch to focus...</div>
<tr><td><p class="price_container"><span class="price">N 177,500</span></p>
 
</table>
 
<td style="padding:3px;border: 1px solid #ededed;">
<table>
<tr><td><a class="lnk_more" href="http://www.---.com/mainstore/index.php?id_product=274&controller=product"><img src="http://www.---.com/mainstore/img/p/7/2/3/723-home_default.jpg" height="170" width="170" ></a>
<tr><td><p class="s_title_block">HP Pavilion 15</p>
<tr><td><div class="product_desc">HP Pavilion 15-n002sia Intel Core i3-2.4GHz, 4GB RAM, 500GB HDD</div>
<tr><td><p class="price_container"><span class="price">N 88,000</span></p>
 
</table>
 
 
<tr><td style="height:20px;"> 
 
<!--LINE 2-->
<tr>
<td style="padding:3px;border: 1px solid #ededed;">
<table>
<tr><td><a class="lnk_more" href="http://www.---.com/mainstore/index.php?id_product=329&controller=product"><img src="http://www.---.com/mainstore/img/p/8/9/5/895-large_default.jpg" height="170" width="170" ></a>
<tr><td><p class="s_title_block">Apple Macbook Air</p>
<tr><td><div class="product_desc">Apple Macbook Air 13 inch, 128GB 1.3GHz Dual-Core Intel Core i5...</div>
<tr><td><p class="price_container"><span class="price">N 180,000</span></p>
 
</table>
 
<td style="padding:3px;border: 1px solid #ededed;">
<table>
<tr><td><a class="lnk_more" href="http://www.---.com/mainstore/index.php?id_product=194&controller=product"><img src="http://www.---.com/mainstore/img/p/5/9/4/594-home_default.jpg" height="170" width="170" ></a>
<tr><td><p class="s_title_block">HP 250</p>
<tr><td><div class="product_desc">HP 250 Intel Pentium 4GB, 500GB, DVD RW, 15.6, Wireless</div>
<tr><td><p class="price_container"><span class="price">N 67,000</span></p>
 
</table>
 
<td style="padding:3px;border: 1px solid #ededed;">
<table>
<tr><td><a class="lnk_more" href="http://www.---.com/mainstore/networking-security-power/403-apc-essential-surgearrest-5-outlets-.html"><img src="http://www.---.com/mainstore/919-large_default/apc-essential-surgearrest-5-outlets-.jpg" height="170" width="170" ></a>
<tr><td><p class="s_title_block">APC Essential Surge Arrest</p>
<tr><td><div class="product_desc">This P5B-UK surge protector by APC is the ideal way to keep your computer...</div>
<tr><td><p class="price_container"><span class="price">N 2,850</span></p>
 
</table>
 
<td style="padding:3px;border: 1px solid #ededed;">
<table>
<tr><td><a class="lnk_more" href="http://www.---.com/mainstore/index.php?id_product=291&controller=product"><img src="http://www.---.com/mainstore/img/p/7/6/7/767-home_default.jpg" height="170" width="170" ></a>
<tr><td><p class="s_title_block">HP Desktop 3500MT</p>
<tr><td><div class="product_desc">HP DESKTOP 3500MT  4GB 500GB DOS</div>
<tr><td><p class="price_container"><span class="price">N 88,000</span></p>
 
</table>
 
<tr><td style="height:20px;"> 
 
<!--LINE 3-->
<tr>
<td style="padding:3px;border: 1px solid #ededed;">
<table>
<tr><td><a class="lnk_more" href="http://www.---.com/mainstore/index.php?id_product=281&controller=product"><img src="http://www.---.com/mainstore/img/p/7/5/2/752-home_default.jpg" height="170" width="170" ></a>
<tr><td><p class="s_title_block">HP 3525 </p>
<tr><td><div class="product_desc">HP Deskjet Ink Advantage 3525</div>
<tr><td><p class="price_container"><span class="price">N 16,100</span></p>
 
</table>
 
<td style="padding:3px;border: 1px solid #ededed;">
 
                        <table>
<tr><td><a class="lnk_more" href="http://www.---.com/mainstore/components-accesories/366-apple-campus-mini-backpack.html"><img src="http://www.---.com/mainstore/838-large_default/apple-campus-mini-backpack.jpg" height="170" width="170" ></a>
<tr><td><p class="s_title_block">Apple CAMPUS MINI BACKPACK</p>
<tr><td><div class="product_desc">The Campus Collection Mini Backpack features a trimmed down silhouette...</div>
<tr><td><p class="price_container"><span class="price">N 10,700</span></p>
 
</table>
 
<td style="padding:3px;border: 1px solid #ededed;">
<table>
<tr><td><a class="lnk_more" href="http://www.---.com/mainstore/index.php?id_product=21&controller=product"><img src="http://www.---.com/mainstore/img/p/5/8/58-home_default.jpg" height="170" width="170" ></a>
<tr><td><p class="s_title_block">Toshiba STOR.E</p>
<tr><td><div class="product_desc">Toshiba STOR.E CANVIO V7 USB 3.0  500GB (RED) HARD DISC.</div>
<tr><td><p class="price_container"><span class="price">N 11,235</span></p>
 
</table>
 
<td style="padding:3px;border: 1px solid #ededed;">
<table>
<tr><td><a class="lnk_more" href="http://www.---.com/mainstore/index.php?id_product=279&controller=product"><img src="http://www.---.com/mainstore/img/p/7/4/7/747-home_default.jpg" height="170" width="170" ></a>
<tr><td><p class="s_title_block">Lenovo A680</p>
<tr><td><div class="product_desc">Lenovo A680 5 Inch Display Screen Dual SIM Android 4.2 Jelly Bean.</div>
<tr><td><p class="price_container"><span class="price">N 22,500</span></p>
 
</table>
 
                     <tr><td style="height:20px;"> 
 
<!--LINE 4-->
<tr>
<td style="padding:3px;border: 1px solid #ededed;">
<table>
<tr><td><a class="lnk_more" href="http://www.---.com/mainstore/index.php?id_product=302&controller=product"><img src="http://www.---.com/mainstore/img/p/7/9/6/796-large_default.jpg" height="170" width="170" ></a>
<tr><td><p class="s_title_block">Apple iphone 5C</p>
<tr><td><div class="product_desc">iPhone 5C is essentially a repackaged iPhone 5 available in five colorful new plastic shells </div>
<tr><td><p class="price_container"><span class="price">N 114,000</span></p>
 
</table>
 
<td style="padding:3px;border: 1px solid #ededed;">
 
                        <table>
<tr><td><a class="lnk_more" href="http://www.---.com/mainstore/index.php?id_product=287&controller=product"><img src="http://www.---.com/mainstore/img/p/7/6/1/761-home_default.jpg" height="170" width="170" ></a>
<tr><td><p class="s_title_block">HP Pavilion 14</p>
<tr><td><div class="product_desc">HP Pavilion 14-Intel Core i5 with Turbo Boost Technology up to 2.7GHz</div>
<tr><td><p class="price_container"><span class="price">N 130,000</span></p>
 
</table>
 
<td style="padding:3px;border: 1px solid #ededed;">
<table>
<tr><td><a class="lnk_more" href="http://www.---.com/mainstore/index.php?id_product=262&controller=product"><img src="http://www.---.com/mainstore/img/p/7/0/3/703-home_default.jpg" height="170" width="170" ></a>
<tr><td><p class="s_title_block">Lenovo S960(Vibe X) </p>
<tr><td><div class="product_desc">Enjoy unimagined clarity with the Vibe X 5inch 1920 x 1080</div>
<tr><td><p class="price_container"><span class="price">N 65,000</span></p>
 
</table>
 
<td style="padding:3px;border: 1px solid #ededed;">
 
                      <table>
<tr><td><a class="lnk_more" href="http://www.---.com/mainstore/computers-tablets/283-hp-slate-10-hd.html"><img src="http://www.---.com/mainstore/757-large_default/hp-slate-10-hd.jpg" height="170" width="170" ></a>
<tr><td><p class="s_title_block">HP SLATE 10 HD TABLET</p>
<tr><td><div class="product_desc">Dual Core-1.2GHz (1GB,16GB HDD,WiFI,3G) 10-Inch Android Tablet</div>
<tr><td><p class="price_container"><span class="price">N 49,990</span></p>
 
</table>
 
<!--Close All -->
</table>
 
</div>
{else}
<p>{l s='No featured products' mod='homefeatured'}</p>
{/if}
</div>
<!-- /MODULE Home Featured Products -->
Link to comment
Share on other sites

it is, definitely :-)

 

in homefeatured.css you've got bug

#featured-products_block_center li {
margin-right: 10px;
padding: 10px 5px;
width: 165px;
height: 250px margin-bottom:20px;
}

there is no semicolon after height: 250px

Link to comment
Share on other sites

There's, this is what have got in there

.

.

.

#featured-products_block_center li {
margin-right:10px;
padding:10px 0;
width:126px;
height:240px
}
#featured-products_block_center li.last_item_of_line  {margin-right:0;}
#featured-products_block_center .s_title_block,  #featured-products_block_center h5 {
padding-top:5px;
height:30px;
font-size:12px;
color:#222;
padding-bottom: 0;
font-weight:bold;
}
 
#featured-products_block_center .product_image {
display:block;
position:relative;
overflow:hidden
}
#featured-products_block_center .product_image span.new {
display: block;
position: absolute;
top: 15px;
right:-30px;
padding: 1px 4px;
width: 101px;
font-size:10px;
color: #fff;
text-align: center;
text-transform: uppercase;
-moz-transform: rotate(45deg);
-webkit-transform: rotate(45deg);
-o-transform:rotate(45deg);
-ms-transform: rotate(45deg);
background-color: #990000;
transform: rotate(45deg);  /* Newer browsers */
}
 
#featured-products_block_center .product_desc {height:45px;}
#featured-products_block_center .product_desc,
#featured-products_block_center .product_desc a {
color:#666
}
#featured-products_block_center .lnk_more {
display:inline;
padding-right:10px;
font-weight:bold;
font-size:10px;
color:#0088cc;
background:url(../img/arrow_right_1.png) no-repeat 100% 3px;
}
#featured-products_block_center .price_container {
margin-top:10px;
padding:0;
}
#featured-products_block_center .price {
font-weight:bold;
font-size:14px;
color:#990000
}
#featured-products_block_center li .ajax_add_to_cart_button {display:none;}
#featured-products_block_center li span.exclusive {display:none;}
Link to comment
Share on other sites

The height value in homefeatured.css is broken

 

 

#featured-products_block_center li {
margin-right: 10px;
padding: 10px 5px;
width: 165px;
height: 250px margin-bottom: 20px;
}
 
Missing a semicolon ;)
 
As for the longer block, try increasing each element's width or margin
Link to comment
Share on other sites

Thanks, Nemo1. I have searched through all the line of code in homefeatured.css and everything appears fine (i guess). 

Be patience with me as am entirely new to prestashop. I don't know where to increase each element's width or margin for a longer block

Link to comment
Share on other sites

yes, but you have to hardcode the change in homefeatured.php

HomeFeatured::$cache_products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8), 'position');

to

HomeFeatured::$cache_products = $category->getProducts((int)Context::getContext()->language->id, 1, ($nb ? $nb : 8), null, null, false, true, true);

The clear cache

Link to comment
Share on other sites

Thanks Nemo1, i applied the above changes, but discovered that it was only displaying one product at a time. What i really want to achieve is getting products under category displayed randomly. For example, the first row displaying accessories, second row displaying laptops, third row displaying printers etc. so i can have different headings for each row. If possible it should alternate products automatically. 

 

 

Thanks in anticipation

Link to comment
Share on other sites

×
×
  • Create New...