Jimster Posted February 26, 2007 Posted February 26, 2007 Hello, 2 very good contribs here: http://www.oscommerce.com/community/contri...product+display and the SPPC I want to try and edit the following so that the prices are correct for the group. <?php /* $Id: new_products.php,v 2.0 2006/11/13 10:42:00 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions [url="http://www.oscommerce.com"]http://www.oscommerce.com[/url] Copyright © 2003 osCommerce Released under the GNU General Public License */ ?> <!-- new_products //--> <?php if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { $sql = "select distinct p.products_id, p.products_quantity, p.products_image, p.products_model, p.products_tax_class_id, p.products_weight, if(s.status, s.specials_new_products_price, p.products_price) as products_price, mnf.manufacturers_name, rvw.reviews_rating from " . TABLE_PRODUCTS . " p left join ".TABLE_SPECIALS." s on p.products_id = s.products_id left join ".TABLE_MANUFACTURERS." mnf on p.manufacturers_id = mnf.manufacturers_id left join ".TABLE_REVIEWS." rvw on p.products_id = rvw.products_id where p.products_image !='' and p.products_status = '1' order by RAND() limit ".MAX_DISPLAY_NEW_PRODUCTS; $new_products_query = tep_db_query($sql); } else { $sql = "select distinct p.products_id, p.products_quantity, p.products_image, p.products_model, p.products_tax_class_id, p.products_weight, if(s.status, s.specials_new_products_price, p.products_price) as products_price, mnf.manufacturers_name, rvw.reviews_rating 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_MANUFACTURERS." mnf on p.manufacturers_id = mnf.manufacturers_id left join ".TABLE_REVIEWS." rvw on p.products_id = rvw.products_id where p.products_image !='' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by RAND() limit " . MAX_DISPLAY_NEW_PRODUCTS; $new_products_query = tep_db_query($sql); } // BOF Separate Price per Customer if(!tep_session_is_registered('sppc_customer_group_id')) { $customer_group_id = '0'; } else { $customer_group_id = $sppc_customer_group_id; } // EOF Separate Price per Customer // custom controls for this box IND_PRODUCT_LIST_COL_NUM; $prod_name_length = 26; $prod_name_cont = '...'; // custom controls // if more than 2 products per row, cut off title to fit box if (IND_PRODUCT_LIST_COL_NUM > 2) { $cut_prod_name = 'true'; } else { $cut_prod_name = 'false'; } $row = 0; $col = 0; $info_box_contents = array(); while ($new_products = tep_db_fetch_array($new_products_query)) { // get full name, then cut it to fit length of the boxes.. if ( $cut_prod_name == 'true' ) { $new_products['products_name_full'] = tep_get_products_name($new_products['products_id']); $new_products['products_name'] = substr($new_products['products_name_full'], 0, $prod_name_length); // if product name has been cut short, add ... to the end if ( strlen($new_products['products_name_full']) > $prod_name_length ) { $new_products['products_name'] .= $prod_name_cont; } } else { // if only one column, display the full product title $new_products['products_name'] = tep_get_products_name($new_products['products_id']); } // get full name, then cut it to fit length of the boxes.. // setup names and variables to be used if no matching results are found $reviews_rating = $new_products['reviews_rating']; $manufacturers_name = $new_products['manufacturers_name']; $products_model = $new_products['products_model']; if(!$manufacturers_name==null) { $manufacturers_name = '<b>' . TABLE_HEADING_MANUFACTURER . '</b><br>' . $manufacturers_name; } else { $manufacturers_name = '<b>' . TABLE_HEADING_MANUFACTURER . ' </b><br>None'; } if(!$products_model==null) { $products_model = '<b>' . TABLE_HEADING_MODEL . ':</b><br>' . $products_model; } else { $products_model = '<b>' . TABLE_HEADING_MODEL . ': </b><br>None'; } if(!$reviews_rating==null){ $reviews_rating = '<img src="images/stars_'. $new_products['reviews_rating'].'.gif" alt="'.$new_products['reviews_rating'] . TABLE_HEADING_TEXT_OF_5_STARS . ' ('.$new_products['products_name'].')" border="0" align="absmiddle">'; } else { $reviews_rating = '<span class="smallText"><a href="product_reviews_write.php?products_id='.$new_products['products_id'].'" alt="' . TABLE_HEADING_FIRST_TO_RATE . '"><img src="images/stars_0.gif" alt="' . TABLE_HEADING_FIRST_TO_RATE . '" border="0" align="absmiddle"></a></span>'; } // setup names and variables to be used if no matching results are found // only display what is set in 'product listing' if (IND_PRODUCT_LIST_IMAGE == "Yes") { $show['image'] = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_PIMAGES . $new_products['products_image'], $new_products['products_name_full'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; } if (IND_PRODUCT_LIST_MANUFACTURER == "Yes") { $show['manufacturer'] = ' <tr> <td height="17" class="smallText"><br>' . $manufacturers_name . '</td> </tr>'; } if (IND_PRODUCT_LIST_MODEL == "Yes") { $show['model'] = ' <tr> <td height="17" class="smallText"><br>' . $products_model . '</td> </tr>'; } if (IND_PRODUCT_LIST_QUANTITY == "Yes") { if($new_products['products_quantity'] == '0') { $show['quantity'] = ' <tr> <td height="17" class="smallText"> <b><br>' . TABLE_HEADING_QUANTITY . ':</b> <img src="images/icons/amber.gif" align="absmiddle"> </td> </tr> '; } elseif($new_products['products_quantity'] == '-1') { $show['quantity'] = ' <tr> <td height="17" class="smallText"> <b><br>' . TABLE_HEADING_QUANTITY . ':</b> <img src="images/icons/red.gif" align="absmiddle"> </td> </tr> '; } else { $show['quantity'] = ' <tr> <td height="17" class="smallText"> <b><br>' . TABLE_HEADING_QUANTITY . ':</b> <img src="images/icons/green.gif" align="absmiddle"> </td> </tr> '; } } if (IND_PRODUCT_LIST_WEIGHT == "Yes") { $show['weight'] = ' <tr> <td height="17" class="smallText"> <b><br>' . TABLE_HEADING_WEIGHT . ':<br></b>' . $new_products['products_weight'] . ' Kg </td> </tr> '; } if (IND_PRODUCT_LIST_PRICE == "Yes") { $show['price'] = ' <tr> <td height="17" class="smallText"> <b><br>' . TABLE_HEADING_PRICE . ':<br><font color="#FF5C02">' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '</font></b> </td> </tr> '; } if (IND_PRODUCT_LIST_RATING == "Yes") { $show['rating'] = ' <tr> <td height="17" class="smallText"> <b><br>' . TABLE_HEADING_RATING . ':</b><br>'.$reviews_rating . '</td> </tr>'; } if (IND_PRODUCT_LIST_DESCRIPTION == "Yes") { // GET PROD DESC $sql = 'SELECT `products_description` FROM `products_description` WHERE products_id ='.$new_products['products_id'].' && language_id='.(int)$languages_id; $description_query = tep_db_query($sql); $description = mysql_fetch_array($description_query, MYSQL_ASSOC); $description['products_description'] = substr($description['products_description'], 0, 76); $desc_len = strlen($description['products_description']); $description['products_description'][$desc_len-1] = '.'; $description['products_description'][$desc_len-2] = '.'; $description['products_description'][$desc_len-3] = '.'; $show['desc'] = ' <tr> <td colspan="2" style="padding:10px;text-align:justify;"><span class="smallText">' . $description['products_description'] . '</span> </td> </tr>'; } if (IND_PRODUCT_LIST_BUY_NOW == "Yes") { $show['buy_now'] = ' <td height="30" width="50%" align="right" style="padding-bottom: 5px;padding-left: -20px;padding-right: 2px"> <a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $new_products['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_BUY_NOW) . '</a> </td>'; } if (IND_PRODUCT_LIST_DETAILS == "Yes") { $show['details'] = ' <td width="10%" height="30" align="left" style="padding-right: -20px;padding-left: 2px;padding-bottom: 5px"> <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '" class="infoBoxContents"> More Info </a> </td>'; } if (IND_PRODUCT_LIST_NAME == "Yes") { $show['name'] = ' <tr> <td bgcolor="#eeeeee" class="infoBoxHeadingC" height="" style="padding:2px;"> <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '" alt="' . $new_products['products_name_full'] . '" class="headerNavigation">' . $new_products['products_name'] . '</a> </td> </tr>'; } // only display what is set in 'product listing' // start the indivdual box $tbl_product = ' <table width="100%" height="100%" border="0" cellspacing="0" cellpadding="0" style="border: 1px solid #333366;padding:0px;">' . $show['name'] . '<tr> <td bgcolor="#FFFFFF"> <table width="100%" border="0" cellspacing="0" cellpadding="0"> <tr> <td align="center" style="padding:3px;">' . $show['image'] . '</td> <td height="125%" valign="top"> <table width="100%" border="0" cellspacing="0" cellpadding="0">' . $show['manufacturer'] . $show['model'] . $show['quantity'] . $show['weight'] . $show['price'] . $show['rating'] . '</table> </td> </tr>' . $show['desc'] . '<tr>' . $show['details'] . $show['buy_now'] . '</tr> </table> </td> </tr> </table>'; // end the indivdual box $info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="smallText" width="33%" valign="top"', 'text' => $tbl_product); $col ++; if ($col >= IND_PRODUCT_LIST_COL_NUM) { $col = 0; $row ++; } } new centralBox($info_box_contents); //echo $info_box_contents[0][0]['text']; ?> I figure that I should be able to grab bits from the altered parts in the other files, however i can't make heads or tails of it :( :( anyone able to shed some light? Quote
Jimster Posted February 26, 2007 Author Posted February 26, 2007 Sorted it, PM me if you require the fix! Quote
Recommended Posts
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.