needforspeed Posted September 25, 2010 Share Posted September 25, 2010 hi guysi want to ask about how to set the home page as a list of my products that i sell with the price also...not just the featured products, coz i have a lot of productsthanks a lot Link to comment Share on other sites More sharing options...
needforspeed Posted September 26, 2010 Author Share Posted September 26, 2010 Anyone help me please... Link to comment Share on other sites More sharing options...
rocky Posted September 26, 2010 Share Posted September 26, 2010 I don't understand what you want. Do you want the homepage to be displayed like category.php?id_category=1 Link to comment Share on other sites More sharing options...
needforspeed Posted September 26, 2010 Author Share Posted September 26, 2010 I want the index will be like this :http://www.akusukatas.com/shop/I dont want if there's onky featured product. Link to comment Share on other sites More sharing options...
rocky Posted September 26, 2010 Share Posted September 26, 2010 So basically, you want lots of new products instead of featured products? You could copy the code from new-products.php into index.php and the code from modules/homefeatured/homefeatured.tpl into index.tpl in your theme's directory to make the homepage display new products in the style of the featured products block. You can define how many new products you want by adding the following before line 11 of the new index.php: $n = 24; Link to comment Share on other sites More sharing options...
needforspeed Posted September 26, 2010 Author Share Posted September 26, 2010 Sorry, i don't know what you mean.Could you please be more detail ?And i also dont know where the file like new-products.php is locatedThanks Link to comment Share on other sites More sharing options...
rocky Posted September 27, 2010 Share Posted September 27, 2010 Replace index.php in the root directory of PrestaShop with: <?php include(dirname(__FILE__).'/config/config.inc.php'); include(dirname(__FILE__).'/header.php'); include(dirname(__FILE__).'/product-sort.php'); $n = 24; $nbProducts = intval(Product::getNewProducts(intval($cookie->id_lang), isset($p) ? intval($p) - 1 : NULL, isset($n) ? intval($n) : NULL, true)); include(dirname(__FILE__).'/pagination.php'); $smarty->assign(array( 'homeSize' => Image::getSize('home'), 'products' => Product::getNewProducts(intval($cookie->id_lang), intval($p) - 1, intval($n), false, $orderBy, $orderWay), 'nbProducts' => intval($nbProducts))); $smarty->display(_PS_THEME_DIR_.'index.tpl'); include(dirname(__FILE__).'/footer.php'); ?> and index.tpl in your theme's directory with: <!-- MODULE Home Featured Products --> {l s='New arrivals'} {if isset($products) AND $products} {assign var='liHeight' value=342} {assign var='nbItemsPerLine' value=4} {assign var='nbLi' value=$products|@count} {assign var='nbLines' value=$nbLi/$nbItemsPerLine|ceil} {assign var='ulHeight' value=$nbLines*$liHeight} {foreach from=$products item=product name=homeFeaturedProducts} {$product.name|truncate:27:'...'|escape:'htmlall':'UTF-8'} {$product.description_short|strip_tags|truncate:130:'...'} getImageLink($product.link_rewrite, $product.id_image, 'home')}" height="{$homeSize.height}" width="{$homeSize.width}" alt="{$product.name|escape:html:'UTF-8'}" /> {if !$priceDisplay}{convertPrice price=$product.price}{else}{convertPrice price=$product.price_tax_exc}{/if} {l s='View'} {if ($product.quantity > 0 OR $product.allow_oosp) AND $product.customizable != 2} {l s='Add to cart'} {else} {l s='Add to cart'} {/if} {/foreach} {else} {l s='No new arrivals'} {/if} <!-- /MODULE Home Featured Products --> Link to comment Share on other sites More sharing options...
needforspeed Posted September 27, 2010 Author Share Posted September 27, 2010 Wow, very nice info..I will give it a try once i got home.Thanks a lot.. Link to comment Share on other sites More sharing options...
espresso Posted October 27, 2010 Share Posted October 27, 2010 thanks, I will try Link to comment Share on other sites More sharing options...
Paldru Posted September 19, 2013 Share Posted September 19, 2013 Tried this in version 1.5.4 but it is not working, the pagination.php file does not exist. Link to comment Share on other sites More sharing options...
vekia Posted September 19, 2013 Share Posted September 19, 2013 prestashop in version 1.5 has got different file structure, and method provided above will not work. what you're looking for exactly? Link to comment Share on other sites More sharing options...
Paldru Posted September 19, 2013 Share Posted September 19, 2013 (edited) I would need the same as needforspeed above; "lots of new products instead of featured products". Basically new-products.php shown as index.php of my site in 1.5.4. Edited September 19, 2013 by TwoPenceCritter (see edit history) Link to comment Share on other sites More sharing options...
Paldru Posted September 22, 2013 Share Posted September 22, 2013 Any hint on how to communicate in this forum to get an answer? I am starting to think there is something wrong with me/my style of questions. Link to comment Share on other sites More sharing options...
vekia Posted September 22, 2013 Share Posted September 22, 2013 in this case you can modify homefeatured module, instead of featured products you can display new products. in module php file instead of $category->getProducts - just use Product::getNewProducts function after little modification of the .tpl file - everything will work as you expected Link to comment Share on other sites More sharing options...
Paldru Posted September 23, 2013 Share Posted September 23, 2013 (edited) Thank you. I have tried your solution and it works for the main part, but the product-sort.tpl and nbr-product-page.tpl as they are used in the new-products.tpl (/index.php?controller=new-products) are not working when used in homefeatured.tpl. (One does not get the the sorting functionality e.g. "product-per-page" and "ascending-descending" like in new-products.php) Edited September 23, 2013 by TwoPenceCritter (see edit history) Link to comment Share on other sites More sharing options...
vekia Posted September 23, 2013 Share Posted September 23, 2013 now i see what you exactly expect, you want the same page with the same features as you've got in new products page, but instead of separate page - you want to display everything on homepage. well, it will be a bit problematic in method that i suggested, mainly because it use different query to get products from database Link to comment Share on other sites More sharing options...
Paldru Posted September 23, 2013 Share Posted September 23, 2013 That is precisely what I ment. I already tried to use new-products.tpl as index.tpl and a part NewProductsController.php as index.php. But of course it is not working. Also I tried to use new-products.tpl as homefeatured.tpl and make an include of NewProductsController.php in homefeatured.php with no luck. Further I tried to make a redirect in .htacces to redirect index to new products.php/NewProductsController.php but this was giving me a redirect loop error in the browser. Link to comment Share on other sites More sharing options...
Paldru Posted September 23, 2013 Share Posted September 23, 2013 So far I found a temporary solution in 1.5.4 with a simple redirect. To redirect the homepage to the new-products controller, use the file controllers/front/IndexController.php and find public function initContent() (around line 29) and paste somewhere inside the curly brackets the code tools::redirect('index.php?controller=new-products'); Well, if someone knows how to modify the homefeatured module not only to show new products but also to have pagination and a sort option for the products, go ahead and let us know. Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now