ChristofVT Posted April 18, 2006 Share Posted April 18, 2006 Sorry it works. Thanks Quote Link to comment Share on other sites More sharing options...
Guest Posted April 21, 2006 Share Posted April 21, 2006 The seperate pricing mod works fantastic. I am having one visual problem though with the Name column button when I select a product category. It is mis-aligned. How can I fix this ? Thanks. Jamie. Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted April 21, 2006 Share Posted April 21, 2006 I am having one visual problem though with the Name column button when I select a product category. It is mis-aligned. Looks like something wrong with your css. If it is the shop where you have uploaded the picture, then I don't see what you show there (using Safari on a Mac) and it sure doesn't look like the stylesheet.css is suggesting. Perhaps try Firefox and/or some more browsers to get some more browser displays. Quote Link to comment Share on other sites More sharing options...
Guest Posted April 21, 2006 Share Posted April 21, 2006 Looks like something wrong with your css. If it is the shop where you have uploaded the picture, then I don't see what you show there (using Safari on a Mac) and it sure doesn't look like the stylesheet.css is suggesting. Perhaps try Firefox and/or some more browsers to get some more browser displays. It's the same on both Firefox and Internet Exploder. https://www.thehometheatrepc.com/shop/index.php?cPath=35 I can't really see anything in the css file. Where are the graphics located for this ? Thanks. Jamie. Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted April 21, 2006 Share Posted April 21, 2006 It's the same on both Firefox and Internet Exploder. Yes, Firefox on the Mac gets it the same as you posted. However, it looks totally shit (excusez le mot) in Safari and that browser is pretty good in CSS. No borders in your product listing. The Buy Now in the heading is black instead of gray, the font is default instead of the Verdana, the area around the search box etc. in the top is white instead of blue, the font for the headings Product Categories and Our Newsletter is default and black instead of white. In short, as I said. Perhaps Safari is expecting to find your stylesheet in the root directory (so one level up), I think I saw that before. Then Safari is to blame for that.Where are the graphics located for this ? There are none, it is pure text. Actually, it looks like Firefox and IE are doing it fine: .productListing-heading { border-right:1px dotted #C2C2C2; border-bottom:1px dotted #C2C2C2; text-align:center; vertical-align:top; color: #6F6F6F; font-weight: bold; padding: 10px; font-family: Tahoma, Verdana, Arial, sans-serif; font-size: 11px; background: #ffffff; You kind of got what you asked for: a box around the text, with a white background and borders. Alas applied to the text instead of the <td> and when it wraps, the background obscures the text "Product". Can't blame the browser :) Quote Link to comment Share on other sites More sharing options...
Guest Posted April 21, 2006 Share Posted April 21, 2006 You kind of got what you asked for: a box around the text, with a white background and borders. Alas applied to the text instead of the <td> and when it wraps, the background obscures the text "Product". Can't blame the browser :) Is there anyway I can fix the "Name" box so it lines up with the rest ? I also copied the stylesheet.css file to the root as well, so hopefully your Safari won't show a mess. Thanks. Quote Link to comment Share on other sites More sharing options...
invasi0n Posted April 22, 2006 Share Posted April 22, 2006 Is there anyway I can fix the "Name" box so it lines up with the rest ? I also copied the stylesheet.css file to the root as well, so hopefully your Safari won't show a mess. Thanks. I'm too far to be a pro, but i think you did something wrong in includes/modules/product_listing.php. Re-upload the original file, and check. Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted April 22, 2006 Share Posted April 22, 2006 Is there anyway I can fix the "Name" box so it lines up with the rest ? The old trick would probably work: instead of having a space in between Product and Name, use a non-breaking space (& nbsp; or & #160; note: I need to add a space in there otherwise the forum software just makes it a space). You can find that define in includes/languages/english/index.php: define('TABLE_HEADING_PRODUCTS', 'Product?Name'); Perhaps you should also use td.productListing-heading instead of .productListing-heading in the style sheet? I also copied the stylesheet.css file to the root as well, so hopefully your Safari won't show a mess. Thanks, but it didn't work. I think it only worked when hard-coding the link to the style sheet (http:// yoursite/shop/stylesheet.css) but I'm not 100% sure (strange behaviour of Safari though). Quote Link to comment Share on other sites More sharing options...
Guest Posted April 22, 2006 Share Posted April 22, 2006 The old trick would probably work: instead of having a space in between Product and Name, use a non-breaking space (& nbsp; or & #160; note: I need to add a space in there otherwise the forum software just makes it a space). You can find that define in includes/languages/english/index.php: Thanks, :thumbsup: I added the between Product and Name and now it is aligned perfectly. Thanks, but it didn't work. I think it only worked when hard-coding the link to the style sheet (http:// yoursite/shop/stylesheet.css) but I'm not 100% sure (strange behaviour of Safari though). I hard coded the path to the stylesheet in shop/index.php. I would love to have my site show up properly in all browsers. :rolleyes: Thanks again for all your help. Jamie. Quote Link to comment Share on other sites More sharing options...
Fredrik.r Posted April 25, 2006 Share Posted April 25, 2006 Hi! I'm using Wishlist 3.5d and as default the prices are wrong when using SPPC. The retail price wont show. I noticed in this thread that someone solved this a month ago but she didnt informed how. If someone knows, please let me know. As I have understodd, it wasnt a big issue to get it work. Quote Link to comment Share on other sites More sharing options...
invasi0n Posted April 25, 2006 Share Posted April 25, 2006 Hello Guys, Anyone here using Random New Products Shows Specials inc SubCats 1.0 with Seperate Pricing Per Customer? I have no idea how to implement SSPPC... This is the includes/modules/new_products.php <?php /* $Id: new_products.php,v 1.35 2004/02/05 15:50:00 adf Exp $ Randomize New Products $Id: new_products.php,v 1.34 2003/06/09 22:49:58 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ ?> <!-- new_products //--> <?php if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { // start random new products $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_price, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as specials_new_products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_added desc limit " . MAX_RANDOM_SELECT_NEW); } else { // in a category $cats[] = $new_products_category_id; // current catID as starting value // put cat-IDs of all cats nested in current branch into $cats array, go through all subbranches for($i=0;$i<count($cats);$i++) { $categorie_query = tep_db_query("select categories_id from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$cats[$i] . "'"); while ($categorie = tep_db_fetch_array($categorie_query)) { $cats[] = $categorie['categories_id']; } $cats=array_unique($cats); // sort out doubles } $num = (int) MAX_DISPLAY_NEW_PRODUCTS; $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_price, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as specials_new_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 where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id in (".implode(', ', $cats).") and p.products_status = '1' order by p.products_date_added desc limit " . MAX_RANDOM_SELECT_NEW); // end random new products } if (tep_db_num_rows($new_products_query) > 0) { $info_box_contents = array(); $info_box_contents[] = array('text' => sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B'))); new contentBoxHeading($info_box_contents); $row = 0; $col = 0; $pCount = 0; $info_box_contents = array(); $found_products = array(); $num_rows = tep_db_num_rows($new_products_query); if (MAX_DISPLAY_NEW_PRODUCTS > MAX_RANDOM_SELECT_NEW) { // don't allow more new products than will be queried $max_new_products = MAX_RANDOM_SELECT_NEW; } else { $max_new_products = MAX_DISPLAY_NEW_PRODUCTS; } if ($num_rows < $max_new_products) { $max_new_products = $num_rows; } // echo "num_rows: " . $num_rows . " max_new_products " . $max_new_products . "<br>"; if ($num_rows > 0) { while ($pCount < $max_new_products) { // choose a random row $random_product = ''; $random_row = tep_rand(0, ($num_rows - 1)); tep_db_data_seek($new_products_query, $random_row); $random_product = tep_db_fetch_array($new_products_query); // see if found already, if not use else skip $found = 0; for ($ii=0; $ii < $pCount; $ii++) { if ($found_products[$ii] == $random_product['products_id']) { $found = 1; break; } } if ($found == 0) { // keep track of found id's $found_products[$pCount] += $random_product['products_id']; $pCount ++; // add to display array $random_product['products_name'] = tep_get_products_name($random_product['products_id']); $random_product['specials_new_products_price'] = tep_get_products_special_price($random_product['products_id']); if (tep_not_null($random_product['specials_new_products_price'])) { $whats_new_price = '<s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br>'; $whats_new_price .= '<span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>'; } else { $whats_new_price = $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])); } $info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="smallText" width="33%" valign="top"', 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a><br>' . $whats_new_price); $col ++; if ($col > 2) { $col = 0; $row ++; } } // found } // while pCount } // num_rows // end random new products new contentBox($info_box_contents); } ?> <!-- new_products_eof //--> Someone can help me? Thanks Quote Link to comment Share on other sites More sharing options...
Fredrik.r Posted April 25, 2006 Share Posted April 25, 2006 (edited) Hi! I have understood how to change files in includes/modules to work with SPPC. However I do not understand how to implement SPPC in files like catalog/products_new.php. Here's one I need to work with SPPC. I really understand if no one has time.. but if I could get an example of this file I could change others too... I think this file and getting retail prices to show in Wishlist 3.5d are my last issues.. puh.. It's been a mess integrating SPPC in my heavily modified store. The file belows lists best selling products in a product list. New Prododucts Icon is also implemented in this file. <?php /* $Id: bestselling_products.php by Mikey J: [email protected] [url=http://www.getmemusic.com]http://www.getmemusic.com[/url] This contribution creates a NEW page on osCommerce that lists your best selling products in ROWS, similar to how the New Products page looks, complete with product image, product name, product price and "more info" and "buy now" links. Also included with this package is a new Infobox that contains links to this page, plus links to Specials and New Products. See the README file for installation instructions. 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 */ require('includes/application_top.php'); // added for New Product Icon contribution $today_time = time(); // end addition require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_BESTSELLING_PRODUCTS); $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_BESTSELLING_PRODUCTS, '', 'NONSSL')); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="100%" cellspacing="3" cellpadding="3"> <tr> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo HEADING_TITLE; ?></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '20'); ?></td> </tr> <?php $best_sellers_array = array(); $best_sellers_query = tep_db_query("select distinct p.products_id, p.products_date_added, pd.products_name, p.products_image, pd.products_description, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_ordered > 0 and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_ordered desc, pd.products_name limit " . MAX_DISPLAY_BESTSELLERS); ?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <?php while ($best_sellers = tep_db_fetch_array($best_sellers_query)) { if ($new_price = tep_get_products_special_price($best_sellers['products_id'])) { $products_price = '<s>' . $currencies->display_price($best_sellers['products_price'], tep_get_tax_rate($best_sellers['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($best_sellers['products_tax_class_id'])) . '</span>'; } else { $products_price = $currencies->display_price($best_sellers['products_price'], tep_get_tax_rate($best_sellers['products_tax_class_id'])); } // added for New Product Icon contribution // convert times to unix timestamp for comparison // 2592000 = 30 days in the unix timestamp format if ( ($today_time - strtotime($best_sellers['products_date_added']) ) < 2592000) { // Originalkod: // $best_sellers['products_name'] .= ' ' . tep_image_button('icon_newarrival.gif', TEXT_ICON_NEW_PRODUCT); $product_title = tep_image_button('icon_newarrival.gif', TEXT_ICON_NEW_PRODUCT, 'align=absmiddle') . $best_sellers['products_name']; } else { $product_title=$best_sellers['products_name']; } // end addition New Product Icon contribution ?> <tr> <td width="<?php echo SMALL_IMAGE_WIDTH + 20; ?>" align="center" valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $best_sellers['products_image'], $best_sellers['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; ?></td> <td valign="top" class="main"><?php //echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers['products_id']) . '"><b><u>' . $best_sellers['products_name'] . '</u></b></a><br>' . tep_flatten_product_description($best_sellers['products_description'], ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers['products_id']) . '">' . TEXT_MORE . '</a>') . '<br><b>' . $products_price . '</b>'; // ?ndring h?r f?r att "ny"-ikonen ska visas OCH att alt-taggen ska visas r?tt p? produktfotot. $best_sellers['products_name'] ?ndrat till $product_title echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers['products_id']) . '"><b><u>' . $product_title . '</u></b></a><br>' . tep_flatten_product_description($best_sellers['products_description'], ' <a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers['products_id']) . '">' . TEXT_MORE . '</a>') . '<br><b>' . $products_price . '</b>'; ?><br> <br><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $best_sellers['products_id']) . '">' . tep_image_button('button_more_info.gif', IMAGE_BUTTON_MORE_INFO) . '</a> ';?><?php echo '<a href="' . tep_href_link(FILENAME_BEST_SELLERS, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $best_sellers['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>'; ?><br> <br></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } ?> </table></td> </tr> </table></td> <!-- body_text_eof //--> <td width="<?php echo BOX_WIDTH; ?>" valign="top"> <table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- right_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_right.php'); ?> <!-- right_navigation_eof //--> </table></td> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> <br> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Edited April 25, 2006 by Fredrik.r Quote Link to comment Share on other sites More sharing options...
tbsg Posted April 28, 2006 Share Posted April 28, 2006 sorry if this issue has been raised before - i've searched the forums and can't find a related issue and/or solution. i've got the SPPC contribution installed and all seems to be working as expected except ... the site is set to only display prices if you're logged in as a wholesale customer. the prices appear correctly on the product_info.php, specials.php and products_new.php pages but the prices don't appear at all on any of the pages driven by index.php - just the buy now button appears. any idea how to get the prices to show up in the product listing driven by index.php? current code: <?php /* $Id: index.php,v 1.1.1.1 2005/08/16 08:31:30 sstolyarov Exp $ adapted for Separate Pricing per Customer 2005/02/06 osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ require('includes/application_top.php'); global $customer_group_id; if(!isset($customer_group_id)) { $customer_group_id = '0'; } // the following cPath references come from application_top.php $category_depth = 'top'; if (isset($cPath) && tep_not_null($cPath)) { $categories_products_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_TO_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'"); $cateqories_products = tep_db_fetch_array($categories_products_query); if ($cateqories_products['total'] > 0) { $category_depth = 'products'; // display products } else { $category_parent_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$current_category_id . "'"); $category_parent = tep_db_fetch_array($category_parent_query); if ($category_parent['total'] > 0) { $category_depth = 'nested'; // navigate through the categories } else { $category_depth = 'products'; // category has no products, but display the 'no products' message } } } require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_DEFAULT); ?> <!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN"> <html <?php echo HTML_PARAMS; ?>> <head> <meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>"> <title><?php echo TITLE; ?></title> <meta name="keywords" content=""> <meta name="description" content=""> <base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>"> <link rel="stylesheet" type="text/css" href="stylesheet.css"> </head> <body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0"> <!-- header //--> <?php require(DIR_WS_INCLUDES . 'header.php'); ?> <!-- header_eof //--> <!-- body //--> <table border="0" width="780" cellspacing="0" cellpadding="3" align="center"> <tr> <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2"> <!-- left_navigation //--> <?php require(DIR_WS_INCLUDES . 'column_left.php'); ?> <!-- left_navigation_eof //--> </table></td> <!-- body_text //--> <?php if ($category_depth == 'nested') { $category_query = tep_db_query("select cd.categories_name, c.categories_image from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = '" . (int)$current_category_id . "' and cd.categories_id = '" . (int)$current_category_id . "' and cd.language_id = '" . (int)$languages_id . "'"); $category = tep_db_fetch_array($category_query); ?> <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo $breadcrumb->last(); ?></td> <td class="pageHeading" align="right"><?php echo tep_image(DIR_WS_IMAGES . $category['categories_image'], $category['categories_name'], HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <?php if (isset($cPath) && strpos('_', $cPath)) { // check to see if there are deeper categories within the current category $category_links = array_reverse($cPath_array); for($i=0, $n=sizeof($category_links); $i<$n; $i++) { $categories_query = tep_db_query("select count(*) as total from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "'"); $categories = tep_db_fetch_array($categories_query); if ($categories['total'] < 1) { // do nothing, go through the loop } else { $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$category_links[$i] . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name"); break; // we've found the deepest category the customer is in } } } else { $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by sort_order, cd.categories_name"); } $number_of_categories = tep_db_num_rows($categories_query); $rows = 0; while ($categories = tep_db_fetch_array($categories_query)) { $rows++; $cPath_new = tep_get_path($categories['categories_id']); $width = (int)(100 / MAX_DISPLAY_CATEGORIES_PER_ROW) . '%'; echo ' <td align="center" class="smallText" width="' . $width . '" valign="top"><a href="' . tep_href_link(FILENAME_DEFAULT, $cPath_new) . '">' . tep_image(DIR_WS_IMAGES . $categories['categories_image'], $categories['categories_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . '<br>' . $categories['categories_name'] . '</a></td>' . "\n"; if ((($rows / MAX_DISPLAY_CATEGORIES_PER_ROW) == floor($rows / MAX_DISPLAY_CATEGORIES_PER_ROW)) && ($rows != $number_of_categories)) { echo ' </tr>' . "\n"; echo ' <tr>' . "\n"; } } // needed for the new products module shown below $new_products_category_id = $current_category_id; ?> </tr> </table></td> </tr> <!-- removed New Products display from category listings --> </table></td> </tr> </table></td> <?php } elseif ($category_depth == 'products' || isset($HTTP_GET_VARS['manufacturers_id'])) { // create column list $define_list = array('PRODUCT_LIST_MODEL' => PRODUCT_LIST_MODEL, 'PRODUCT_LIST_NAME' => PRODUCT_LIST_NAME, 'PRODUCT_LIST_MANUFACTURER' => PRODUCT_LIST_MANUFACTURER, 'PRODUCT_LIST_PRICE' => PRODUCT_LIST_PRICE, 'PRODUCT_LIST_QUANTITY' => PRODUCT_LIST_QUANTITY, 'PRODUCT_LIST_WEIGHT' => PRODUCT_LIST_WEIGHT, 'PRODUCT_LIST_IMAGE' => PRODUCT_LIST_IMAGE, 'PRODUCT_LIST_BUY_NOW' => PRODUCT_LIST_BUY_NOW); asort($define_list); $column_list = array(); reset($define_list); while (list($key, $value) = each($define_list)) { if ($value > 0) $column_list[] = $key; } // BOF Separate Pricing Per Customer if(!tep_session_is_registered('sppc_customer_group_id')) { $customer_group_id = '0'; } else { $customer_group_id = $sppc_customer_group_id; } // this will build the table with specials prices for the retail group or update it if needed // this function should have been added to includes/functions/database.php if ($customer_group_id == '0') { tep_db_check_age_specials_retail_table(); } $status_product_prices_table = false; $status_need_to_get_prices = false; // find out if sorting by price has been requested if ( (isset($HTTP_GET_VARS['sort'])) && (ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) && (substr($HTTP_GET_VARS['sort'], 0, 1) <= sizeof($column_list)) && $customer_group_id != '0' ){ $_sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1); if ($column_list[$_sort_col-1] == 'PRODUCT_LIST_PRICE') { $status_need_to_get_prices = true; } } if ($status_need_to_get_prices == true && $customer_group_id != '0') { $product_prices_table = TABLE_PRODUCTS_GROUP_PRICES.$customer_group_id; // the table with product prices for a particular customer group is re-built only a number of times per hour // (setting in /includes/database_tables.php called MAXIMUM_DELAY_UPDATE_PG_PRICES_TABLE, in minutes) // to trigger the update the next function is called (new function that should have been // added to includes/functions/database.php) tep_db_check_age_products_group_prices_cg_table($customer_group_id); $status_product_prices_table = true; } // end if ($status_need_to_get_prices == true && $customer_group_id != '0') // EOF Separate Pricing Per Customer $select_column_list = ''; for ($i=0, $n=sizeof($column_list); $i<$n; $i++) { switch ($column_list[$i]) { case 'PRODUCT_LIST_MODEL': $select_column_list .= 'p.products_model, '; break; case 'PRODUCT_LIST_NAME': $select_column_list .= 'pd.products_name, '; break; case 'PRODUCT_LIST_MANUFACTURER': $select_column_list .= 'm.manufacturers_name, '; break; case 'PRODUCT_LIST_QUANTITY': $select_column_list .= 'p.products_quantity, '; break; case 'PRODUCT_LIST_IMAGE': $select_column_list .= 'p.products_image, '; break; case 'PRODUCT_LIST_WEIGHT': $select_column_list .= 'p.products_weight, '; break; } } // show the products of a specified manufacturer if (isset($HTTP_GET_VARS['manufacturers_id'])) { if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) { // We are asked to show only a specific category // BOF Separate Pricing Per Customer if ($status_product_prices_table == true) { $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, tmp_pp.products_price, p.products_tax_class_id, IF(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'"; } else { // either retail or no need to get correct special prices $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "'"; } // end else { // either retail... // EOF Separate Pricing Per Customer } else { // We show them all // BOF Separate Pricing Per Customer if ($status_product_prices_table == true) { $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, tmp_pp.products_price, p.products_tax_class_id, IF(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'"; } else { // either retail or no need to get correct special prices $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id where p.products_status = '1' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'"; } // end else { // either retail... // EOF Separate Pricing Per Customer } } else { // show the products in a given categorie if (isset($HTTP_GET_VARS['filter_id']) && tep_not_null($HTTP_GET_VARS['filter_id'])) { // We are asked to show only specific catgeory; // BOF Separate Pricing Per Customer if ($status_product_prices_table == true) { $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, tmp_pp.products_price, p.products_tax_class_id, IF(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price from " . TABLE_PRODUCTS . " p left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } else { // either retail or no need to get correct special prices $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_MANUFACTURERS . " m, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS_RETAIL_PRICES . " s using(products_id) where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and m.manufacturers_id = '" . (int)$HTTP_GET_VARS['filter_id'] . "' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } // end else { // either retail... // EOF Separate Pricing Per Customer } else { // We show them all // BOF Separate Pricing Per Customer if ($status_product_prices_table == true) { $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, tmp_pp.products_price, p.products_tax_class_id, IF(tmp_pp.status, tmp_pp.specials_new_products_price, NULL) as specials_new_products_price, IF(tmp_pp.status, tmp_pp.specials_new_products_price, tmp_pp.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . $product_prices_table . " as tmp_pp using(products_id), " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } else { // either retail or no need to get correct special prices $listing_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '" . (int)$languages_id . "' and p2c.categories_id = '" . (int)$current_category_id . "'"; } // end else { // either retail... // EOF Separate Pricing per Customer } } if ( (!isset($HTTP_GET_VARS['sort'])) || (!ereg('[1-8][ad]', $HTTP_GET_VARS['sort'])) || (substr($HTTP_GET_VARS['sort'], 0, 1) > sizeof($column_list)) ) { for ($i=0, $n=sizeof($column_list); $i<$n; $i++) { if ($column_list[$i] == 'PRODUCT_LIST_NAME') { $HTTP_GET_VARS['sort'] = $i+1 . 'a'; $listing_sql .= " order by pd.products_name"; break; } } } else { $sort_col = substr($HTTP_GET_VARS['sort'], 0 , 1); $sort_order = substr($HTTP_GET_VARS['sort'], 1); $listing_sql .= ' order by '; switch ($column_list[$sort_col-1]) { case 'PRODUCT_LIST_MODEL': $listing_sql .= "p.products_model " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_NAME': $listing_sql .= "pd.products_name " . ($sort_order == 'd' ? 'desc' : ''); break; case 'PRODUCT_LIST_MANUFACTURER': $listing_sql .= "m.manufacturers_name " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_QUANTITY': $listing_sql .= "p.products_quantity " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_IMAGE': $listing_sql .= "pd.products_name"; break; case 'PRODUCT_LIST_WEIGHT': $listing_sql .= "p.products_weight " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; case 'PRODUCT_LIST_PRICE': $listing_sql .= "final_price " . ($sort_order == 'd' ? 'desc' : '') . ", pd.products_name"; break; } } ?> <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="pageHeading"><?php echo $breadcrumb->last(); ?></td> <?php // optional Product List Filter if (PRODUCT_LIST_FILTER > 0) { if (isset($HTTP_GET_VARS['manufacturers_id'])) { $filterlist_sql = "select distinct c.categories_id as id, cd.categories_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where p.products_status = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and p2c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and p.manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "' order by cd.categories_name"; } else { $filterlist_sql= "select distinct m.manufacturers_id as id, m.manufacturers_name as name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_MANUFACTURERS . " m where p.products_status = '1' and p.manufacturers_id = m.manufacturers_id and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by m.manufacturers_name"; } $filterlist_query = tep_db_query($filterlist_sql); if (tep_db_num_rows($filterlist_query) > 1) { echo ' <td align="center" class="main">' . tep_draw_form('filter', FILENAME_DEFAULT, 'get') . TEXT_SHOW . ' '; if (isset($HTTP_GET_VARS['manufacturers_id'])) { echo tep_draw_hidden_field('manufacturers_id', $HTTP_GET_VARS['manufacturers_id']); $options = array(array('id' => '', 'text' => TEXT_ALL_CATEGORIES)); } else { echo tep_draw_hidden_field('cPath', $cPath); $options = array(array('id' => '', 'text' => TEXT_ALL_MANUFACTURERS)); } echo tep_draw_hidden_field('sort', $HTTP_GET_VARS['sort']); while ($filterlist = tep_db_fetch_array($filterlist_query)) { $options[] = array('id' => $filterlist['id'], 'text' => $filterlist['name']); } // Added hidden session id to next line for manufacturer sub-categories echo tep_draw_pull_down_menu('filter_id', $options, (isset($HTTP_GET_VARS['filter_id']) ? $HTTP_GET_VARS['filter_id'] : ''), 'onchange="this.form.submit()"'). tep_hide_session_id(); echo '</form></td>' . "\n"; } } // Get the right image for the top-right $image = DIR_WS_IMAGES . 'table_background_list.gif'; if (isset($HTTP_GET_VARS['manufacturers_id'])) { $image = tep_db_query("select manufacturers_image from " . TABLE_MANUFACTURERS . " where manufacturers_id = '" . (int)$HTTP_GET_VARS['manufacturers_id'] . "'"); $image = tep_db_fetch_array($image); $image = $image['manufacturers_image']; } elseif ($current_category_id) { $image = tep_db_query("select categories_image from " . TABLE_CATEGORIES . " where categories_id = '" . (int)$current_category_id . "'"); $image = tep_db_fetch_array($image); $image = $image['categories_image']; } ?> <td align="right"><?php echo tep_image(DIR_WS_IMAGES . $image, HEADING_TITLE, HEADING_IMAGE_WIDTH, HEADING_IMAGE_HEIGHT); ?></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><?php include(DIR_WS_MODULES . FILENAME_PRODUCT_LISTING); ?></td> </tr> </table></td> <?php } else { // default page ?> <td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td class="main"><?php echo tep_customer_greeting(); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <?php $row = 0; $manufacturers_query = tep_db_query("select manufacturers_name, manufacturers_id, manufacturers_image from " . TABLE_MANUFACTURERS . " order by manufacturers_name" ); while ($manufacturers = tep_db_fetch_array($manufacturers_query)) { $row++; ?> <td align="center" class="main" width="25%" valign="top"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $manufacturers['manufacturers_id'] . '=' . $manufacturers['manufacturers_name']) . '">'. tep_image(DIR_WS_IMAGES . $manufacturers['manufacturers_image'], $manufacturers['manufacturers_name'], SUBCATEGORY_IMAGE_WIDTH, SUBCATEGORY_IMAGE_HEIGHT) . "</a>"; ?></td> <?php if ((($row / 3) == floor($row / 3))) { ?> </tr> <tr> <?php } } ?> </tr> </table> </td> </tr> </table></td> </tr> </table></td> <?php } ?> <!-- body_text_eof //--> <td width="0" valign="top"><table border="0" width="0" cellspacing="0" cellpadding="2"> <!-- right_navigation //--> <!-- right_navigation_eof //--> </table></td> </tr> </table> <!-- body_eof //--> <!-- footer //--> <?php require(DIR_WS_INCLUDES . 'footer.php'); ?> <!-- footer_eof //--> <br> </body> </html> <?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?> Quote Link to comment Share on other sites More sharing options...
Fredrik.r Posted April 28, 2006 Share Posted April 28, 2006 Hi. I have not been able to solve incudling SPPC related code to other pages than catalog/products_new.php. Are there any directions how to include it to other pages, like for example the bestselling_products.php two posts up? I would be very very thankful for information about this. Also, I have not managed to get Wishlist 3.5d to show the right prices depending on customer group. I saw in this thread that someone else did this some pages ago, but she did not tell how to.. Quote Link to comment Share on other sites More sharing options...
invasi0n Posted April 28, 2006 Share Posted April 28, 2006 Hi, Can somebody please explain the latest version v4.1.3? Separate Pricing Per Customer v4.1.3 (bugfix) infobroker 28 Apr 2006 Fix in admin/categories.php in } elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') for customers_group_id, customers_group_price, products_id I have v4.1.2 installed and my admin/categories.php already contain this line: } elseif ($HTTP_POST_VARS['copy_as'] == 'duplicate') I don't understand this update. Somebody can help? Thanks. Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted April 28, 2006 Share Posted April 28, 2006 Anyone here using Random New Products Shows Specials inc SubCats 1.0 with Seperate Pricing Per Customer? I have no idea how to implement SSPPC... Pretty inefficient code by the way. Eliminated quite a number of unnecessary queries. <?php /* $Id: new_products.php,v 1.35 2004/02/05 15:50:00 adf Exp $ Randomize New Products adapted for Separate Pricing Per Customer 2006/04/29 $Id: new_products.php,v 1.34 2003/06/09 22:49:58 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Released under the GNU General Public License */ ?> <!-- new_products //--> <?php if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) { // start random new products // deleted all reference to specials, only NULL as specials_new_products_price left $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_price, p.products_tax_class_id, pd.products_name, NULL as specials_new_products_price from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p where products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added desc limit " . MAX_RANDOM_SELECT_NEW); } else { // in a category $cats[] = $new_products_category_id; // current catID as starting value // put cat-IDs of all cats nested in current branch into $cats array, go through all subbranches for($i=0;$i<count($cats);$i++) { $categorie_query = tep_db_query("select categories_id from " . TABLE_CATEGORIES . " where parent_id = '" . (int)$cats[$i] . "'"); while ($categorie = tep_db_fetch_array($categorie_query)) { $cats[] = $categorie['categories_id']; } $cats=array_unique($cats); // sort out doubles } $num = (int) MAX_DISPLAY_NEW_PRODUCTS; $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_price, NULL as specials_new_products_price, p.products_tax_class_id, pd.products_name from " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p , " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id in (".implode(', ', $cats).") and p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added desc limit " . MAX_RANDOM_SELECT_NEW); // end random new products } if (tep_db_num_rows($new_products_query) > 0) { $info_box_contents = array(); $info_box_contents[] = array('text' => sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B'))); new contentBoxHeading($info_box_contents); $row = 0; $col = 0; $pCount = 0; $info_box_contents = array(); $found_products = array(); $num_rows = tep_db_num_rows($new_products_query); if (MAX_DISPLAY_NEW_PRODUCTS > MAX_RANDOM_SELECT_NEW) { // don't allow more new products than will be queried $max_new_products = MAX_RANDOM_SELECT_NEW; } else { $max_new_products = MAX_DISPLAY_NEW_PRODUCTS; } if ($num_rows < $max_new_products) { $max_new_products = $num_rows; } if ($num_rows > 0) { // SPPC code to get correct prices if(!tep_session_is_registered('sppc_customer_group_id')) { $customer_group_id = '0'; } else { $customer_group_id = $sppc_customer_group_id; } while ($_new_products = tep_db_fetch_array($new_products_query)) { $new_products[] = $_new_products; $list_of_prdct_ids[] = $_new_products['products_id']; } $select_list_of_prdct_ids = "products_id = '".$list_of_prdct_ids[0]."' "; if ($num_rows > 1) { for ($n = 1; $n < count($list_of_prdct_ids); $n++) { $select_list_of_prdct_ids .= "or products_id = '".$list_of_prdct_ids[$n]."' "; } } // get all customers_group_prices for products with the particular customer_group_id // however not necessary for customer_group_id = 0 if ($customer_group_id != '0') { $pg_query = tep_db_query("select pg.products_id, customers_group_price as price from " . TABLE_PRODUCTS_GROUPS . " pg where (".$select_list_of_prdct_ids.") and pg.customers_group_id = '".$customer_group_id."'"); while ($pg_array = tep_db_fetch_array($pg_query)) { $new_prices[] = array ('products_id' => $pg_array['products_id'], 'products_price' => $pg_array['price'], 'specials_new_products_price' => ''); } for ($x = 0; $x < $num_rows; $x++) { // replace products prices with those from customers_group table if(!empty($new_prices)) { for ($i = 0; $i < count($new_prices); $i++) { if( $new_products[$x]['products_id'] == $new_prices[$i]['products_id'] ) { $new_products[$x]['products_price'] = $new_prices[$i]['products_price']; } } } // end if(!empty($new_prices) } // end for ($x = 0; $x < $num_rows; $x++) } // end if ($customer_group_id != '0') // an extra query is needed for all the specials $specials_query = tep_db_query("select products_id, specials_new_products_price from specials where (".$select_list_of_prdct_ids.") and status = '1' and customers_group_id = '" .$customer_group_id. "' "); while ($specials_array = tep_db_fetch_array($specials_query)) { $new_s_prices[] = array ('products_id' => $specials_array['products_id'], 'specials_new_products_price' => $specials_array['specials_new_products_price']); } // replace NULL with the correct specials_new_products_price if(!empty($new_s_prices)) { for ($x = 0; $x < $num_rows; $x++) { for ($i = 0; $i < count($new_s_prices); $i++) { if( $new_products[$x]['products_id'] == $new_s_prices[$i]['products_id'] ) { $new_products[$x]['specials_new_products_price'] = $new_s_prices[$i]['specials_new_products_price']; } } } } // // end if(!empty($new_s_prices) while ($pCount < $max_new_products) { // choose a random row $random_product = ''; $random_row = tep_rand(0, ($num_rows - 1)); // tep_db_data_seek($new_products_query, $random_row); // $random_product = tep_db_fetch_array($new_products_query); // because the fetch array of the new_products_query has already been done, slightly different // code is used: $random_product = $new_products[$random_row]; // see if found already, if not use else skip $found = 0; for ($ii=0; $ii < $pCount; $ii++) { if ($found_products[$ii] == $random_product['products_id']) { $found = 1; break; } } if ($found == 0) { // keep track of found id's $found_products[$pCount] += $random_product['products_id']; $pCount++; // add to display array // next two queries made obsolete by adapted $new_products_query (products_name) and sppc code (special prices) // $random_product['products_name'] = tep_get_products_name($random_product['products_id']); // $random_product['specials_new_products_price'] = tep_get_products_special_price($random_product['products_id']); if (tep_not_null($random_product['specials_new_products_price'])) { $whats_new_price = '<s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br>'; $whats_new_price .= '<span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>'; } else { $whats_new_price = $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])); } $info_box_contents[$row][$col] = array('align' => 'center', 'params' => 'class="smallText" width="33%" valign="top"', 'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a><br>' . $whats_new_price); $col ++; if ($col > 2) { $col = 0; $row ++; } } // found } // while pCount } // num_rows // end random new products new contentBox($info_box_contents); } ?> <!-- new_products_eof //--> Quote Link to comment Share on other sites More sharing options...
Fredrik.r Posted April 29, 2006 Share Posted April 29, 2006 Hi Jan! Sorry for asking about Wishlist, I just found the post you wrote in october.. :blush: I'm having some problems though. When I am logged in as a retail customer everything works fine. However, when logged in as wholesale customer only products with assigned wholesale prices will show correct in the wishlist. If the product only has a retail price theres no image in the wishlist, a price of 0 and a text that the product is not available any longer. The same product will show properly if the customer belongs to the retail group. Do you know why this happens? Have I missed something important in your code example for wishlist? Carlos, The most elegant way would be to first collect all the products_id's (as shown below) and then pick up all the info for all items on the wishlist in one query (and then using the extra [$x] as in includes/modules/product_listing.php). As a starter I suggest to use this code (starts around line 49 in your file): <?php $i = 0; // BOF Separate Pricing per Customer if(!tep_session_is_registered('sppc_customer_group_id')) { $customer_group_id = '0'; } else { $customer_group_id = $sppc_customer_group_id; } while (list($wishlist_id, ) = each($wishList->wishID)) { $list_of_prdct_ids[] = tep_get_prid($wishlist_id); if (tep_not_null($list_of_prdct_ids)) { // implode will give an error when $list_of_prdct_ids is empty $specials_query = tep_db_query("select products_id, specials_new_products_price from " . TABLE_SPECIALS . " where products_id in ('" . implode("','",$list_of_prdct_ids) . "') and status = '1' and customers_group_id = '" . $customer_group_id . "'"); while ($specials_array = tep_db_fetch_array($specials_query)) { $special_prices[] = array ('products_id' => $specials_array['products_id'], 'specials_new_products_price' => $specials_array['specials_new_products_price'] , 'final_price' => $specials_array['specials_new_products_price']); } // end while ($specials_array = tep_db_fetch_array($specials_query)) } // end if (tep_not_null($list_of_prdct_ids)) } // end while (list($wishlist_id, ) = each($wishList->wishID)) reset($wishList->wishID); // EOF Separate Pricing per Customer while (list($wishlist_id, ) = each($wishList->wishID)) { $product_id = tep_get_prid($wishlist_id); // BOF Separate Pricing per Customer if ($customer_group_id == '0') { $products_query = tep_db_query("select pd.products_id, pd.products_name, pd.products_description, p.products_image, p.short_desc, p.products_status, p.manufacturers_id, p.products_price, p.products_tax_class_id, NULL as specials_new_products_price, p.products_price as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = '" . $product_id . "' and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "'"); } else { $products_query = tep_db_query("select pd.products_id, pd.products_name, pd.products_description, p.products_image, p.short_desc, p.products_status, p.manufacturers_id, pg.customers_group_price as products_price, p.products_tax_class_id, NULL as specials_new_products_price, pg.customers_group_price as final_price from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_GROUPS . " pg using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = '" . $product_id . "' and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and pg.customers_group_id = '" . $customer_group_id . "'"); } // end if/else ($customer_group_id == '0') $products = tep_db_fetch_array($products_query); // add special price if there is one, replace final price in that case too if (tep_not_null($special_prices)) { for ($i = 0; $i < count($special_prices); $i++) { if( $products['products_id'] == $special_prices[$i]['products_id'] ) { $products['specials_new_products_price'] = $special_prices[$i]['specials_new_products_price']; $products['final_price'] = $special_prices[$i]['final_price']; } } } // end if (tep_not_null($special_prices)) // EOF Separate Pricing per Customer if (($i/2) == floor($i/2)) { $class = "productListing-even"; } else { $class = "productListing-odd"; } This basically goes through the wishlist to pick up the products_id's, then collects all the special prices (to avoid even more queries), then uses a different query for retail and customers groups (avoids picking up special prices) and then adds in the special prices and replaces the final price (special price if there is one). The rest stays the same. Haven't been able to test this, since I don't have that contribution installed so expect bugs. Quote Link to comment Share on other sites More sharing options...
invasi0n Posted April 29, 2006 Share Posted April 29, 2006 Pretty inefficient code by the way. Eliminated quite a number of unnecessary queries. Thanks a lot man! Your help is very appreciated Thanks! Quote Link to comment Share on other sites More sharing options...
Guest Posted April 29, 2006 Share Posted April 29, 2006 Sorry for my question. Is there a way to implement a separate tax per customer? Because in my country, when the customer is a Reseller, the tax is only 10.5%, but the common public has 21%. I search in the entire forum but without success. It is similar to "enable or disable tax per customer", but with the choice of tax rates. Thank any help :blush: Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted April 29, 2006 Share Posted April 29, 2006 Fredrik, Sorry for asking about Wishlist, I just found the post you wrote in october.. That is OK, I haven't even had the time to take a look at it. I'm having some problems though. When I am logged in as a retail customer everything works fine. However, when logged in as wholesale customer only products with assigned wholesale prices will show correct in the wishlist. If the product only has a retail price theres no image in the wishlist, a price of 0 and a text that the product is not available any longer. The same product will show properly if the customer belongs to the retail group. Do you know why this happens? Have I missed something important in your code example for wishlist? Looking at the code I see the problem. It wasn't very good code anyway, I should have done better. The wishlist code is rather "query happy", separate queries for everything and every item, nothing I can do about that now. I think this should work better (left getting the special price but now for the customer group in the first query, only get and replace the products price with group price when the customer is not retail). Note that I haven't tested this.... <?php $i = 0; while (list($wishlist_id, ) = each($wishList->wishID)) { $product_id = tep_get_prid($wishlist_id); // BOF Separate Pricing per Customer if(!tep_session_is_registered('sppc_customer_group_id')) { $customer_group_id = '0'; } else { $customer_group_id = $sppc_customer_group_id; } // get the special price for the customer group, the customer group price is // queried and added separately $products_query = tep_db_query("select pd.products_id, pd.products_name, pd.products_description, p.products_image, p.short_desc, p.products_status, p.manufacturers_id, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where pd.products_id = '" . $product_id . "' and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and s.customers_group_id = '". $customer_group_id . "' "); $products = tep_db_fetch_array($products_query); // check for a group price when customer is not retail if ($customer_group_id != '0') { $group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $product_id . "' and customers_group_id = '" . $customer_group_id . "'"); if ($group_price = tep_db_fetch_array($group_price_query)) { // replace products_price with group price if there is one $products['products_price'] = $group_price['customers_group_price']; } } // end if ($customer_group_id != '0') // EOF Separate Pricing per Customer if (($i/2) == floor($i/2)) { $class = "productListing-even"; } else { $class = "productListing-odd"; } ?> Quote Link to comment Share on other sites More sharing options...
Fredrik.r Posted April 29, 2006 Share Posted April 29, 2006 (edited) Hi Jan! Thank you for helping me! I tried the code above but it seems that only products with special prices are added to wishlist when logged in as retail and wholesale customer. All other products (regardless of retail or wholesale customer) will be added as "non existent" with no image, no price, no description and no delete button. Is your code the only modifications to wishlist.php or do I need to change something else? Edited April 29, 2006 by Fredrik.r Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted April 29, 2006 Share Posted April 29, 2006 it seems that only products with special prices are added to wishlist when logged in as retail and wholesale customer. All other products (regardless of retail or wholesale customer) will be added as "non existent" with no image, no price, no description and no delete button. Bummer, yes, that will mean not only one extra query (for the group price) but also for the special price. Try this: <?php $i = 0; while (list($wishlist_id, ) = each($wishList->wishID)) { $product_id = tep_get_prid($wishlist_id); // BOF Separate Pricing per Customer if(!tep_session_is_registered('sppc_customer_group_id')) { $customer_group_id = '0'; } else { $customer_group_id = $sppc_customer_group_id; } // special price for the customer group and the customer group price is // queried and added separately $products_query = tep_db_query("select pd.products_id, pd.products_name, pd.products_description, p.products_image, p.short_desc, p.products_status, p.manufacturers_id, p.products_price, p.products_tax_class_id, NULL as as specials_new_products_price, p.products_price as final_price from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where pd.products_id = '" . $product_id . "' and p.products_id = pd.products_id and pd.language_id = '" . $languages_id . "' and s.customers_group_id = '". $customer_group_id . "' "); $products = tep_db_fetch_array($products_query); // check for a group price when customer is not retail if ($customer_group_id != '0') { $group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $product_id . "' and customers_group_id = '" . $customer_group_id . "'"); if ($group_price = tep_db_fetch_array($group_price_query)) { // replace products_price and final price with group price if there is one $products['products_price'] = $group_price['customers_group_price']; $products['final_price'] = $group_price['customers_group_price']; } } // end if ($customer_group_id != '0') // get the special price, tep_get_products_special_price is customer group aware if ($new_price = tep_get_products_special_price($products['products_id'])) { $products['specials_new_products_price'] = $new_price; $products['final_price'] = $new_price; } // EOF Separate Pricing per Customer if (($i/2) == floor($i/2)) { $class = "productListing-even"; } else { $class = "productListing-odd"; } ?> Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted April 29, 2006 Share Posted April 29, 2006 tbsg, the site is set to only display prices if you're logged in as a wholesale customer. the prices appear correctly on the product_info.php, specials.php and products_new.php pages but the prices don't appear at all on any of the pages driven by index.php - just the buy now button appears. There seems to be nothing wrong with the code in index.php. If I cut and paste it, it works fine. In the product listing I see a price and a buy now button, whether logged in or not. I assume you have set the retail prices to zero? The prices in the product listing are displayed by catalog/includes/modules/product_listing.php. It looks to me the error is in there, not on index.php. Quote Link to comment Share on other sites More sharing options...
Fredrik.r Posted April 29, 2006 Share Posted April 29, 2006 Bummer, yes, that will mean not only one extra query (for the group price) but also for the special price. Try this: Jan, Thank you for being so helpful!! I get a new error though; 1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'as specials_new_products_price, p.products_price as final_price select pd.products_id, pd.products_name, pd.products_description, p.products_image, p.products_status, p.manufacturers_id, p.products_price, p.products_tax_class_id, NULL as as specials_new_products_price, p.products_price as final_price from products p, products_description pd where pd.products_id = '306' and p.products_id = pd.products_id and pd.language_id = '4' and s.customers_group_id = '0' Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted April 29, 2006 Share Posted April 29, 2006 I get a new error though; 1064 - You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near 'as specials_new_products_price, p.products_price as final_price There is twice an "as", should be only one in the first query: select pd.products_id, pd.products_name, pd.products_description, p.products_image, p.products_status, p.manufacturers_id, p.products_price, p.products_tax_class_id, NULL as as specials_new_products_price, p.products_price as final_price from products p, products_description pd where pd.products_id = '306' and p.products_id = pd.products_id and pd.language_id = '4' and s.customers_group_id = '0' Quote Link to comment Share on other sites More sharing options...
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.