Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

Dear JanZ,

 

Thanks a lot for your contributions!

I'd install the Separate Pricing Per Customer v.4.1.5 (build 051113) + bug fixed and your Quantity Price Breaks for Separate Pricing Per Customer Version 1.02 + Upgrade for version 1.0.2.

 

The problem is the Dealer qunatity price break doesn't work. For Example:

 

I have 2 groups:

Retail group_id: 0

Dealer group_id: 1

 

Dealer group (group_id: 1) Qunatity Price Breaks:

customers_group_price (1): 10.00 euro

products_price1_qty (10+): 9.00 euro

products_price2_qty (20+): 8.00 euro

products_price3_qty (30+): 7.00 euro

 

When I logged in as a member of dealer and added qunatity 10 or 20 or 30 into the Cart, it always picks up the customers_group_price(1): 10 euro.

I think the problem is in the PriceFormatterStore.php line 63:

 

$pg_query = tep_db_query("select pg.products_id, customers_group_price as price from " . TABLE_PRODUCTS_GROUPS . " pg where pg.products_id in (" . $product_id_list .") and pg.customers_group_id = '" . $this->cg_id . "' ");

 

It just queries the products_id and the customers_group_price, do I right?

 

Experts, please help...

 

Aton

Link to comment
Share on other sites

The problem is the Dealer qunatity price break doesn't work.

 

When I logged in as a member of dealer and added qunatity 10 or 20 or 30 into the Cart, it always picks up the customers_group_price(1): 10 euro.

I think the problem is in the PriceFormatterStore.php line 63:

 

$pg_query = tep_db_query("select pg.products_id, customers_group_price as price from " . TABLE_PRODUCTS_GROUPS . " pg where pg.products_id in (" . $product_id_list .") and pg.customers_group_id = '" . $this->cg_id . "' ");

 

It just queries the products_id and the customers_group_price, do I right?

Yep, major f*** up. I'll try to upload a corrected version this weekend. Thanks for catching this major error.
Link to comment
Share on other sites

It just queries the products_id and the customers_group_price, do I right?
OK, this seems to work a lot better. Replace the function PriceFormatterStore with this one (first 40 lines or so have not changed, removed final_price on the bottom, added a big chunk of code in the middle):

	function PriceFormatterStore() {
	global $cart, $languages_id;
	if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {
	  $this->cg_id = (int)$_SESSION['sppc_customer_group_id'];
	} else {
	  $this->cg_id = 0;
	}

	if (is_object($cart)) {
		$product_id_list = $cart->get_product_id_list();
		if (tep_not_null($product_id_list)) {
			// get rid of attributes first
			$product_id_list_array = array();
			$product_id_list_temp_array = explode(",", $product_id_list);
			foreach ($product_id_list_temp_array as $key => $value) {
	  $valid_value = tep_get_prid($value);
	  if (tep_not_null($valid_value)) {
				  $product_id_list_array[] = $valid_value;
	  }
			}
			unset($product_id_list);
			$product_id_list = implode(",", $product_id_list_array);
			// now do one query for all products in the shopping basket
				$sql = "select pd.products_name, p.products_model, p.products_image, p.products_id," .
	" p.products_price, p.products_weight, p.products_quantity, " .
	" p.products_price1, p.products_price2, p.products_price3, p.products_price4, " . 
	" p.products_price5, p.products_price6, p.products_price7, p.products_price8, " .
	" p.products_price1_qty, p.products_price2_qty, p.products_price3_qty, p.products_price4_qty, " .
	" p.products_price5_qty, p.products_price6_qty, p.products_price7_qty, p.products_price8_qty, " .
	" p.products_qty_blocks, p.products_tax_class_id," .
	" NULL as specials_new_products_price" .
	" from " . TABLE_PRODUCTS_DESCRIPTION . " pd," .
	"	  " . TABLE_PRODUCTS . " p" .
	" where p.products_status = '1'" .
	"   and p.products_id in (" . $product_id_list . ")" .
	"   and pd.products_id = p.products_id " .
	"   and pd.language_id = '". (int)$languages_id ."'";
				$product_info_query = tep_db_query($sql);
					$no_of_listings = tep_db_num_rows($product_info_query);
					while ($_product_info = tep_db_fetch_array($product_info_query)) {
						$product_info[] = $_product_info;
					}

// get all product prices for products with the particular customer_group_id
// however not necessary for customer group  0 (retail)
					if ($this->cg_id != '0') {
		  // first remove all the retail prices and quantity blocks
		  foreach ($product_info as $key => $sub_array_product_info) {
			for ($i = 1; $i < 9; $i++) {
			   $product_info[$key]['products_price'.$i.''] = '0.0000';
			   $product_info[$key]['products_price'.$i.'_qty'] = '0';
			 } 
				 $product_info[$key]['products_qty_blocks'] = '1';
		  } // end foreach ($product_info as $key => $sub_array_product_info)
					  $pg_query = tep_db_query("select pg.products_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 " . TABLE_PRODUCTS_GROUPS . " pg where " .
		  " pg.products_id in (" . $product_id_list . ") and pg.customers_group_id = '" . $this->cg_id . "' ");

						while ($pg_array = tep_db_fetch_array($pg_query)) {
						$new_prices[] = array ('products_id' => $pg_array['products_id'], 'products_price' => $pg_array['customers_group_price'], 
		  'products_price1' => $pg_array['products_price1'], 'products_price1_qty' => $pg_array['products_price1_qty'],
		  'products_price2' => $pg_array['products_price2'], 'products_price2_qty' => $pg_array['products_price2_qty'],
		  'products_price3' => $pg_array['products_price3'], 'products_price3_qty' => $pg_array['products_price3_qty'],
		  'products_price4' => $pg_array['products_price4'], 'products_price4_qty' => $pg_array['products_price4_qty'],
		  'products_price5' => $pg_array['products_price5'], 'products_price5_qty' => $pg_array['products_price5_qty'],
		  'products_price6' => $pg_array['products_price6'], 'products_price6_qty' => $pg_array['products_price6_qty'],
		  'products_price7' => $pg_array['products_price7'], 'products_price7_qty' => $pg_array['products_price7_qty'],
		  'products_price8' => $pg_array['products_price8'], 'products_price8_qty' => $pg_array['products_price8_qty'],
		  'products_qty_blocks' => $pg_array['products_qty_blocks']);
						}

					for ($x = 0; $x < $no_of_listings; $x++) {
// replace products prices with those from customers_group table
					  if (!empty($new_prices)) {
						for ($i = 0; $i < count($new_prices); $i++) {
						  if ($product_info[$x]['products_id'] == $new_prices[$i]['products_id'] ) {
							  $product_info[$x]['products_price'] = $new_prices[$i]['products_price'];
				for ($y = 1; $y < 9; $y++) {
				  $product_info[$x]['products_price'.$y.''] = $new_prices[$i]['products_price'.$y.''];
				  $product_info[$x]['products_price'.$y.'_qty'] = $new_prices[$i]['products_price'.$y.'_qty'];
				}
				  $product_info[$x]['products_qty_blocks'] = $new_prices[$i]['products_qty_blocks'];
							  }
						  }
						} // end if(!empty($new_prices)
					} // end for ($x = 0; $x < $no_of_listings; $x++)
				} // end if ($this->cg_id != '0')

// an extra query is needed for all the specials

				$specials_query = tep_db_query("select products_id, specials_new_products_price from " . TABLE_SPECIALS . " where products_id in (" . $product_id_list . ") and status = '1' and customers_group_id = '" . $this->cg_id . "'");
				while ($specials_array = tep_db_fetch_array($specials_query)) {
					$new_s_prices[] = array ('products_id' => $specials_array['products_id'], 'specials_new_products_price' => $specials_array['specials_new_products_price']);
				}

// add the correct specials_new_products_price and replace final_price
				for ($x = 0; $x < $no_of_listings; $x++) {
				  if (!empty($new_s_prices)) {
					for ($i = 0; $i < count($new_s_prices); $i++) {
					  if ($product_info[$x]['products_id'] == $new_s_prices[$i]['products_id'] ) {
					  $product_info[$x]['specials_new_products_price'] = $new_s_prices[$i]['specials_new_products_price'];
					  }
					}
				  } // end if(!empty($new_s_prices)
					$this->addPriceBreakData($product_info[$x]['products_id'], $product_info[$x]);
				} // end for ($x = 0; $x < $no_of_listings; $x++)
		} // end if tep_not_null($product_id_list)
	} // end if (is_object($cart)
}

Link to comment
Share on other sites

After installing the mod, I go to the group prices button in the attributes section, but I do not see the save button.

 

Not sure on this one.

 

I have attached an image.

 

nosavebutton.JPG

 

Thanks

_________________________________________________________________________

 

David G Aschenbrener

Tranquil | Sense - Your Stop for Tranquility.

Link to comment
Share on other sites

After installing the mod, I go to the group prices button in the attributes section, but I do not see the save button.

 

Not sure on this one.

 

I have attached an image.

 

nosavebutton.JPG

 

Thanks

_________________________________________________________________________

 

David G Aschenbrener

Tranquil | Sense - Your Stop for Tranquility.

Link to comment
Share on other sites

I have a rather unique problem where our state, Washington, charges a flat tax of $0.50 on each cigar sold in-state on top of the sales tax. So we need to be able to charge our in-state customers this tax. I was looking for a way to do this with the taxing functions of OSC but then I found SPPC and figured it might be a better solution to use.

 

So what I was thinking was that there might be a way to mod SPPC to check what state a customer is from and then display the retail pricing if they are not from Washington, but show the higher prices that include the cigar tax to them if they are in WA state. Could someone help me out with this? I have never used SPPC before so I will be starting from scratch and this will be implemented on a new OSC store with only a few visual tweaks and the Minimum_Order mod added.

 

thanks in advance

Link to comment
Share on other sites

OK, this seems to work a lot better. Replace the function PriceFormatterStore with this one (first 40 lines or so have not changed, removed final_price on the bottom, added a big chunk of code in the middle):

 

wow, you are a real guru! It just takes 1 hour to figure out. I will test it now.

 

Thanksssssssssssssssssss !!!!!!!!!!!!!!!

 

Aton

Link to comment
Share on other sites

OK, this seems to work a lot better. Replace the function PriceFormatterStore with this one (first 40 lines or so have not changed, removed final_price on the bottom, added a big chunk of code in the middle):

	function PriceFormatterStore() {

}

 

wow, you are a real guru! It just takes 1 hour to figure out. I will test it now.

 

Thanksssssssssssssssssss !!!!!!!!!!!!!!!

 

Aton

 

Dear JanZ,

 

It works perfectly.

 

Again, thank u so much!!!!!!!!!!!!!!!!!!!!!

 

Aton

Link to comment
Share on other sites

After installing the mod, I go to the group prices button in the attributes section, but I do not see the save button.

 

Not sure on this one.

That was my fault. See for example this post where to look for a missing > that obscures the button in IE (but not in Safari and FireFox so that hid it for me).

 

You might also be bitten by a MySQL4 error. See this post.

Link to comment
Share on other sites

I have a rather unique problem where our state, Washington, charges a flat tax of $0.50 on each cigar sold in-state on top of the sales tax. So we need to be able to charge our in-state customers this tax. I was looking for a way to do this with the taxing functions of OSC but then I found SPPC and figured it might be a better solution to use.
Actually, IMHO this can and should be done with the taxing function in osC. It is just as with sales tax for a state, nothing new here.

 

Something that could not be done with standard osC is making certain customers tax exempt for that but not for the regular sales tax. That specifity is coded and waiting to be included in the next version of SPPC. In the available versions there is only the possibility to make a customer or customer group tax exempt for all taxes, but not for specific taxes (needed in Canada for example).

Link to comment
Share on other sites

Hi!

 

I would like to put a primium on customers who order for a certain amount in a month or so.

 

One convenient way of doing this is that such a customer is automatically moved from the retail group to another group which has cheaper prices and stays in this new group as long as he/she qualifies to be there and, if not, then moved back to the retail group.

 

Would it be possible to accomplish?

Link to comment
Share on other sites

I'm battling the advanced search now. I've updated the file with the fixes you had previously posted but suspect my issues may be with trying to integrate the multistores. The advanced search worked fine before adding SPPC and I only modified the lines that were the same between the new updates and the modified multistores lines. So I'm not sure where I've gone wrong.

Looks like you went wrong in this part. The joins to products_description, categories, products_to_categories in the first "else" below do not belong there. That moved 10-15 lines below (see bottom of code part).

//rmh M-S_multi-stores edited next line
//  $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id and s.stores_id = '" . STORES_ID . "', " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c INNER JOIN " . TABLE_PRODUCTS_TO_STORES . " p2s ON p.products_id = p2s.products_id";
if ($status_tmp_product_prices_table == true) {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . $product_prices_table . " as tmp_pp using(products_id)";
  } elseif ($status_tmp_special_prices_table == true) {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id) left join " . TABLE_SPECIALS_RETAIL_PRICES . " s on p.products_id = s.products_id ";
  } else {
 $from_str = "from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m using(manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id and s.stores_id = '" . STORES_ID . "', " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c INNER JOIN " . TABLE_PRODUCTS_TO_STORES . " p2s ON p.products_id = p2s.products_id";//modified to match multistores

  }
 // EOF Separate Pricing Per Customer
 if ( (DISPLAY_PRICE_WITH_TAX == 'true') && (tep_not_null($pfrom) || tep_not_null($pto)) ) {
if (!tep_session_is_registered('customer_country_id')) {
  $customer_country_id = STORE_COUNTRY;
  $customer_zone_id = STORE_ZONE;
}
$from_str .= " left join " . TABLE_TAX_RATES . " tr on p.products_tax_class_id = tr.tax_class_id left join " . TABLE_ZONES_TO_GEO_ZONES . " gz on tr.tax_zone_id = gz.geo_zone_id and (gz.zone_country_id is null or gz.zone_country_id = '0' or gz.zone_country_id = '" . (int)$customer_country_id . "') and (gz.zone_id is null or gz.zone_id = '0' or gz.zone_id = '" . (int)$customer_zone_id . "')";
 }
 $from_str .= ", " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_CATEGORIES . " c, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c";
//rmh M-S_multi-stores edited next line

Link to comment
Share on other sites

I would like to put a primium on customers who order for a certain amount in a month or so.

 

One convenient way of doing this is that such a customer is automatically moved from the retail group to another group which has cheaper prices and stays in this new group as long as he/she qualifies to be there and, if not, then moved back to the retail group.

 

Would it be possible to accomplish?

I don't see why this could not be done, but how it is done might be tricky. Say you build this into checkout_payment or checkout_shipping and then when the customer gets a lower price he/she falls below the threshold you set? That would start a loop for some customers.

Since the prices in previous orders are not changed anymore after having finalized the order, that wouldn't be a problem when promoting or demoting the customer to a different group.

Link to comment
Share on other sites

Yes I thought it might be tricky. :)

 

To avoid the threshold issue and still using different groups, it could be designed like this. Set a time frame, say 12 month, then after the third order the member gets a discount on each order made within the same time frame.

 

So what is your take on this? I think that this splendid contribution would be even more versatile with an incentive along these lines!

Link to comment
Share on other sites

I am looking for some help with getting this module to work with Product Listing in Columns. I have tried to merge the code from the directions at line 74-78 in product_listing_col.php but either get no images or errors.
What is wrong with using Column Product Listing (for Separate Pricing Per Costomer v4.0)?
Link to comment
Share on other sites

Hi there,

 

Firstly I would like to apologise if this issue has already been adressed somewhere else, but I've searched as much as I can without being able to come across a solution for my problem.

 

I'm using OSC 2.2 with SPPC v4.1.5

 

I installed SPPC fine and its all working with no errors (there were one or two files with an unexpected '}' character in the code but thats all, nothing major), and i can manage customers/groups and their details. however when i'm in the admin/categories page and im editing the product details, no matter what price i put into the field, it will result in changing the price for that customer group to $0.00

 

if i go into phpMyAdmin and manually insert the correct data to the database in the products_groups table then it displays all the correct pricing on the live site, and when i go back to edit the product details the price is listed there, but clicking on 'preview' on the product information page will reset the group pricing for that product to $0.00 - and this change is instantly visible in the live storefront.

 

so even if i simply wanted to update the description of a product, editing anything on the details page in the admin section will reset it's price for any product group to zero. this means that everytime i make any change to a product whatsoever that i have to go into phpMyAdmin and re-upload all the group pricing form the products_groups table.

 

as you can imagine this is very frustrating 'caus there doesnt seem to be anything actually wrong with any of the code, in that there are no errors being displayed and that all the right fields are in the right forms and such. i followed the installation instructions very closely and while im no *expert* in php, i can debug most of the stuff provided its not too complex - but seeing as there is no error as such i dont even have anything to work with with my limited debugging skill .

 

has this issue come up before? or have i missed something blatantly obvious? or does anyone have any tips on where i could look to solve or find a solution to this problem?

 

any help would be greatly appreciated.

 

+Coby+

Edited by cobyone
Link to comment
Share on other sites

Hi all,

 

Sorry, I am new to osCommerce. I am a committee member for a UK based charity. We currently have a (get this...) stand alone Access database with members details and shop transactions. It is extremely time consuming as we have to manually re-enter records from a 1&1 shop into our Access db.

 

We now want to get our database online. We want to use osCommerce as the shop. We wish to allow non-members to buy from the shop, but members should get a discount. I am assuming we can use the SPPC contribution to achieve this?

 

Unfortunately, I am rather new to php and mysql. I do not understand how to install this contrib, I cannot seem to find any instructions... perhaps they are staring me int he face!

 

Any help or advice would be greatly appreciated. Thanks,

 

James

Link to comment
Share on other sites

Hi all,

 

Sorry, I am new to osCommerce. I am a committee member for a UK based charity. We currently have a (get this...) stand alone Access database with members details and shop transactions. It is extremely time consuming as we have to manually re-enter records from a 1&1 shop into our Access db.

 

We now want to get our database online. We want to use osCommerce as the shop. We wish to allow non-members to buy from the shop, but members should get a discount. I am assuming we can use the SPPC contribution to achieve this?

 

Unfortunately, I am rather new to php and mysql. I do not understand how to install this contrib, I cannot seem to find any instructions... perhaps they are staring me int he face!

 

Any help or advice would be greatly appreciated. Thanks,

 

James

 

Hi James,

 

By members and non-members I just want to verify what you mean.

 

For example - by default, when a visitor places an order through an osCommerce store they have to setup an account. This allows them to see their order history - view the status of their current order - login to their account when they return to shop again - saves their shopping cart if they didn't checkout on the last visit, etc.....

 

So - once they place an order and have an account are they considered members? Do you want non-members to be able to place an order without setting up an account?

 

Yes - SPPC will allow you to setup different customer "groups" and assign prices for each product individually for each group you have. But I'm asking about the members / non-members because you may need another contribution as well if you need to allow your non-members to checkout without creating an account :blush:

~Tracy
 

Link to comment
Share on other sites

Hi there,

 

Firstly I would like to apologise if this issue has already been adressed somewhere else, but I've searched as much as I can without being able to come across a solution for my problem.

 

I'm using OSC 2.2 with SPPC v4.1.5

 

I installed SPPC fine and its all working with no errors (there were one or two files with an unexpected '}' character in the code but thats all, nothing major), and i can manage customers/groups and their details. however when i'm in the admin/categories page and im editing the product details, no matter what price i put into the field, it will result in changing the price for that customer group to $0.00

 

+Coby+

 

I would use something like WinMerge to compare your Admin/categories.php file with the one included in SPPC v4.1.5

 

It sounds to me like something was missed in that file when you were editing it for the SPPC install :blush:

~Tracy
 

Link to comment
Share on other sites

Hi James,

 

By members and non-members I just want to verify what you mean.

 

For example - by default, when a visitor places an order through an osCommerce store they have to setup an account. This allows them to see their order history - view the status of their current order - login to their account when they return to shop again - saves their shopping cart if they didn't checkout on the last visit, etc.....

 

So - once they place an order and have an account are they considered members? Do you want non-members to be able to place an order without setting up an account?

 

Yes - SPPC will allow you to setup different customer "groups" and assign prices for each product individually for each group you have. But I'm asking about the members / non-members because you may need another contribution as well if you need to allow your non-members to checkout without creating an account :blush:

 

Hi Tracy, thanks for your reply.

 

We want all customers to have access to see order status and history, so everyone needs an account. We basically want two groups - members and non-members, (members will be able to purchase items at a reduced price). We also wish to charge overseas customers more for postage, but i think this is already possible with the standard OSC (no contrib required).

 

There is another complication which i think i will just have to learn to program... when customers create an account the default group should be non-member. Anyone joining by post (ie by cheque), we will add their details manually and set their group to be member. Also, if someone creates an account online and buys membership (a product), their group should be changed to member. (we may also want to have overseas members as another group). Also, if someone adds a membership product to their cart, is it possible to then change the pricing of any of the other products in the cart to the prices for the members group?

 

Infact, would there be a way to restrict buying of a product according to location of customer based on country?

 

Thanks for helping!

James

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