Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Strange issues with my hacks...


jcroson

Recommended Posts

Well, here is the scoop. I'm sooo close to opening this shop for my employer, and have encountered a strange problem.

 

I have hacked in a mod (Featured Products V1.1) and it works great. I've even managed to include it in a box, and that also works, but won't in one area...

 

If you go to the Racine Art Museum Store, you will only see two categories listed in the left menu, Classes and Membership. Each category has sub-categories, and the box mod I hacked should show up in the right column on each category listing you do. It does this in the Membership and subs, and all the Class subs, but not the main Class category.

 

Here is the code:

<?php
/*
 $Id: featured_products.php,v 1.23 2002/11/12 14:09:30 dgw_ Exp $

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

 Copyright (c) 2002 osCommerce

 Released under the GNU General Public License
*/
?>
<?php
 $featured_products_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' 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 p.products_date_added DESC, pd.products_name";

 $featured_products_split = new splitPageResults($HTTP_GET_VARS['page'], MAX_DISPLAY_FEATURED_PRODUCTS_LISTING, $featured_products_query_raw, $featured_products_numrows);

 $featured_products_query = tep_db_query($featured_products_query_raw);
 while ($featured_products = tep_db_fetch_array($featured_products_query)) {
   $featured_products_array[] = array('id' => $featured_products['products_id'],
                                 'name' => $featured_products['products_name'],
                                 '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'],
                                 'date_added' => tep_date_long($featured_products['products_date_added']),
                                 'manufacturer' => $featured_products['manufacturers_name']);
 }

?>

<!-- featured_products //-->
<tr><td>
<?php
if(FEATURED_PRODUCTS_DISPLAY == true)
{
 $featured_products_category_id = $new_products_category_id;
 $cat_name_query = tep_db_query("select categories_name from categories_description where categories_id = '" . $featured_products_category_id . "' limit 1");
 $cat_name_fetch = tep_db_fetch_array($cat_name_query);
 $cat_name = $cat_name_fetch['categories_name'];
 $info_box_contents = array();

 if ( (!isset($featured_products_category_id)) || ($featured_products_category_id == '0') ) {
   $info_box_contents[] = array('align' => 'left', 'text' => " " . TABLE_HEADING_FEATURED_PRODUCTS);
   $featured_products_query = tep_db_query("select 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 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);
 } else {
   $info_box_contents[] = array('align' => 'left', 'text' => sprintf(TABLE_HEADING_FEATURED_PRODUCTS_CATEGORY, $cat_name));
   $featured_products_query = tep_db_query("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' and f.status = '1' order by rand() DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS);
 }


 $row = 0;
 $col = 0;
 $num = 0;
 while ($featured_products = tep_db_fetch_array($featured_products_query)) {
   $num ++; if ($num == 1) { new contentBoxHeading($info_box_contents); }
   $featured_products['products_name'] = tep_get_products_name($featured_products['products_id']);
   if($featured_products['specstat']) {
     $info_box_contents[$row][$col] = array('align' => 'left',
                                          'params' => 'class="smallText" width="33%" valign="top"',
                                          'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . $featured_products['products_name'] . '</a><br><s>' . $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' .
                                          $currencies->display_price($featured_products['specials_new_products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '</span>');
   } else {
     $info_box_contents[$row][$col] = array('align' => 'left',
                                          'params' => 'class="smallText" width="33%" valign="top"',
                                          //'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . $featured_products['products_name'] . '</a><br>' . $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])));
                                          
  	 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a class="navTextBlack" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id='  . $featured_products['products_id']) . '">' . $featured_products['products_name'] . '</a><br><span class="blackBold">' . $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '</span>');


   }
   //$col ++;
   if ($col > 2) {
     $col = 0;
     $row ++;
   }
 }
 if($num) {
     new contentBox($info_box_contents);
 }
} else // If it's disabled, then include the original New Products box
{
include (DIR_WS_MODULES . FILENAME_NEW_PRODUCTS);
}
?>

</td>
         </tr><tr><td><img src="images/pixel_trans.gif" width="1" height="20" border="0"></td></tr>

<!-- featured_products_eof //-->

 

Have I done something obvious here? :ph34r:

 

Thanks in advance for your prods...

 

JC

John Croson

Technology Operations Manager

Racine Art Museum

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...