Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

I need help in modifying a particular file.....

 

 

 

Dear Fireman-911,

 

there is no need to heavily modify all your new products page in order to randomly show new products. All you have to do is change the new products query to:

 

$new_products_query = tep_db_query("select p.products_id, p.products_image, 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 where products_status = '1' order by RAND() limit " . MAX_DISPLAY_NEW_PRODUCTS);

 

This very clever way of randomising new products is by no way mine. I found it in the forum and it was divised by Gary Burton.

 

If you need the code for the new products page, with random new products and SPPC 4.1 integraded here it is:

<?php
/*
 $Id: new_products.php,v 1.34 2003/06/09 22:49:58 hpdl Exp $
 adapted for Separate Pricing Per Customer v4.0 2005/01/26
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/
?>
<!-- new_products //-->
<?php
 $info_box_contents = array();
 $info_box_contents[] = array('text' => sprintf(TABLE_HEADING_NEW_PRODUCTS, strftime('%B')));

 new contentBoxHeading($info_box_contents);

 if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {
   // BOF Separate Pricing per Customer
   $new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, p.products_price as products_price from " . TABLE_PRODUCTS . " p where products_status = '1' and p.products_image != '' order by rand() limit " . MAX_DISPLAY_NEW_PRODUCTS);
 } else {
   $new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, p.products_price as products_price from " . 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 = '" . (int)$new_products_category_id . "' and p.products_status = '1' and p.products_image != '' order by rand() limit ". MAX_DISPLAY_NEW_PRODUCTS);
 }

// 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;
 }

 if (($no_of_new_products = tep_db_num_rows($new_products_query)) > 0) {
  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 ($no_of_new_products > 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 < $no_of_new_products; $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 < $no_of_products_new; $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 products_price with the correct specials_new_products_price
if(!empty($new_s_prices)) {
for ($x = 0; $x < $no_of_new_products; $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]['products_price'] = $new_s_prices[$i]['specials_new_products_price'];
     }
       }
   }
} // // end if(!empty($new_s_prices)

 $row = 0;
 $col = 0;

 $info_box_contents = array();

//  while ($new_products = tep_db_fetch_array($new_products_query)) {
for ($x = 0; $x < $no_of_new_products; $x++) {
   $new_products[$x]['products_name'] = tep_get_products_name($new_products[$x]['products_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=' . $new_products[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products[$x]['products_image'], $new_products[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products[$x]['products_id']) . '">' . $new_products[$x]['products_name'] . '</a><br>' . $currencies->display_price($new_products[$x]['products_price'], tep_get_tax_rate($new_products[$x]['products_tax_class_id'])));

   $col ++;
   if ($col > 2) {
     $col = 0;
     $row ++;
   }
  } // end for ($x = 0; $x < $no_of_new_products; $x++)
} //  end if (($no_of_new_products = tep_db_num_rows($new_products_query)) > 0)
// EOF Separate Pricing per Customer
new contentBox($info_box_contents);
?>
<!-- new_products_eof //-->

 

I hope this will help you.

 

Cheers

Yiannis

Link to comment
Share on other sites

Quick question. I'm tyring to display the category name in main content so it does not say "Lets see what we have here"

 

I have changed /catalog/includes/languages/LANGUAGE/index.php

 

   define('HEADING_TITLE', 'Let\'s See What We Have Here');

 

to

 

 define('HEADING_TITLE', ' ');

 

 

That is fine.... but when I go to edit /catalog/index.php I remove

 

         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
            <td class="pageHeading"><?php echo HEADING_TITLE; ?></td>
<?php
// optional Product List Filter

 

and replace it with

 

         <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
          <tr>
 <td class="pageHeading">
 <?php
// hacked to display current category name in main content area! Nik
echo HEADING_TITLE . '\'' . $tree[$current_category_id]['name'] . '\'';
?>
 </td>
<?php
// optional Product List Filter

 

but it does not display the name in the main content? Has SPPC changed somthing? Thanks for any help.

 

This is all based off http://www.oscommerce.com/community/contributions,1954

 

Nate

Link to comment
Share on other sites

HI all!

 

I've installed a debug tool and I've realized that installing SPPC has slowed down the search results from advanced_search_results.php page. It takes me 23 seconds to fulfill a search! :'( .

Anyone wfo meets the same pb and solved it?

 

Really need help on this... Any help will be greatly appreciated! Thanks in advance.

OSC2.2

Link to comment
Share on other sites

I've installed a debug tool and I've realized that installing SPPC has slowed down the search results from advanced_search_results.php page. It takes me 23 seconds to fulfill a search!

 

On my testing site the advanced search is fast but I only have a few products in my catalog. Do you have a great deal of products on your site?

Best & Thanks;
Marvin
----------------------
osCommerce 2.3.3.4 

Link to comment
Share on other sites

On my testing site the advanced search is fast but I only have a few products in my catalog. Do you have a great deal of products on your site?

 

Hi Marvin!

 

Thanks for you replying... I've almost 2.200 products and as you see the search engine is really too slow. It takes 6 seconds if I remove SPPC...

OSC2.2

Link to comment
Share on other sites

Hi Marvin!

 

Thanks for you replying... I've almost 2.200 products and as you see the search engine is really too slow. It takes 6 seconds if I remove SPPC...

 

That makes sense. The sites I beta tested the contrib on only had about 30 products at the most so that issue would not have shown up.

 

I know Jan had to do a lot of work on the advanced search page and if I remember right is was pretty intense due to the complexity of the code required.

 

Jan would be better able to answer the question (because it probably is a programming concern) but I think at least knowing that this issue occurs when a lot of products are in the catalog may narrow it down some for him :)

Best & Thanks;
Marvin
----------------------
osCommerce 2.3.3.4 

Link to comment
Share on other sites

I've almost 2.200 products and as you see the search engine is really too slow. It takes 6 seconds if I remove SPPC...
Wow, that is a big difference. I probably got the same debug tool (Chemo's) installed on of the test set-ups I used to see if there were any problems. When I exchange the advanced_search_result page with the stock one, I cannot see any difference. That is with the standard about 30 products that come with the osC install file. Whether it is stock or SPPC it is between 0.575 and 0.734 seconds for 34-37 queries.

 

I was worried that the extra tables that are dynamically built every 15 minutes or so (max) would take a lot of time, but it turned out they took the same time as a regular query (about 3 microseconds I think). And if I recall correctly they are only re-built when there is a price range involved in the search.

 

If you see such a big difference, there should be either a large difference in the number of queries (I don't think so, might be 2 or 3 more) or there is a query or queries that take much longer than normal. So my question is, is there a trouble query?

 

To elaborate on the performance issue, this is exactly what the trouble was with the "old" SPPC. For example the module/product_listing.php (that shows the results on advanced_search_results) would query the database three times for every product. If you have 20 products....you can do the math.

 

Now it is brought back to two queries extra, no matter how many products you have.

Link to comment
Share on other sites

SPPC is FANTASTIC and just what I needed.

 

I'm also trying to install

ENABLE & DISABLE CATEGORIES

http://www.oscommerce.com/community/contributions,326

 

No problems merging code except on the home page...where I'm getting confused.

Does anyone have these 2 mods together?

Would you consider sharing with me...my brain hurts....

 

CODE BLOCK IN QUESTION ~ line 240 ~ I've added a bunch of comments to try to help me keep it straight.

REGARDING $listing_sql = "select " . $select_column_list . " p.products_id...

 

FROM:

// show the products of a specified manufacturer

 

TO:

} // end else { // either retail...

//////////// EOF Separate Pricing Per Customer

Edited by netstep

Sam M. - Seattle

Link to comment
Share on other sites

"Hide products for customer groups for Separate Pricing Per Customer" is available in the contribution section now.

 

I'm a little confused on how to install...

 

I've added Separate Pricing Per Customer v4 and Price Break 1.11.3 add ons.

 

I also saw in the SPPC_Price_Break_v1.01 archive a couple of files that are named: product_info_pb_hide_price_if_0.php

 

What do I do with these? Are these the Hide products that you put into that archive that also have the price break lines in it?

 

I'm very confused... I would like to have all 3 mods. Seperate Pricing per customer, price break and hide feature. To accomplish the last part, how do I do this easily when I have the first two mods installed?

 

Thanks

Link to comment
Share on other sites

sv1eez,

 

Thanks for the code! It worked perfectly!

 

 

 

Now, the only question that I have is how do you activate someone that I would have manually updated to be a wholesale client?

 

I know that there's a way, but i can't seem to find it anywhere!!!!

 

:-" :'( :(

Link to comment
Share on other sites

Ok, now, I'm having a bad night!

 

I'm getting this error and I have no idea what I need to do to fix it.

 

The error is

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource

 

And the appropriate line of code is

function tep_db_num_rows($db_query) {
   return mysql_num_rows($db_query);
 }

 

Now, I am really not sure what else to do..... Could use some guidance!

 

Thanks!

Link to comment
Share on other sites

I'm a little confused on how to install...

 

I've added Separate Pricing Per Customer v4 and Price Break 1.11.3 add ons.

 

I also saw in the SPPC_Price_Break_v1.01 archive a couple of files that are named: product_info_pb_hide_price_if_0.php

 

What do I do with these? Are these the Hide products that you put into that archive that also have the price break lines in it?

 

I'm very confused... I would like to have all 3 mods. Seperate Pricing per customer, price break and hide feature. To accomplish the last part, how do I do this easily when I have the first two mods installed?

 

Thanks

 

 

Howard,

 

I will do the best to explain this to you, but my explanation won't be as half good as Jan's.

 

The file product_info_pb_hide_price_if_0.php has three differen't contributions in it. First it has the modified product_info.php info for SPPC. Next it also has the changes for the SPPC pride break contribution (thus the pb) and lastly it has another contribution that has not been talked about much in this thread. Tthis last contribution function is more or less to hide the buy button and price if it is left at zero. So if you put together everything in the file name product_info_pb_hide_price_if_0.php that is what it is... I must say Jan is very organized.

 

To answer your other question about using all three mods together, it can be done. Unfortunately at this time there is no 'master' SPPC contribution both price breaks and hide products together, I believe this is due to the fact that when they are offered separate they leave the door more wide open so to say. You will need to manually update per the instructions provided with the contribution.

 

I hope that answers your questions.

 

Good Luck,

 

Nate

 

PS: Perhaps when you have successfully combined the three SPPC mods you can upload them as a 'master' contribution for future users like you to use!

Link to comment
Share on other sites

Howard,

I also saw in the SPPC_Price_Break_v1.01 archive a couple of files that are named: product_info_pb_hide_price_if_0.php

 

What do I do with these? Are these the Hide products that you put into that archive that also have the price break lines in it?

In addition to Nate's answers:

 

I'm sorry if I confused you. These files ended up in the zip unintentionally. They have modifications to work with the Hide price if $0 contribution. With price breaks the class PriceFormatter.php takes over the display of the price in product_info.php and modules/product_listing.php. To get the two contributions working together is not an immediately obvious modification (whereas it probably is for the other files that need changing for the Hide price if $0 contribution).

 

I left them in by accident. Sorry for that.

Link to comment
Share on other sites

Joel,

I'm getting this error and I have no idea what I need to do to fix it.
I'm sorry, this is such a generic error message (most likely a tep_db_fetch_array where there hasn't been a tep_db_query) that even if I knew what page the error came from I couldn't tell you were the error is.

 

You will have to go carefully through the page where this error comes from to see whether you made a small mistake in putting the mods in, or whether SPPC clashes with code from another contribution.

Link to comment
Share on other sites

Wow, that is a big difference. I probably got the same debug tool (Chemo's) installed on of the test set-ups I used to see if there were any problems. When I exchange the advanced_search_result page with the stock one, I cannot see any difference. That is with the standard about 30 products that come with the osC install file. Whether it is stock or SPPC it is between 0.575 and 0.734 seconds for 34-37 queries.

 

I was worried that the extra tables that are dynamically built every 15 minutes or so (max) would take a lot of time, but it turned out they took the same time as a regular query (about 3 microseconds I think). And if I recall correctly they are only re-built when there is a price range involved in the search.

 

If you see such a big difference, there should be either a large difference in the number of queries (I don't think so, might be 2 or 3 more) or there is a query or queries that take much longer than normal. So my question is, is there a trouble query?

 

To elaborate on the performance issue, this is exactly what the trouble was with the "old" SPPC. For example the module/product_listing.php (that shows the results on advanced_search_results) would query the database three times for every product. If you have 20 products....you can do the math.

 

Now it is brought back to two queries extra, no matter how many products you have.

 

 

Hi Jan,

 

I do use the same debug tool (Chemo's). Only two queries appear to deal with the search engine.

 

- One for (count (*) as total) that starts with 'select count(distinct p.products_id) as total ' and which takes 6 to 7 seconds.

 

- Another one that select all the products required and which takes 13-14 seconds

 

ANd obviously there is a query for each product that is displayed on the advanced_search_result page.

 

I have 82-83 queries on this page but none seem to explain the slowdown. As you see it's the search engine that takes almost the whole parse time.

 

Would you mind to have a look to my products_listing.php module if I send it to you by PM? Maybe there's some mistake which causes such a slowdown?

 

Thanks a lot Jan!

Edited by mujina

OSC2.2

Link to comment
Share on other sites

Jan,

 

As you know I've got Separate Pricing Per Customer v4 and Price Break 1.11.3 installed. I think your hide price and buy button mod at $0 price is exactly what I need!! How exactly would I add this mod to my current Separate Pricing Per Customer v4 and Price Break 1.11.3 mods? I really need to add the option of not showing a price or add to cart button when a price is 0.00 as people add products and try to check out.

 

Thanks!!!!!!!!

 

 

 

 

Howard,

In addition to Nate's answers:

 

I'm sorry if I confused you. These files ended up in the zip unintentionally. They have modifications to work with the Hide price if $0 contribution. With price breaks the class PriceFormatter.php takes over the display of the price in product_info.php and modules/product_listing.php. To get the two contributions working together is not an immediately obvious modification (whereas it probably is for the other files that need changing for the Hide price if $0 contribution).

 

I left them in by accident. Sorry for that.

Link to comment
Share on other sites

Howard,

 

Just try to follow the directions in that contribution. In the two files that are in the zip you obviously don't need to change anything anymore, but in the others you do (and set the price for retail customers to 0.00 of course).

 

You might need to use a slightly different syntax e.g. instead of $products_new['products_price'] you might need $products_new[$x]['products_price']. Use whatever is used in the SPPC version.

 

Example from hide_price_if_$0 contribution:

        //$products_price = $currencies->display_price($products_new['products_price'], tep_get_tax_rate($products_new['products_tax_class_id']));
       // Start "Hide Price if $0" edit 1 of 2 (uncomment above line if removing this contribution)
$products_price = (($products_new['products_price'] > 0) ? $currencies->display_price($products_new['products_price'], tep_get_tax_rate($products_new['products_tax_class_id'])) : '');
// End "Hide Price if $0" edit 1 of 2

Link to comment
Share on other sites

Mujina,

Would you mind to have a look to my products_listing.php module if I send it to you by PM? Maybe there's some mistake which causes such a slowdown?

No problem. 82-83 queries is a lot more than I have (but I also have Chemo's tax class installed, would be helpful in your case too, even 6 seconds is a bit long in my view).

 

Can you add the list of queries with parse time too?

 

Thanks in advance.

Link to comment
Share on other sites

Ughh... I'm lost..... :(

 

I feel I'm reading Greek! I'm at a lost as to what files you are talking about.

 

I'm not sure what file to use to copy and paste the mod into my system and which contrib file you are eactly talking about.

 

Thanks!

 

Howard,

 

Just try to follow the directions in that contribution. In the two files that are in the zip you obviously don't need to change anything anymore, but in the others you do (and set the price for retail customers to 0.00 of course).

 

You might need to use a slightly different syntax e.g. instead of $products_new['products_price'] you might need $products_new[$x]['products_price']. Use whatever is used in the SPPC version.

 

Example from hide_price_if_$0 contribution:

 ? ? ? ?//$products_price = $currencies->display_price($products_new['products_price'], tep_get_tax_rate($products_new['products_tax_class_id']));
? ? ? ?// Start "Hide Price if $0" edit 1 of 2 (uncomment above line if removing this contribution)
$products_price = (($products_new['products_price'] > 0) ? $currencies->display_price($products_new['products_price'], tep_get_tax_rate($products_new['products_tax_class_id'])) : '');
// End "Hide Price if $0" edit 1 of 2

Link to comment
Share on other sites

Jan,

Here is another good question for you:

 

If I have a product that is available for dealers in different conditions, where do I add these different conditions with prices for the one record?

 

I can't use the attributes feature, as when I put a price it shows for retail customers.

Link to comment
Share on other sites

If I have a product that is available for dealers in different conditions, where do I add these different conditions with prices for the one record?
I was already afraid someone would ask that one day :'(

The attribute system is indeed customer_group unaware and frankly I haven't used that system so I have no clue as to how easy it would be to do that. Using a "master products" contribution might help, but if you have seen the admin/categories.php that comes with it, you will realize that this is not a piece of cake either...

Link to comment
Share on other sites

Hi Marvin and JanZ,

 

I have a question just for fun to see if you forget to add in the doc file or it's just me.

 

When the version 3.5 were buggy, the forum talked about Table to add to MySQL.

Here the code to add:

 

DROP TABLE IF EXISTS products_groups;
CREATE TABLE products_groups (
products_groups_id int(11) NOT NULL auto_increment,
customers_group_id int(11) NOT NULL default '0',
customers_group_price decimal(15,4) NOT NULL default '0.0000',
products_id int(11) NOT NULL default '0',
products_price decimal(15,4) NOT NULL default '0.0000',
PRIMARY KEY  (products_groups_id)
) TYPE=MyISAM;

 

It is good or it's not good, because you don't speak about this MySQL add to your doc in a new install 4.1 ? ;)

 

Do you have all this table in your MySQL ? Just want to know because I have this in a version of a store with 3.5 updated to 4.1 and don't have this in another version of a store which have a new install of oScommerce and SPPC 4.1

 

In my version 3.5 to 4.1 , I configure Easypopulate to update my price but the same config in the new install of 4.1, EasyPopulate don't work because the Table of MySQL I write a little up are not in. Bizarre, no ? :lol:

 

Jeep

John

--------------------

osCommerce 2.3.4 Bootstrap Edge

Link to comment
Share on other sites

Jeep_ice,

The table is there, check the sql file:

DROP TABLE IF EXISTS products_groups;
CREATE TABLE products_groups (
?customers_group_id smallint UNSIGNED NOT NULL default '0',
?customers_group_price decimal(15,4) NOT NULL default '0.0000',
?products_id int(11) NOT NULL default '0',
?PRIMARY KEY ?(customers_group_id, products_id)
);

I assume this was done because the wrong primary key was used in that table. You can't use the products_id because you obviously want to have the same products_id with another customer group so therefore someone came up with adding another index to the table: PRIMARY KEY ?(products_groups_id). This is nonsense, since you can have a different products_groups_id and still the same combination of products_id and customers_group_id. The correct solution is of course using the combination of those two, as is done in the new SPPC versions.

 

Having the products_price in that table is utter nonsense too (you don't want to have the same info in two spots), it wasn't even used. Therefore that column was dropped and the code in the admin section changed accordingly.

 

Somebody had a fix for Easypopulate in this forum: http://www.oscommerce.com/forums/index.php?sho...ndpost&p=574470

Edited by JanZ
Link to comment
Share on other sites

Your contrib is such a must have for stores having multiple prices in having only one database! I now need to figure out my problem with multiple conditions...

 

 

Is our hope that someone here can give insight on how to do this?

How do we accomplish this here? Start a new thread?

 

Thanks

 

I was already afraid someone would ask that one day  :'(

The attribute system is indeed customer_group unaware and frankly I haven't used that system so I have no clue as to how easy it would be to do that. Using a "master products" contribution might help, but if you have seen the admin/categories.php that comes with it, you will realize that this is not a piece of cake either...

Link to comment
Share on other sites

RE: POST 733 (this topic)

I'm hoping someone can save me.

 

I'm really stuck trying to merge SPPC with ENABLE & DISABLE CATEGORIES

http://www.oscommerce.com/community/contributions,326

 

All good until I hit the home page.

 

How do I blend the 2 codes below?

If someone wants some $$ to sort this out...PM me ASAP.

I know this is a big block of code. (only a couple dozen lines in real life.)

If you copy it into an editor w/out line wrap...it helps.

 

 

FROM SPPC index.php @ line 205.

// 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

 

With this code from Enable/Disable Categories

// 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
// ################## Added Enable Disable Categorie #################
//      $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 . " 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'] . "'";
       $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 . " s on p.products_id = s.products_id left join " . TABLE_CATEGORIES . " c on p2c.categories_id = c.categories_id where c.categories_status = '1' and 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 {
// We show them all
// ################## Added Enable Disable Categorie #################
//      $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 . " 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'] . "'";
       $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 . " s on p.products_id = s.products_id left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c on p.products_id = p2c.products_id left join " . TABLE_CATEGORIES . " c on p2c.categories_id = c.categories_id where c.categories_status = '1' and 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 {
// 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
// ################## Added Enable Disable Categorie #################
//        $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 . " 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['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 . "'";
       $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 . " s on p.products_id = s.products_id left join " . TABLE_CATEGORIES . " c on c.categories_id = p2c.categories_id where c.categories_status = '1' and 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 {
// We show them all
// ################## Added Enable Disable Categorie #################
//        $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 . " 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 . "'";
       $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 . " s on p.products_id = s.products_id left join " . TABLE_CATEGORIES . " c on c.categories_id = p2c.categories_id where c.categories_status = '1' and 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 . "'";

Sam M. - Seattle

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...