Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How to add a language


Recommended Posts

Hi all,

 

I am using the Simple Category/Product Tree Contrib - http://www.oscommerce.com/community/contri...ions,912/page,3

 

It works very well exept language filtering. It shows products in all languages at the same time. Could you help me to add language filtering to the code? I tried to add this

 

and pd.language_id = '" . languages_id . "'

 

to the query in the function tep_products_in_category but it didn't work. Please, any idea. I include the readme instructions for the contrib below.

 

5)	Look for the following code in the catalog/includes/boxes/categories.php:



<code>

   if (SHOW_COUNTS == 'true') {

     $products_in_category = tep_count_products_in_category($counter);

     if ($products_in_category > 0) {

       $categories_string .= ' (' . $products_in_category . ')';

     }

   }

</code>



6)	Add the following code after the above code:



<code>

   $products_in_category_query = tep_products_in_category($counter);



   while ($products_in_category = tep_db_fetch_array($products_in_category_query)) {



  $product_id_h = 'products_id='.$products_in_category ['product_id'];

  $product_name_h = $products_in_category ['product'];





  $categories_string .= '<br>   <span class="boxText"><a href="'. tep_href_link(FILENAME_PRODUCT_INFO, $product_id_h). '">' .$product_name_h . '</a></span>';



  }

</code>



7)	Open "general.php" in directory "catalog/includes/functions". 



8)	Add the following function before the last ?> in the script:

<code>

////

// Return the query for products in a category

// TABLES: products, products_to_categories, and products_description

 function tep_products_in_category($category_id, $include_inactive = false) {



   if ($include_inactive) {

     $products_query = tep_db_query("select pd.products_name as product, pd.products_id as product_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = p2c.products_id and p2c.categories_id = '" . $category_id . "' and p.products_id = pd.products_id order by pd.products_name");

   } else {

     $products_query = tep_db_query("select pd.products_name as product, pd.products_id as product_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = p2c.products_id and p.products_status = '1' and p2c.categories_id = '" . $category_id . "' and p.products_id = pd.products_id order by pd.products_name");

   }

-- s i g n a t u r e --

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...