Jump to content


Corporate Sponsors


Latest News: (loading..)

* * * * * 14 votes

Seperate Pricing Per Customer v3.5


5884 replies to this topic

#1 scendent

  • Community Member
  • 35 posts
  • Real Name:Scott Everson
  • Location:Denver, CO, USA

Posted 04 August 2003, 00:28

All, I uploaded a new version of Seperate Pricing Per Customer.
Some bug fixes I found when installing on my new copy of 2.2MS2 and a MAJOR OPTIONAL improvement -- I needed the functionality of having special prices for each group.

I think all the code is good -- I have spent the day testing. If you find something doesn't work on your install, or perhaps I missed something, let me know. (email: scott AT everson D0T ws)

Here are the notes:

Updated by Scott Everson (scott AT everson DOT ws), 08/02/2003

Bug fixes:

-Added in mod to products_new.php (so correct price displayed in new products list)
-Adjusted location of mod in modules/product_listing.php
-Changed $product_info_values[] to $product_info[] in product_info.php mod. My 2.2MS2 used the $product_info[] array.

Improvements:

-Added option mod to support special prices per group. This means that you can create a special price for your 'Retail' group and only customers in that group will see the special price. Create a special price for your 'Wholesale' group and only customers in that group will see the special price. Special prices will not default.. meaning if there is no special price for 'Wholesale' but there is one for 'Retail' your wholesale customer will NOT BE SHOWN the retail special price.

More info: When you add special prices, you will see the prices for each group next to the product title. It a price/group is missing, it is because a special price for that prodcut/group already exists. If the product is missing, it is because there is already a special price for all groups.

I am willing to offer support for this MOD and version 2.2MS2.

#2 loxly

  • Community Member
  • 1,802 posts
  • Real Name:Deborah Carney
  • Gender:Male
  • Location:New York State

Posted 04 August 2003, 00:53

EasyPopulate supported this in it's MS1 version, can you download ep and check that it still has the correct fields etc?

Email any changes that need to be made to dc@loxly.com or post them here, I'll keep an eye on this thread. Unless the miserable people jump over here too.

Debbie
*Positive energy works much better than negative*

#3 fiscus

  • Community Member
  • 153 posts
  • Real Name:fiscus
  • Location:Australia

Posted 05 August 2003, 03:57

This Mod looks like it is perfect for my need - I will install it tongiht and see how I go.

I was wondering if it were possible (either through further development or an additional addon) that the available products could change from customer to customer.

Say you have a specific customer (or no group of customers) that you have specific pricing for. The login with their details and then they see all their specific pricing is displayed. Would it be difficult to limit (or expand) a range depending on their login??

So not only do they get specific pricing they would get a specific (and tailored) product range? This (to me) seems like it could be a natural progression although I know it is probably complicated! Has anything looked into this? Do you think it would be hard to modify this Contrib. further for this to work?

Basically I don't want to offer my entire range to all customers. If i tailor the price as well as the offered range for each customer that would be ideal!!!

I hope this is possible :-)

Looking forward to getting this mod installed tonight.

Thanks

#4 scendent

  • Community Member
  • 35 posts
  • Real Name:Scott Everson
  • Location:Denver, CO, USA

Posted 05 August 2003, 04:17

Quote

Basically I don't want to offer my entire range to all customers. If i tailor the price as well as the offered range for each customer that would be ideal!!!

Fiscus, I think that is a great idea and I think this mod CAN do the trick. I will play with it later this week and let you know. Perhaps setting the price to be -1 or something would make it not available to the group. I will let you know what I come up with.

-Scott

#5 fiscus

  • Community Member
  • 153 posts
  • Real Name:fiscus
  • Location:Australia

Posted 05 August 2003, 04:22

Scott,

This would really be brilliant!!

I offer certain ranges to specifc customers at specifc prices (alternitevly the general publix just get the normal range and normal prices). To be able to offer people diff ranges and diff prices would be perfect.

While I am still working on my PHP and MySQL skills, I can imagine that this would be a perfect mod to try and intergrate it into.

While I haven't installed this current MOD atm - I imagine that there could simply be a matrix of check boxes where you can select the products that a spefic customer or group can purchase. The prices could also be intergrated this way.

I will install your mod to see how you currently have things setup...

I will be looking forward to seeing how you go!

Can't wait.

Keep up the good work!

#6 adamdemerlis

  • Community Member
  • 31 posts
  • Real Name:Adam de Merlis
  • Location:Toronto

Posted 05 August 2003, 16:39

I am not very good with the SQL codes, and I was wondering if you could please write out how to add -

Database Changes:



Add to the customers table:

customers_group_name (char 27) Default value: Retail

customers_group_id (int 11) Default value: 0



Create

products_groups table



Add to the products_groups table:

customers_group_id (int 11)

customers_group_price (decimal 15, 4)

products_id (int 11)

products_price (decimal 15,4)

Thank you very much, I'm excited to try this out on my version of MS2.

Thanks again,
Adam de Merlis

#7 TB

  • Community Member
  • 624 posts
  • Real Name:Tony Hodges
  • Location:Victoria, Australia

Posted 05 August 2003, 16:52

Adam,
Insert the following using phpMyAdmin and you should be right.
ALTER TABLE `customers` ADD `customers_group_name` CHAR( 27 ) DEFAULT 'Retail' NOT NULL ,

ADD `customers_group_id` INT( 11 ) DEFAULT '0' NOT NULL;



CREATE TABLE `products_groups` (

`customers_group_id` INT( 11 ) NOT NULL ,

`customers_group_price` DECIMAL( 15, 4 ) NOT NULL ,

`products_id` INT( 11 ) NOT NULL ,

`products_price` DECIMAL( 15, 4 ) NOT NULL 

);
HTH,
Tony
"The price of success is perseverance. The price of failure comes much cheaper."

#8 adamdemerlis

  • Community Member
  • 31 posts
  • Real Name:Adam de Merlis
  • Location:Toronto

Posted 05 August 2003, 19:22

Thanks, that is all I needed.

I have since installed the entire contribution without custom specials, and I am having trouble using it. I notice that at the bottom of each customer there is a group name and a list of groups (only retail) but it is not availiable inside the product it-self? Is there a box I need to check or what?

Thanks for your help.
Adam de Merlis

#9 adamdemerlis

  • Community Member
  • 31 posts
  • Real Name:Adam de Merlis
  • Location:Toronto

Posted 05 August 2003, 19:32

Don't worry I have it working!

I was wondering if there is way to drop the pricing by a certain percentage for a specific group? Or is there a contribution that does this and wont mess up this contribution I just added?

Thanks
Adam de Merlis

#10 Lighthouse

  • Community Member
  • 44 posts
  • Real Name:Ligthouse
  • Gender:Male
  • Location:Netherlands

Posted 05 August 2003, 20:57

hi,

if have a lite problem

Quote

select distinct customers_group_id from TABLE_PRODUCTS_GROUPS  

[TEP STOP]

whats wrong, ik cant see it.
i am yust starting with php

thx

Lighthouse
yes i know my english is bad, but you understand wath i mean;) if not ask

#11 mattice

  • Community Member
  • 2,637 posts
  • Real Name:Matthijs van der Vegte
  • Location:Belgium / Netherlands

Posted 05 August 2003, 22:03

Seems to be your TABLE_PRODUCTS_GROUPS is not defined in the database table defines... so mySQL can't find it.

Adding a
define('TABLE_PRODUCTS_GROUPS', 'whateverthenameis');
should fix it.

Mattice
"Politics is the art of preventing people from taking part in affairs which properly concern them"

#12 John Doswell

  • Team Member
  • 456 posts
  • Real Name:John Doswell
  • Gender:Male

Posted 07 August 2003, 10:02

does anyone know if it is possible to change the product page.
say we have 3 groups
retail
wholesale
supplyer

retail and guest get standard page
wholesale gets price for retail & wholesale
supplyer gets price for retail, wholesale & Supplyer

would i have to make 3 diferent produkt pages and display them based on the login???

Regards John

#13 Mr.Snowman

  • Community Member
  • 13 posts
  • Real Name:Darryl
  • Location:California

Posted 07 August 2003, 18:29

I am having the same error and have made sure that the table is being identified in the database_tables.php file.

1146 - Table 'mysqlname.TABLE_PRODUCTS_GROUPS' doesn't exist

select distinct customers_group_id from TABLE_PRODUCTS_GROUPS

[TEP STOP]

When I go to update the user to a new group such as "wholesale" it brings up the above error.

What am I doing wrong???
"Failure will never overtake me if my determination to succeed is strong enough" - Og Mandino

#14 PremierC

  • Community Member
  • 16 posts
  • Real Name:William

Posted 08 August 2003, 16:22

Quote

ALTER TABLE `customers` ADD `customers_group_name` CHAR( 27 ) DEFAULT 'Retail' NOT NULL ,

ADD `customers_group_id` INT( 11 ) DEFAULT '0' NOT NULL;



CREATE TABLE `products_groups` (

`customers_group_id` INT( 11 ) NOT NULL ,

`customers_group_price` DECIMAL( 15, 4 ) NOT NULL ,

`products_id` INT( 11 ) NOT NULL ,

`products_price` DECIMAL( 15, 4 ) NOT NULL 

);


Where do i insert this please. I am new to this and dont understand how to create a table. I have tried using phpmyadmin but could not figure it out. If anyone has any advice it would be greatly appreciated. Thanks, William Skaggs

#15 PremierC

  • Community Member
  • 16 posts
  • Real Name:William

Posted 08 August 2003, 16:38

Here is the part of the install instructions I dont understand..


Database Changes:

Add to the customers table:
customers_group_name (char 27) Default value: Retail
customers_group_id (int 11) Default value: 0

Create
products_groups table

Add to the products_groups table:
customers_group_id (int 11)
customers_group_price (decimal 15, 4)
products_id (int 11)
products_price (decimal 15,4)

Does anyone think they could explain this to me being I am completely stupid about this.

Thanks,
William Skaggs

#16 TB

  • Community Member
  • 624 posts
  • Real Name:Tony Hodges
  • Location:Victoria, Australia

Posted 09 August 2003, 00:15

Do you have access to phpMyAdmin? If yes... read on.

Select your database from the drop down box in the left of your screen.
Then, select 'SQL' from the top menu on the right of your screen.

Copy the following code and paste it to the text box on your phpMyAdmin screen.
ALTER TABLE `customers` ADD `customers_group_name` CHAR( 27 ) DEFAULT 'Retail' NOT NULL , 

ADD `customers_group_id` INT( 11 ) DEFAULT '0' NOT NULL; 



CREATE TABLE `products_groups` ( 

`customers_group_id` INT( 11 ) NOT NULL , 

`customers_group_price` DECIMAL( 15, 4 ) NOT NULL , 

`products_id` INT( 11 ) NOT NULL , 

`products_price` DECIMAL( 15, 4 ) NOT NULL 

);

Press 'Go'
Some should appear saying 'Successful', and vaugly resemble what you pasted previously.

That should be it...

Let me know if you have any more troubles,
Tony
"The price of success is perseverance. The price of failure comes much cheaper."

#17 Clement

  • Community Member
  • 88 posts
  • Real Name:Clement

Posted 09 August 2003, 02:11

Hello everybody,

Here are some problems that I found into 3.5 version for different specials for each new group:


A. In the install instructions
------------------------------------

1. At catalog/specials.php changes:

Around line 80



After



    $row = 0;

    $specials_query = tep_db_query($specials_split->sql_query);

    while ($specials = tep_db_fetch_array($specials_query)) {

      $row++;



Add 



          $customer_group_query = tep_db_query("select customers_group_id from " . TABLE_CUSTOMERS . "        where customers_id =  '" . $customer_id . "'");

          $customer_group = tep_db_fetch_array($customer_group_query);



    $row = 0;

    $specials_query = tep_db_query($specials_split->sql_query);

    while ($specials = tep_db_fetch_array($specials_query)) {

      $row++;



          $customer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $specials['products_id'] . "' and customers_group_id =  '" . $customer_group['customers_group_id'] . "'");

          if ( $customer_group['customers_group_id'] != 0)

            if ($customer_group_price = tep_db_fetch_array($customer_group_price_query))

                $specials['products_price']= $customer_group_price['customers_group_price'];


I think there must be "replace" and not "add" because if I just add the seccond part of code then I've got an arror into specials.php file.




2. For catalog/includes/functions/general.php changes the instructions say that :

Around 200



After



    $select_string .= '>';



Add .......


But "$select_string .= '>';" is only in admin/includes/functions/general.php , so I think at this point all changes must be swiched to the admin/functions/general.php



A. Runing the script
------------------------------------


3. The special prices for "Resellers" - not the default group - arn't displayed from the catalog/includes/modules/new_products.php


4. If I setup a special price for "Reseller" as percent, then the special price is calculated based on the default group price not as a percent from the "reseller" price.


Thank you very much for this contribution,

#18 Clement

  • Community Member
  • 88 posts
  • Real Name:Clement

Posted 09 August 2003, 02:26

Also,

If I have a special price for "Resseler" group, the modules/new_products.php show tho everyone this special price.

Have a great day,

#19 Clement

  • Community Member
  • 88 posts
  • Real Name:Clement

Posted 09 August 2003, 03:30

Ok. Here is how I fixed the problem of special groups prices in modules/new_products.php

>>>>>>>>>>>>

REPLACE

$new_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);

WITH

$new_products_query = tep_db_query("select products_id, products_image, products_tax_class_id,  products_price from " . TABLE_PRODUCTS . " where products_status = '1' order by products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);


>>>>>>>>>>>


REPLACE

$new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . 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' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);

WITH

$new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id,  p.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' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);


>>>>>>>>>>


BEFORE

    $info_box_contents[$row][$col] = array('align' => 'center',

                                           'params' => 'class="smallText" width="33%" valign="top"',

                                           'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br>' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])));

ADD

        $special_price_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . $new_products['products_id'] . "' and customers_group_id =  '" . $customer_group['customers_group_id'] . "' and status <> '0'");

  if ($special_price = tep_db_fetch_array($special_price_query)) {

   $new_products['products_price'] = $special_price['specials_new_products_price'];

        }



Good Luck!!

#20 TheFinnisher

  • Community Member
  • 149 posts
  • Real Name:Thomas

Posted 10 August 2003, 08:52

POSSIBLE BUG!

Does anyone else recognize this problem?

The shopping cart recognizes an individual price purchase right. BUT the calculation of the sub-total seems to be according to the "retail" or normal price...

The checkout proceeds as it is supposed to. but it would still be nice to get the item prices agree with the sub-total in the shopping_cart.php page.

Am I the only one who has this problem? If not, could someone have a look at it?

I think this is the area to change. but unfortunately my php is still on the learning stage...

    function show_total() {

      $this->calculate();