Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Separate Pricing Per Customer v3.3 fresh install


VyReN

Recommended Posts

I am having one problem... A customer_group will not appear on the catagories.php page until I go into the database and edit the customers table and change customers_group_id to the correct ID. It adds customer_group_name correctly, but not the ID. Other than this (Which may very well be another mistake on my part) everything is working perfectly...

 

Thanks for the contrib!

Link to comment
Share on other sites

Son of a ... Yes, again, my fault. I never could follow simple directions. I *SWEAR* no more working on the website after midnight.

 

I guess the one good thing was finding a very real possibility of contribs messing with each other using the POST vars. Everyone should avoid common words (Such as 'price')... AH WELL.

 

Thanks all!

Link to comment
Share on other sites

Everyone should avoid common words (Such as 'price')

 

I'll definitely do that in future mods. Thanks and sorry for the inconvenience.

If every member of this board donated $1 to the dev team, that would be over $11,000.00. Don't you think this cart is worth at least a $1????

Link to comment
Share on other sites

Hello to all!

 

I am writing a little modification to this mod to allow a per group percentage of discount when it will be finished i'll post it into contributions

 

It is very basic but it works for me....

 

just one thing....when i have a new client and i put him into a non existent group (so i create a new group) the field customers_group_id on table "customers" is always initialized as 1.

 

This prevents to create 'per groups discount' and to alter per groups price in categories.php

 

suggestions?

thanks

Link to comment
Share on other sites

Hello to all!

 

just one thing....when i have a new client and i put him into a non existent group (so i create a new group) the field customers_group_id on table "customers" is always initialized as 1.

 

This prevents to create 'per groups discount' and to alter per groups price in categories.php

 

suggestions?

thanks

 

Don't know if Iam wrong but:

$multiple_groups_query = tep_db_query("select distinct customers_group_id from " . TABLE_PRODUCTS_GROUPS . " ");



// select the single type of customer 



while ($group_ids = tep_db_fetch_array($multiple_groups_query)) {



// if it is more than one group (the retail) have a loop



$multiple_customers_query = tep_db_query("select distinct customers_group_id from " . TABLE_CUSTOMERS . " where customers_group_id = " . $group_ids['customers_group_id'] . " ");

 if (!($multiple_groups = tep_db_fetch_array($multiple_customers_query))) {

   tep_db_query("delete from " . TABLE_PRODUCTS_GROUPS . " where customers_group_id = '" . $group_ids['customers_group_id'] . "'");

 }

}



// just one customer?



$customers_group_name = tep_db_prepare_input($HTTP_POST_VARS['customers_group_name']);

$counter = 1;



// counter is initilized at 1 and it remains at one: if you change it manually

// to 1423 the new group has a customers_group_id of 1423

// even if $counter should increment to the bigger customers_group_id +1



any suggestion?

thanks

Link to comment
Share on other sites

mmmm... i never got that problem but all i know is mine isnt retaining more then one set of seperate prices.

Don't die with the music in you!!!

 

Failure is just another boundary to sucess!!! But that doesn't mean your getting somewhere...

Link to comment
Share on other sites

yeh i can try with more then one but when i put the second seperate price it changes into the first seperat price

Don't die with the music in you!!!

 

Failure is just another boundary to sucess!!! But that doesn't mean your getting somewhere...

Link to comment
Share on other sites

frog

 

Without having the code in front of me, I may be wrong, but somewhere in the code when a new group is created, there is a query to the database to see what group_ids there are so far. Then when the new group is made it is assigned a value equal to one plus that value. Make sense? If that's not in there, I screwed up somewhere. I haven't heard anything like this from anyone else that I can remember. Can you tell me what file and lines that code is from? I will compare it to mine and see what the difference is.

 

Kristofor

 

I still haven't been able to look into your problem and I apologize for that. I'm swamped with moving things on my end. I know I ran into your problem before but I thought I had it fixed. I hope it's not something to do with code changes in other files. What snapshot are you using?

If every member of this board donated $1 to the dev team, that would be over $11,000.00. Don't you think this cart is worth at least a $1????

Link to comment
Share on other sites

thats cool,

 

i know you fixed those file for me but i had the same result, its not really urgent at the moment caus ei can survive with only the one extra price.

i was just wonmdering thats all.

 

ok

thanks

Don't die with the music in you!!!

 

Failure is just another boundary to sucess!!! But that doesn't mean your getting somewhere...

Link to comment
Share on other sites

frog

 

Without having the code in front of me, I may be wrong, but somewhere in the code when a new group is created, there is a query to the database to see what group_ids there are so far.  Then when the new group is made it is assigned a value equal to one plus that value.  Make sense?  If that's not in there, I screwed up somewhere.  I haven't heard anything like this from anyone else that I can remember.  Can you tell me what file and lines that code is from?  I will compare it to mine and see what the difference is.

 

The file is admin/customers.php and in the query the value of customer table in customers_group_id is always = $counter (counter is =1 always)

 

I am using the alternativa attribute handling contribution and patched as seen on this thread

 

thanks

Link to comment
Share on other sites

CyberOto

 

http://www.oscommerce.com/community/contri...ions,716/page,8

 

 

Frog

 

I can't seem to find the code you mentioned unless you are doing an upgrade from a previous version or something. Here is the installation straight from the "Fresh Install" doc for admin/customers.php

 

admin/customers.php



Around line 25



After:



case 'update':

       $customers_id = tep_db_prepare_input($HTTP_GET_VARS['cID']);

       $customers_firstname = tep_db_prepare_input($HTTP_POST_VARS['customers_firstname']);

       $customers_lastname = tep_db_prepare_input($HTTP_POST_VARS['customers_lastname']);

       $customers_email_address = tep_db_prepare_input($HTTP_POST_VARS['customers_email_address']);

       $customers_telephone = tep_db_prepare_input($HTTP_POST_VARS['customers_telephone']);

       $customers_fax = tep_db_prepare_input($HTTP_POST_VARS['customers_fax']);

       $customers_newsletter = tep_db_prepare_input($HTTP_POST_VARS['customers_newsletter']);



Add:



$multiple_groups_query = tep_db_query("select distinct customers_group_id from " . TABLE_PRODUCTS_GROUPS . " ");

while ($group_ids = tep_db_fetch_array($multiple_groups_query)) {

 $multiple_customers_query = tep_db_query("select distinct customers_group_id from " . TABLE_CUSTOMERS . " where customers_group_id = " . $group_ids['customers_group_id'] . " ");

 if (!($multiple_groups = tep_db_fetch_array($multiple_customers_query))) {

   tep_db_query("delete from " . TABLE_PRODUCTS_GROUPS . " where customers_group_id = '" . $group_ids['customers_group_id'] . "'");

 }

}



$customers_group_name = tep_db_prepare_input($HTTP_POST_VARS['customers_group_name']);

$counter = 0;

$assigned = 0;

 

$customers_group_name_query = tep_db_query("select distinct customers_group_name, customers_group_id from " . TABLE_CUSTOMERS . " order by customers_group_id");



while ($group_name_check = tep_db_fetch_array($customers_group_name_query)) {

$counter = $group_name_check['customers_group_id'];

 

 if ($group_name_check['customers_group_name'] == $customers_group_name) {

   $customers_group_id = $group_name_check['customers_group_id'];

$assigned = 1;

   break;

 }

   

 ++$counter;

}



if ($assigned == 0) {

 $customers_group_id = $counter;

}



Around line 55



After:



$sql_data_array = array('customers_firstname' => $customers_firstname,

                               'customers_lastname' => $customers_lastname,

                               'customers_email_address' => $customers_email_address,

                               'customers_telephone' => $customers_telephone,

                               'customers_fax' => $customers_fax,

                               'customers_newsletter' => $customers_newsletter,



Add:



'customers_group_id' => $customers_group_id,

'customers_group_name' => $customers_group_name);



BE SURE TO MOVE THE SEMICOLON AND PARENTHESIS FROM AFTER $customers_newsletter AND REPLACE IT WITH A COMMA 

TO MAKE THE ASSIGNMENT CORRECT!!!!



Around line 120



After:



if ($HTTP_POST_VARS['delete_reviews'] == 'on') {

 $reviews_query = tep_db_query("select reviews_id from " . TABLE_REVIEWS . " where customers_id = '" . tep_db_input($customers_id) . "'");

 while ($reviews = tep_db_fetch_array($reviews_query)) {

   tep_db_query("delete from " . TABLE_REVIEWS_DESCRIPTION . " where reviews_id = '" . $reviews['reviews_id'] . "'");

 }

 tep_db_query("delete from " . TABLE_REVIEWS . " where customers_id = '" . tep_db_input($customers_id) . "'");

 } else {

 tep_db_query("update " . TABLE_REVIEWS . " set customers_id = null where customers_id = '" . tep_db_input($customers_id) . "'");

}



Add:



$multiple_groups_query = tep_db_query("select distinct customers_group_id from " . TABLE_PRODUCTS_GROUPS . " ");

while ($group_ids = tep_db_fetch_array($multiple_groups_query)) {

 $multiple_customers_query = tep_db_query("select distinct customers_group_id from " . TABLE_CUSTOMERS . " where customers_group_id = " . $group_ids['customers_group_id'] . " ");

 if (!($multiple_groups = tep_db_fetch_array($multiple_customers_query))) {

   tep_db_query("delete from " . TABLE_PRODUCTS_GROUPS . " where customers_group_id = '" . $group_ids['customers_group_id'] . "'");

 }

}



Around line 275



Find:



$customers_query = tep_db_query("select c.customers_gender, c.customers_firstname, c.customers_lastname, c.customers_dob, c.customers_email_address, a.entry_company, a.entry_street_address, a.entry_suburb, a.entry_postcode, a.entry_city, a.entry_state, a.entry_zone_id, a.entry_country_id, c.customers_telephone, c.customers_fax, c.customers_newsletter, c.customers_default_address_id from " . TABLE_CUSTOMERS . " c left join " . TABLE_ADDRESS_BOOK . " a on c.customers_default_address_id = a.address_book_id where a.customers_id = c.customers_id and c.customers_id = '" . $HTTP_GET_VARS['cID'] . "'");



Change to:



$customers_query = tep_db_query("select c.customers_gender, c.customers_firstname, c.customers_lastname, c.customers_dob, c.customers_email_address, a.entry_company, a.entry_street_address, a.entry_suburb, a.entry_postcode, a.entry_city, a.entry_state, a.entry_zone_id, a.entry_country_id, c.customers_telephone, c.customers_fax, c.customers_newsletter, c.customers_group_name, c.customers_default_address_id from " . TABLE_CUSTOMERS . " c left join " . TABLE_ADDRESS_BOOK . " a on c.customers_default_address_id = a.address_book_id where a.customers_id = c.customers_id and c.customers_id = '" . $HTTP_GET_VARS['cID'] . "'");



Right after the above line add:



$existing_customers_query = tep_db_query("select distinct customers_group_name from " . TABLE_CUSTOMERS . " order by customers_group_id ");



Around line 430



After:



<tr>

 <td class="main"><?php echo ENTRY_NEWSLETTER; ?></td>

 <td class="main"><?php echo tep_draw_pull_down_menu('customers_newsletter', $newsletter_array, $cInfo->customers_newsletter); ?></td>

</tr>



Add:



<tr>

 <td class="main"><?php echo ENTRY_CUSTOMERS_GROUP_NAME; ?></td>

 <td class="main"><?php echo tep_draw_input_field('customers_group_name', $cInfo->customers_group_name, 'maxlength="25"'); ?></td>

</tr>

<tr>

 <td class="main"><?php 

 $index = 0;

 echo ("Existing Groups: ");

 while ($existing_customers =  tep_db_fetch_array($existing_customers_query)) {

   echo ($existing_customers['customers_group_name']);

   echo (", ");

   ++$index;

   if ($index%10 == 0) {

   echo (" ");

   }

 }?>

 </td>

</tr>

 

I can't find the code you posted anywhere in the new docs. Is it from a past version? If so you should upgrade to the latest one as I've screwed up a few things.

If every member of this board donated $1 to the dev team, that would be over $11,000.00. Don't you think this cart is worth at least a $1????

Link to comment
Share on other sites

  • 6 months later...

Hi Thorsten,

 

I'm running MS2 and it almost works. Soooo close. I know that if I actually knew what I was doing with PHP that it'd be solved but I'm just not very bright.

 

Maybe someone else can help us out here?

Roadracing makes heroin addiction look like a vague wish for something salty.

Link to comment
Share on other sites

Well now I'm not so sure. At first I thought it wasn't reading the price for each group in. Now I look at the products_groups table and notice the customers_group_price field isn't getting updated.

 

That means all my theories have just gone out the window. I recall (maybe in this thread even) something about the admin side not working properly but I'll have to read more. Maybe someone else has the solution already.

 

If I edit the customers_group_price field by hand it works like a charm!

Roadracing makes heroin addiction look like a vague wish for something salty.

Link to comment
Share on other sites

Actually it seems to be working now. I did notice that the products_groups table was empty so I filled that in by hand via myPHPadmin. Now I can add groups through the admin panel. Works pretty well actually. Now, we don't use newsletter (yet) so I don't know if that's boogered or not.

 

Not much help, I know. Sorry. I'll keep experiementing.

Roadracing makes heroin addiction look like a vague wish for something salty.

Link to comment
Share on other sites

  • 2 weeks later...

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