TracyS Posted June 24, 2008 Share Posted June 24, 2008 Ok - I thought I could just create a product_info2.php - remove references to application_top and the left and right columns and footer -etc.. and save it in the includes/modules folder and define it. Then include it in index.php where normally the product_listing.php file is included. For some reason though - it is telling me "No Products Found". The only thing I have changed in the queries is adding the TABLE_PRODUCTS_TO_CATEGORIES p2c using(products_id) and then checked where p2c.categories_id = '" . $HTTP_GET_VARS['categories_id'] . "' rather than checking for products_id. Any idea why this switch would cause it to not find any products? I'm going to see if I can revert to an osC stock product_info.php to grab the code from and see if I can get that working and then add the SPPC and Master Products back in - maybe that will help me pinpoint which query is causing it to not find any products. If you happen to see anything in my product_info2.php file that strikes you as incorrect - please let me know :blush: Also - where it currently says if ($product_check['total'] < 1) { Can I change it to while ($product_check['total'] < 1) { To cause it to loop through and create what I want for all of the products in that category? my product_info2.php <?php require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO); // BOF Separate Price per Customer, hide products and categories from groups if(!tep_session_is_registered('sppc_customer_group_id')) { $customer_group_id = '0'; } else { $customer_group_id = $sppc_customer_group_id; } $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) left join " . TABLE_CATEGORIES . " c using(categories_id) where p.products_status = '1' and p.products_id = p2c.products_id AND p2c.categories_id = '" . (int)$HTTP_GET_VARS['categories_id'] . "' and p2c.categories_id = c.categories_id and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 and find_in_set('" . $customer_group_id . "', categories_hide_from_groups) = 0"); $product_check = tep_db_fetch_array($product_check_query); // EOF Separate Price per Customer, hide products and categories from groups //added by admin showing the master for slave products $master_query1 = tep_db_query("select p.products_id,p.products_master,p2c.categories_id from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) where p2c.categories_id = '" . (int)$HTTP_GET_VARS['categories_id'] . " '"); $results1 = tep_db_fetch_array($master_query1); if (($results1['products_master'] != null) &&($results1['products_master'] != 0) ) { $HTTP_GET_VARS['categories_id']=(int)$results1['products_master']; } //end of code added by admin showing the master for slave products ?> <table border="0" width="100%" cellspacing="3" cellpadding="3"> <tr> <td width="100%" valign="top"><?php echo '<form name="buy_now_" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=add_slave', 'NONSSL') . '">'; ?><table border="0" width="100%" cellspacing="0" cellpadding="0"> <?php // Master Products EOF if ($product_check['total'] < 1) { // BOF Separate Pricing Per Customer, Hide products and categories for groups $hide_product = true; // needed for column_right // EOF Separate Pricing Per Customer, Hide products and categories for groups ?> <tr> <td><?php new infoBox(array(array('text' => TEXT_PRODUCT_NOT_FOUND))); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table></td> </tr> </table></td> </tr> <?php } else { //Master Products $product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_master_status, NULL as specials_new_products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id, p2c.categories_id from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p2c.categories_id = '" . (int)$HTTP_GET_VARS['categories_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'"); //Master Products EOF $product_info = tep_db_fetch_array($product_info_query); // tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'"); if ($new_price = tep_get_products_special_price($product_info['products_id'])) { // BOF Separate Pricing per Customer $scustomer_group_price_query = tep_db_query("select pg.customers_group_price, p2c.categories_id from " . TABLE_PRODUCTS_GROUPS . " pg left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) where p2c.categories_id = '" . (int)$HTTP_GET_VARS['categories_id']. "' and customers_group_id = '" . $customer_group_id . "'"); if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) { $product_info['products_price']= $scustomer_group_price['customers_group_price']; } // EOF Separate Price per Customer $products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>'; } else { // BOF Separate Pricing per Customer $scustomer_group_price_query = tep_db_query("select pg.customers_group_price, p2c.categories_id from " . TABLE_PRODUCTS_GROUPS . " pg left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) where p2c.categories_id = '" . (int)$HTTP_GET_VARS['categories_id']. "' and customers_group_id = '" . $customer_group_id . "'"); if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) { $product_info['products_price']= $scustomer_group_price['customers_group_price']; } // EOF Separate Price per Customer $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])); } if (tep_not_null($product_info['products_model'])) { $products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>'; } else { $products_name = $product_info['products_name']; } ?> <tr> <td><table border="0" width="100%" cellspacing="0" cellpadding="0"> <tr> <td valign="top"><h1><?php echo $products_name; ?></h1></td> <td class="pageHeading" align="right" valign="top"><?php echo $products_price; ?></td> </tr> </table></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td class="main"> <?php if (tep_not_null($product_info['products_image'])) { ?> <table border="0" cellspacing="0" cellpadding="2" align="right"> <tr> <td align="center" class="smallText"> <script language="javascript" type="text/javascript"><!-- document.write('<?php echo ' ' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"'); ?>'); //--></script> <noscript> <?php echo ' ' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"'); ?> </noscript> </td> </tr> </table> <?php } ?> <?php echo embedded_href_replace($product_info['products_description']); ?> <?php } //Master Products if (tep_not_null($product_info['products_url'])) { ?> <tr> <td class="main"><?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?></td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } ?> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php if ($product_info['products_price']>0) { $qty_array = array(); for ($i=0; $n2 = (($product_info['products_quantity'] < 20) ? $product_info['products_quantity'] : 20), $i <= $n2; $i++) { $qty_array[] = array('id' => $i, 'text' => $i); } ?> <tr> <td align="right" class="main"><?php if ($product_info['products_quantity'] > 0) { echo TEXT_QUANTITY . ' ' . tep_draw_pull_down_menu('Qty_ProdId_' . $product_info['products_id'], $qty_array); } elseif ((STOCK_CHECK == 'false')&& ($product_info['products_quantity'] < 1)) { $qty_array = array(); for ($i=0; $ns = 20, $i <= $ns; $i++) { $qty_array[] = array('id' => $i, 'text' => $i); } echo TEXT_QUANTITY . ' ' . tep_draw_pull_down_menu('Qty_ProdId_' . $product_info['products_id'], $qty_array); } else { echo TEXT_STOCK; } echo tep_draw_separator('pixel_trans.gif', '30', '10'); ?> </td> </tr> <?php } if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) { ?> <tr> <td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></td> </tr> <?php } ?> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php $master_query = tep_db_query("select p.products_master, p.products_id, p2c.categories_id from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) where p2c.categories_id = '" . (int)$HTTP_GET_VARS['categories_id'] . "' and p.products_master = p2c.products_id"); $results = tep_db_fetch_array($master_query); if (($results['products_id'] != null) && ($product_info['products_master_status'] == 1)) { ?> <tr> <td align="left" class="smallText"> <?php echo TEXT_SLAVE_PRODUCTS; ?> </td> </tr> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <tr> <td><?php include(DIR_WS_MODULES . FILENAME_MASTER_PRODUCTS); ?></td> </tr> <?php } ?> <tr><td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '10'); ?></td></tr> <tr><td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox"> <tr class="infoBoxContents"> <td><table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> <td class="main" align="right"><?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?></td> <td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td> </tr> </table></td> </tr> </table></td> </tr> </table></form></td> <!-- Master Products EOF //--> </tr> </table> Yeah, working on getting it all figured out :blush: Hopefully starting fresh today after a nice long weekend will help my brain to get it all working today :rolleyes: Quote ~Tracy Link to comment Share on other sites More sharing options...
Jan Zonjee Posted June 24, 2008 Share Posted June 24, 2008 Q1: I am using both English and Swedish in the admin area, do I need to install Swedish admin files as well? (Easily done, just copying the English files and translate the admin text) Yes. Q2: Will the TVA Intracom work with SPPC? (I use this contrib in order to check if the VAT number is valid eithin the EU/EES area). I know that contribution exists, but I have never taken a good look at it. So will it work with SPPC doesn't say me much because I don't know how TVA Intracom is incorporated in the admin section. Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted June 24, 2008 Share Posted June 24, 2008 Do you happen to know if anyone has managed this before? Never heard of that but if the code you are trying to make work is this: if (isset($_GET["customer_id"])) { $email_query = tep_db_query("select customer_id, customers_email_address as email from " . TABLE_CUSTOMERS . " where customer_id = '" . (int)$customer_id . "'"); '<li><a href="' . tep_href_link(/newsletter/?p=preferences&email=$email_query['email']) . '">' . HEADER_TITLE_ACCOUNT_NEWSLETTER . '</a></li>' . } else { '<li><a href="' . tep_href_link(/login.php) . '">' . HEADER_TITLE_ACCOUNT_NEWSLETTER . '</a></li>' . } Then there is a lot wrong with it. First, you don't fetch the array with results from $email_query so $email_query['email'] is very very wrong. Then if you look at how the function tep_href_link is used: function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) you would notice from examples that always a constant is used for the file name. So not /login.php (which would give the wrong link anyway) but FILENAME_LOGIN. Then next the different get values as p=preferences are added as the second parameter in that function. See for example: <?php echo '<a href="' . tep_href_link(FILENAME_ADDRESS_BOOK_PROCESS, 'edit=' . $addresses['address_book_id'], 'SSL') . '"> Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted June 24, 2008 Share Posted June 24, 2008 For some reason though - it is telling me "No Products Found". I don't remember ever having seen a get variable called categories_id. But as far as I'm aware there should be a global variable $current_category_id that contains the value of the category id the product is in (at the moment because it can be in several of course). Maybe you have to declare it global in your code before you can use it. Quote Link to comment Share on other sites More sharing options...
TracyS Posted June 24, 2008 Share Posted June 24, 2008 Thanks Jan! I keep trying to plug away at it and I learn as I go each time :blush: You are correct, the get doesn't work with categories_id - but doing p2c.categories_id = '" . (int)$current_category_id . "' does at least produce a product in that category (WOOHOO) Now I just need to figure out how to loop it so I get all of the products in that category rather than just one. Gotta find my PHP books again! UGH :blink: I don't remember ever having seen a get variable called categories_id. But as far as I'm aware there should be a global variable $current_category_id that contains the value of the category id the product is in (at the moment because it can be in several of course). Maybe you have to declare it global in your code before you can use it. Quote ~Tracy Link to comment Share on other sites More sharing options...
TracyS Posted June 24, 2008 Share Posted June 24, 2008 OY! Back to the drawing board we go! LOL :blush: Never heard of that but if the code you are trying to make work is this: if (isset($_GET["customer_id"])) { $email_query = tep_db_query("select customer_id, customers_email_address as email from " . TABLE_CUSTOMERS . " where customer_id = '" . (int)$customer_id . "'"); '<li><a href="' . tep_href_link(/newsletter/?p=preferences&email=$email_query['email']) . '">' . HEADER_TITLE_ACCOUNT_NEWSLETTER . '</a></li>' . } else { '<li><a href="' . tep_href_link(/login.php) . '">' . HEADER_TITLE_ACCOUNT_NEWSLETTER . '</a></li>' . } Then there is a lot wrong with it. First, you don't fetch the array with results from $email_query so $email_query['email'] is very very wrong. Then if you look at how the function tep_href_link is used: function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) you would notice from examples that always a constant is used for the file name. So not /login.php (which would give the wrong link anyway) but FILENAME_LOGIN. Then next the different get values as p=preferences are added as the second parameter in that function. See for example: <?php echo '<a href="' . tep_href_link(FILENAME_ADDRESS_BOOK_PROCESS, 'edit=' . $addresses['address_book_id'], 'SSL') . '"> Quote ~Tracy Link to comment Share on other sites More sharing options...
Guest Posted June 25, 2008 Share Posted June 25, 2008 Hi Everyone, After installing SPPC ver 4.2.1a, I receive this error where the new products module should be on the categories page. 1052 - Column 'products_id' in from clause is ambiguous select distinct p.products_id, p.products_image, p.products_tax_class_id, p.products_price, pd.products_name from products p, products_description pd left join products_to_categories p2c using(products_id) left join categories c using(categories_id) where c.parent_id = '21' and p.products_status = '1' and pd.language_id = '1' and p.products_id = pd.products_id order by p.products_date_added desc limit 9 The featured products module will work in place of the new products module. I have searched the forum and cannot find an answer. The server that the site is on is using PHP Version 4.4.7 and MySQL 5. I have tested the site on another server that is using PHP Version 4.3.11 and MySQL 4 and everything works fine. Any help would be greatly appreciated. Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted June 25, 2008 Share Posted June 25, 2008 After installing SPPC ver 4.2.1a, I receive this error where the new products module should be on the categories page. 1052 - Column 'products_id' in from clause is ambiguous select distinct p.products_id, p.products_image, p.products_tax_class_id, p.products_price, pd.products_name from products p, products_description pd left join products_to_categories p2c using(products_id) left join categories c using(categories_id) where c.parent_id = '21' and p.products_status = '1' and pd.language_id = '1' and p.products_id = pd.products_id order by p.products_date_added desc limit 9 The featured products module will work in place of the new products module. I have searched the forum and cannot find an answer. The server that the site is on is using PHP Version 4.4.7 and MySQL 5. I have tested the site on another server that is using PHP Version 4.3.11 and MySQL 4 and everything works fine. I would expect it to work fine on MySQL 5 instead of the other way around. Try products_description pd left join products_to_categories p2c on pd.products_id = p2c.product_id instead of products_description pd left join products_to_categories p2c using(products_id) Quote Link to comment Share on other sites More sharing options...
bizcribz Posted June 25, 2008 Share Posted June 25, 2008 Addtional Mods incl: SPPC, CCGV, WillCallWithCard, Extra Images, Easy Populate, Discount Coupons, Feed Transform, Related Products, Customer Special Prices Report I have installed version 202 of Hide Products & Categories for SPPC. Cosmetically, it looks great, everything is where it's supposed to be, both in the list of products view and in the product edit view. In the product edit view, when I click the box to hide a group, it is technically hidden and the box stays clicked when I go back to check on it. In the List of Products View, the icon does not show up under the Hidden Column and next to "Hidden from groups:" on the right side it says "none" even though I have several items checked off as hidden. Also, If I have an item hidden, when I do a search for it in the store, it still shows up in the search query. Now, if I click on the item it is un available, so that's good, but my client doesn't want it to show up in search query because they don't want the public to even know it's available yet. How can I fix these items so that I can say can officially unveil this to my client and make them happy - B) Quote Link to comment Share on other sites More sharing options...
Alec Posted June 25, 2008 Share Posted June 25, 2008 (edited) I have integrated the Quantity Price Break for SPPC to my web site. Everything is fine except two bugs at the shopping cart. When I log in wholeseller group: SubTotal doesn't reflect the quantity price Credit Point only reflects the original price. There might be a bug at "include/class/shopping_cart.php". The module works well at retailer group. Anyone experience this issue, or knows a solution. Please tell me. Edited June 25, 2008 by Alec Quote Link to comment Share on other sites More sharing options...
Guest Posted June 25, 2008 Share Posted June 25, 2008 I would expect it to work fine on MySQL 5 instead of the other way around. Try products_description pd left join products_to_categories p2c on pd.products_id = p2c.product_id instead of products_description pd left join products_to_categories p2c using(products_id) That worked great! There was just one small typo: p2c.product_id should be p2c.products_id. Thank you very much. I have been racking my brain to figure this out. Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted June 25, 2008 Share Posted June 25, 2008 How can I fix these items so that I can say can officially unveil this to my client and make them happy - B) Sounds like you made errors installing it. Hard to give advice on that. Sounds like you can hide them fine, so the writing to the database is OK (although an error in the display apparently). Another error in the advanced_search_results.php because you can find the hidden products with searching. Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted June 25, 2008 Share Posted June 25, 2008 There might be a bug at "include/class/shopping_cart.php". The module works well at retailer group. The function that calculates the subtotal is called calculate in that class. Since it gets the price from the object PriceFormatter ($pf) and that in turn from PriceFormaterStore ($pfs) you should check if they hold the correct prices by echo'ing them. Preferably not loggin in and see the retail info (copy paste to a text file for easier comparison) and then logging-in to do the same thing. // add this to footer.php for example <!-- // begin html comment, do "view source" to see the information echo'ed <?php print_r($pfs); ?> --> Quote Link to comment Share on other sites More sharing options...
Guest Posted June 26, 2008 Share Posted June 26, 2008 (edited) HI all, Im Using SPPC 4.2.0 i install the mod and every page works fine but when i apply the changes to product_listing.php, it screws my pages up , e.g Error 1 and HERE Should Look Like This I Also dont have the correct code as stipulated in the install, for products_new and specials.php, the last two file edits, below is an untouched product_listing.php (modules folder) in my style, could someone help me put the code in the right place, please <?php /* $Id: product_listing.php,v 1.44 2003/06/09 22:49:59 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 */ ?> <?php echo tep_draw_title_top();?> <?php echo $breadcrumb->trail(' » ')?> <?php echo tep_draw_title_bottom();?> <? tep_draw_heading_top_3();?> <?php $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id'); if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '2') ) ) { ?> <?php echo tep_draw_result_top_1(); ?> <table border="0" width="100%" cellspacing="0" cellpadding="0" class="result"> <tr> <td><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td> <td class="result_right" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td> </tr> </table> <?php echo tep_draw_result_bottom_1(); ?> <?php echo tep_draw_result_top(); ?> <?php } $info_box_contents = array(); $list_box_contents = array(); $my_row = 0; $my_col = 0; for ($col=0, $n=sizeof($column_list); $col<$n; $col++) { switch ($column_list[$col]) { case 'PRODUCT_LIST_MODEL': $lc_text = TABLE_HEADING_MODEL; $lc_align = ''; break; case 'PRODUCT_LIST_NAME': $lc_text = TABLE_HEADING_PRODUCTS; $lc_align = ''; break; case 'PRODUCT_LIST_MANUFACTURER': $lc_text = TABLE_HEADING_MANUFACTURER; $lc_align = ''; break; case 'PRODUCT_LIST_PRICE': $lc_text = TABLE_HEADING_PRICE; $lc_align = 'right'; break; case 'PRODUCT_LIST_QUANTITY': $lc_text = TABLE_HEADING_QUANTITY; $lc_align = 'right'; break; case 'PRODUCT_LIST_WEIGHT': $lc_text = TABLE_HEADING_WEIGHT; $lc_align = 'right'; break; case 'PRODUCT_LIST_IMAGE': $lc_text = TABLE_HEADING_IMAGE; $lc_align = 'center'; break; case 'PRODUCT_LIST_BUY_NOW': $lc_text = TABLE_HEADING_BUY_NOW; $lc_align = 'center'; break; } if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) { $lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text); } $list_box_contents[0][] = array('align' => $lc_align, 'params' => 'class="productListing-heading"', 'text' => ' ' . $lc_text . ' '); } if ($listing_split->number_of_rows > 0) { $rows = 0; $listing_query = tep_db_query($listing_split->sql_query); while ($listing = tep_db_fetch_array($listing_query)) { $rows++; if (($rows/2) == floor($rows/2)) { $list_box_contents[] = array('params' => 'class="productListing-even"'); } else { $list_box_contents[] = array('params' => 'class="productListing-odd"'); } $cur_row = sizeof($list_box_contents) - 1; for ($col=0, $n=sizeof($column_list); $col<$n; $col++) { $lc_align = ''; switch ($column_list[$col]) { case 'PRODUCT_LIST_MODEL': $lc_align = ''; $lc_text = ' ' . $listing['products_model'] . ' '; break; case 'PRODUCT_LIST_NAME': $lc_align = ''; if (isset($HTTP_GET_VARS['manufacturers_id'])) { $p_name = $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>'; } else { $p_name = $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>'; } break; case 'PRODUCT_LIST_MANUFACTURER': $lc_align = ''; $lc_text = ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a> '; break; case 'PRODUCT_LIST_PRICE': $lc_align = 'right'; if (tep_not_null($listing['specials_new_products_price'])) { $p_price = $lc_text = '<s>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>'; } else { $p_price = $lc_text = '<span class="productSpecialPrice">' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>'; } break; case 'PRODUCT_LIST_QUANTITY': $lc_align = 'right'; $lc_text = ' ' . $listing['products_quantity'] . ' '; break; case 'PRODUCT_LIST_WEIGHT': $lc_align = 'right'; $lc_text = ' ' . $listing['products_weight'] . ' '; break; case 'PRODUCT_LIST_IMAGE': $lc_align = 'center'; if (isset($HTTP_GET_VARS['manufacturers_id'])) { $p_pic = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; } else { $p_pic = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; } break; case 'PRODUCT_LIST_BUY_NOW': $lc_align = 'center'; $lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> '; break; } $product_query = tep_db_query("select products_description, products_id from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$listing['products_id'] . "' and language_id = '" . (int)$languages_id . "'"); $product = tep_db_fetch_array($product_query); $p_desc = substr($product['products_description'], 0, MAX_DESCR_1); $p_id = $product['products_id']; /* $list_box_contents[$cur_row][] = array('align' => $lc_align, 'params' => '', 'text' => $lc_text); */ } $info_box_contents[$my_row][$my_col] = array('align' => 'center', 'params' => ' style="width:100%;"', 'text' => ''.tep_draw_prod_top().' <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="col_1"> <table cellpadding="0" cellspacing="0" border="0" class="col_1"> <tr> <td class="pic">'.$p_pic.'</td> </tr> </table> </td> <td> <table cellpadding="0" cellspacing="0" border="0" class="col_2"> <tr> <td class="border_bottom middle" style="height:30px">'.$p_name.'</td> </tr> <tr> <td class="middle" style="height:42px">'.$p_price.'</td> </tr> <tr> <td><a href="'.tep_href_link("products_new.php","action=buy_now&products_id=".$p_id).'">'.tep_image_button('button_add_to_cart1.gif').'</a>'.tep_draw_separator('spacer.gif', '12', '1').'<a href="' . tep_href_link('product_info.php?products_id='.$p_id) . '">'.tep_image_button("button_details.gif").'</a> </td> </tr> </table> </td> </tr> </table> '.tep_draw_prod_bottom().''); $my_col ++; if ($my_col > 0) { $my_col = 0; $my_row ++; } } new contentBox($info_box_contents); // new productListingBox($list_box_contents); } else { ?> <?php echo tep_draw_heading_top_1(); ?> <table border="0" cellspacing="1" cellpadding="2" class="infoBox box_width_cont"> <tr class="infoBoxContents"> <td> <table cellpadding="0" cellspacing="0" class="product"> <tr><td class="padd_22"><?php echo TEXT_NO_PRODUCTS ?></td></tr> </table> </td> </tr> </table> <br style="line-height:1px;"><br style="line-height:10px;"> <?php echo tep_draw_heading_bottom_1(); } if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) { ?> <?php echo tep_draw_result_bottom(); ?> <?php echo tep_draw_result_top_2(); ?> <table border="0" width="100%" cellspacing="0" cellpadding="0" class="result"> <tr> <td><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td> <td class="result_right" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td> </tr> </table> <?php echo tep_draw_result_bottom_2(); ?> <?php } ?> Edited June 26, 2008 by lilmikey Quote Link to comment Share on other sites More sharing options...
Guest Posted June 26, 2008 Share Posted June 26, 2008 okay i managed to work out were the edits need to go now my problem is the wholesale price isnt being displayed to wholesale customers on this page http://www.binsacks.com/index.php?cPath=15 this will be a product_listing.php problem i no it lol, but it only shows retail price when ur logged in as either retail or wholesale, any ideas how to fix this so it shows wholessale price to wholesale customers Quote Link to comment Share on other sites More sharing options...
fat_dog Posted June 26, 2008 Share Posted June 26, 2008 I've trauled this thread for a working way of enabling two minimum order levels, one for Group 0 (Retail) and one for Group 1 (Wholesale). However, despite my best efforts and tweaking, I just can't get any of the combinations to work properly. The "Minimum Order Text" just seems to stay there for whichever group regardless of basket amount, and the amounts are not returning to basket correctly. Can anyone help compile a final version of this code that works with SPPC? Change: <?php // minimum order total if ($cart->show_total() < MIN_ORDER_AMOUNT) { ?> <tr> <td class="stockWarning" align="center"><br><?php echo sprintf(TEXT_ORDER_UNDER_MIN_AMOUNT, $currencies->format(MIN_ORDER_AMOUNT)); ?></td> </tr> <?php } ?> <tr> To this: <?php // minimum order total if ($cart->show_total() < MIN_ORDER_AMOUNT) { ?> <tr> <td class="stockWarning" align="center"><br><B> <?php if ($_SESSION['sppc_customer_group_id'] == '0' || !isset($_SESSION['sppc_customer_group_id'])) { echo ' '; } else if ($_SESSION['sppc_customer_group_id'] == '1') { echo sprintf(TEXT_ORDER_UNDER_MIN_AMOUNT, $currencies->format(MIN_ORDER_AMOUNT)); ?> </B></td> </tr> <?php } } ?> <tr> Make sure you backup and test this.... The reason you must do this is that the message defined under 'EXT_ORDER_UNDER_MIN_AMOUNT' will show for those members of ALL GROUPS and not just members of the groups which the minimum order applies to. I have everything setup now like this: CODE if ($customer_group_id != '0' && $order->info['subtotal'] < MIN_ORDER_AMOUNT) { A simple version of this has been discussed before (see this post). If you would want to have it for every customer group I think it would be the easiest to have defines for every customer group made up of the MIN_ORDER_AMOUNT followed by the customer group id. You would need to change the line: CODE if ($order->info['subtotal'] < MIN_ORDER_AMOUNT) { to: CODE if ($order->info['subtotal'] < MIN_ORDER_AMOUNT . $customer_group_id ) { You might have to check if $customer_group_id is set as this point, or perhaps you can get away with it by using the same minimum order amount for the define MIN_ORDER_AMOUNT and MIN_ORDER_AMOUNT0. Then add the sql queries for each group: CODE INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Minimum Order Amount for retail', 'MIN_ORDER_AMOUNT0', '', 'The minimum amount an order must total to be able to checkout. Empty means no minimum.', '1', '23', now()); INSERT INTO configuration (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) VALUES ('Minimum Order Amount for Wholesale', 'MIN_ORDER_AMOUNT1', '', 'The minimum amount an order must total to be able to checkout. Empty means no minimum.', '1', '23', now()); I haven't tried this... I was wondering if anyone ever got this to work. This is just what I have been looking for. I can get it to work with either the Retail or wholesale price I set, but not both. I know nothing about coding so I'm no help. Doesn't this CODE if ($order->info['subtotal'] < MIN_ORDER_AMOUNT . $customer_group_id ) { need to check both prices that are set in admin; 'MIN_ORDER_AMOUNT0' & 'MIN_ORDER_AMOUNT1'? Like I said, by changing MIN_ORDER_AMOUNT in this line CODE if ($order->info['subtotal'] < MIN_ORDER_AMOUNT . $customer_group_id ) to either MIN_ORDER_AMOUNT0 or MIN_ORDER_AMOUNT1, It will check the price set for that group, but not both. Can anyone give my any help on what to do? Thanks in advance. Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted June 26, 2008 Share Posted June 26, 2008 any ideas how to fix this so it shows wholessale price to wholesale customers I think you made a mistake on line 55. Do you really think we are psychic here? Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted June 26, 2008 Share Posted June 26, 2008 I've trauled this thread for a working way of enabling two minimum order levels, one for Group 0 (Retail) and one for Group 1 (Wholesale). From what I recall the version you refer to in a post of mine was not working without adding a small tweak: if ($order->info['subtotal'] < constant(MIN_ORDER_AMOUNT . $customer_group_id) ) { You would need the sql to insert the MIN_ORDER_AMOUNT0 and MIN_ORDER_AMOUNT0 and $customer_group_id need to be established on that page before you use it there. Quote Link to comment Share on other sites More sharing options...
Guest Posted June 26, 2008 Share Posted June 26, 2008 its defintley a problem with this page, this is fresh code it now displays the layout properly, but i simply carnt find the code edits its asking me to find for it, prices and everythings works everywere just apart form on a catagory i really need help to get this working to meet a deadline, could someone workout the code replacments cause ive tried but i get a blank page without any images or products jsut empty boxes with buttons, Mikey <?php /* $Id: product_listing.php,v 1.44 2003/06/09 22:49:59 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 */ ?> <?php echo tep_draw_title_top();?> <?php echo $breadcrumb->trail(' » ')?> <?php echo tep_draw_title_bottom();?> <? tep_draw_heading_top_3();?> <?php $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id'); if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '2') ) ) { ?> <?php echo tep_draw_result_top_1(); ?> <table border="0" width="100%" cellspacing="0" cellpadding="0" class="result"> <tr> <td><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td> <td class="result_right" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td> </tr> </table> <?php echo tep_draw_result_bottom_1(); ?> <?php echo tep_draw_result_top(); ?> <?php } $info_box_contents = array(); $list_box_contents = array(); $my_row = 0; $my_col = 0; for ($col=0, $n=sizeof($column_list); $col<$n; $col++) { switch ($column_list[$col]) { case 'PRODUCT_LIST_MODEL': $lc_text = TABLE_HEADING_MODEL; $lc_align = ''; break; case 'PRODUCT_LIST_NAME': $lc_text = TABLE_HEADING_PRODUCTS; $lc_align = ''; break; case 'PRODUCT_LIST_MANUFACTURER': $lc_text = TABLE_HEADING_MANUFACTURER; $lc_align = ''; break; case 'PRODUCT_LIST_PRICE': $lc_text = TABLE_HEADING_PRICE; $lc_align = 'right'; break; case 'PRODUCT_LIST_QUANTITY': $lc_text = TABLE_HEADING_QUANTITY; $lc_align = 'right'; break; case 'PRODUCT_LIST_WEIGHT': $lc_text = TABLE_HEADING_WEIGHT; $lc_align = 'right'; break; case 'PRODUCT_LIST_IMAGE': $lc_text = TABLE_HEADING_IMAGE; $lc_align = 'center'; break; case 'PRODUCT_LIST_BUY_NOW': $lc_text = TABLE_HEADING_BUY_NOW; $lc_align = 'center'; break; } if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) { $lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text); } $list_box_contents[0][] = array('align' => $lc_align, 'params' => 'class="productListing-heading"', 'text' => ' ' . $lc_text . ' '); } if ($listing_split->number_of_rows > 0) { $rows = 0; $listing_query = tep_db_query($listing_split->sql_query); while ($listing = tep_db_fetch_array($listing_query)) { $rows++; if (($rows/2) == floor($rows/2)) { $list_box_contents[] = array('params' => 'class="productListing-even"'); } else { $list_box_contents[] = array('params' => 'class="productListing-odd"'); } $cur_row = sizeof($list_box_contents) - 1; for ($col=0, $n=sizeof($column_list); $col<$n; $col++) { $lc_align = ''; switch ($column_list[$col]) { case 'PRODUCT_LIST_MODEL': $lc_align = ''; $lc_text = ' ' . $listing['products_model'] . ' '; break; case 'PRODUCT_LIST_NAME': $lc_align = ''; if (isset($HTTP_GET_VARS['manufacturers_id'])) { $p_name = $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>'; } else { $p_name = $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . $listing['products_name'] . '</a>'; } break; case 'PRODUCT_LIST_MANUFACTURER': $lc_align = ''; $lc_text = ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing['manufacturers_id']) . '">' . $listing['manufacturers_name'] . '</a> '; break; case 'PRODUCT_LIST_PRICE': $lc_align = 'right'; if (tep_not_null($listing['specials_new_products_price'])) { $p_price = $lc_text = '<s>' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($listing['specials_new_products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>'; } else { $p_price = $lc_text = '<span class="productSpecialPrice">' . $currencies->display_price($listing['products_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</span>'; } break; case 'PRODUCT_LIST_QUANTITY': $lc_align = 'right'; $lc_text = ' ' . $listing['products_quantity'] . ' '; break; case 'PRODUCT_LIST_WEIGHT': $lc_align = 'right'; $lc_text = ' ' . $listing['products_weight'] . ' '; break; case 'PRODUCT_LIST_IMAGE': $lc_align = 'center'; if (isset($HTTP_GET_VARS['manufacturers_id'])) { $p_pic = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; } else { $p_pic = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing['products_image'], $listing['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; } break; case 'PRODUCT_LIST_BUY_NOW': $lc_align = 'center'; $lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> '; break; } $product_query = tep_db_query("select products_description, products_id from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$listing['products_id'] . "' and language_id = '" . (int)$languages_id . "'"); $product = tep_db_fetch_array($product_query); $p_desc = substr($product['products_description'], 0, MAX_DESCR_1); $p_id = $product['products_id']; /* $list_box_contents[$cur_row][] = array('align' => $lc_align, 'params' => '', 'text' => $lc_text); */ } $info_box_contents[$my_row][$my_col] = array('align' => 'center', 'params' => ' style="width:100%;"', 'text' => ''.tep_draw_prod_top().' <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="col_1"> <table cellpadding="0" cellspacing="0" border="0" class="col_1"> <tr> <td class="pic">'.$p_pic.'</td> </tr> </table> </td> <td> <table cellpadding="0" cellspacing="0" border="0" class="col_2"> <tr> <td class="border_bottom middle" style="height:30px">'.$p_name.'</td> </tr> <tr> <td class="middle" style="height:42px">'.$p_price.'</td> </tr> <tr> <td><a href="'.tep_href_link("products_new.php","action=buy_now&products_id=".$p_id).'">'.tep_image_button('button_add_to_cart1.gif').'</a>'.tep_draw_separator('spacer.gif', '12', '1').'<a href="' . tep_href_link('product_info.php?products_id='.$p_id) . '">'.tep_image_button("button_details.gif").'</a> </td> </tr> </table> </td> </tr> </table> '.tep_draw_prod_bottom().''); $my_col ++; if ($my_col > 0) { $my_col = 0; $my_row ++; } } new contentBox($info_box_contents); // new productListingBox($list_box_contents); } else { ?> <?php echo tep_draw_heading_top_1(); ?> <table border="0" cellspacing="1" cellpadding="2" class="infoBox box_width_cont"> <tr class="infoBoxContents"> <td> <table cellpadding="0" cellspacing="0" class="product"> <tr> <td class="padd_22"><?php echo TEXT_NO_PRODUCTS ?></td> </tr> </table> </td> </tr> </table> <br style="line-height:1px;"><br style="line-height:10px;"> <?php echo tep_draw_heading_bottom_1(); } if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) { ?> <?php echo tep_draw_result_bottom(); ?> <?php echo tep_draw_result_top_2(); ?> <table border="0" width="100%" cellspacing="0" cellpadding="0" class="result"> <tr> <td><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td> <td class="result_right" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td> </tr> </table> <?php echo tep_draw_result_bottom_2(); ?> <?php } ?> Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted June 26, 2008 Share Posted June 26, 2008 ibut i simply carnt find the code edits its asking me to find for it Lord have mercy. This should work... probably. <?php /* $Id: product_listing.php,v 1.44 2003/06/09 22:49:59 hpdl Exp $ osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright © 2003 osCommerce Released under the GNU General Public License */ ?> <?php echo tep_draw_title_top();?> <?php echo $breadcrumb->trail(' » ')?> <?php echo tep_draw_title_bottom();?> <? tep_draw_heading_top_3();?> <?php $listing_split = new splitPageResults($listing_sql, MAX_DISPLAY_SEARCH_RESULTS, 'p.products_id'); if ( ($listing_split->number_of_rows > 0) && ( (PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '2') ) ) { ?> <?php echo tep_draw_result_top_1(); ?> <table border="0" width="100%" cellspacing="0" cellpadding="0" class="result"> <tr> <td><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td> <td class="result_right" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td> </tr> </table> <?php echo tep_draw_result_bottom_1(); ?> <?php echo tep_draw_result_top(); ?> <?php } $info_box_contents = array(); $list_box_contents = array(); $my_row = 0; $my_col = 0; for ($col=0, $n=sizeof($column_list); $col<$n; $col++) { switch ($column_list[$col]) { case 'PRODUCT_LIST_MODEL': $lc_text = TABLE_HEADING_MODEL; $lc_align = ''; break; case 'PRODUCT_LIST_NAME': $lc_text = TABLE_HEADING_PRODUCTS; $lc_align = ''; break; case 'PRODUCT_LIST_MANUFACTURER': $lc_text = TABLE_HEADING_MANUFACTURER; $lc_align = ''; break; case 'PRODUCT_LIST_PRICE': $lc_text = TABLE_HEADING_PRICE; $lc_align = 'right'; break; case 'PRODUCT_LIST_QUANTITY': $lc_text = TABLE_HEADING_QUANTITY; $lc_align = 'right'; break; case 'PRODUCT_LIST_WEIGHT': $lc_text = TABLE_HEADING_WEIGHT; $lc_align = 'right'; break; case 'PRODUCT_LIST_IMAGE': $lc_text = TABLE_HEADING_IMAGE; $lc_align = 'center'; break; case 'PRODUCT_LIST_BUY_NOW': $lc_text = TABLE_HEADING_BUY_NOW; $lc_align = 'center'; break; } if ( ($column_list[$col] != 'PRODUCT_LIST_BUY_NOW') && ($column_list[$col] != 'PRODUCT_LIST_IMAGE') ) { $lc_text = tep_create_sort_heading($HTTP_GET_VARS['sort'], $col+1, $lc_text); } $list_box_contents[0][] = array('align' => $lc_align, 'params' => 'class="productListing-heading"', 'text' => ' ' . $lc_text . ' '); } if ($listing_split->number_of_rows > 0) { $rows = 0; // BOF Separate Pricing per Customer $no_of_listings = tep_db_num_rows($listing_query); // global variable (session) $sppc_customer_group_id -> local variable customer_group_id if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') { $customer_group_id = $_SESSION['sppc_customer_group_id']; } else { $customer_group_id = '0'; } while ($_listing = tep_db_fetch_array($listing_query)) { $listing[] = $_listing; $list_of_prdct_ids[] = $_listing['products_id']; } // next part is a debug feature, when uncommented it will print the info that this module receives /* echo '<pre>'; print_r($listing); echo '</pre>'; */ // get all product 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 products_id in (" . implode(',', $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' => '', 'final_price' => $pg_array['price']); } for ($x = 0; $x < $no_of_listings; $x++) { // replace products prices with those from customers_group table if(!empty($new_prices)) { for ($i = 0; $i < count($new_prices); $i++) { if( $listing[$x]['products_id'] == $new_prices[$i]['products_id'] ) { $listing[$x]['products_price'] = $new_prices[$i]['products_price']; $listing[$x]['final_price'] = $new_prices[$i]['final_price']; } } } // end if(!empty($new_prices) $listing[$x]['specials_new_products_price'] = ''; // makes sure that a retail specials price doesn't carry over to another customer group $listing[$x]['final_price'] = $listing[$x]['products_price']; // final price should not be the retail special price } // end for ($x = 0; $x < $no_of_listings; $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 " . 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)) { $new_s_prices[] = array ('products_id' => $specials_array['products_id'], 'products_price' => '', 'specials_new_products_price' => $specials_array['specials_new_products_price'] , 'final_price' => $specials_array['specials_new_products_price']); } // add the correct specials_new_products_price and replace final_price for ($x = 0; $x < $no_of_listings; $x++) { if(!empty($new_s_prices)) { for ($i = 0; $i < count($new_s_prices); $i++) { if( $listing[$x]['products_id'] == $new_s_prices[$i]['products_id'] ) { $listing[$x]['specials_new_products_price'] = $new_s_prices[$i]['specials_new_products_price']; $listing[$x]['final_price'] = $new_s_prices[$i]['final_price']; } } } // end if(!empty($new_s_prices) } // end for ($x = 0; $x < $no_of_listings; $x++) // while ($listing = tep_db_fetch_array($listing_query)) { (was original code) for ($x = 0; $x < $no_of_listings; $x++) { $rows++; if (($rows/2) == floor($rows/2)) { $list_box_contents[] = array('params' => 'class="productListing-even"'); } else { $list_box_contents[] = array('params' => 'class="productListing-odd"'); } $cur_row = sizeof($list_box_contents) - 1; for ($col=0, $n=sizeof($column_list); $col<$n; $col++) { $lc_align = ''; switch ($column_list[$col]) { case 'PRODUCT_LIST_MODEL': $lc_align = ''; $lc_text = ' ' . $listing[$x]['products_model'] . ' '; break; case 'PRODUCT_LIST_NAME': $lc_align = ''; if (isset($HTTP_GET_VARS['manufacturers_id'])) { $p_name = $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing[$x]['products_id']) . '">' . $listing[$x]['products_name'] . '</a>'; } else { $p_name = $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_id']) . '">' . $listing[$x]['products_name'] . '</a>'; } break; case 'PRODUCT_LIST_MANUFACTURER': $lc_align = ''; $lc_text = ' <a href="' . tep_href_link(FILENAME_DEFAULT, 'manufacturers_id=' . $listing[$x]['manufacturers_id']) . '">' . $listing[$x]['manufacturers_name'] . '</a> '; break; case 'PRODUCT_LIST_PRICE': $lc_align = 'right'; if (tep_not_null($listing[$x]['specials_new_products_price'])) { $p_price = $lc_text = '<s>' . $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($listing[$x]['specials_new_products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '</span>'; } else { $p_price = $lc_text = '<span class="productSpecialPrice">' . $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . '</span>'; } break; case 'PRODUCT_LIST_QUANTITY': $lc_align = 'right'; $lc_text = ' ' . $listing[$x]['products_quantity'] . ' '; break; case 'PRODUCT_LIST_WEIGHT': $lc_align = 'right'; $lc_text = ' ' . $listing[$x]['products_weight'] . ' '; break; case 'PRODUCT_LIST_IMAGE': $lc_align = 'center'; if (isset($HTTP_GET_VARS['manufacturers_id'])) { $p_pic = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing[$x]['products_image'], $listing[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; } else { $p_pic = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing[$x]['products_image'], $listing[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; } break; case 'PRODUCT_LIST_BUY_NOW': $lc_align = 'center'; $lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> '; break; } $product_query = tep_db_query("select products_description, products_id from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$listing[$x]['products_id'] . "' and language_id = '" . (int)$languages_id . "'"); $product = tep_db_fetch_array($product_query); $p_desc = substr($product['products_description'], 0, MAX_DESCR_1); $p_id = $product['products_id']; /* $list_box_contents[$cur_row][] = array('align' => $lc_align, 'params' => '', 'text' => $lc_text); */ } $info_box_contents[$my_row][$my_col] = array('align' => 'center', 'params' => ' style="width:100%;"', 'text' => ''.tep_draw_prod_top().' <table cellpadding="0" cellspacing="0" border="0"> <tr> <td class="col_1"> <table cellpadding="0" cellspacing="0" border="0" class="col_1"> <tr> <td class="pic">'.$p_pic.'</td> </tr> </table> </td> <td> <table cellpadding="0" cellspacing="0" border="0" class="col_2"> <tr> <td class="border_bottom middle" style="height:30px">'.$p_name.'</td> </tr> <tr> <td class="middle" style="height:42px">'.$p_price.'</td> </tr> <tr> <td><a href="'.tep_href_link("products_new.php","action=buy_now&products_id=".$p_id).'">'.tep_image_button('button_add_to_cart1.gif').'</a>'.tep_draw_separator('spacer.gif', '12', '1').'<a href="' . tep_href_link('product_info.php?products_id='.$p_id) . '">'.tep_image_button("button_details.gif").'</a> </td> </tr> </table> </td> </tr> </table> '.tep_draw_prod_bottom().''); $my_col ++; if ($my_col > 0) { $my_col = 0; $my_row ++; } } new contentBox($info_box_contents); // new productListingBox($list_box_contents); } else { ?> <?php echo tep_draw_heading_top_1(); ?> <table border="0" cellspacing="1" cellpadding="2" class="infoBox box_width_cont"> <tr class="infoBoxContents"> <td> <table cellpadding="0" cellspacing="0" class="product"> <tr> <td class="padd_22"><?php echo TEXT_NO_PRODUCTS ?></td> </tr> </table> </td> </tr> </table> <br style="line-height:1px;"><br style="line-height:10px;"> <?php echo tep_draw_heading_bottom_1(); } if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) { ?> <?php echo tep_draw_result_bottom(); ?> <?php echo tep_draw_result_top_2(); ?> <table border="0" width="100%" cellspacing="0" cellpadding="0" class="result"> <tr> <td><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td> <td class="result_right" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td> </tr> </table> <?php echo tep_draw_result_bottom_2(); ?> <?php } ?> Quote Link to comment Share on other sites More sharing options...
Guest Posted June 26, 2008 Share Posted June 26, 2008 (edited) Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/binsacks/public_html/includes/functions/database.php on line 104 Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /home/binsacks/public_html/includes/functions/database.php on line 100 Warning: implode() [function.implode]: Invalid arguments passed in /home/binsacks/public_html/includes/modules/product_listing.php on line 137 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 ') and status = '1' and customers_group_id = '0'' at line 1 select products_id, specials_new_products_price from specials where products_id in () and status = '1' and customers_group_id = '0' [TEP STOP] bro im sorry but that page is giving me this error, im using verison 4.2.0 on oscomerce 2.2 rc1 Edited June 26, 2008 by Jan Zonjee Quote Link to comment Share on other sites More sharing options...
Jan Zonjee Posted June 26, 2008 Share Posted June 26, 2008 bro im sorry but that page is giving me this error, Yes, I seem to have cut and pasted and missed a line around line 74: if ($listing_split->number_of_rows > 0) { $rows = 0; $listing_query = tep_db_query($listing_split->sql_query); // missing line // BOF Separate Pricing per Customer Quote Link to comment Share on other sites More sharing options...
audreyannlow Posted June 28, 2008 Share Posted June 28, 2008 (edited) I guess you used a file from the package (which is for RC2) but used an older version of osC to install this on. This particular one is caused by a few changes in the table orders (see upgrade.html in the download of RC2a for all the changes): alter table orders_status add public_flag int DEFAULT '1'; alter table orders_status add downloads_flag int DEFAULT '0'; alter table orders modify payment_method varchar(255) NOT NULL; There is also a change in the table whos_online: alter table whos_online modify last_page_url text NOT NULL; and there are a lot more changes that add certain indexes to certain tables. These indexes are not essential from a functional viewpoint but they make queries faster. You might run into more of those things. Missing function tep_hide_session_id in the admin section, something with a missing function in the class currencies (catalog side) depending on which version you started with. Awesome, thanks! Worked like a charm except...can't figure out what on earth I did, but the footer won't load, and everything goes blank as soon as the index page is reloaded! I commented out new_producsts.php, so that's why THAT doesn't show up, but I left in the date on the LH side and also the footer text (deleted the banner via admin panel). The website is aipathedog.com/catalog Thanks so much! Audrey Edited June 28, 2008 by audreyannlow Quote Link to comment Share on other sites More sharing options...
lilitoy Posted July 1, 2008 Share Posted July 1, 2008 Hello, First I want to tell that os en php and everything around it, is very new. I'm more then a newbie :blush: but I really want to learn. I have managed to install SPPC. But there it’s end for me. I have read here that I have to make costumers groups in my admin. But al the that I have seen are “Chinese” for me. I just want to install 3 groups - Retail - Wholesale - Specials Maybe someone can provide me the total code’s that I need for this, Or do I have to search it? Many Thanks Lili Quote Link to comment Share on other sites More sharing options...
TracyS Posted July 1, 2008 Share Posted July 1, 2008 Lili, Go to your stores admin section (www.yourdomainhere.com/admin/) Then, on your left, click on "Customers". Once this page loads, you will see some new links underneath Customers, click on "Customers Groups". This page is where you create your different groups. If I remember correctly, Retail is already there for you. But for any group you want that is not already setup, click the "Insert" button and create the group. Specials may not need to be a group if it is just for special offers. You can choose which group you want your specials shown to when you create a special. Once your groups are created, you then go into the Catalog area in your admin and set the price for each group for each product individually. I think someone has come up with a way to do this faster than doing each product individually, but I don't know what it is. Maybe someone else will post it if they know :blush: Hope this helps ;) Hello, First I want to tell that os en php and everything around it, is very new. I'm more then a newbie :blush: but I really want to learn. I have managed to install SPPC. But there it’s end for me. I have read here that I have to make costumers groups in my admin. But al the that I have seen are “Chinese” for me. I just want to install 3 groups - Retail - Wholesale - Specials Maybe someone can provide me the total code’s that I need for this, Or do I have to search it? Many Thanks Lili Quote ~Tracy 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.