Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

cieto Featured Products 1.5 products don't belong categories


enhbat

Recommended Posts

does anyone know what happened to Emiliano??

 

awhile back I pointed out quite a few issues with v1.5 and helped him solve them too... he said in a couple days he'd issue an update with all he fixes/enhancements we came up with... he never did and I haven't seen him since.

 

if no one knows what happened to him, do u think it'd be OK if I put the updated version up?

The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Link to comment
Share on other sites

hey emiliano...

 

good to see you back...

 

I posted the fix for the specials price here:

http://www.oscommerce.com/forums/viewtopic.php...atured+products

 

also we posted alot of the fixes in this thread:

http://www.oscommerce.com/forums/viewtopic.php...atured+products

 

the categories fix was never posted... let me look a second here and see what I did to fix it.

The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Link to comment
Share on other sites

emiliano,

 

this is my catalog/modules/featured.php file. it contains the categories fix.

 

but it doesn't pull the short descriptions since I am using part of the normal description... I would put it back in, but I am not good with SQL queries across multiple tables.

 

catalog/modules/featured.php

<?php

/*

 osCommerce, Open Source E-Commerce Solutions

 http://www.oscommerce.com



 Copyright (c) 2002 osCommerce



 Released under the GNU General Public License

 

 Featured Products Listing

*/



 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_FEATURED);



if(FEATURED_PRODUCTS_DISPLAY == true) 

   {

?>



<!-- body //-->

<table border="0" cellspacing="0" cellpadding="0">

      <tr>

   <td class="pageHeadingSub">Featured Products</td>

   </tr>

   <tr>

       <td>

<?php



 $featured_products_category_id = $new_products_category_id;

 

  if ( (!isset($featured_products_category_id)) || ($featured_products_category_id == '0') ) { // We are not in category depth; we are on the main page

   $featured_products_query_raw = "select p.products_id, pd.products_name, pd.products_shortdescription, p.products_image, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price, p.products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join " . TABLE_FEATURED . " f on p.products_id = f.products_id where p.products_status = '1' and f.status = '1' order by rand() DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS; //and f.status = '1'

 } else { // We are in category depth; pull the featured from the category by random

   $featured_products_query_raw = "select distinct p.products_id, p.products_image, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price, p.products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c left join " . TABLE_FEATURED . " f on p.products_id = f.products_id where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . $featured_products_category_id . "' and p.products_status = '1' order by rand() DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS; //and f.status = '1' 

 }



 $featured_products_query = tep_db_query($featured_products_query_raw);

 while ($featured_products = tep_db_fetch_array($featured_products_query)) {

   $featured_products['products_name'] = tep_get_products_name($featured_products['products_id']);

   $featured_products['products_description'] = tep_get_products_description($featured_products['products_id']);



   $featured_products_array[] = array('id' => $featured_products['products_id'],

                                 'name' => $featured_products['products_name'],

         'description' => $featured_products['products_description'],

         'image' => $featured_products['products_image'],

                                 'price' => $featured_products['products_price'],

                                 'specials_price' => $featured_products['specials_new_products_price'],

                                 'tax_class_id' => $featured_products['products_tax_class_id'],

                                 'manufacturer' => $featured_products['manufacturers_name']);

 }



 require(DIR_WS_MODULES  . FILENAME_FEATURED_PRODUCTS);

?>

       </td>

     </tr>

   </table>

<?php

} else // If it's disabled, then include the original New Products box 

   { 

     include (DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); 

   }

?>

The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Link to comment
Share on other sites

well there were a couple errors in above...

 

and I put the short descriptions back in incase I would want to use them in the future...

 

here is the correct /catalog/includes/modules/featured.php

 

<?php

/*

 osCommerce, Open Source E-Commerce Solutions

 http://www.oscommerce.com



 Copyright (c) 2002 osCommerce



 Released under the GNU General Public License

 

 Featured Products Listing

*/



 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_FEATURED);



if(FEATURED_PRODUCTS_DISPLAY == true) 

   {

?>



<!-- body //-->

<table border="0" cellspacing="0" cellpadding="0">

      <tr>

   <td class="pageHeadingSub">Featured Products</td>

   </tr>

   <tr>

       <td>

<?php



 $featured_products_category_id = $new_products_category_id;

 

  if ( (!isset($featured_products_category_id)) || ($featured_products_category_id == '0') ) { // We are not in category depth; we are on the main page

   $featured_products_query_raw = "select p.products_id, pd.products_name, pd.products_description, pd.products_shortdescription, p.products_image, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price, p.products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' left join " . TABLE_FEATURED . " f on p.products_id = f.products_id where p.products_status = '1' and f.status = '1' order by rand() DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS; //and f.status = '1'

 } else { // We are in category depth; pull the featured from the category by random

   $featured_products_query_raw = "select distinct p.products_id, pd.products_name, p.products_image, p.products_tax_class_id, pd.products_description, pd.products_shortdescription, s.status as specstat, s.specials_new_products_price, p.products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' left join " . TABLE_FEATURED . " f on p.products_id = f.products_id where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . $featured_products_category_id . "' and p.products_status = '1' order by rand() DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS; //and f.status = '1' 

 }



 $featured_products_query = tep_db_query($featured_products_query_raw);

 while ($featured_products = tep_db_fetch_array($featured_products_query)) {

//    $featured_products['products_name'] = tep_get_products_name($featured_products['products_id']);

//    $featured_products['products_description'] = tep_get_products_description($featured_products['products_id']);

   $featured_products_array[] = array('id' => $featured_products['products_id'],

                                 'name' => $featured_products['products_name'],

         'description' => $featured_products['products_description'],

           'shortdescription' => $featured_products['products_shortdescription'],

         'image' => $featured_products['products_image'],

                                 'price' => $featured_products['products_price'],

                                 'specials_price' => $featured_products['specials_new_products_price'],

                                 'tax_class_id' => $featured_products['products_tax_class_id'],

                                 'manufacturer' => $featured_products['manufacturers_name']);

 }



 require(DIR_WS_MODULES  . FILENAME_FEATURED_PRODUCTS);

?>

       </td>

     </tr>

   </table>

<?php

} else // If it's disabled, then include the original New Products box 

   { 

     include (DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); 

   }

?>

The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

Link to comment
Share on other sites

how do you make it align in column style?

 

use the other featured products contribution (just called featured products v1.3 I think)... it shows them in columns...

 

this one uses only one per row b/c it also shows decriptions with the items... would be kinda crowded to do a column like layout with it.

The only thing necessary for evil to flourish is for good men to do nothing

- Edmund Burke

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.
Note: Your post will require moderator approval before it will be visible.

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