Jump to content
scendent

Seperate Pricing Per Customer v3.5

Recommended Posts

Jeep,

I have a question, if i want to make a catalog PDF price download catalog , Can I do a download version for my three price version ?
After having changed the code in that contribution to be aware of the customer group and the prices in products_groups, yes.

 

But it definitely needs changes.....

 

Good to hear you found the source of the JavaScript problem.

Share this post


Link to post
Share on other sites

After installation of this beautifull looking script: my admin (insert products) look like this:

 

1054 - Unknown column 'products_price1' in 'field list'

 

select customers_group_id, customers_group_price, products_price1, products_price2, products_price3, products_price4, products_price5, products_price6, products_price7, products_price8, products_price1_qty, products_price2_qty, products_price3_qty, products_price4_qty, products_price5_qty, products_price6_qty, products_price7_qty, products_price8_qty, products_qty_blocks from products_groups where products_id = '' and customers_group_id = '1' order by customers_group_id

 

and I only see the several prices and quantities for the default customer group..

 

Anyone a solution??

Share this post


Link to post
Share on other sites

Jeroen,

 

It sounds like you either didn't run the price_break-113_sppc.sql or it wasn't succesful...

Share this post


Link to post
Share on other sites

Jan,

When I run it again PHPmyadmin says that there is duplicate fields name, when I look in the tables I see all fields..

 

SQL-query:

 

ALTER TABLE products ADD COLUMN products_price1 decimal( 15, 4 ) NOT NULL default 0.0,

ADD COLUMN products_price2 decimal( 15, 4 ) NOT NULL default 0.0,

ADD COLUMN products_price3 decimal( 15, 4 ) NOT NULL default 0.0,

ADD COLUMN products_price4 decimal( 15, 4 ) NOT NULL default 0.0,

ADD COLUMN products_price5 decimal( 15, 4 ) NOT NULL default 0.0,

ADD COLUMN products_price6 decimal( 15, 4 ) NOT NULL default 0.0,

ADD COLUMN products_price7 decimal( 15, 4 ) NOT NULL default 0.0,

ADD COLUMN products_price8 decimal( 15, 4 ) NOT NULL default 0.0,

ADD COLUMN products_price1_qty int NOT NULL default 0,

ADD COLUMN products_price2_qty int NOT NULL default 0,

ADD COLUMN products_price3_qty int NOT NULL default 0,

ADD COLUMN products_price4_qty int NOT NULL default 0,

ADD COLUMN products_price5_qty int NOT NULL default 0,

ADD COLUMN products_price6_qty int NOT NULL default 0,

ADD COLUMN products_price7_qty int NOT NULL default 0,

ADD COLUMN products_price8_qty int NOT NULL default 0,

ADD COLUMN products_qty_blocks int NOT NULL default 1

 

 

Any other suggestions??

Share this post


Link to post
Share on other sites

Jeroen,

 

Do you see the columns also in products_groups? Perhaps only the first part (adding the columns to the table products) ran and you need to run the second part separately?

 

alter table products_groups
add column products_price1 decimal(15,4) not null default 0.0,
add column products_price2 decimal(15,4) not null default 0.0,
etcetera, etcetera
add column products_price8_qty int not null default 0,
add column products_qty_blocks int not null default 1;

Share this post


Link to post
Share on other sites

I have looked all over for the zip download for this contribution. Even on http://www.askmarvin.ca/temp/ and can not find the download. Am I blind? Can someone point me in the direction for Version 4.1 or newer.


Laser labels, barcode labels, custom labels

Share this post


Link to post
Share on other sites
Am I blind? Can someone point me in the direction for Version 4.1 or newer.

 

Here you go my friend, it's here. Thanks to Marvin. He's the host. :thumbsup:

 

 

Jeep


John

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

osCommerce 2.3.4 Bootstrap Edge

Share this post


Link to post
Share on other sites

Thanks... that would probably be a good idea to buy some books. :) If only I had time.. <G>

 

What file name would that code go into?

 

Also, on another note.... :-).......

 

I have monthly specials and it works great with the different price groups on special for individual prices, but what happens when I have a special like this: 3 burgers for $15.00 ? How exactly do I have that go one special for the month for dealers? The specials moudle doesn't allow for anything like that. Does something exist?

 

Thanks a bunch!

 

 

Howard, I don't want to patronize, but I you should do yourself a favor and get a good book on PHP. This kind of thing is dealt with in the first few chapters. Since the variable customer_group_id is available (after the obligatory if(!tep_session_is_registered('sppc_customer_group_id')) { etc. on the page ) you can do all kind of things with it. Like:

<?php
if ($customer_group_id == '1' ) { // 1 is dealer
echo 'Heh dude, you got dealer prices';
} elseif ($customer_group_id == '2') { // 2 is dealers with better prices
echo 'You got the best prices';
} else {
echo 'You are wasting my server\'s bandwidth, go away';
}
?>

Share this post


Link to post
Share on other sites

Good news! 2 hours later and I finally got it working! <G>

 

Thanks!

 

One problem I've discovered... from some reason my prices don't always display in the product_info.php display. Some products do and some don't. I can't figure it out. Any suggestions?

 

 

Thanks... that would probably be a good idea to buy some books. :) If only I had time.. <G>

 

What file name would that code go into?

 

Also, on another note.... :-).......

 

I have monthly specials and it works great with the different price groups on special for individual prices, but what happens when I have a special like this: 3 burgers for $15.00 ? How exactly do I have that go one special for the month for dealers? The specials moudle doesn't allow for anything like that. Does something exist?

 

Thanks a bunch!

Share this post


Link to post
Share on other sites

Jeroen,

 

Do you see the columns also in products_groups? Perhaps only the first part (adding the columns to the table products) ran and you need to run the second part separately?

 

CODEalter table products_groups

add column products_price1 decimal(15,4) not null default 0.0,

add column products_price2 decimal(15,4) not null default 0.0,

etcetera, etcetera

add column products_price8_qty int not null default 0,

add column products_qty_blocks int not null default 1;

 

 

 

Jan; I added it in a completely new installation and now it works!

Thanks anyway!

Share this post


Link to post
Share on other sites

has anyone already discovered how to upload files with Easypopulate when using quantity price breaks per customer?

 

and when I upload manually; the prises and quantities for mu 'extra' groeps are not saved.. anyone an idea??

Edited by jeroen123

Share this post


Link to post
Share on other sites

Hi,

 

I have installed the script and having 1 annoying problem.

 

In the admin area while editing customers (customers.php) when ever I try to update the customer I get "Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in C:\Web Server\CurrentShop\admin1979\includes\functions\database.php on line 99" just above the customer group section.

 

My guess this is the section of the code that gives the error:

<!--  BOF Separate Pricing per Customer -->
<tr>
 <td class="main"><?php echo ENTRY_CUSTOMERS_GROUP_NAME; ?></td>
 <?php
 if ($processed == true) { echo "TRUE"; } else { echo "FALSE"; }
 if ($processed != true) {
   $index = 0;
   while ($existing_customers =  tep_db_fetch_array($existing_customers_query)) {
     $existing_customers_array[] = array("id" => $existing_customers['customers_group_id'], "text" => " ".$existing_customers['customers_group_name']." ");
     ++$index;
   }
 } // end if ($processed != true )
?>
 <td class="main"><?php if ($processed == true) {
   echo $cInfo->customers_group_id . tep_draw_hidden_field('customers_group_id');
 } else {	
 echo tep_draw_pull_down_menu('customers_group_id', $existing_customers_array, $cInfo->customers_group_id);
 } ?></td>
</tr>
<!-- EOF Separate Pricing per Customer -->

 

I am using the files supplied in v4.11 ... breaking my head on the problem.

 

Hope you can help ...

 

Thanks.

Share this post


Link to post
Share on other sites

Does the error go away if you add line 314 of admin/customers.php to that section?

 

<!-- ?BOF Separate Pricing per Customer -->
<tr>
?<td class="main"><?php echo ENTRY_CUSTOMERS_GROUP_NAME; ?></td>
?<?php
?if ($processed == true) { echo "TRUE"; } else { echo "FALSE"; }
?if ($processed != true) {
? ?$index = 0;
// BOF does error go away after adding this?
$existing_customers_query = tep_db_query("select customers_group_id, customers_group_name from " . TABLE_CUSTOMERS_GROUPS . " order by customers_group_id ");
// EOF does error go away after adding this?
? ?while ($existing_customers = ?tep_db_fetch_array($existing_customers_query)) {
? ? ?$existing_customers_array[] = array("id" => $existing_customers['customers_group_id'], "text" => "?".$existing_customers['customers_group_name']."?");
? ? ?++$index;
? ?}
?} // end if ($processed != true )
?>
?<td class="main"><?php if ($processed == true) {
? ?echo $cInfo->customers_group_id . tep_draw_hidden_field('customers_group_id');
?} else { 
?echo tep_draw_pull_down_menu('customers_group_id', $existing_customers_array, $cInfo->customers_group_id);
?} ?></td>
</tr>
<!-- EOF Separate Pricing per Customer -->

Share this post


Link to post
Share on other sites

Hi Everyone,

Thanks for a great contrib!

I have it installed and working fine but I need to also have Add Multi-Products installed as well, the site is for a wholesaler.

At the moment I have multi-prods installed but while it shows the fields for adding multiples of any product it is not submitting the form.

Does anyone have it working or could maybe point me in the direction of getting it working?

 

Thanks,

Bob

Share this post


Link to post
Share on other sites
point me in the direction of getting it working
I understand this is a replacement for the product_listing module. What probably happens is that the form is missing the product_id. The thing is that to cut down on queries the array that is fetched from mysql is traversed first in SPPC to pick-up all the product_id's and then two more queries are done to collect the customer group prices and correct special prices.

 

Now the original product listing uses a while loop to traverse the array from mysql, but that has already happened. So instead of $listing['products_id'] you should use $listing[$x]['products_id'] (and similar changes for special prices etc.) because now a for loop is used (for $x = 0; etc).

 

I think that is the problem.

Share this post


Link to post
Share on other sites

First of all, congrats on the new release of SPPC. I have read a little about it and it seems very nice!

 

I am not sure if I need B2BSuite or SPPC, need some input please.

 

I need a contribution which will allow me to input individual prices per group (or customer). Will SPPC allow for individual product pricing for groups? Or does it just allow for a % discount all the way across the board? I would like a contribution that would allow for either % or specific pricing.

 

I would like to be able to use Easy Populate as well to be able to easily change pricing, does B2BSuite or SPPC integrate with Easy Populate?

 

Also, I read that B2BSuite has alot of VAT (tax i.d.) numbers on forms that maybe difficult to get rid of, has that been fixed?

 

I appreciate all input on this, as I am not sure which one I need to install to fit my needs.

 

Thanks in advance,

Shawn

Share this post


Link to post
Share on other sites
Does the error go away if you add line 314 of admin/customers.php to that section?

 

<!-- ?BOF Separate Pricing per Customer -->
<tr>
?<td class="main"><?php echo ENTRY_CUSTOMERS_GROUP_NAME; ?></td>
?<?php
?if ($processed == true) { echo "TRUE"; } else { echo "FALSE"; }
?if ($processed != true) {
? ?$index = 0;
// BOF does error go away after adding this?
$existing_customers_query = tep_db_query("select customers_group_id, customers_group_name from " . TABLE_CUSTOMERS_GROUPS . " order by customers_group_id ");
// EOF does error go away after adding this?
? ?while ($existing_customers = ?tep_db_fetch_array($existing_customers_query)) {
? ? ?$existing_customers_array[] = array("id" => $existing_customers['customers_group_id'], "text" => "?".$existing_customers['customers_group_name']."?");
? ? ?++$index;
? ?}
?} // end if ($processed != true )
?>
?<td class="main"><?php if ($processed == true) {
? ?echo $cInfo->customers_group_id . tep_draw_hidden_field('customers_group_id');
?} else { 
?echo tep_draw_pull_down_menu('customers_group_id', $existing_customers_array, $cInfo->customers_group_id);
?} ?></td>
</tr>
<!-- EOF Separate Pricing per Customer -->

 

Yes this corrects the error.

 

Thanks!

 

Simon

Share this post


Link to post
Share on other sites

Searching for customer in admin...

 

Hi all seams to work brilliantly with this great contrib, but I'm having trouble with customer searching through the admin... I have found people talking about this error with sppc on oscommerce forums but in German, and I don't understand a word of german... Here is the error message, I get, maybe you can point me in the correct direction:

 

1064 - You have an error in your SQL syntax near 'where c.customers_lastname like '%cirque%' or c.customers_firstname like '%cirqu' at line 1

 

select count(*) as total from customers c left join address_book a on c.customers_id = a.customers_id and c.customers_default_address_id = a.address_book_id, customers_groups cg where c.customers_group_id = cg.customers_group_id where c.customers_lastname like '%cirque%' or c.customers_firstname like '%cirque%' or c.customers_email_address like '%cirque%'

 

Where "cirqu" corresponds to the part of the customers name that I'm searching for...

 

Any help of any kind would be greatly appreciated.

Share this post


Link to post
Share on other sites

I am running into some problems and need some help please. I have installed Seperate Pricing Per Customer and I already had MAP (Minimum Advertised Pricing) installed. This is the error I am getting on product_info.php:

 

Parse error: parse error, unexpected T_ELSE in /homepages/25/d103504835/htdocs/catalog/product_info.php on line 102

 

Here was my working code (starting on line 79) for product_info.php before installed SPPC:

 

} else {

$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_retail_price, p.products_price, p.products_map, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

$product_info = tep_db_fetch_array($product_info_query);

 

tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");

 

if ($product_info['products_price']<$product_info['products_map']){

$products_price = '<a href="' . tep_href_link(FILENAME_CALL_FOR_PRICE, 'products_id=' . $product_info['products_id']) . '">' . CLICK_FOR_PRICE . '</a>';

}else{

if ($new_price = tep_get_products_special_price($product_info['products_id'])) {

if ($new_price<$product_info['products_map']){

$products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <a href="' . tep_href_link(FILENAME_CALL_FOR_PRICE, 'products_id=' . $product_info['products_id']) . '">' . CLICK_FOR_PRICE . '</a>';

}else{

$products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';

}

} else {

$products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));

}

}

 

if (tep_not_null($product_info['products_model'])) {

$products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';

} else {

$products_name = $product_info['products_name'];

}

?>

 

 

Here is how I merged the two together and getting an error:

 

} else {

$product_info_query = tep_db_query("select p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_retail_price, p.products_price, p.products_map, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");

$product_info = tep_db_fetch_array($product_info_query);

 

tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");

 

if ($product_info['products_price']<$product_info['products_map']){

$products_price = '<a href="' . tep_href_link(FILENAME_CALL_FOR_PRICE, 'products_id=' . $product_info['products_id']) . '">' . CLICK_FOR_PRICE . '</a>';

}else{

if ($new_price = tep_get_products_special_price($product_info['products_id'])) {

if ($new_price<$product_info['products_map']){

$products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <a href="' . tep_href_link(FILENAME_CALL_FOR_PRICE, 'products_id=' . $product_info['products_id']) . '">' . CLICK_FOR_PRICE . '</a>';

}

else {

// BOF Separate Price per Customer

 

$scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id']. "' and customers_group_id = '" . $customer_group_id . "'");

if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) {

$product_info['products_price']= $scustomer_group_price['customers_group_price'];

}

// EOF Separate Price per Customer

 

$products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';

} else {

// BOF Separate Price per Customer

$scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id']. "' and customers_group_id = '" . $customer_group_id . "'");

if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) {

$product_info['products_price']= $scustomer_group_price['customers_group_price'];

}

// EOF Separate Price per Customer

}

 

$products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));

}

}

 

if (tep_not_null($product_info['products_model'])) {

$products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';

} else {

$products_name = $product_info['products_name'];

}

?>

 

I am an amatuer and doing the best I can to figure this out, but I have spent hours and hours on this and not getting anywhere. Anyone who can help me I would gladly appreciate it!

 

Thanks,

Shawn

Share this post


Link to post
Share on other sites

:angry: :angry: I just can't get my 'dynamic' welcome text to work. I'm going crazy and Jan allready helped me! Anyone... ?

 

Note: code starts with:

// START WELCOME TEXT BY NATHAN L AND JAN Z

 

and ends with...

 

// END WELCOME TEXT BY NATHAN L AND JAN Z

 

define('ICON_CART', 'In Cart');
define('ICON_ERROR', 'Error');
define('ICON_SUCCESS', 'Success');
define('ICON_WARNING', 'Warning');

// START WELCOME TEXT BY NATHAN L AND JAN Z

define('TEXT_GREETING_PERSONAL', '<small><td valign="top"><div align="center">
                  <table width="517" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td valign="top"><img src="http://blackwidowsecurity.com/images/titlebar.jpg" alt="Black Widow Security Systems" width="517" height="24"></td>
     </tr>
                    <tr>
                      <td valign="top" background="http://blackwidowsecurity.com/images/mainc_background.jpg"><table width="517" border="0" cellspacing="0" cellpadding="5">
                        <tr>
                          <td align="left">
Welcome back <span class="greetUser">%s</span> to the Black Widow Online Store! You are of a vauled member of our echo '$sppc_customer_group_id'; group.
}
<br><br>
if ($sppc_customer_group_id != '1')
{
echo 'Although on line sales of Black Widow systems are limited to authorized dealers only, the Black Widow on line Store does offer our complete line of accessories, including replacement transmitters, that are available to everyone.';
} else {
echo 'On line sales of Black Widow systems are available to you as an authorized dealer as well as our complete line of accessories priced lower than you can find them anywhere else!';
<br><br>
if ($sppc_customer_group_id != '1')
{
echo 'Black Widow\'s on line store excepts all major credit cards and Paypal for purchases. ';
} else {
echo 'Black Widow\'s on line store excepts all major credit cards and Paypal for purchases, but as an Authorized Black Widow dealer or distributor, you may choose from these payment options or opt to apply your pre-existing sales terms provided by Black Widow\'s credit department.';
}
<br><br>
Thank you for visiting our store, we hope it makes your life easier!  Of course if you prefer to place your orders with a live sales associate, please feel free to drop us a line during our normal business hours. <br><br>
     </tr>
                      </table></td>
                    </tr>
                    <tr>
                      <td valign="top"><img src="http://blackwidowsecurity.com/images/mainc_bottom.jpg" width="517" height="7"></td>
                    </tr>
                  </table>');
define('TEXT_GREETING_GUEST', '<small><td valign="top"><div align="center">
                  <table width="517" border="0" cellspacing="0" cellpadding="0">
                    <tr>
                      <td valign="top"><img src="http://blackwidowsecurity.com/images/titlebar.jpg" alt="Black Widow Security Systems" 

width="517" height="24"></td>
     </tr>
                    <tr>
                      <td valign="top" background="http://blackwidowsecurity.com/images/mainc_background.jpg"><table width="517" 

border="0" cellspacing="0" cellpadding="5">
                        <tr>
                          <td align="left">
Welcome to the Black Widow Online Store, your online home for vehicle security products!<br><br>

We understand that oftentimes there are just not enough hours in the day to get everything done.  That\'s why we\'ve created the Black Widow Online Store- a 24 hour a day, 7 day a week business resource that enables you to view products, download manuals, and place orders all at a time that is most convenient for you!<br><br>

Please take a moment and <a href="http://blackwidowsecurity.com/store/create_account.php"><u>register</u></a>
your email address to receive a personal login and password.  Once you have registered and <a href="http://blackwidowsecurity.com/store/login.php"><u>logged 
in</u></a>, you will be able to view exclusive pricing on all items within the Black Widow website.
                        </tr>
                      </table></td>
                    </tr>
                    <tr>
                      <td valign="top"><img src="http://blackwidowsecurity.com/images/mainc_bottom.jpg" width="517" height="7"></td>
                    </tr>
                  </table>');
// END WELCOME TEXT BY NATE LEVY

define('TEXT_SORT_PRODUCTS', 'Sort products ');
define('TEXT_DESCENDINGLY', 'descendingly');
define('TEXT_ASCENDINGLY', 'ascendingly');
define('TEXT_BY', ' by ');

Share this post


Link to post
Share on other sites

Hi Guys,

I'm having a problem with specials, in the admin all "old" prices are 0.00 no matter what group they are for, deafult retail or the one other I have set up, it just doesn't seem to be getting the data out of either products_price or customers_group_price.

Where should I start looking?

 

Thanks in advance,

Bob

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

×