Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

Do you download the full release of the SPPC 4.1?

Yes, I did. I've already downloaded the full 4.11 from the contrib section. Thx anyway for the reply :)

 

Go to the advanced search page and look for a product using a from/to price. If you are not logged-in or logged-in as a retail customer the table will be created automagically. You shouldn't have a problem after that.

Well, funny thing is, no matter what I do, I can't reproduce the error I had before. It didn't work even after doing that search you suggested. I realized though, that I was logged in as someone. Someone, because it was a login from an old install, where I logged in and didn't close the browser window nor log out manually, and after doing a fresh install of MS2.2 and SPPC 4.11, I continued browsing with that browser window. So, in the end, I was logged in with an account that actually was no more ;)

 

Well, to put a long story short:

I messed it up, but now everything works like expected :)

Just to be sure, I repeated the installation of a fresh MS2.2-Shop, added SPPC 4.11 and everything worked like a charm.

 

I'm very happy with this contribution, as it's by far one of the most professional ones currently around. A big thank you, both, for the contrib and for the ultra-fast reply to my first post.

 

 

Greetz

 

Bran

Link to comment
Share on other sites

First off, thanks for this contribution. It looks incredible and I'm looking forward to using it!!

 

Quick question - I'm at the contribution page for this:

 

http://www.oscommerce.com/community/contributions,716/

 

I've downloaded and installed (without any issues) version 4.1.1, which was uploaded on 3/20/05. It refers to version 4.1, uploaded on 3/15/05, for HTML documentation, as that's not included in the 4.1.1 zip. Hope I'm not going blind but I don't see version 4.1 available for download. Any thoughts on how I can get the docs?

 

Thanks!

John

Link to comment
Share on other sites

Any thoughts on how I can get the docs?
A link to the temporary place where you can download those docs was given in post 877 on page 44. Version 4.1 with the docs was uploaded on March 15 (so almost 6 weeks ago) by Marvin Miller but since it was over 500 K it had to be manually approved.

 

Unfortunately, we are still waiting for the manual approval.

Link to comment
Share on other sites

Well, I was just about to add the docs only to the contrib page (zip created, upload form filled), as my mail notifier stopped me from hitting the "Submit"-Button.

 

But that "manual approval"-thing sounds like I better shouldn't do it, right?

Link to comment
Share on other sites

But that "manual approval"-thing sounds like I better shouldn't do it, right?
As long as it is under 500K there is no problem with the manual approval. I think you should be fine. Since the manual approval might never happen, perhaps this is the best way...
Link to comment
Share on other sites

I was JUST about to install this GREAT mod when I was told to include in customers site the Separate Price Per Customer dingy.

I saw somewhere that the co-ordination of these two mods is a challenge?

 

Anybody with experience? Which one to install first?

And where did my bookmark go, that showed a link to forum about this mod (Price Break) actually getting updated to support SPPC (or was it the other way around?)

I'm lost and tired of browsing the forums, hence this cry for assistance,

BEFORE I reinstall the whole lot!

 

Anybody out there? Please!

Link to comment
Share on other sites

I just installed SPPC and Quantity Price Breaks. They work great and no errors.

 

Is there a way to make the price breaks apply to products cumulatively instead of per Product, ie, 5 of product A plus 5 of product B would still trigger the 10 product discount level. I tried adding Quantity Discounts and that worked without conflicting with SPPC but then that applies the global discounts to ALL customers, not per Group.

 

My goal is to create a group that gets a base discount plus volume discounts, and another group with no discounts at all. Is this even possible with this contribution?

 

Thanks

Dave

Link to comment
Share on other sites

John,

See post 885 on this page by Jean Pierre/Jeep-Ice. I assume you know how a drop-down menu works?  ;)

 

thank you for your time, i did not know where to look for it as i used the german language, but now i have moved it to my store (db) so now it only needs to be defined once and it works with all languages.

 

greetz john

Link to comment
Share on other sites

Is there a way to make the price breaks apply to products cumulatively instead of per Product, ie, 5 of product A plus 5 of product B would still trigger the 10 product discount level.
I haven't tried this (yet) but if you mean you would like to have the number of items in the shopping cart to be used as the quantity level for the price break I think that be made to work.

 

My first try would be to change the function computePrice($qty) in the class priceFormatter.php to use the number of items in the shopping cart (using the function count_items in the class shopping cart). Something along these lines (around line 258 in priceFormatter.php):

  function computePrice($qty)
 {
$qty = $this->adjustQty($qty);
$number_of_items_in_cart = $cart->count_contents();
      if ($number_of_items_in_cart > $qty) {
        $qty = $number_of_items_in_cart;
     }

// Compute base price, taking into account the possibility of a special
$price = ($this->hasSpecialPrice === TRUE) ? $this->specialPrice : $this->thePrice;

for ($i=1; $i<=8; $i++)
 if (($this->quantity[$i] > 0) && ($qty >= $this->quantity[$i]))
	 $price = $this->price[$i];

return $price;
 }

This doesn't take into account the fact that with adjustQty the number of items in the shopping cart will change but it might be a start to what you would like.

Link to comment
Share on other sites

Dave,

 

The code as per my post above doesn't work. To take all the items in the shopping cart into account while looking up the price for the price break (so with 4 products A and 6 products B the price break for 10 products A and 10 products B is used to calculate the price of A and B ) the following changes seem to do that:

 

Change the function computePrice in includes/classes/priceFormatter.php (around line 28) to:

     function computePrice($qty, $number_of_other_items_in_cart = -1)
 {
$qty = $this->adjustQty($qty);
      $qty += $number_of_other_items_in_cart; 

// Compute base price, taking into account the possibility of a special
$price = ($this->hasSpecialPrice === TRUE) ? $this->specialPrice : $this->thePrice;

for ($i=1; $i<=8; $i++)
 if (($this->quantity[$i] > 0) && ($qty >= $this->quantity[$i]))
	 $price = $this->price[$i];

return $price;
 }

 

Then there are two changes in the class shopping_cart.php, one in the function calculate (around line 210-236) and one in get_products (around line 276-299).

 

    function calculate() {
     $this->total = 0;
     $this->weight = 0;
     // BOF Separate Pricing Per Customer, Price Break 1.11.3 mod plus cumulative mod
    $this->number_of_items_in_cart = $this->count_contents();
     if (!is_array($this->contents)) return 0;

  global $languages_id;
  $pf = new PriceFormatter;

     reset($this->contents);
     while (list($products_id, ) = each($this->contents)) {
       $qty = $this->contents[$products_id]['qty'];
$number_of_other_items_in_cart = $this->number_of_items_in_cart - $qty;

// products price
   //    $product_query = tep_db_query("select products_id, products_price, products_tax_class_id, products_weight from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");

   //    if ($product = tep_db_fetch_array($product_query)) {
       if ($product = $pf->loadProduct($products_id, $languages_id)){     
         $prid = $product['products_id'];
        $products_tax = tep_get_tax_rate($product['products_tax_class_id']);
 //        $products_price = $product['products_price'];
        $products_price = $pf->computePrice($qty, $number_of_other_items_in_cart);
 //        $products_price = $pf->computePrice($qty);
         $products_weight = $product['products_weight'];
// EOF Separate Pricing Per Customer, Price Break 1.11.3 mod plus cumulative mod

 

    function get_products() {
    global $languages_id;
// BOF Separate Pricing Per Customer v4, Price Break 1.11.3 modification, plus cumulative mod
     if (!is_array($this->contents)) return false;
     $pf = new PriceFormatter;
     $this->number_of_items_in_cart = $this->count_contents();
     
     $products_array = array();
     reset($this->contents);
     while (list($products_id, ) = each($this->contents)) {
/*        $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_model, p.products_image, p.products_price, p.products_weight, p.products_tax_class_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = '" . (int)$products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
       if ($products = tep_db_fetch_array($products_query)) {
         $prid = $products['products_id'];
         $products_price = $products['products_price'];

         $specials_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$prid . "' and status = '1'");
         if (tep_db_num_rows($specials_query)) {
           $specials = tep_db_fetch_array($specials_query);
           $products_price = $specials['specials_new_products_price'];
         } */

  if ($products = $pf->loadProduct($products_id, $languages_id)) {
         $products_price = $pf->computePrice($this->contents[$products_id]['qty'], ($this->number_of_items_in_cart - $this->contents[$products_id]['qty']));
// EOF Separate Pricing Per Customer v4, Price Break 1.11.3 modification, plus cumulative mod  

Link to comment
Share on other sites

Thanks Jan!

 

I'd been puzzling thru the first solution and getting nowhere (my php skills are pretty weak anyway) so I really appreciate your testing it. I'll implement your second solution and let you know.

 

Dave

 

 

Dave,

 

The code as per my post above doesn't work. To take all the items in the shopping cart into account while looking up the price for the price break (so with 4 products A and 6 products B the price break for 10 products A and 10 products B is used to calculate the price of A and B ) the following changes seem to do that:

 


Link to comment
Share on other sites

It worked perfectly! This is exactly what I needed for 2 different stores. I hope it's useful to others too. If you're looking for new features to incorporate this has my vote.

 

Thanks for an excellent contrib.

 

Dave

 

 

Dave,

 

The code as per my post above doesn't work. To take all the items in the shopping cart into account while looking up the price for the price break (so with 4 products A and 6 products B the price break for 10 products A and 10 products B is used to calculate the price of A and B ) the following changes seem to do that:

 


Link to comment
Share on other sites

There seems to be a bug in the Admin feature.

 

File: catalog/admin/specials.php

 

When a % special is entered for any customer category other than retail, the % is applied to the retail price.

 

The problem is in the following code block

 

if (substr($specials_price, -1) == '%') {

$new_special_insert_query = tep_db_query("select products_id, products_price from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");

$new_special_insert = tep_db_fetch_array($new_special_insert_query);

 

$products_price = $new_special_insert['products_price'];

$specials_price = ($products_price - (($specials_price / 100) * $products_price));

}

 

$products_price, retrieved from TABLE_PRODUCTS, will always be the base or "retail" price for the item.

 

 

Being new to this, I'm not sure how to fix the problem. The correct product price for the customer type has already been retrieved. It's just a matter of using that price in the % calculation rather than the retail price. Can someone suggest a fix?

 

In another topic related to "Separate Pricing per Customer", is there a provision for allowing separate pricing by "product attribute" admin/products_attributes.php) to be made customer-type aware? For example, our 4x6 picture frame retails for $26. The 5*7 size is +$6. But for a wholesale customer, the frame is $12.50, and the 5x7 size is + $3. Put simply, is the Product Attributes feature aware of the Separate Pricing per Customer mod?

Link to comment
Share on other sites

There seems to be a bug in the Admin feature.
You are right, this is a piece of original osC code and not been touched. It does indeed apply the percentage to the retail price.

If you change it like below it seems to work OK again:

        if (substr($specials_price, -1) == '%' && $customers_group == '0') {
         $new_special_insert_query = tep_db_query("select products_id, products_price from " . TABLE_PRODUCTS . " where products_id = '" . (int)$products_id . "'");
         $new_special_insert = tep_db_fetch_array($new_special_insert_query);

         $products_price = $new_special_insert['products_price'];
         $specials_price = ($products_price - (($specials_price / 100) * $products_price));
       } elseif (substr($specials_price, -1) == '%' && $customers_group != '0') {
 $specials_price = ($products_price - (($specials_price / 100) * $products_price));
}
// EOF Separate Pricing Per Customer

In another topic related to "Separate Pricing per Customer", is there a provision for allowing separate pricing by "product attribute" admin/products_attributes.php) to be made customer-type aware?
As far as I know nobody reported a working solution for that. I know I never even looked into it. It might be as simple as adding a customer_group_id to the table with a default of '0' (for retail) and going through all the code that looks for attributes and add the customer_group_id. The admin side might be another story...
Link to comment
Share on other sites

Thanks a lot. That works, in the case where it's a new special.

 

When modifying an existing special (the other branch of the "case" statement), however, the price is still drawn from the the retail price. The wrong price is displayed and the % discount is applied to the wrong price.

 

I looked at the code for about ten minutes this morning without being able to perceived a solution. I'd get it eventually. But if you can spot it, I'd appreciate it.

 

I'll also get into the "product attributes" issues when I have time. Thanks for the reply on that.

Link to comment
Share on other sites

Could somebody tell me what the file "product_info_pb_hide_price_if_0.php" is good for? I grepped through all the shop files for it, but it doesn't seem to be used anywhere.

Link to comment
Share on other sites

When modifying an existing special (the other branch of the "case" statement), however, the price is still drawn from the the retail price.  The wrong price is displayed and the % discount is applied to the wrong price.
Right again. It also displays the wrong price (the retail price) and the same price in a hidden field. Better kill two birds with one stone: change (around line 149-154 in admin/specials.php)

// BOF Separate Pricing Per Customer
     $product_query = tep_db_query("select p.products_id, pd.products_name, p.products_price, s.specials_new_products_price, s.expires_date, s.customers_group_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = s.products_id and s.specials_id = '" . (int)$HTTP_GET_VARS['sID'] . "'");
// EOF Separate Pricing Per Customer
     $product = tep_db_fetch_array($product_query);

     $sInfo = new objectInfo($product);

to:

// BOF Separate Pricing Per Customer
     $product_query = tep_db_query("select p.products_id, pd.products_name, p.products_price, s.specials_new_products_price, s.expires_date, s.customers_group_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_SPECIALS . " s where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = s.products_id and s.specials_id = '" . (int)$HTTP_GET_VARS['sID'] . "'");

     $product = tep_db_fetch_array($product_query);
     
     $customer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $product['products_id']. "' and customers_group_id =  '" . $product['customers_group_id'] . "'");
        if ($customer_group_price = tep_db_fetch_array($customer_group_price_query)) {
           $product['products_price']= $customer_group_price['customers_group_price'];
        }
// EOF Separate Pricing Per Customer	
     $sInfo = new objectInfo($product);

I think that will do it. Only thing that is changed is the addition of:

      $customer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $product['products_id']. "' and customers_group_id =  '" . $product['customers_group_id'] . "'");
        if ($customer_group_price = tep_db_fetch_array($customer_group_price_query)) {
           $product['products_price']= $customer_group_price['customers_group_price'];
        }

Link to comment
Share on other sites

Could somebody tell me what the file "product_info_pb_hide_price_if_0.php" is good for? I grepped through all the shop files for it, but it doesn't seem to be used anywhere.
You only need it if you use SPPC, Price Breaks AND the Hide Price if $0 contribution. These files (I think there are about three) ended up by accident in the package. It you do use the Hide Price if $0 contribution more files need changing, but these three are the ones that are not trivial (due to the Price Break contrib which uses a class). So just ignore the files with _hide_price_if_0 in the name.
Link to comment
Share on other sites

You only need it if you use SPPC, Price Breaks AND the Hide Price if $0 contribution. These files (I think there are about three) ended up by accident in the package. It you do use the Hide Price if $0 contribution more files need changing, but these three are the ones that are not trivial (due to the Price Break contrib which uses a class). So just ignore the files with _hide_price_if_0 in the name.

 

Ah, k, that makes sense then :)

 

I was just wondering, as I'm trying to integrate the Master Products Contribution into a shop which has the SPPC and QPBPP installed, and after making the modifications to product_info, I was just like "Doh - not another modification on a product_info-Script! :P

 

Thx for the clarification (and saving me from a heart attack ;) )

Edited by Bran
Link to comment
Share on other sites

If you were looking for Quantity Price Breaks for Separate Pricing Per Customer then I just answered your question ;)

 

And install SPPC first yes.

 

Thanx. I did and it worked :D BUT .....

Which ones of these mods affect the number of products displayed in main view??

I changed the "Search results" setting in Admin as per the instructions,

but nothing happens.

Confused? Not me, I'm just lost!

damsbo

Link to comment
Share on other sites

Which ones of these mods affect the number of products displayed in main view??
Neither, they don't touch that part of the code (I think the class split_page_results deals with that and takes it settings from the configuration keys).
I changed the "Search results" setting in Admin as per the instructions,

but nothing happens. Confused?

Me too, that should work :huh:
Link to comment
Share on other sites

Hi,

 

I have installed SPPC and I am getting the following error on my product pages in my admin catalog area:

 

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 = '1172' and customers_group_id = '1' order by customers_group_id

 

[TEP STOP]

 

Can someone tell me what this is and help me get rid of it?

 

Thanks!

 

Julie

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