Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

I am sooo at a loss here. I have no idea what it is I did :'( I've tried reverting files back to my backup files and it has had no effect :blink:

 

When I try to add a product to my cart - I get this error:

 

Array ( [0] => Array ( [file] => /home/.lew/mmherbs/mountainmeadowherbs.com/includes/application_top.php [line] => 461 [function] => tep_redirect [args] => Array ( [0] => http://208.97.183.185/shopping_cart.php?os...052a3d4e4f1edf6 ) ) [1] => Array ( [file] => /home/.lew/mmherbs/mountainmeadowherbs.com/product_info.php [line] => 18 [args] => Array ( [0] => /home/.lew/mmherbs/mountainmeadowherbs.com/includes/application_top.php ) [function] => require ) )

 

1

 

I am just at a loss at this point. I've even double checked my application_top.php and I can't find anything wrong with any of the code that I've added for various contrib's. Does anybody here know what the above error means?

~Tracy
 

Link to comment
Share on other sites

I am sooo at a loss here. I have no idea what it is I did :'( I've tried reverting files back to my backup files and it has had no effect :blink:

 

When I try to add a product to my cart - I get this error:

 

Array ( [0] => Array ( [file] => /home/.lew/mmherbs/mountainmeadowherbs.com/includes/application_top.php [line] => 461 [function] => tep_redirect [args] => Array ( [0] => http://208.97.183.185/shopping_cart.php?os...052a3d4e4f1edf6 ) ) [1] => Array ( [file] => /home/.lew/mmherbs/mountainmeadowherbs.com/product_info.php [line] => 18 [args] => Array ( [0] => /home/.lew/mmherbs/mountainmeadowherbs.com/includes/application_top.php ) [function] => require ) )

 

1

 

I am just at a loss at this point. I've even double checked my application_top.php and I can't find anything wrong with any of the code that I've added for various contrib's. Does anybody here know what the above error means?

 

PS - the item is being added to the cart - but it doesn't take me to the shopping cart page. If I click on my back button and choose to view my cart contents - I can see the item is there :huh:

~Tracy
 

Link to comment
Share on other sites

PS - the item is being added to the cart - but it doesn't take me to the shopping cart page. If I click on my back button and choose to view my cart contents - I can see the item is there :huh:

 

Whew!! I don't know what happened to my catalog/includes/functions/general.php file - but I re-uploaded that file and the problem is solved! :thumbsup:

~Tracy
 

Link to comment
Share on other sites

Is there a debug code that I could put on a page to see what the query was getting before it returns 1065 - Query was empty ?

 

I am back to attempting to get the 2gether discount functioning - and for some reason it isn't pulling the info up in the query :huh:

 

This is what I have at the moment:

<?php
if (!$together_id) $together_id = $_GET['products_id'];
if ($together_id) {
include(DIR_WS_LANGUAGES . $language . '/2gether.php');
global $sppc_customer_group_id;
$show_money_savings = true; // show money savings
$show_percentage_savings = true; // show percentage savings
$show_original_prices = true; // show origibal prices of the products

//BOF Separate Pricing Per Customer
if(!tep_session_is_registered('sppc_customer_group_id')) {
$customer_group_id = '0';
}else{
$customer_group_id = $sppc_customer_group_id;
}
?>
<tr>
<td>
<?php
$together_query = tep_db_query("select distinct product_1_id, product_2_id, discount, type from ". TABLE_2GETHER ."  where (product_1_id = '" . $together_id . "' or product_2_id = '" . $together_id . "') and status = 1");
$num_together = tep_db_num_rows($together_query);
if ($num_together > 0) {
 $record = tep_db_fetch_array($together_query);
 $discount = $record['discount'];
 $discount_type = $record['type'];
 if ($record['product_1_id'] == $together_id) {
if ($customer_group_id != '0') {
$aq ="select p.products_id, p.products_image, IF(pg.customers_group_price IS NOT NULL, pg.customers_group_price, p.products_price) as products_price,  p.products_tax_class_id, pd.products_name from " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_GROUPS . " pg using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd  where p.products_id='". $record['product_1_id'] ."' and p.products_id = pd.products_id and products_status = '1' and pd.language_id ='". $languages_id ."' and pg.customers_group_id = '".$customer_group_id."' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0";
$bq ="select p.products_id, p.products_image, IF(pg.customers_group_price IS NOT NULL, pg.customers_group_price, p.products_price) as products_price,  p.products_tax_class_id, pd.products_name from " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_GROUPS . " pg using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd  where p.products_id='". $record['product_2_id'] ."' and p.products_id = pd.products_id and products_status = '1' and pd.language_id ='". $languages_id ."' and pg.customers_group_id = '".$customer_group_id."' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0";
 } else {
 $aq ="select p.products_id, p.products_image, p.products_price,  p.products_tax_class_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd  where p.products_id='". $record['product_2_id'] ."' and p.products_id = pd.products_id and products_status = '1' and pd.language_id ='". $languages_id ."' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0";
 $bq ="select p.products_id, p.products_image, p.products_price,  p.products_tax_class_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd  where p.products_id='". $record['product_1_id'] ."' and p.products_id = pd.products_id and products_status = '1' and pd.language_id ='". $languages_id ."' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0";
 }
}
 $product_a_query = tep_db_query($aq);
 $product_a = tep_db_fetch_array($product_a_query);
 $product_b_query = tep_db_query($bq);
 $product_b = tep_db_fetch_array($product_b_query);
 $product_a_price = $product_a['products_price'];
 $product_b_price = $product_b['products_price'];
 if (DISPLAY_PRICE_WITH_TAX) {
  $product_a_price = tep_add_tax($product_a_price,tep_get_tax_rate($product_a['products_tax_class_id']));
  $product_b_price = tep_add_tax($product_b_price,tep_get_tax_rate($product_b['products_tax_class_id']));
}

 

Do you see any problems with the query that would cause it to be empty?

~Tracy
 

Link to comment
Share on other sites

Is there a debug code that I could put on a page to see what the query was getting before it returns 1065 - Query was empty ?

 

I am back to attempting to get the 2gether discount functioning - and for some reason it isn't pulling the info up in the query :huh:

 

Do you see any problems with the query that would cause it to be empty?

 

I don't know why- I can look at something and try to fix it for hours and then the minute I post to the forum for help I get it figured out - LOL

 

I had to change where a '}' was located - so I changed:

 

if ($record['product_1_id'] == $together_id) {
if ($customer_group_id != '0') {
$aq ="select p.products_id, p.products_image, IF(pg.customers_group_price IS NOT NULL, pg.customers_group_price, p.products_price) as products_price,  p.products_tax_class_id, pd.products_name from " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_GROUPS . " pg using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd  where p.products_id='". $record['product_1_id'] ."' and p.products_id = pd.products_id and products_status = '1' and pd.language_id ='". $languages_id ."' and pg.customers_group_id = '".$customer_group_id."' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0";
$bq ="select p.products_id, p.products_image, IF(pg.customers_group_price IS NOT NULL, pg.customers_group_price, p.products_price) as products_price,  p.products_tax_class_id, pd.products_name from " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_GROUPS . " pg using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd  where p.products_id='". $record['product_2_id'] ."' and p.products_id = pd.products_id and products_status = '1' and pd.language_id ='". $languages_id ."' and pg.customers_group_id = '".$customer_group_id."' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0";
} else {
 $aq ="select p.products_id, p.products_image, p.products_price,  p.products_tax_class_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd  where p.products_id='". $record['product_2_id'] ."' and p.products_id = pd.products_id and products_status = '1' and pd.language_id ='". $languages_id ."' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0";
 $bq ="select p.products_id, p.products_image, p.products_price,  p.products_tax_class_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd  where p.products_id='". $record['product_1_id'] ."' and p.products_id = pd.products_id and products_status = '1' and pd.language_id ='". $languages_id ."' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0";
 }
}

 

to this:

 

if ($record['product_1_id'] == $together_id) {
if ($customer_group_id != '0') {
$aq ="select p.products_id, p.products_image, IF(pg.customers_group_price IS NOT NULL, pg.customers_group_price, p.products_price) as products_price,  p.products_tax_class_id, pd.products_name from " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_GROUPS . " pg using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd  where p.products_id='". $record['product_1_id'] ."' and p.products_id = pd.products_id and products_status = '1' and pd.language_id ='". $languages_id ."' and pg.customers_group_id = '".$customer_group_id."' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0";
$bq ="select p.products_id, p.products_image, IF(pg.customers_group_price IS NOT NULL, pg.customers_group_price, p.products_price) as products_price,  p.products_tax_class_id, pd.products_name from " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_GROUPS . " pg using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd  where p.products_id='". $record['product_2_id'] ."' and p.products_id = pd.products_id and products_status = '1' and pd.language_id ='". $languages_id ."' and pg.customers_group_id = '".$customer_group_id."' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0";
 }
} else {
 $aq ="select p.products_id, p.products_image, p.products_price,  p.products_tax_class_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd  where p.products_id='". $record['product_2_id'] ."' and p.products_id = pd.products_id and products_status = '1' and pd.language_id ='". $languages_id ."' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0";
 $bq ="select p.products_id, p.products_image, p.products_price,  p.products_tax_class_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd  where p.products_id='". $record['product_1_id'] ."' and p.products_id = pd.products_id and products_status = '1' and pd.language_id ='". $languages_id ."' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0";
 }

 

and it works again - LOL :blush:

~Tracy
 

Link to comment
Share on other sites

Now this part I've been stuck on for a bit :blush:

 

I am attempting to modify the queries (which I believe are finally working with SPPC and hide products for SPPC) so that they will work with Master Products as well. (I did post on the Master Products forum thread but I've not heard back yet so thought I'd try here as well).

 

Ok - the products that will be in the together query will all be "slave" products. So the $_GET['products_id'] feature is going to be pulling the Master Product product_id - not the slave products product_id. Therefor - the query only works if someone places a slave product in their cart, and then clicks from their cart to view the slave product (that's when the slaves product_id is in the URL).

 

Now - in product_info.php I have this query to call the slave products:

$master_query = tep_db_query("select products_id from " . TABLE_PRODUCTS . " where products_master LIKE  '%" . $HTTP_GET_VARS['products_id'] . "%'");
$results = tep_db_fetch_array($master_query);
if (($results['products_id'] != null) && ($product_info['products_master_status'] == 1)) { ?>

 

In my 2gether.php I need to modify the query - but this bit of code at the top is throwing me off:

if (!$together_id) $together_id = $_GET['products_id'];
if ($together_id) {

 

Somehow I need to change the $together_id to be an array of product_ids that are returned by a $master_query (at least that's what I think I need to do) :blush:

 

The current query looks like this:

<?php
if (!$together_id) $together_id = $_GET['products_id'];
if ($together_id) {
include(DIR_WS_LANGUAGES . $language . '/2gether.php');
global $sppc_customer_group_id;
$show_money_savings = true; // show money savings
$show_percentage_savings = true; // show percentage savings
$show_original_prices = true; // show origibal prices of the products

//BOF Separate Pricing Per Customer
if(!tep_session_is_registered('sppc_customer_group_id')) {
$customer_group_id = '0';
}else{
$customer_group_id = $sppc_customer_group_id;
}
?>
<tr>
<td>
<?php
$together_query = tep_db_query("select distinct product_1_id, product_2_id, discount, type from ". TABLE_2GETHER ."  where (product_1_id = '" . $together_id . "' or product_2_id = '" . $together_id . "') and status = 1");
$num_together = tep_db_num_rows($together_query);
if ($num_together > 0) {
 $record = tep_db_fetch_array($together_query);
 $discount = $record['discount'];
 $discount_type = $record['type'];
 if ($record['product_1_id'] == $together_id) {
if ($customer_group_id != '0') {
$aq ="select p.products_id, p.products_image, IF(pg.customers_group_price IS NOT NULL, pg.customers_group_price, p.products_price) as products_price,  p.products_tax_class_id, pd.products_name from " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_GROUPS . " pg using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd  where p.products_id='". $record['product_1_id'] ."' and p.products_id = pd.products_id and products_status = '1' and pd.language_id ='". $languages_id ."' and pg.customers_group_id = '".$customer_group_id."' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0";
$bq ="select p.products_id, p.products_image, IF(pg.customers_group_price IS NOT NULL, pg.customers_group_price, p.products_price) as products_price,  p.products_tax_class_id, pd.products_name from " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_GROUPS . " pg using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd  where p.products_id='". $record['product_2_id'] ."' and p.products_id = pd.products_id and products_status = '1' and pd.language_id ='". $languages_id ."' and pg.customers_group_id = '".$customer_group_id."' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0";
 }
} else {
 $aq ="select p.products_id, p.products_image, p.products_price,  p.products_tax_class_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd  where p.products_id='". $record['product_2_id'] ."' and p.products_id = pd.products_id and products_status = '1' and pd.language_id ='". $languages_id ."' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0";
 $bq ="select p.products_id, p.products_image, p.products_price,  p.products_tax_class_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd  where p.products_id='". $record['product_1_id'] ."' and p.products_id = pd.products_id and products_status = '1' and pd.language_id ='". $languages_id ."' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0";
 }

 

Notice the reference in the $together_query to the $together_id ? I think, (hope), that if I can get the $together_id to be the array of slave product_id then the rest would all fall into place.

 

Any thoughts?

~Tracy
 

Link to comment
Share on other sites

Now this part I've been stuck on for a bit :blush:

 

I am attempting to modify the queries (which I believe are finally working with SPPC and hide products for SPPC) so that they will work with Master Products as well. (I did post on the Master Products forum thread but I've not heard back yet so thought I'd try here as well).

 

Notice the reference in the $together_query to the $together_id ? I think, (hope), that if I can get the $together_id to be the array of slave product_id then the rest would all fall into place.

 

Any thoughts?

 

Hmmm - I tried changing the code at the top to this:

$master_query = tep_db_query("select products_id from " . TABLE_PRODUCTS . " where products_master LIKE  '%" . $HTTP_GET_VARS['products_id'] . "%'");
$results = tep_db_fetch_array($master_query);
if (!$together_id) $together_id = $results['products_id'];
if (($together_id) && ($results['products_id'] != null) && ($product_info['products_master_status'] == 1)) {

 

And I seem to be half way there. For products in the products_2gether table as product_2_id it works - the master product page calls in the table to show the discount - but only with one option.

 

Ie - product_2_id is actually two different id's that should be pulled from the array $master_query. One is a 4oz size and one is a 2oz size. But the table only shows me the 2oz size with the product_1_id for the discount.

 

For some reason - product_1_id is not being found by the query when I go to it's master page? It generates a "Query was empty" error.

 

I tried this - but it didn't result in finding anything:

$master_query = tep_db_query("select products_id from " . TABLE_PRODUCTS . " where products_master LIKE  '%" . $HTTP_GET_VARS['products_id'] . "%'");
if (!$together_id) $together_id = tep_db_fetch_array($master_query);
if (($together_id['products_id'] != null) && ($product_info['products_master_status'] == 1)) {

 

Confusing :blink:

~Tracy
 

Link to comment
Share on other sites

HELP !!

 

I have installed the latest build of OSC 2.2 and have updated it with the following contributions:

 

* sppc 4.15

* order_editor_2_8_4

* invoice & Packingslip ADMN v1.26

* Must agree to terms v1.5.2 (AGB bestätigen & Widerrufsrecht)

* Agree Conditions (Impressum)

* Tax info 1.0 by Christoph Marczinzik (Anzeige von MwSt. Satz der Produkte)

* German Tax v1.01 (korrekte Steuerzone und Steuersätze für Deutschland)

* Ship In Cart Alpha 1.0 by Nightwalker/mountain (Anzeige der vorläufigen Versandkosten im Warenkorb)

 

The address in OSC should look like:

 

shouldlook.gif

 

but looks like:

 

lookslike.gif

 

I have an uncomplete address as well in the invoice and packingslip.

If I EDIT the order with the order_editor, I find the complete address...

 

 

I don't find anything wrong in general.php where I believe to find the problem in defining the address...

 

When I track down since when I really know, that this happened, then it is after installing SPPC 4.15 and the problems with MySQL 5 (before returning zu MySQL 4). But i am not quit shure weather I installed SPPC as third or fourth contribution.

 

Thank you for help.

 

Regards,

Ralf

Link to comment
Share on other sites

Hmmm - I tried changing the code at the top to this:

$master_query = tep_db_query("select products_id from " . TABLE_PRODUCTS . " where products_master LIKE  '%" . $HTTP_GET_VARS['products_id'] . "%'");
$results = tep_db_fetch_array($master_query);
if (!$together_id) $together_id = $results['products_id'];
if (($together_id) && ($results['products_id'] != null) && ($product_info['products_master_status'] == 1)) {

 

And I seem to be half way there. For products in the products_2gether table as product_2_id it works - the master product page calls in the table to show the discount - but only with one option.

 

Well - I removed the ($product_info['products_master_status'] == 1) bit as I don't think I need to have that. Only the master products have a products_master_status of 1 and I'm looking for the slave products.

 

I still have the same weird thing though - if it's product_2_id that I'm viewing in my browser, then the table shows the option to buy product_2_id with product_1_id.

 

But - if it's product_1_id that I'm viewing in the browser, then the option to buy it with product_2_id isn't there - just an "1065 - Query was empty" error instead :huh:

~Tracy
 

Link to comment
Share on other sites

Well - I removed the ($product_info['products_master_status'] == 1) bit as I don't think I need to have that. Only the master products have a products_master_status of 1 and I'm looking for the slave products.

 

I still have the same weird thing though - if it's product_2_id that I'm viewing in my browser, then the table shows the option to buy product_2_id with product_1_id.

 

But - if it's product_1_id that I'm viewing in the browser, then the option to buy it with product_2_id isn't there - just an "1065 - Query was empty" error instead :huh:

 

Well - I seem to have solved this problem - but I'm sure there is a better way to do it. I changed the query to look also for if record product_2_id == together_id like this:

 

$together_query = tep_db_query("select distinct product_1_id, product_2_id, discount, type from ". TABLE_2GETHER ."  where (product_1_id = '" . $together_id . "' or product_2_id = '" . $together_id . "') and status = 1");
$num_together = tep_db_num_rows($together_query);
if ($num_together > 0) {
 $record = tep_db_fetch_array($together_query);
 $discount = $record['discount'];
 $discount_type = $record['type'];
 if (($record['product_1_id'] == $together_id) && ($customer_group_id != '0')) {
$aq ="select p.products_id, p.products_image, IF(pg.customers_group_price IS NOT NULL, pg.customers_group_price, p.products_price) as products_price,  p.products_tax_class_id, pd.products_name from " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_GROUPS . " pg using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd  where p.products_id='". $record['product_1_id'] ."' and p.products_id = pd.products_id and products_status = '1' and pd.language_id ='". $languages_id ."' and pg.customers_group_id = '".$customer_group_id."' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0";
$bq ="select p.products_id, p.products_image, IF(pg.customers_group_price IS NOT NULL, pg.customers_group_price, p.products_price) as products_price,  p.products_tax_class_id, pd.products_name from " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_GROUPS . " pg using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd  where p.products_id='". $record['product_2_id'] ."' and p.products_id = pd.products_id and products_status = '1' and pd.language_id ='". $languages_id ."' and pg.customers_group_id = '".$customer_group_id."' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0";
 }else if (($record['product_2_id'] == $together_id) && ($customer_group_id != '0')) {
$aq ="select p.products_id, p.products_image, IF(pg.customers_group_price IS NOT NULL, pg.customers_group_price, p.products_price) as products_price,  p.products_tax_class_id, pd.products_name from " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_GROUPS . " pg using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd  where p.products_id='". $record['product_1_id'] ."' and p.products_id = pd.products_id and products_status = '1' and pd.language_id ='". $languages_id ."' and pg.customers_group_id = '".$customer_group_id."' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0";
$bq ="select p.products_id, p.products_image, IF(pg.customers_group_price IS NOT NULL, pg.customers_group_price, p.products_price) as products_price,  p.products_tax_class_id, pd.products_name from " . TABLE_PRODUCTS . " p LEFT JOIN " . TABLE_PRODUCTS_GROUPS . " pg using(products_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd  where p.products_id='". $record['product_2_id'] ."' and p.products_id = pd.products_id and products_status = '1' and pd.language_id ='". $languages_id ."' and pg.customers_group_id = '".$customer_group_id."' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0";
 }else {
 $aq ="select p.products_id, p.products_image, p.products_price,  p.products_tax_class_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd  where p.products_id='". $record['product_2_id'] ."' and p.products_id = pd.products_id and products_status = '1' and pd.language_id ='". $languages_id ."' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0";
 $bq ="select p.products_id, p.products_image, p.products_price,  p.products_tax_class_id, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd  where p.products_id='". $record['product_1_id'] ."' and p.products_id = pd.products_id and products_status = '1' and pd.language_id ='". $languages_id ."' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0";
 }

 

Is there a way to shortcut this with an "or" statement somewhere in this bit:

if (($record['product_1_id'] == $together_id) && ($customer_group_id != '0')) {

 

So that it says if $record['product_1_id'] OR $record['product_2_id] == $together_id ? I'm not sure what the proper syntax would be to set that up. :blush:

 

But at least I'm making progress ;)

~Tracy
 

Link to comment
Share on other sites

Somehow I need to change the $together_id to be an array of product_ids that are returned by a $master_query (at least that's what I think I need to do)

Wouldn't it be better to move the find_in_set to the first query (you don't want to show these products...). Also if it is an array or just one value, you could change from "=" to "IN ( #, #, #)" IMO.

That way you could get a correct first query, haven't looked on what happens next.

<?php
if (is_array($together_id)) {
$together_array = implode(",", $together_id);
} else {
$together_id = (int)$together_id;
}
$together_query = tep_db_query("select distinct product_1_id, product_2_id, discount, type from ". TABLE_2GETHER ."  where (product_1_id in (" . $together_id . ") or product_2_id in (" . $together_id . ") ) and status = 1  and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0");

Link to comment
Share on other sites

Hey Guys,

 

I have a kind of strange request...

 

I have SPPC + Prices for Logged-In Users Only.

 

Now i want to display a message to Retail customers (blah blah blah) instead of price and for wholesalers i wanna show them the appropriate price... ( i know i might have to hardcode this, and that's OK too..)

 

anybody know how i can do this??? I would really appreciate the help...

 

 

P.S: Prices for Logged-In Users Only is here:

 

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

 

 

 

 

Best Regards

Jack

Edited by jackanderson

Converge

Link to comment
Share on other sites

Wouldn't it be better to move the find_in_set to the first query (you don't want to show these products...). Also if it is an array or just one value, you could change from "=" to "IN ( #, #, #)" IMO.

That way you could get a correct first query, haven't looked on what happens next.

<?php
if (is_array($together_id)) {
$together_array = implode(",", $together_id);
} else {
$together_id = (int)$together_id;
}
$together_query = tep_db_query("select distinct product_1_id, product_2_id, discount, type from ". TABLE_2GETHER ."  where (product_1_id in (" . $together_id . ") or product_2_id in (" . $together_id . ") ) and status = 1  and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0");

 

Well - moving the find_in_set does make a whole lot of sense - but will it recognize that product_1_id and p.products_id are the same thing? It's calling from a table called products_2gether, and that table doesn't have the "hide" status listed for it's rows. It just basically says tid (auto increment) - product_1_id, product_2_id, discount amount, discount type ($ or %) and status (active or disabled).

 

Or - is the find_in_set bit looking at the $together_id bit - which would be the correct place to be looking??

 

Also - is this bit separate from other items, or a change to an existing bit of code? What does it do differently from the code I currently have? (Sorry for the questions - just trying to learn as I go so hopefully someday I'm able to answer more than I ask) :blush:

if (is_array($together_id)) {
$together_array = implode(",", $together_id);
} else {
$together_id = (int)$together_id;

 

I currently have this (from top of page to the end of the $together_query)

<?php
$master_query = tep_db_query("select products_id from " . TABLE_PRODUCTS . " where products_master LIKE  '%" . $HTTP_GET_VARS['products_id'] . "%'");
$results = tep_db_fetch_array($master_query);
if (!$together_id) $together_id = $results['products_id'];
if (($together_id) && ($results['products_id'] != null)) {
include(DIR_WS_LANGUAGES . $language . '/2gether.php');
global $sppc_customer_group_id;
$show_money_savings = true; // show money savings
$show_percentage_savings = true; // show percentage savings
$show_original_prices = true; // show origibal prices of the products

//BOF Separate Pricing Per Customer
if(!tep_session_is_registered('sppc_customer_group_id')) {
$customer_group_id = '0';
}else{
$customer_group_id = $sppc_customer_group_id;
}
?>
<tr>
<td>
<?php
$together_query = tep_db_query("select distinct product_1_id, product_2_id, discount, type from ". TABLE_2GETHER ."  where (product_1_id = '" . $together_id . "' or product_2_id = '" . $together_id . "') and status = 1");

 

Which seems to be working properly at the moment (at least for showing things on the master pages).

~Tracy
 

Link to comment
Share on other sites

but will it recognize that product_1_id and p.products_id are the same thing? It's calling from a table called products_2gether, and that table doesn't have the "hide" status listed for it's rows. It just basically says tid (auto increment) - product_1_id, product_2_id, discount amount, discount type ($ or %) and status (active or disabled).
No, you are right. You would have to have a join on products p1 where p1.products_id = product_1_id and join again on products p2 (the same table should not be a problem) on p2.products_id = product_2_id.

 

Also - is this bit separate from other items, or a change to an existing bit of code? What does it do differently from the code I currently have? (Sorry for the questions - just trying to learn as I go so hopefully someday I'm able to answer more than I ask) :blush:

if (is_array($together_id)) {
$together_array = implode(",", $together_id);
} else {
$together_id = (int)$together_id;

This should fit between getting the products_id's from the master query and the together query.

 

I currently have this (from top of page to the end of the $together_query)

<?php
$master_query = tep_db_query("select products_id from " . TABLE_PRODUCTS . " where products_master LIKE  '%" . $HTTP_GET_VARS['products_id'] . "%'");
$results = tep_db_fetch_array($master_query);

That will only give you the first result of the query. You have to use a while (see product_listing) and store the products_id in an array, that you "implode" to get a comma separated list.
Link to comment
Share on other sites

Now i want to display a message to Retail customers (blah blah blah) instead of price and for wholesalers i wanna show them the appropriate price... ( i know i might have to hardcode this, and that's OK too..)
You can't know if the visitor is a wholesale customer until she is logged-in and you decide who is wholesale so what is the scenario for the retail customers then? Do you mean visitors who are not logged-in or do you actually have retail customers who buy from you (then they have to see prices, don't they)?
Link to comment
Share on other sites

This should fit between getting the products_id's from the master query and the together query.

 

That will only give you the first result of the query. You have to use a while (see product_listing) and store the products_id in an array, that you "implode" to get a comma separated list.

 

Ok - now I'm stumbling through this part very badly :blush: Here is what I changed the very top to, but it isn't working (not pulling up any info on pages it should):

<?php
$master_query = tep_db_query("select products_id from " . TABLE_PRODUCTS . " where products_master LIKE  '%" . $HTTP_GET_VARS['products_id'] . "%'");
while($together_id = tep_db_fetch_array($master_query)) {
$together_id[] = $together_id['products_id'];
}
if (is_array($together_id)) {
$together_array = implode(",", $together_id);
} else {
$together_id = (int)$together_id;
}

if (($together_id) && ($together_id['products_id'] != null)) {
include(DIR_WS_LANGUAGES . $language . '/2gether.php');
global $sppc_customer_group_id;
$show_money_savings = true; // show money savings
$show_percentage_savings = true; // show percentage savings
$show_original_prices = true; // show origibal prices of the products

//BOF Separate Pricing Per Customer
if(!tep_session_is_registered('sppc_customer_group_id')) {
$customer_group_id = '0';
}else{
$customer_group_id = $sppc_customer_group_id;
}
?>

 

I didn't include the queries after this as I have not touched those - only this top part.

What is it that I did wrong in trying to setup the array? (Or could it be that the part that echo's the results onto the page isn't setup to show more than one result yet?)

~Tracy
 

Link to comment
Share on other sites

Does anyone have SPPC installed with Multi Stores? I am trying to integrate Seperate Pricing per Customer into my Multi Stores and am having issues. I don't know how to modify the statements to include the "stores" part of the Multi Stores contribution.

 

Specifically, my issues so far are on:

 

index.php - clicking on any category, I get

1054 - Unknown column 's.stores_id' in 'on clause'

 

advanced_search_result.php

1066 - Not unique table/alias: 'pd'

 

shopping_cart.php

1109 - Unknown table 's' in where clause

 

Can anyone assist?

 

Thanks,

 

Joanne

Link to comment
Share on other sites

You use a non-standard product listing (includes/product_listing.php) which might have confused you when you were adding the changes needed for SPPC to work. Basically, the "normal" product_listing does a query and then while getting the rows one by one the output is being made. In SPPC first all the rows are collected and stored in an array. Then all the products_id's are known and with those the group prices are picked up, changed in that array if different and then the same is done for the special prices.

 

Hi, thanks for the reply. Ive been looking at the product_listing.php page and im not sure what order i should have put the sppc code in (would have been the same as the instructions) but there are other mods on that page so probably a conflict somewhere.

 

JanZ, can you take a look at my product_listing page to see if anything looks out of the ordinary, thanks.

 

<?php

/*

$Id: product_listing.php,v 1.44 2003/06/09 22:49:59 hpdl Exp $

 

adapted for Separate Pricing Per Customer v4 2005/02/26

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright (c) 2003 osCommerce

 

Released under the GNU General Public License

*/

$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 == '3') ) ) {

?>

<table border="0" width="100%" cellspacing="0" cellpadding="2" bgcolor="#E9E6E3">

<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 '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;

$column = 0;

echo '

 

<table width="533" cellpadding="0" cellspacing="0" bgcolor="#ffffff">

<tr>

<td height="33" bgcolor="#F4F0ED" valign="middle">

<table bgcolor="#F4F0ED" cellpadding="0" cellspacing="0" width="531">

<tr>

<td width="4"></td>

<td width="32"><img src="images/m05.jpg"></td>

<td width="5"></td>

<td width="488"><span class="ch">Categories » '.$breadcrumb->trail(' » ').'</span></td>

</tr>

</table>

</td>

</tr>

<tr><td height="1"></td></tr>

<tr>

<td height="20" bgcolor="#E9E6E3">

<table cellpadding="0" border=0 cellspacing="0">

 

<tr>

<td width="5"></td>

<td></td>

</tr>

 

</table>

</td>

</tr>

<tr>

<td valign="top"><table width="100%" cellpadding="1" cellspacing="1">

<tr>

 

 

 

';

 

$listing_query = tep_db_query($listing_split->sql_query);

// 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(!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($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>';

*/

$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 = '';

 

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'])) {

$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 = ' <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'])) {

$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 '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'])) {

$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; // EOF Separate Pricing per Customer

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;

}

 

$list_box_contents[$cur_row][] = array('align' => $lc_align,

'params' => 'class="productListing-data"',

'text' => $lc_text);

$product_contents[] = $lc_text;

}

 

 

$product_query = tep_db_query("select products_description from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$listing['products_id'] . "' and language_id = '" . (int)1 . "'");

$product = tep_db_fetch_array($product_query);

$new_products['products_description'] = $product['products_description'];

 

echo '

 

<td valign="top" bgcolor="#E9E6E3">

<table width="100%" cellpadding="0" cellspacing="0">

<tr>

<td valign="top">

<table cellpadding="0" border="0" cellspacing="0" width=100%>

<tr>

<td width="1"></td>

<td valign="top">

<table width="100%" border=0 cellpadding="0" cellspacing="0">

 

<tr><td height=19 valign=top><br><div align="center">'.$product_contents[1].'</div></td></tr>

<tr>

<td><br><div align="center">

'.$product_contents[0].'

</div><div align="left"></div></td>

</tr>

<tr><td><div align="center"><b>Price:</b></div></td></tr>

<tr>

<td height=30 valign=middle><div align="center"><span class="ch3">'.$product_contents[2].'</span></div></td>

</tr>

<tr><td>

<table align="center" cellpadding="0" cellspacing="0">

<tr><td height="5"></td></tr>

<tr>

<td width="100" valign="top">

<table width="120" cellpadding="0" border="0" cellspacing="0">

<tr>

<td><div align="center"><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $listing['products_id']) . '">' . tep_image_button('small_view.gif') . '</a></div></td>

<td width="4"><div align="center"></div></td>

<td><div align="center"><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_in_cart.gif') . '</a></div></td>

</tr>

</table> </td>

</tr>

</table>

</td>

</tr>

<tr>

<td> </td>

</tr>

</table>

</td>

 

</tr>

 

</table>

</td>

</tr>

</table>

</td>

 

';

$column ++;

if ($column >= 2) {

$rows ++;

$column = 0;

echo '

 

</tr>

 

<tr>

 

 

 

 

';

} else echo '

';

 

 

 

}

 

echo '

 

 

</tr>

</table>

</td>

</tr>

</table>

 

';

 

//new productListingBox($list_box_contents);

} else {

$list_box_contents = array();

 

$list_box_contents[0] = array('params' => 'class="productListing-odd"');

$list_box_contents[0][

Link to comment
Share on other sites

Here's the end of product_listing.php from the above post:

 

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

echo '<div class=PageHeading>Categories</div>';
new productListingBox($list_box_contents);
 }

 if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {
?>

<table border="0" width="100%" cellspacing="0" cellpadding="2">
 <tr><td height=2></td></tr>
 <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
 }
?>

Link to comment
Share on other sites

Wouldn't it be better to move the find_in_set to the first query (you don't want to show these products...). Also if it is an array or just one value, you could change from "=" to "IN ( #, #, #)" IMO.

That way you could get a correct first query, haven't looked on what happens next.

<?php
if (is_array($together_id)) {
$together_array = implode(",", $together_id);
} else {
$together_id = (int)$together_id;
}
$together_query = tep_db_query("select distinct product_1_id, product_2_id, discount, type from ". TABLE_2GETHER ."  where (product_1_id in (" . $together_id . ") or product_2_id in (" . $together_id . ") ) and status = 1  and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0");

 

From this concept I thought I would try this - since the master_query is done first to find all the products for the array that have a products_master LIKE HTTP_GET_VARS['products_id'] - I thought I would change it in that query. Supposedly, all of the products for the array come from that query (I have to check later queries to make sure whether or not I need that find_in_set bit duplicated or not yet).

 

Of course - then I thought about the fact that the master_query was in the page before any of the SPPC code for getting the customer_group_id. So I moved that above the master_query as well as the global.

 

So I now have this at the top of the page - does this look right to you?

<?php
//BOF Separate Pricing Per Customer
if(!tep_session_is_registered('sppc_customer_group_id')) {
$customer_group_id = '0';
}else{
$customer_group_id = $sppc_customer_group_id;
}
global $sppc_customer_group_id;

$master_query = tep_db_query("select products_id from " . TABLE_PRODUCTS . " where products_master LIKE  '%" . $HTTP_GET_VARS['products_id'] . "%' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0");

~Tracy
 

Link to comment
Share on other sites

Well - I am now totally stumped. I have changed the first query (the results of which are then queried by the other queries in the page) - and I am not getting any errors - nor is it sucessfully executing the query the way I want because it doesn't find anything :huh:

 

Here is what I have at the moment:

<?php
//BOF Separate Pricing Per Customer
if(!tep_session_is_registered('sppc_customer_group_id')) {
$customer_group_id = '0';
}else{
$customer_group_id = $sppc_customer_group_id;
}
global $sppc_customer_group_id;

$master_query = tep_db_query("select products_id from " . TABLE_PRODUCTS . " where products_master LIKE '%" . $HTTP_GET_VARS['products_id'] . "%' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0");
while ($together_id = tep_db_fetch_array($master_query)) {
if (is_array($together_id)) {
$together_array = implode(",", $together_id);
} else {
$together_id = (int)$together_id;
}

if ($together_id['products_id'] != null) {
include(DIR_WS_LANGUAGES . $language . '/2gether.php');
$show_money_savings = true; // show money savings
$show_percentage_savings = true; // show percentage savings
$show_original_prices = true; // show origibal prices of the products
?>
<tr>
<td>
<?php
$together_query = tep_db_query("select distinct product_1_id, product_2_id, discount, type from ". TABLE_2GETHER ."  where (product_1_id = '" . $together_id . "' or product_2_id = '" . $together_id . "') and status = 1");
$num_together = tep_db_num_rows($together_query);
if ($num_together > 0) {
 $record = tep_db_fetch_array($together_query);

 

The $together_query is included just so you can see that it is then pulling it's information from the master_query array which should be $together_id. I don't know where it is I'm messing this up, but apparently I've got something wrong as it should be finding 2 results on the page I'm testing it on and it isn't finding any :(

 

Do you have any idea what I'm doing wrong? :blush:

~Tracy
 

Link to comment
Share on other sites

Well - I am now totally stumped. I have changed the first query (the results of which are then queried by the other queries in the page) - and I am not getting any errors - nor is it sucessfully executing the query the way I want because it doesn't find anything :huh:

 

Still no luck - latest attempt (many in between too)

<?php
//BOF Separate Pricing Per Customer
if(!tep_session_is_registered('sppc_customer_group_id')) {
$customer_group_id = '0';
}else{
$customer_group_id = $sppc_customer_group_id;
}
global $sppc_customer_group_id;

$master_query = tep_db_query("select products_id from " . TABLE_PRODUCTS . " where products_master LIKE '%" . $HTTP_GET_VARS['products_id'] . "%' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0");
$num_master = tep_db_num_rows($master_query);
if ($num_master > 0) {
$together_id = tep_db_fetch_array($master_query);
}
while ($together_id = tep_db_fetch_array($master_query)) {
if (is_array($together_id)) {
$together_array = implode(",", $together_id);
} else {
$together_id = (int)$together_id;
}
if (!$together_id) $together_id = $together_id['products_id'];
if (($together_id) && ($together_id['products_id'] != null)) {
include(DIR_WS_LANGUAGES . $language . '/2gether.php');
$show_money_savings = true; // show money savings
$show_percentage_savings = true; // show percentage savings
$show_original_prices = true; // show original prices of the products
?>

 

I tried removing the find_in_set to see if that was causing a problem but it didn't make any difference. What gets me is that this produces at least one of the two items it should:

<?php
$master_query = tep_db_query("select products_id from " . TABLE_PRODUCTS . " where products_master LIKE  '%" . $HTTP_GET_VARS['products_id'] . "%'");
$results = tep_db_fetch_array($master_query);
if (!$together_id) $together_id = $results['products_id'];
if (($together_id) && ($results['products_id'] != null)) {
include(DIR_WS_LANGUAGES . $language . '/2gether.php');
global $sppc_customer_group_id;
$show_money_savings = true; // show money savings
$show_percentage_savings = true; // show percentage savings
$show_original_prices = true; // show origibal prices of the products

//BOF Separate Pricing Per Customer
if(!tep_session_is_registered('sppc_customer_group_id')) {
$customer_group_id = '0';
}else{
$customer_group_id = $sppc_customer_group_id;
}
?>
<tr>
<td>
<?php
$together_query = tep_db_query("etc.....

 

So I have no clue why the second one above gets me results while the first one gets nothing when it should be getting the full array of results :blink:

 

Is there a test debug code I could use to print any results that the master_query is getting to make sure that it isn't just that my display of the results is messed up for displaying more than one and so it's getting confused and just not showing anything? I don't know if that's possible or not - I would think if the display is setup to only show one result, and the query array has two results, it would at least show the first of the two in the display area rather than nothing at all :huh:

~Tracy
 

Link to comment
Share on other sites

So I have no clue why the second one above gets me results while the first one gets nothing when it should be getting the full array of results :blink:

 

Is there a test debug code I could use to print any results that the master_query is getting to make sure that it isn't just that my display of the results is messed up for displaying more than one and so it's getting confused and just not showing anything? I don't know if that's possible or not - I would think if the display is setup to only show one result, and the query array has two results, it would at least show the first of the two in the display area rather than nothing at all :huh:

 

Nevermind the above - I have found a simpler solution to fit our needs rather than trying to basically re-write the 2gether discount contrib :blush:

 

I will need some help in a little bit - I'm going to use the Discount Coupon Codes module to create a coupon to serve our needs - but I will need to figure out how to exclude customer groups. I will post again when I get up to that point and need help figuring out how to setup the exclusion :blush:

 

Thank you very much again! I am learning a lot through all of this :blush:

~Tracy
 

Link to comment
Share on other sites

im hoping someone here can help me

i have installed this mod along with PWA. heres what i want to do:

If the customer signs up they become a "member" where they get discounted prices

if they PWA they are non members and pay the full price

Now i got that bit sorted however heres my problem, someone who visits my site will automaticaly get shown the members price rather than the normal one. What am i doing wrong please.

I dont help with templates (thats what the seller is for)

 

th search function will often help, when it dont try this in google.

 

site:http://www.oscommerce.com/forums then your search word

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