Menu (List of products)

Polygrafix

Avatar: Polygrafix

2007-05-02 13:20

I'm working on a very small cart (1 category, 10–20 products) and I would like to achieve this:
Creating menu that would not contain list of categories but list of products.

I tried to generate this instead of menu3, so I altered code in index.php to:

<?php
  
if( !isset( $sMenu3 ) ){
    require_once 
DIR_CORE.'files-'.DB_TYPE.'.php';
    require_once 
DIR_CORE.'files.php';

    require_once 
DIR_CORE.'products-'.DB_TYPE.'.php';
    require_once 
DIR_CORE.'products.php';
      
    
$sMenu3 listProducts'menu_3.tpl'30true, Array( $iCategory ) );
    if( !isset( 
$sMenu3 ) )
      
$sMenu3 $tpl->tbHtml'menu_3.tpl''NOT_FOUND' );
  }
?>



I added series of require_once as treewood pointed out in another topic, changed listCategories function to listProducts and increased number to 30 (otherwise I'd have displayed only 3 products).

It works to some extent. Did anyone tried to achieve the same? I don't know whether I took right approach, but I doesn't work on every page. Menu displays only products that are contained within selected category. That means this menu is empty on contact page, because that page doesn't contain any products. And if I choose to display 5 products per page in product list, menu is created only on the first page. It's empty on page 2 and further.

I'd appreciate any help or suggestions where to point my attention.

» Quick.Cart v2.x

Polygrafix

Avatar: Polygrafix

2007-05-02 13:21

10&#8211;20 means 10-20

merci

No avatar

2007-05-04 10:42

Polygrafix - by the way, you probably want to display products instead of categories, so you should change manu1 not manu3, but if about displaying products on every page (also contact page) try to comment in core/products.php this:

if( isset( $GLOBALS['iCategory'] ) && is_numeric$GLOBALS['iCategory'] ) ){
      
$aParams[1] = $GLOBALS['iCategory'];
      
$sPage      .= '&amp;iCategory='.$GLOBALS['iCategory'];
    }


and to display products on every page (not only first) you should:
in config/general.php paste:

define'QUANTITY',       20 );


here you can change quantity of products displayed

in index.php change this:

$sMenu3 listProducts'menu_3.tpl'30true, Array( $iCategory ) );


for this:

$sMenu3 listProducts'menu_3.tpl'QUANTITY );



in core/products-ff.php after this:

$aCategories dbThrowProductsCategories( );


paste this:

if( $iList == QUANTITY )
      
$iPage 1;
    else
      
$iPage $GLOBALS['iPage'];


and replace this:

return $oFF->throwFileArrayFunctionPagesDB_PRODUCTSnull$GLOBALS['iPage'], $iList'dbListProductsCheck', Array( $aParams$aCategories ) );


with this:

return $oFF->throwFileArrayFunctionPagesDB_PRODUCTSnull$iPage$iList'dbListProductsCheck', Array( $aParams$aCategories ) );

Polygrafix

Avatar: Polygrafix

2007-05-04 13:03

Thank you merci! That's exactly what I needed.

Back to top
about us | contact