Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Categories on main page


mx5gr

Recommended Posts

I installed the mod, which is installed as a module within Catalog. However, the SQL syntax may be incorrect, since it does not show up unique categories on the main page but it displays all main categories in all languages entered.

 

For example, if we have two categories called "Tables" and "Chairs", they will be shown 4 times, twice for English & French each.

 

Can someone check the SQL syntax and point any errors found?

 

I attach the code of the module.

 

Thank you in advance.

 

<?php

/*
 $Id: also_purchased_products.php,v 1.21 2003/02/12 23:55:58 hpdl Exp $

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
 
 Contribution by Diego Discacciati
*/

?>

<!-- main categories/ pictures and name//-->

<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => sprintf('Main Categories', strftime('%B')));

 new contentBoxHeading($info_box_contents);


$new_products_query = tep_db_query("select p.categories_id, p.categories_image, s.categories_name from " . TABLE_CATEGORIES . " p left join " . TABLE_CATEGORIES_DESCRIPTION . " s on p.categories_id = s.categories_id where parent_id = '0' order by p.sort_order limit " . MAX_DISPLAY_NEW_PRODUCTS);

 $row = 0;
 $col = 0;
 $info_box_contents = array();
 while ($new_products = tep_db_fetch_array($new_products_query)) 
{  
   $info_box_contents[$row][$col] = array(	'align' => 'center',
                                           'params' => 'class="smallText" width="33%" valign="top"',                                           
        	 'text' => '<a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=' . $new_products['categories_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['categories_image'], $new_products['categories_name'], 70, auto) . '</a><br><a href="' . tep_href_link(FILENAME_DEFAULT, 'cPath=' . $new_products['categories_id']) . '">' . $new_products['categories_name']);


   $col ++;
   if ($col > 2) {
     $col = 0;
     $row ++;
   }
 }

 new contentBox($info_box_contents);
?>

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...