Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

TracyS

Pioneers
  • Posts

    1,222
  • Joined

  • Last visited

Reputation Activity

  1. Like
    TracyS reacted to kymation in [Contribution] STS v4   
    1. Try this:
    <?php   if ( $PHP_SELF == 'index.php' && $current_category_id == 0 ) {   require(DIR_WS_INCLUDES . 'slideshow.php'); }  ?> 2. And this:
    <a href="<?php echo tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=26&products_id=42'); ?>"> Regards
    Jim
  2. Like
    TracyS got a reaction from Peper in Master Products - MS2   
    Hmmm - could it be the X-Sell contribution? I have a includes/modules/xsell_cart.php file with this query:

    $xsell_master_query = tep_db_query("SELECT products_master FROM " . TABLE_PRODUCTS . " WHERE products_id = " . $product_id_in_cart['id'] . "");
     
    includes/modules/master_products.php has a similar query - but it uses the "LIKE" statement so I don't think it's the right one- but here it is just in case
    $master_query = tep_db_query("select products_master from " . TABLE_PRODUCTS . " where products_master LIKE '%" . $HTTP_GET_VARS['products_id'] . "%' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0");
     
    These are the only two places I can find the query string
    tep_db_query("select products_master from in the entire site.
     
  3. Like
    TracyS got a reaction from Peper in Seperate Pricing Per Customer v3.5   
    Thank you JanZ!! :D
     
    I compared what you had put up with what I had - made some edits to what I had and got the quantity field back to a field where you just type in the number of products you want rather than a pull down menu and all is working - YAY!!!!! :thumbsup:
     
    Now - I'm curious about this master_sql query. I'm still learning how all of this works so please bear with me :blush: I made a test special product in the wholesale group. If I'm not logged in, or logged in as a retail customer, I see the original price with the slash through it, and then the special price for a product on special in the retail group. When I log in as a wholesaler I get the same thing - only for the products that are on special for the wholesale group. Also, the products add to the cart correctly and show the correct special price in the cart for either group. So all seems to be working correctly.
     
    The original master_sql query is:
    $master_query = tep_db_query("select products_master from " . TABLE_PRODUCTS . " where products_master LIKE '%" . $HTTP_GET_VARS['products_id'] . "%'");
     
    This is, I think, telling the server to get the products whose products_master field is the same as the current products products_id field. This way it knows which slave products it should be showing on the master products page.
     
    If we change it to:

    $master_sql = "select " . $select_column_list . " p.products_id, p.manufacturers_id, p.products_tax_class_id, NULL as specials_new_products_price, p.products_price from ". TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id where p.products_id = pd.products_id and p.products_master = '" . $thisquery['products_master'] . "' and p.products_status = '1' and pd.language_id = '" . (int)$languages_id . "'";
     
    then how does it know which products have the current product_id as their products_master field?
     
    Also - in the p.products_master = '" . $thisquery['products_master'] . "' part - is $thisquery literally meaning "this query" as in the $master_sql query - or does it mean that there should be another query somewhere named $this_query ?
     
    I am sure you are going to look at my questions and feel the answers should be staring me in the face :blush: But I had just started learning how to create my own PHP / MySQL when we learned we needed to use osC - so this is my first ever osC website, my first full online shopping site, and quite the big plunge into some advanced PHP and MySQL :blink: So now that I'm getting things up and running I'm trying to slow down a little bit here and there and learn "why" they are up and running in hopes that I will be able to become a little more capable with all of this, and hopefully someday be able to offer support and contributions back to the community :)
     
     
    For anyone who may be looking for this in the future - here is my modified for SPPC master_listing.php file :)

    <?php /* $Id: master_listing.php adapted for Separate Pricing Per Customer v4 2005/02/26 osCommerce, Open Source E-Commerce Solutions http://www.oscommerce.com Copyright (c) 2003 osCommerce Master Products MS2 - JOHNSON - 05/07/2003 [email protected] Copyright (c) 2003 Suomedia - Dynamic Content Management Released under the GNU General Public License */ $listing_split = new splitPageResults($master_sql, MAX_DISPLAY_SEARCH_RESULTS, 'products_master'); if ( ($listing_split->number_of_rows > 0) && ( (MASTER_PREV_NEXT_BAR_LOCATION == '1') || (MASTER_PREV_NEXT_BAR_LOCATION == '3') ) ) { ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td> <td class="smallText" 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 } $list_box_contents = array(); for ($col=0, $n=sizeof($column_list); $col<$n; $col++) { switch ($column_list[$col]) { case 'MASTER_LIST_MODEL': $lc_text = TABLE_HEADING_MODEL; $lc_align = ''; break; case 'MASTER_LIST_NAME': $lc_text = TABLE_HEADING_PRODUCTS; $lc_align = ''; break; case 'MASTER_LIST_DESCRIPTION': $lc_text = TABLE_HEADING_DESCRIPTION; $lc_align = 'center'; break; case 'MASTER_LIST_ATTRIBUTES': $lc_text = TABLE_HEADING_ATTRIBUTES; $lc_align = 'center'; break; case 'MASTER_LIST_MANUFACTURER': $lc_text = TABLE_HEADING_MANUFACTURER; $lc_align = ''; break; case 'MASTER_LIST_PRICE': $lc_text = TABLE_HEADING_PRICE; $lc_align = 'right'; break; case 'MASTER_LIST_QUANTITY': $lc_text = TABLE_HEADING_QUANTITY; $lc_align = 'right'; break; case 'MASTER_LIST_WEIGHT': $lc_text = TABLE_HEADING_WEIGHT; $lc_align = 'right'; break; case 'MASTER_LIST_IMAGE': $lc_text = TABLE_HEADING_IMAGE; $lc_align = 'center'; break; case 'MASTER_LIST_BUY_NOW': $lc_text = TABLE_HEADING_BUY_NOW; $lc_align = 'center'; break; case 'MASTER_LIST_OPTIONS': $lc_text = TABLE_HEADING_OPTIONS; $lc_align = 'align="center"'; break; } if ( ($column_list[$col] != 'MASTER_LIST_BUY_NOW') && ($column_list[$col] != 'MASTER_LIST_IMAGE') && ($column_list[$col] != 'MASTER_LIST_MULTIPLE') && ($column_list[$col] != 'MASTER_LIST_DESCRIPTION') && ($column_list[$col] != 'MASTER_LIST_OPTIONS') ) { $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; $master_query = tep_db_query($listing_split->sql_query); // BOF Separate Pricing per Customer $no_of_listings = tep_db_num_rows($master_query); global $sppc_customer_group_id; // global variable (session) $sppc_customer_group_id -> local variable customer_group_id if(!tep_session_is_registered('sppc_customer_group_id')) { $customer_group_id = '0'; } else { $customer_group_id = $sppc_customer_group_id; } while ($_listing = tep_db_fetch_array($master_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>'; */ $select_list_of_prdct_ids = "products_id = '".$list_of_prdct_ids[0]."' "; if ($no_of_listings > 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 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 (".$select_list_of_prdct_ids.") and pg.customers_group_id = '".$customer_group_id."' "); // $no_of_pg_products = tep_db_num_rows($pg_query); 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 (".$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'], '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 = ''; $lc_params = ''; switch ($column_list[$col]) { case 'MASTER_LIST_MODEL': $lc_align = ''; $lc_text = ' ' . $listing[$x]['products_model'] . ' '; break; case 'MASTER_LIST_NAME': $lc_align = ''; if (isset($HTTP_GET_VARS['manufacturers_id'])) { $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 { $lc_text = ' ' . $listing[$x]['products_name'] . '</a> '; } break; case 'MASTER_LIST_DESCRIPTION': $lc_align = ''; $lc_text = ' ' . osc_trunc_string(strip_tags($listing[$x]['products_description'], '<a><b><em><font><i><s><span><strong><sub><sup><u>'), MASTER_LIST_DESCRIPTION_LENGTH) . ' '; break; case 'MASTER_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 'MASTER_LIST_PRICE': $lc_align = 'right'; if (tep_not_null($listing[$x]['specials_new_products_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 { $lc_text = ' ' . $currencies->display_price($listing[$x]['products_price'], tep_get_tax_rate($listing[$x]['products_tax_class_id'])) . ' '; } break; case 'MASTER_LIST_QUANTITY': $lc_align = 'right'; $lc_text = ' ' . $listing[$x]['products_quantity'] . ' '; break; case 'MASTER_LIST_WEIGHT': $lc_align = 'right'; $lc_text = ' ' . $listing[$x]['products_weight'] . ' '; break; case 'MASTER_LIST_IMAGE': $lc_align = 'center'; if (isset($HTTP_GET_VARS['manufacturers_id'])) { $lc_text = '<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 { $lc_text = ' <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 'MASTER_LIST_BUY_NOW': $lc_align = 'center'; $lc_valign = 'top'; if ((STOCK_CHECK == 'true')&&(tep_get_products_stock($listing[$x]['products_id']) < 1)) { $lc_text = TEXT_STOCK; } elseif ((STOCK_CHECK == 'false')&&(tep_get_products_stock($listing[$x]['products_id']) < 1)) { $qty_array = array(); for ($i=0; $ns = 20, $i <= $ns; $i++) { $qty_array[] = array('id' => $i, 'text' => $i); $lc_text = tep_draw_input_field('Qty_ProdId_' . $listing[$x]['products_id'], '', 'size="4"'); } } else { $quantity = tep_get_products_stock($listing[$x]['products_id']); $qty_array = array(); for ($i=0; $ns = (($quantity < 20) ? $quantity : 20), $i <= $ns; $i++) { $qty_array[] = array('id' => $i, 'text' => $i); $lc_text = tep_draw_input_field('Qty_ProdId_' . $listing[$x]['products_id'], '', 'size="4"'); } } break; case 'MASTER_LIST_OPTIONS': $lc_align = 'align="center"'; $lc_text = ''; // BOF: attribute options $opt_count=0; $products_options_name = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . $listing[$x]['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . $languages_id . "' ORDER by products_options_id"); while ($products_options_name_values = tep_db_fetch_array($products_options_name)) { $opt_count++; $products_options_array = array(); $lc_text .= '<b>' . $products_options_name_values['products_options_name'] . '</b><br />' . "\n"; $products_options = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$listing[$x]['products_id'] . "' and pa.options_id = '" . (int)$products_options_name_values['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'"); while ($products_options_values = tep_db_fetch_array($products_options)) { $products_options_array[] = array('id' => $products_options_values['products_options_values_id'], 'text' => $products_options_values['products_options_values_name'], 'style' => ''); if ($products_options_values['options_values_price'] != '0') { $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options_values['price_prefix'] . $currencies->display_price($products_options_values['options_values_price'], tep_get_tax_rate($product_info_values['products_tax_class_id'])) .') '; } } $lc_text .= tep_draw_pull_down_menu('id_'.$listing[$x]['products_id'].'[' . $products_options_name_values['products_options_id'] . ']', $products_options_array); $lc_text .= '<br />'; } if($opt_count==0) { $lc_text = MASTER_TEXT_NONE; } // EOF: attribute options break; } $list_box_contents[$cur_row][] = array('align' => $lc_align, 'valign' => $lc_valign, 'params' => 'class="productListing-data"', 'text' => $lc_text); } } new productListingBox($list_box_contents); } else { $list_box_contents = array(); $list_box_contents[0] = array('params' => 'class="productListing-odd"'); $list_box_contents[0][] = array('params' => 'class="productListing-data"', 'text' => TEXT_NO_PRODUCTS); new productListingBox($list_box_contents); } ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> </table> <?php if ( ($listing_split->number_of_rows > 0) && ((MASTER_PREV_NEXT_BAR_LOCATION == '2') || (MASTER_PREV_NEXT_BAR_LOCATION == '3')) ) { ?> <table border="0" width="100%" cellspacing="0" cellpadding="2"> <tr> <td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td> <td class="smallText" 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> <tr> <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td> </tr> <?php } ?>
  4. Like
    TracyS got a reaction from multimixer in "Dynamenu" for osCommerce   
    I would love to, but I have not had to deal with this issue yet. Did you try posting the lines of code that need changing to the other forum post regarding this specific issue?
     
  5. Downvote
    TracyS got a reaction from 111oneeleven in "Dynamenu" for osCommerce   
    I would love to, but I have not had to deal with this issue yet. Did you try posting the lines of code that need changing to the other forum post regarding this specific issue?
     
×
×
  • Create New...