Jump to content

Creating a product page, showing all products?


Recommended Posts

Hi,

i would like to know how to go about creating a page title "all products" which will display every product in my shop, in rows of three. I have created a products.php file and products.tpl file from an example, which creates the new page. However i would like to know the best way to populate this with every product. My code:

Products.php

<?php

include(dirname(__FILE__).'/config/config.inc.php');
include(dirname(__FILE__).'/header.php');

include(dirname(__FILE__).'/product-sort.php');

$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(
   'products' => Product::getNewProducts(intval($cookie->id_lang), 0, 10, false, $orderBy, $orderWay),
   'nbProducts' => intval($nbProducts)));

$smarty->display(_PS_THEME_DIR_.'products.tpl');

include(dirname(__FILE__).'/footer.php');

?> 


Products.tpl

capture name=path}{l s='products'}{/capture}
{include file=$tpl_dir./breadcrumb.tpl}

{l s='products'}


{if $products}
   {include file=$tpl_dir./product-sort.tpl}
   {include file=$tpl_dir./product-list.tpl products=$products}
   {include file=$tpl_dir./pagination.tpl}
{else}

{l s='No products.'}
{/if} 

Link to comment
Share on other sites

  • 1 month later...
  • 3 months later...
×
×
  • Create New...