Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

scendent any updates on the new release?

 

 

Eagerly awaiting  :D

Fiscus, and others, I appreciate your patience and understand your eagerness for the new version. I have been swamped with other tasks and have not been able to devote the time needed to get the new mod working. Please know that I have a paying customer waiting for some of these updates too! LOL that will help it move along. :D

Thanks for the update - really can't wait for this to be released so we can start testing it all!!!

Link to comment
Share on other sites

This is a slight adjustment I have made to this contribution on the Product Info page which serves the following purposes:

 

i) Displays both the "Standard" price, the Revised price and the associated saving according to the class of customer.

ii) If no Revision takes place displays a simple "Web Price"

 

Obviously, it only makes sense if the seperate pricing mod is used for discounting...

 

Apologies for the inelegance of the PHP / HTML programming, but I am a mere beginner.

 

Steps:

 

1) Back-up /catalog/product_info.php

 

2) Make the following change to query / variable part of the mod

 

replace:

global $customer_id;

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

$customer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $HTTP_GET_VARS['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)) {

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

  } else {

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

    }

} else {

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

  }

 

with:

  global $customer_id;

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

  $customer_group = tep_db_fetch_array($customer_group_query);

  $customer_group_name = $customer_group['customers_group_name'];

  $customer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $HTTP_GET_VARS['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)) {

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

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

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

    } else {

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

      }

  } else {

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

    }

 

 

3) Make the following change to the HTML output section:

 

replace:

 

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

          <tr>

            <td class="pageHeading" valign="top"><?php echo $products_name; ?></td>

            <td class="pageHeading" align="right" valign="top"><?php echo $products_price; ?></td>

          </tr>

        </table></td>

 

with

 

      <tr>

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

<?php

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

  if ($products_price_discount) {

?>   

          <tr>

            <td class="pageHeading" valign="top"><?php echo $products_name; ?></td>

            <td class="pageHeading" align="right" valign="top"><?php echo "Standard Web Price: $products_price_orig"; ?></td>

          </tr>

          <tr>

            <td class="pageHeading" valign="top"><?php echo " " ?></td>

            <td class="pageHeading" align="right" valign="top"><?php echo "Your $customer_group_name Price: $products_price_discount"; ?></td>

          </tr>

          <tr>

            <td class="pageHeading" valign="top"><?php echo " " ?></td>

            <td class="pageHeading" align="right" valign="top"><?php echo "Your $customer_group_name Saving: $products_price_saving"; ?></td>

          </tr>

<?php

  } else {

?>

          <tr>

            <td class="pageHeading" valign="top"><?php echo $products_name; ?></td>

            <td class="pageHeading" align="right" valign="top"><?php echo "Web Price: $products_price_orig"; ?></td>

          </tr>

<?php 

  }

} else {

?>

          <tr>

            <td class="pageHeading" valign="top"><?php echo $products_name; ?></td>

            <td class="pageHeading" align="right" valign="top"><?php echo "Web Price: $products_price_orig"; ?></td>

          </tr>

<?php

}

?>

  </table></td>

 

I hope this helps someone...

 

Keep Smiling,

Keith

Link to comment
Share on other sites

Hi all,

 

Is it possible to somehow change this contribution like this:

 

reseller: 10$

all others: 15$

 

TO:

 

reseller: 20%

all others: 15$

 

In this case resellers get 20% off the normal price for ordinary deadly peole. Could this be easily done?

 

Thanx in advance!

Edited by svepe
Link to comment
Share on other sites

Hello,

 

Ok I'm not sure what I've done so I hope some one can help. I had this mod working fine with no problems and then I installed another mod and now the wholesale price window is not comin up in the ad new product form in the admin....

 

Which file do I need to check to make sure its all working. I dont really want to redo the whole mod as it took me forever the first time.

 

Thank you for your help.

 

Angie

Link to comment
Share on other sites

Hi all,

 

Is it possible to somehow change this contribution like this:

 

reseller: 10$

all others: 15$

 

TO:

 

reseller: 20%

all others: 15$

 

In this case resellers get 20% off the normal price for ordinary deadly peole. Could this be easily done?

 

Thanx in advance!

Hello,

 

It is possible to change this contribution easily to accomplish what you are needing. You would have to go to each file that is displaying/checking the customer's group price, and if a new price is found, use it as a multiplyer on the original price, instead of just replacing the price.

 

Here is a quick example based on the snippet from catalog/product_info.php. I added some comments and changes in bold. (I didn't put this in CODE format because the BOLD won't show up that way)

 

global $customer_id;

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

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

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

//only change needs to go here, multiply the base price times the group price

if ($customer_group_price = tep_db_fetch_array($customer_group_price_query)) {

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

} else {

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

}

} else {

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

}

 

So, in this example, if the customer is logged into a group, and the group price is say .8, the effect would be 80% of the base price (or 20% off).

 

This change would have to go into all of the files that display or load up the price.

 

Hope that helps,

 

-Scott

Link to comment
Share on other sites

Hello,

 

Ok I'm not sure what I've done so I hope some one can help. I had this mod working fine with no problems and then I installed another mod and now the wholesale price window is not comin up in the ad new product form in the admin....

 

Which file do I need to check to make sure its all working. I dont really want to redo the whole mod as it took me forever the first time.

 

Thank you for your help.

 

Angie

Hi Angie,

 

I would double check the admin/categories.php file for this' mod's additions. This is the file that displays the product information/details form in the admin.

 

-Scott

Link to comment
Share on other sites

I have the following Problem:

 

I?m using b2b suite (where separate pricing is a part of it), and Attribute sorter copier v5 (Webmakers).

 

When i want to edit a product (categories.php) i have to check a box, if VIP-Customers should get a discount. looks like this:

 

Problem1.JPG

 

I can also add the different attributes on same screen, if i want.

Looks like this:

 

Problem2.JPG

 

 

Now my Problem:

 

In the code is the Function: each HTTP_POST_VARS.

When i put in a discount for a group, the first attribute is selected too. And the Price for the Attribute is the same like the discount for the usergroup VIP?s.

I think, the Problem is, that the script makes no difference between the checkboxes that belong to the Customer-Groups and the Checkboxes that belong to the Product attributes...

 

Does anybody know how to get it run ? I think, i must just set an option, that the first Checkboxes are not used for attributes. But i don?t know how...

 

PLEASE HELP ME !!!!

Link to comment
Share on other sites

I think, the Problem is this Part of the Code:

 

/////////////////////////////////////////////////////////////////////

// BOF: WebMakers.com Added: Modified to include Attributes Code

/* Re-Post all POST'ed variables */

reset($HTTP_POST_VARS);

while (list($key, $value) = each($HTTP_POST_VARS)) {

if (is_array($value)) {

while (list($k, $v) = each($value)) {

echo tep_draw_hidden_field($key . '[' . $k . ']', htmlspecialchars(stripslashes($v)));

}

} else {

echo tep_draw_hidden_field($key, htmlspecialchars(stripslashes($value)));

}

}

// EOF: WebMakers.com Added: Modified to include Attributes Code

/////////////////////////////////////////////////////////////////////

 

There all Attributes are included... maybe i?m wromg, but i think, i have to add that the discount fields should not be included...

 

Any Ideas ?

Link to comment
Share on other sites

Hi people

 

I have read through the thread and there appears to of been a few problems with some installations...

 

That said however the bugs have been removed and the contribution works great!

 

Thanks Scott for this fantastic contribution. I tried to install the BsB suite and ended up reinstalling my product_info.php (and make changes) and the whole of my admin...and reinstall the contributions there as well

 

I have installed this with no problem (Which is why i wanted the b2b suite) and Keith McMahon has made a change for the price display which I have also implemented and I now have a site for retail and wholesale customers

 

Thanks Guys and Girls for this project!

 

Best regards

 

Mark

Regards

 

Mark A Reynolds

Link to comment
Share on other sites

<-- There are updates that need to be made to the Easy Populate mod to get it to work with separate pricing. Look at the README file there. -->

 

Where is there? Phesis? They get touchy if you are not a "loaded" user. I can attest that the manual attached to the contribution is inaccurate in this regard. The Contrib. section also offered no assistance. And a search in the forums resulted in 1600 results, none of which were remotely related. Any direction toward reconfiguring Easy Populate would be greatly appreciated.

 

Spice

Link to comment
Share on other sites

<-- There are updates that need to be made to the Easy Populate mod to get it to work with separate pricing. Look at the README file there. -->

Spice,

 

The info you are looking for can be found in the EasyPopulate_Manual.txt file that comes with the mod. I have clipped the info for you below:

 

For use with the Separate Price per Customer contrib:
Edit easypopulate.php.  Find function ep_create_file_layout around line 655.  Uncomment all rows in that function that look like this:
	 #'v_customer_price_1'  => $iii++,
	 #'v_customer_group_id_1'  => $iii++,
Only uncomment the pairs of lines for as many prices as you are using.  I.E. If you are using Retail and Wholesale, then only umcomment the lines that end in _1 and _2.  If you have 3 levels of prices, uncomment the _1, _2, and _3 lines.

The comments in the code should help you locate these rows.

Link to comment
Share on other sites

Kai,

 

It sounds as if the two mods are using the same variable names. If you are still having this problem, send your categories.php file over to me and I will take a look when I have a moment. My personal email is 'scott AT everson DOT ws'

 

-Scott

Link to comment
Share on other sites

Hi,

 

I've just installed SPPC 3.5 on MS 2.2 (tried to) I'm getting the following error message:

 

Parse error: parse error in /var/www/html/shop/admin/customers.php on line 259

 

I've seen a couple of posts with this problem and I think I followed the install pretty well.

 

Any ideas?

 

Here's the code from line 250 to 265 in my admin/customers.php

 

  tep_db_query("delete from " . TABLE_ADDRESS_BOOK . " where customers_id = '" . (int)$customers_id . "'");
       tep_db_query("delete from " . TABLE_CUSTOMERS . " where customers_id = '" . (int)$customers_id . "'");
       tep_db_query("delete from " . TABLE_CUSTOMERS_INFO . " where customers_info_id = '" . (int)$customers_id . "'");
       tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customers_id . "'");
       tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customers_id . "'");
       tep_db_query("delete from " . TABLE_WHOS_ONLINE . " where customer_id = '" . (int)$customers_id . "'");

       tep_redirect(tep_href_link(FILENAME_CUSTOMERS, tep_get_all_get_params(array('cID', 'action'))));
       break;
     default:
       $customers_query = tep_db_query("select c.customers_id, 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 = '" . (int)$HTTP_GET_VARS['cID'] . "'");
       $customers = tep_db_fetch_array($customers_query);
       $cInfo = new objectInfo($customers);
   }
 }
?>

Link to comment
Share on other sites

Hi,

 

I've just installed SPPC 3.5 on MS 2.2 (tried to) I'm getting the following error message:

 

Parse error: parse error in /var/www/html/shop/admin/customers.php on line 259

 

I've seen a couple of posts with this problem and I think I followed the install pretty well.

 

Any ideas?

 

Here's the code from line 250 to 265 in my admin/customers.php

Justin,

 

I ran your snipped through the parser and there is no parse error there. I am thinking that the error is in the lines prior to what you posted, and the parser just prints the line numbers as you reported. It can't always be exact, by the nature of parsing...

 

Anyway,

 

Take a look at the instructions in the mod again, especially the following lines:

 

(in admin/customers.php...)
Around line 186

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 240

After:

} else {
         tep_db_query("update " . TABLE_REVIEWS . " set customers_id = null where customers_id = '" . (int)$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'] . "'");
 }
}

 

If you are unable to track this down, email me a copy of your admin/customers.php file to my personal address (scott AT everson DOT ws) and I will take a look for you.

 

-Scott

Link to comment
Share on other sites

I spoke to soon!!!

 

The customer admin now loads but I'm now getting this on the customer details listing.

 

Existing Groups:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/html/shop/admin/includes/functions/database.php on line 99

 

I guess the proble originates in customers.php

 

Obviously I can't even cut and paste!!! :unsure:

 

Any help would be very appreciated.

Link to comment
Share on other sites

  • 2 weeks later...

Can I ask a quick questions.

 

I have installed this mod and its working fine, or so I thought. I realised today that the prices are correct for the wholesaler when they view all the prices on the product_info.php, but if they click on the actual product for more details the price goes back to retail.

 

What have I missed? can anyone let me know so that I can fix it, please...

 

Angie :)

Link to comment
Share on other sites

Another little problem is that if you edit a "Special" not add, but edit, it doesn't allow you to choose a new group for that special.  This was relatively easy to fix, and if anyone wants the fix, I'll give it to them.

What was the fix for this one then?

 

-- Dave

Link to comment
Share on other sites

Hey, Scendent, any news on the next version of this?

Its been awhile since you last gave us an update.

Hows it coming along.?

 

Eagerly awaiting its release!

 

cheers

Link to comment
Share on other sites

Hello,

 

I hope some one can give me a hand. I'm running this contribution as well as Quick price update. I want to show both the retail price and the wholesale price.

 

Anyone done this and if so how do I go about it.

 

Thank you for any help.

 

Angie

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...