Jump to content
scendent

Seperate Pricing Per Customer v3.5

Recommended Posts

I have installed SPPC working fine and I'm interested in Quantity Price Breaks Per Product, but the version adapted for SPPC seems too old. I'm reading the documentation of current versions of Quantity Price Breaks Per Product but it's too hard for me to adapt it to SPPC.

That new version of QPBPP is only a few months old and not even stable yet (I personally changed some parts of it to get it working with the discount categories as intended). So do you mind I don't have time to catch up with changing contributions and osCommerce? Hide categories and products e.g. is still old code and needs updating.

 

The new QPBPP took the prices and quantities out of the table products. Not a bad idea but it meant a lot of code changes (and new bugs).

Share this post


Link to post
Share on other sites
If you download the latest SPPC version and copy over that part from index.php to your index.php you should be fine again. You will have a problem with advanced_search_results.php too. Use the one from a later/the latest version of SPPC too.

 

Hello Jan,

 

Thanks for your reply.

 

I am running OSC 2M2.2 not RC1. That's why I've installed SPPC 1.4.6 instead of SPPC 4.2.0 and above.

Anyway as you suggested, I downloaded the latest SPPC and just extracted the catalog/index.php file.

 

From that catolg/index.php file I picked up the portion of the code that deals with my errors...meaning that I replaced a part of the code I posted in my previous post by this:

 

// BOF Separate Pricing Per Customer
if ($status_product_prices_table == true) { // ok in mysql 5
$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['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 -- changed for mysql 5
$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 left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.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['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) { // ok in mysql 5
	$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 -- changed for mysql 5
	$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 left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.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'] . "'";
} // 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) { // ok for mysql 5
	$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 -- ok in mysql 5
	$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 --last query changed for mysql 5 compatibility
	if ($status_product_prices_table == true) {
// original, no need to change for mysql 5
$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 -- changed for mysql 5
	$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 left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_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 . "'"; 
  } // end else { // either retail...
// EOF Separate Pricing per Customer

 

It worked out. I don't get any issue related to PHP5 anymore on index.php. Thanks.

 

Please, be aware that I did not change or replace the code after require('includes/application_top.php'); by the code below as required by the installation guide of SPPC 4.2.0:

 

// BOF Separate Pricing Per Customer
 if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {
 $customer_group_id = $_SESSION['sppc_customer_group_id'];
 } else {
  $customer_group_id = '0';
 }
// EOF Separate Pricing Per Customer

 

 

I left it as it is from SPPC 1.4.6 like this:

 

global $customer_group_id;
 if(!isset($customer_group_id)) { $customer_group_id = '0'; }

 

Although everything works fine, my main concern/question is: will leaving this piece of code after require('includes/application_top.php'); unchanged give me some problem in the future? Is it a right way of doing things? Or should I change it too to the one included in the SPPC 4.2.0 Reand-me file?

 

Thanks for helping.

 

BTW: My advanced_search_results.php doen't have any PHP5 related problem. It is working fine. So, I didn't change it. Sounds strange :(

 

 

JBS7

Share this post


Link to post
Share on other sites

HI All,

 

I installed SSPC 4.2.1A,

 

Default group for users is retail, right? Now, let say I created a new group, Wholesale, and I change the group of one of my customers, from retail to wholesale. The customer then tries to login and gets this error:

 

1054 - Unknown column 's.public_flag' in 'where clause'

 

select count(*) as total from orders o, orders_status s where o.customers_id = '2' and o.orders_status = s.orders_status_id and s.language_id = '1' and s.public_flag = '1'

 

[TEP STOP]

 

As ive installed sppc 4.2.1a with osc 2.2RC1, also fresh. So i just followed the instrcutions for fresh installation. I copied the included files and I went to phpmyadmin, run the spcc_v42_install.sql.

 

I have checked the table order_status, found no column public_flag.

Share this post


Link to post
Share on other sites
1054 - Unknown column 's.public_flag' in 'where clause'

This is new in RC2a. I assume this post in Tips & Tricks will solve it.

Share this post


Link to post
Share on other sites
Please, be aware that I did not change or replace the code after require('includes/application_top.php'); by the code below as required by the installation guide of SPPC 4.2.0:

 

// BOF Separate Pricing Per Customer
 if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {
 $customer_group_id = $_SESSION['sppc_customer_group_id'];
 } else {
  $customer_group_id = '0';
 }
// EOF Separate Pricing Per Customer

I left it as it is from SPPC 1.4.6 like this:

 

global $customer_group_id;
 if(!isset($customer_group_id)) { $customer_group_id = '0'; }

 

Although everything works fine, my main concern/question is: will leaving this piece of code after require('includes/application_top.php'); unchanged give me some problem in the future? Is it a right way of doing things? Or should I change it too to the one included in the SPPC 4.2.0 Reand-me file?

In my opinion the top version is the cleanest but nobody ever mentioned a problem with the old one so I don't think you should have an issue with it.

 

Regarding the advanced search result. I don't remember what triggered the error. Perhaps it will happen if you choose a manufacturer (if you have those) or a price range (the more "advanced" stuff) in advanced_search_result.php.

 

Regarding 4.1.6 versus 4.2.1a. Version 4.2.1a has a few more features but a two out of three of these options can be added separately (the mail and the individual tax exempt features). Code wise not so much is different between those versions.

Share this post


Link to post
Share on other sites
This is new in RC2a. I assume this post in Tips & Tricks will solve it.

 

 

Tnx, yeah I did add a new column public_flag, but was just concerned that if I set wrong values for this, I may later have problems again. Is this in anyway useful? Or is just a code that has some purpose but was abandoned and forgotten. If thats the case, then why not remove from the .php file. BTW, i set the values of the oublic_flag column to int default is 0. In the link you gave, it was set to default 1. Does this make a difference? Everything seems to work fine even if the default value is set to 0. I still see different prices for differnt groups.

 

And one more thing, what version of Quantity Price Breaks Per Product works with SPPC 4.2.1A? I also want to include that mod.

 

 

Thanks once again, best regards...

Share this post


Link to post
Share on other sites
Tnx, yeah I did add a new column public_flag, but was just concerned that if I set wrong values for this, I may later have problems again. Is this in anyway useful? Or is just a code that has some purpose but was abandoned and forgotten. If thats the case, then why not remove from the .php file. BTW, i set the values of the oublic_flag column to int default is 0. In the link you gave, it was set to default 1. Does this make a difference? Everything seems to work fine even if the default value is set to 0. I still see different prices for differnt groups.

It has something to do with payment modules (like PayPal). Better leave it in and 1 as default (this is how it comes in RC2).

 

And one more thing, what version of Quantity Price Breaks Per Product works with SPPC 4.2.1A? I also want to include that mod.

For SPPC there is a special version (based on/compatible with 1.2.9 of the "retail" one) called Quantity Price Breaks for Separate Pricing Per Customer (#3039).

 

Version 1.3 of the original QPBPP has not been adapted yet to SPPC.

Share this post


Link to post
Share on other sites
It has something to do with payment modules (like PayPal). Better leave it in and 1 as default (this is how it comes in RC2).

For SPPC there is a special version (based on/compatible with 1.2.9 of the "retail" one) called Quantity Price Breaks for Separate Pricing Per Customer (#3039).

 

Version 1.3 of the original QPBPP has not been adapted yet to SPPC.

 

 

Great, Thanks!

Share this post


Link to post
Share on other sites

I installed SPPC V. 4.2.1a. Everything seems to be working ok, except I cannot get the individuals tax exempt status to work. I click on the "Exempt tax rates from the customer" button, then click on the checkbox of the tax rate, then update it. Then I return to check on the edits to make sure they are what I want for the customer and that is ok. However, when purchasing a product the tax rate still shows up on the confirmation page. Please help.


Production:
osCommerce V. 2.3.4BS
VPS Box

Share this post


Link to post
Share on other sites
I installed SPPC V. 4.2.1a. Everything seems to be working ok, except I cannot get the individuals tax exempt status to work. I click on the "Exempt tax rates from the customer" button, then click on the checkbox of the tax rate, then update it. Then I return to check on the edits to make sure they are what I want for the customer and that is ok. However, when purchasing a product the tax rate still shows up on the confirmation page.

Did you logoff and login again after the changes you made in the admin? These setting are not queried but taken from the session variables and those get only updated after logging-in again.

Share this post


Link to post
Share on other sites
Did you logoff and login again after the changes you made in the admin? These setting are not queried but taken from the session variables and those get only updated after logging-in again.

 

Yes. I logged out of Admin. I logged out of John Doe's site. After logging back in, it still shows the tax on the confirmation page even though the settings are set for the individual tax exempt feature.


Production:
osCommerce V. 2.3.4BS
VPS Box

Share this post


Link to post
Share on other sites
Yes. I logged out of Admin. I logged out of John Doe's site. After logging back in, it still shows the tax on the confirmation page even though the settings are set for the individual tax exempt feature.

Then start with checking if it is added to the SESSION variables when logging in.

E.g. add to the footer:

<!--
<?php print_r($_SESSION); ?>
-->

And then do a view source to see the values stored in the SESSION variables. The one to look for in this case is $_SESSION['sppc_customer_specific_taxes_exempt']

Share this post


Link to post
Share on other sites

Then start with checking if it is added to the SESSION variables when logging in.

E.g. add to the footer:

<!--
Array
(
   [cart] => shoppingCart Object
       (
           [contents] => Array
               (
                   [22{5}10] => Array
                       (
                           [qty] => 1
                           [attributes] => Array
                               (
                                   [5] => 10
                               )

                       )

               )

           [total] => 22
           [weight] => 7
           [cartID] => 
           [content_type] => 
           [cg_id] => 1
       )

   [language] => english
   [languages_id] => 1
   [currency] => USD
   [navigation] => navigationHistory Object
       (
           [path] => Array
               (
                   [0] => Array
                       (
                           

 

Just for your information, I don't have SSL installed yet and don't know if that matters. I think I was looking in the right place to view source. I don't see here what you said I should try and find. Thanks for your help Jan in what ever you can do to help.


 => index.php
                           [mode] => NONSSL
                           [get] => Array
                               (
                               )

                           [post] => Array
                               (
                               )

                       )

               )

           [snapshot] => Array
               (
               )

       )

   [sendto] => 1
   [shipping] => Array
       (
           [id] => flat_flat
           [title] => Flat Rate (Best Way)
           [cost] => 5.00
       )

   [billto] => 1
   [payment] => cod
   [customer_id] => 1
   [customer_default_address_id] => 1
   [customer_first_name] => John
   [sppc_customer_group_id] => 1
   [sppc_customer_group_show_tax] => 0
   [sppc_customer_group_tax_exempt] => 0
   [customer_country_id] => 223
   [customer_zone_id] => 12
)
-->

Production:
osCommerce V. 2.3.4BS
VPS Box

Share this post


Link to post
Share on other sites
Just for your information, I don't have SSL installed yet and don't know if that matters.

No, doesn't matter.

I think I was looking in the right place to view source. I don't see here what you said I should try and find.

In the ones on the bottom starting with sppc the sppc_customer_specific_taxes_exempt is missing.

 

Either something is wrong in your login.php (next the code that deals with that):

	$group_specific_taxes_exempt = $customer_group_tax['group_specific_taxes_exempt'];
if (tep_not_null($customers_specific_taxes_exempt)) {
	$sppc_customer_specific_taxes_exempt = $customers_specific_taxes_exempt;
} elseif (tep_not_null($group_specific_taxes_exempt)) {
	$sppc_customer_specific_taxes_exempt = $group_specific_taxes_exempt;
} else {
	$sppc_customer_specific_taxes_exempt = '';
}
// EOF Separate Pricing Per Customer
	$customer_country_id = $check_country['entry_country_id'];
	$customer_zone_id = $check_country['entry_zone_id'];
	tep_session_register('customer_id');
	tep_session_register('customer_default_address_id');
	tep_session_register('customer_first_name');
// BOF Separate Pricing per Customer
tep_session_register('sppc_customer_group_id');
tep_session_register('sppc_customer_group_show_tax');
tep_session_register('sppc_customer_group_tax_exempt');
if (tep_not_null($sppc_customer_specific_taxes_exempt)) {
	tep_session_register('sppc_customer_specific_taxes_exempt');
}
// EOF Separate Pricing per Customer

Or the values for the specific taxes exempt do not get saved to the database.

 

From going over the code in login.php I however get the nasty feeling something is missing in the very first query:

// Check if email exists
// BOF Separate Pricing per Customer
$check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_group_id, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
// EOF Separate Pricing Per Customer

What happens if you change it to:

// Check if email exists
// BOF Separate Pricing per Customer
$check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_group_id, customers_password, customers_email_address, customers_default_address_id, customers_specific_taxes_exempt  from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
// EOF Separate Pricing Per Customer

Share this post


Link to post
Share on other sites
From going over the code in login.php I however get the nasty feeling something is missing in the very first query:

// Check if email exists
// BOF Separate Pricing per Customer
$check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_group_id, customers_password, customers_email_address, customers_default_address_id from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
// EOF Separate Pricing Per Customer

What happens if you change it to:

// Check if email exists
// BOF Separate Pricing per Customer
$check_customer_query = tep_db_query("select customers_id, customers_firstname, customers_group_id, customers_password, customers_email_address, customers_default_address_id, customers_specific_taxes_exempt from " . TABLE_CUSTOMERS . " where customers_email_address = '" . tep_db_input($email_address) . "'");
// EOF Separate Pricing Per Customer

 

BINGO!

Adding the above change worked for me, that is, adding ", customers_specific_taxes_exempt" to the query.

I tested the site with and without taxes and it works in both ways.

 

I am actually changing hosts and moving my store to this new site. I have been using SPPC for a couple years now. On my existing site there are 3 groups but two groups have the same prices, one of the two of those groups is for tax exempt customers. Now, this new addition will help greatly because it will eliminate one price group. EXCELLENT!

 

Jan, many thanks again,

Alan


Production:
osCommerce V. 2.3.4BS
VPS Box

Share this post


Link to post
Share on other sites

Hi,

 

Have you guys use any "show sold out" contribution with sppc??

 

I used this ---> http://addons.oscommerce.com/info/4884 before I use SPPC 4.21a,

and its too difficult for me to use them together......so I removed this and installed SPPC.

 

now the SPPC is successfully installed, but I think I still need to show show out products in my site,

so I found this: http://addons.oscommerce.com/info/3076

 

This one seems more simple to use, but I don`t know how to mix SPPC and this sold out contribution together.......

 

the last file to be modified is catalog/includes/modules/product_listing.php ,

 

The instruction says:

 

Go to catalog/includes/modules/product_listing.php

 

Find: (about line 144)

 

$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';

 

Replace with:

<!-- sold out -->
$quantity = tep_db_fetch_array(tep_db_query("select products_quantity from products where products_id like '".$listing["products_id"]."'"));
$lc_align = 'right';
if (intval($quantity['products_quantity'])<1) {
 $lc_text = tep_image_button('button_sold_out.gif', IMAGE_BUTTON_SOLD_OUT) . '  ';
} else {
$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';
}
<!-- sold out -->

 

But the same code is modified for SPPC......Like this

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

 

I tried to keep the changes that SPPC needed, and add the others codes the sold out conb needed, Like this:

 //sold out start
$quantity = tep_db_fetch_array(tep_db_query("select products_quantity from products where products_id like '".$listing["products_id"]."'"));
$lc_align = 'right';
$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> '; 
if (intval($quantity['products_quantity'])<1) {
 $lc_text = tep_image_button('button_sold_out.gif', IMAGE_BUTTON_SOLD_OUT) . '  ';
} else {
//sold out end
}
// EOF Separate Pricing per Customer

and now ALL products shown sold out in my site!!! :'(

 

and anyone tell me what I did wrong???

 

Thanks a million!!

 

Fung

Edited by drummercat

Share this post


Link to post
Share on other sites

I have installed this nice contrib and have everthing working.. On page 37 sv1eez posted a quick and clean way to show random products in new_products.php

 

He's code looks like this

 

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

 

that code was for a older SPPC version..

 

todays code for SPPC 4.21a without rand look like this

 

$new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, p.products_price, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and pd.language_id = '" . (int)$languages_id . "' and p.products_id = pd.products_id order by p.products_date_added desc 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, pd.products_name from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) left join " . TABLE_CATEGORIES . " c using(categories_id) where c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' and pd.language_id = '" . (int)$languages_id . "' and p.products_id = pd.products_id order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);

 

I dont realy want to break any code and get some other problems somewhere else ;) Anyone who can help?

 

Thanks in advance, and a high five to the SPPC contrib maker :)

 

--

D-BlooD

Share this post


Link to post
Share on other sites
I dont realy want to break any code and get some other problems somewhere else

I haven't tried this but I would be surprised if in the new code you also couldn't replace

order by p.products_date_added desc

by

and p.products_image != '' order by rand()

Share this post


Link to post
Share on other sites

Hi all,

 

at first I'd like to thank you the wonderful work you are doing here.

 

I've just registered because I'm running MS2 on a professional server and now, I want to set some contributions under RC2 (local). I decided to start with SPPC to add later QPBPP but I don't know how to do it. I can find SPPC for RC2, QPBPP for RC2, but the contribution called "Quantity Price Breaks for Separate Pricing Per Customer" doesn't work properly with RC2 versions because of its date.

 

I'd like to find the way to set both contributions for RC2. I've to tell that I've been trying to "mix" both but it's for me impossible. Of course I don't want you to work now in this contribution, I just want to know a trick to start developing other contributions to my "template".

 

Sorry for my bad English.

 

Thanks

Share this post


Link to post
Share on other sites

Hi,

 

I was wondering whether anybody can help me out,

 

I have installed this contribution and it seems to be working fine on the backend, i can add groups, add specific prices on the item screen.

 

However when i log in as a user i have placed in the wholesale pricing group, all i receive is retail pricing, i dont get any errors what so ever, just retail prices.

 

Where is the problem likely to be? in the calculation of the display price somewhere?

 

Any help would be greatly appreciated,

 

cheers

 

dlyxzen

Share this post


Link to post
Share on other sites
I haven't tried this but I would be surprised if in the new code you also couldn't replace

order by p.products_date_added desc

by

and p.products_image != '' order by rand()

 

Thanks, it works like a charm :) Maybe it could be something to add to the documentation for others, this litle change saved me from having to add an extra contrib.

 

--

D-BlooD

Share this post


Link to post
Share on other sites
In my opinion the top version is the cleanest but nobody ever mentioned a problem with the old one so I don't think you should have an issue with it.

 

Regarding the advanced search result. I don't remember what triggered the error. Perhaps it will happen if you choose a manufacturer (if you have those) or a price range (the more "advanced" stuff) in advanced_search_result.php.

 

Regarding 4.1.6 versus 4.2.1a. Version 4.2.1a has a few more features but a two out of three of these options can be added separately (the mail and the individual tax exempt features). Code wise not so much is different between those versions.

 

Hello Jan,

 

Thanks your reply and thanks for helping.

 

Cheers!

 

JBS7

Share this post


Link to post
Share on other sites

Greetings all -

 

I have added this contribution onto an existing, working oscommerce website.

 

I've been working through the various problems bit by bit.

 

A few questions:

 

1) I've got this message: "Warning: Missing argument 1 for order() in E:\inetpub\vhosts\3guyscoffee.com\httpdocs\includes\classes\order.php on line 17"

 

I've searched and searched and so far have come up with nothing.

 

2) Payment and shipping modules are now broken:

 

" United Parcel Service United Parcel Service

An error occured with the UPS shipping calculations.

Missing ConsigneeCountry

If you prefer to use UPS as your shipping method, please contact the store owner.

 

 

United States Postal Service United States Postal Service

-2147219080 - Missing value for Country."

 

I believe this is because the distribution overwrites some of the existing

shipping module php files. The USPS missing value is odd, as there is no

setting that I can find for that...

 

Under Shipping/Packaging, the appropriate information has been set (just double-checked).

 

3) Under Customers, I have BOX_CUSTOMERS_GROUPS, and under that category I have

TEXT_DISPLAY_NUMBER_OF_CUSTOMERS_GROUPS. This is confusing and perhaps

I haven't dug into the instructions enough (there's a lot to digest), but I think something's

wrong here.

 

Thanks for any help you can give. I do have backups of both the html and database, but

since I'm working with Plesk, this is ugly. I'm a command-line guy and hate guis, so

restoring the database, well, it would take me a sec on the command-line...

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×