Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

If a retail item's price is $54.00 for the small, 56 for the med and 59 for the large lets say and the wholesale pricing is 21, 22 and 22.50 lets say, there would appear to be no way to do that without using seperate entries for each size of product since the product attributes only allow me to add a general increase in price that applies to both retail and wholesale which this is getting rather messy on some items that have lots of sizes like pants. Is there some work around, a different contrib or some easy fix that anyone can think of?

Will be standard in a next version of SPPC, but the code was already uploaded on November 16 as SPPC attributes mod rev. 1. Check the thread for a few minor bugs you might encounter (missing button for save due to a missing > and a MySQL4 problem).

Edited by JanZ
Link to comment
Share on other sites

I realize this is off-topic, but thought maybe somebody here would know this one off the top of their head (so to speak) :blush:

 

On my contact_us.php page I have added some extra fields. I am then printing them to the email that is sent upon form submission like so:

$enquiry = 'Address: ' . tep_db_prepare_input($HTTP_POST_VARS['address']) . "\n";
$enquiry .= 'City: ' . tep_db_prepare_input($HTTP_POST_VARS['city']) . "/n";
$enquiry .= 'State: ' . tep_db_prepare_input($HTTP_POST_VARS['state']) . "/n";
$enquiry .= 'Zip: ' . tep_db_prepare_input($HTTP_POST_VARS['zip']) . "/n";
etc.....

 

My question is, how do I get it so that the "\n" causes a return rather than printing in the email as \n ? I did double check and our email client is set to receive HTML emails - not sure if that has anything to do with it or not.

 

Thanks in advance! :blush:

 

PS - This appears to be an issue with any code going through email. My welcome email for setting up a new account, for example, has all sorts of extra characters that should be telling it to bold a word etc... and instead they are just being printed out rather than causing the text change :huh:

Edited by TracyS

~Tracy
 

Link to comment
Share on other sites

Then visitors who are not logged in will get to see the member pricing...

 

Of course the code should be like:

	if ($newsletter == 1 ) {
$sql_data_array['customers_group_id'] = '2';
}

 

Thanks for the help, but no matter where I put this, the Cust ID is not changing. I even took out the IF statement and added to the last line of the file.

 

 

This belongs in the catalog/create_account.php ??

Edited by graysonhobby
Link to comment
Share on other sites

Thanks for the help, but no matter where I put this, the Cust ID is not changing. I even took out the IF statement and added to the last line of the file.

This belongs in the catalog/create_account.php ??

 

 

I may have this working !!!!

Edited by graysonhobby
Link to comment
Share on other sites

Thanks for the help, but no matter where I put this, the Cust ID is not changing. I even took out the IF statement and added to the last line of the file.

This belongs in the catalog/create_account.php ??

You can't just put this anywhere... The particular $sql_data_array to which this should be added is started being built on around line 176:

	if ($error == false) {
  $sql_data_array = array('customers_firstname' => $firstname,
						  'customers_lastname' => $lastname,

So it should be placed after that, but before the query is actually performed (around line 196):

	  // EOF Separate Pricing Per Customer
  tep_db_perform(TABLE_CUSTOMERS, $sql_data_array);

  $customer_id = tep_db_insert_id();

Link to comment
Share on other sites

You can't just put this anywhere... The particular $sql_data_array to which this should be added is started being built on around line 176:

	if ($error == false) {
  $sql_data_array = array('customers_firstname' => $firstname,
						  'customers_lastname' => $lastname,

So it should be placed after that, but before the query is actually performed (around line 196):

	  // EOF Separate Pricing Per Customer
  tep_db_perform(TABLE_CUSTOMERS, $sql_data_array);

  $customer_id = tep_db_insert_id();

 

 

THANKS SOOOO MUCH..

 

I was on the right track as I had the hardcode in that area, but I kept adding the code for newsletter swtich futher down.

 

THANKS AGAIN!!!

Link to comment
Share on other sites

THANKS SOOOO MUCH..

 

I was on the right track as I had the hardcode in that area, but I kept adding the code for newsletter swtich futher down.

 

THANKS AGAIN!!!

 

 

Not a big problem, but after a new account is created, the user needs to log out then log back in to see the 'member' pricing. Im sure it has to do with the sessions

 

I did add this bit of code...

 

 if (SESSION_RECREATE == 'True') {
	tep_session_recreate();
  }

  $check_customer_group_info = tep_db_query("select c.customers_group_id, cg.customers_group_show_tax, cg.customers_group_tax_exempt from " . TABLE_CUSTOMERS . " c left join " . TABLE_CUSTOMERS_GROUPS . " cg using(customers_group_id) where c.customers_id = '" . $customers_id . "'");
  $customer_group_info = tep_db_fetch_array($check_customer_group_info);
  $sppc_customer_group_id = $customer_group_info['customers_group_id'];
  $sppc_customer_group_show_tax = (int)$customer_group_info['customers_group_show_tax'];
  $sppc_customer_group_tax_exempt = (int)$customer_group_info['customers_group_tax_exempt'];

  $customer_first_name = $firstname;
  $customer_default_address_id = $address_id;
  $customer_country_id = $country;
  $customer_zone_id = $zone_id;
  tep_session_register('customer_id');
  tep_session_register('customer_first_name');
  tep_session_register('customer_default_address_id');
  tep_session_register('customer_country_id');
  tep_session_register('customer_zone_id');
	  // BOF Separate Pricing per Customer
tep_session_register('sppc_customer_group_id');
tep_session_register('sppc_customer_group_show_tax');
tep_session_register('sppc_customer_group_tax_exempt');
// EOF Separate Pricing per Customer

// restore cart contents
  $cart->restore_contents();

Edited by graysonhobby
Link to comment
Share on other sites

Not a big problem, but after a new account is created, the user needs to log out then log back in to see the 'member' pricing. Im sure it has to do with the sessions

 

I did add this bit of code...

That should fix your problem. Just tried it again and if I echo the session variables after creating an account I get the expected values:

	[customer_id] => 7
[customer_first_name] => Jan
[customer_default_address_id] => 8
[customer_country_id] => 150
[customer_zone_id] => 0
[sppc_customer_group_id] => 2
[sppc_customer_group_show_tax] => 1
[sppc_customer_group_tax_exempt] => 0

Link to comment
Share on other sites

That should fix your problem. Just tried it again and if I echo the session variables after creating an account I get the expected values:

	[customer_id] => 7
[customer_first_name] => Jan
[customer_default_address_id] => 8
[customer_country_id] => 150
[customer_zone_id] => 0
[sppc_customer_group_id] => 2
[sppc_customer_group_show_tax] => 1
[sppc_customer_group_tax_exempt] => 0

 

Perhaps my session settings are not correct,

 

Is it easy to echo these setting?

 

 

 

Also in my ERROR Log file, Im getting these errors

 

 

sh: line 3: size:: command not found

sh: line 2: day:: command not found

Edited by graysonhobby
Link to comment
Share on other sites

Is it easy to echo these setting?

Yes, if you change the last <?php } ?> in the includes/footer.php to:

<?php
echo '<!-- ';
echo '<pre>';
print_r($_SESSION);
echo '</pre> -->';
 }
?>

You will see that in the source code of the page (because I now added HTML comments around it).

Also in my ERROR Log file, Im getting these errors

sh: line 3: size:: command not found

sh: line 2: day:: command not found

Doesn't ring a bell with me.
Link to comment
Share on other sites

Yes, if you change the last <?php } ?> in the includes/footer.php to:

<?php
echo '<!-- ';
echo '<pre>';
print_r($_SESSION);
echo '</pre> -->';
 }
?>

You will see that in the source code of the page (because I now added HTML comments around it).

Doesn't ring a bell with me.

 

Seems Im taking 2 steps back for everyone foward...

 

Heres another problem Im having...

 

When logged on as 'wholesale' the category listing does show the special price, but the product info does NOT. Its shows the Retail Special Price.

 

Im just testing out the special module and have a special for each customer group, but the retail special is super ceding all others no matter who logs in.

 

Does SPPC 4.15 allow for prodcuts to have a special price for each customer group?

Edited by graysonhobby
Link to comment
Share on other sites

When logged on as 'wholesale' the category listing does show the special price, but the product info does NOT. Its shows the Retail Special Price.

 

Im just testing out the special module and have a special for each customer group, but the retail special is super ceding all others no matter who logs in.

 

Does SPPC 4.15 allow for prodcuts to have a special price for each customer group?

Yes. Probably a matter of the session variable with the customer group id not being available on that page (perhaps due to STS). Make sure that on the page that has the price information that variable is available (echo it if you need to check it). Try the "superglobals version":

// BOF Separate Pricing per Customer
 if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {
$customer_group_id = $_SESSION['sppc_customer_group_id'];
 } else {
$customer_group_id = '0';
 }
// EOF Separate Pricing per Customer

Link to comment
Share on other sites

I appreciate your patience and all your help. :) :)

 

The pricing with no Specials works fine, I added the session fix bove and the specials are still not working properly. It seems to be the last special's price will show no matter whos logged in.

 

Also, I cannot get the echo to work in the footer.

 

I attached by my footer.ph and prod_listing.php.

 

 

Im at the point now I cant even post properly

Link to comment
Share on other sites

The pricing with no Specials works fine, I added the session fix bove and the specials are still not working properly. It seems to be the last special's price will show no matter whos logged in.

Actually, the special pricing has its own function in includes/functions/general.php in which you can also use the "superglobal version":

  function tep_get_products_special_price($product_id) {
// BOF Separate Pricing Per Customer
 if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {
$customer_group_id = $_SESSION['sppc_customer_group_id'];
 } else {
$customer_group_id = '0';
 }

	$product_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . (int)$product_id . "' and status and customers_group_id = '" . (int)$customer_group_id . "'");
// EOF Separate Pricing Per Customer
$product = tep_db_fetch_array($product_query);

return $product['specials_new_products_price'];
 }

Also, I cannot get the echo to work in the footer.

 

I attached by my footer.ph and prod_listing.php.

Im at the point now I cant even post properly

Did you do a "view source" on the page. I assumed you had a live shop and did not want to show that stuff to everybody so I put HTML comments ( <!-- --> ) around it so that it doesn't show on the page but shows up in the source code of the page.

Link to comment
Share on other sites

I think that has solved it!!

 

NOW back to the login in.. :rolleyes:

 

I was finally able to get the footer working

 

Here is what is displayed

 

[customer_zone_id] => 1

[sppc_customer_group_id] =>

[sppc_customer_group_show_tax] => 0

[sppc_customer_group_tax_exempt] => 0

 

The customer group is blank, but in the Admin section, the customer account is created in the correct group.

Link to comment
Share on other sites

I think that has solved it!!

 

NOW back to the login in.. :rolleyes:

 

I was finally able to get the footer working

 

Here is what is displayed

 

[customer_zone_id] => 1

[sppc_customer_group_id] =>

[sppc_customer_group_show_tax] => 0

[sppc_customer_group_tax_exempt] => 0

 

The customer group is blank, but in the Admin section, the customer account is created in the correct group.

 

 

I logged out, then logged back in and this is what displays

 

[sppc_customer_group_id] => 2

[sppc_customer_group_show_tax] => 1

[sppc_customer_group_tax_exempt] => 0

[customer_country_id] => 223

[customer_zone_id] => 1

Link to comment
Share on other sites

Might be offtopic but...assigned to Pricebreaks per Product for SPPC

 

For all of you, who want to have a minimum orderquantity per product instead of the Quantityblocks, here is the hack:

includes/classes/PriceFormatter.php

  // changed for minimum orderquantity per product
 function adjustQty($qty) {
	// Force QTY_BLOCKS granularity
	$qb = $this->getQtyBlocks();
	if ($qty < 1) $qty = 1;
	if ($qb >= 1) {
	  if ( ($this->getcartquantity()<$qb) && ($qty>$qb) ) {
		$qty = $qty;
	  } elseif ($this->getcartquantity()>=$qb) {
		$qty = $qty;
	  } else {
		$this->updatecartquantity($qb);
		$qty = 1;
		if ($qty < $qb) {
		  $qty = $qb;
		}
	  }
	}
	return $qty;
 }

/* Original function for quantityblocks
 function adjustQty($qty) {
	// Force QTY_BLOCKS granularity
	$qb = $this->getQtyBlocks();
	if ($qty < 1) $qty = 1;
	if ($qb >= 1) {
	  if ($qty < $qb) $qty = $qb;
	  if (($qty % $qb) != 0) $qty += ($qb - ($qty % $qb));
	}
	return $qty;
 }
*/
 // Additional function to update cart
 function updatecartquantity($qb) {
global $cart;
$cart->update_quantity($this->productsID, $qb, $attributes = '');
 }
 // Additional function to get the actual cartquantity
 function getcartquantity() {
global $cart;
$cartquantity = $cart->get_quantity($this->productsID);
return $cartquantity;
 }

Might be, there is another smarter way to code this, but it works :thumbsup:

Link to comment
Share on other sites

NOW back to the login in.. :rolleyes:

 

The customer group is blank, but in the Admin section, the customer account is created in the correct group.

It took me a while to see it but you posted this as your code:

$check_customer_group_info = tep_db_query("select c.customers_group_id, cg.customers_group_show_tax, cg.customers_group_tax_exempt from " . TABLE_CUSTOMERS . " c left join " . TABLE_CUSTOMERS_GROUPS . " cg using(customers_group_id) where c.customers_id = '" . $customers_id . "'");

The trick is that you should use $customer_id in that query, not $customers_id because that is a non-set variable and therefore the query doesn't give a result. The use (int) in a few lines turns the non-set variables to zero.

Link to comment
Share on other sites

It took me a while to see it but you posted this as your code:

$check_customer_group_info = tep_db_query("select c.customers_group_id, cg.customers_group_show_tax, cg.customers_group_tax_exempt from " . TABLE_CUSTOMERS . " c left join " . TABLE_CUSTOMERS_GROUPS . " cg using(customers_group_id) where c.customers_id = '" . $customers_id . "'");

The trick is that you should use $customer_id in that query, not $customers_id because that is a non-set variable and therefore the query doesn't give a result. The use (int) in a few lines turns the non-set variables to zero.

 

 

I owe you BIG!

 

I finally have it all working..Fingers Crossed :thumbsup:

 

I will actually be able to get a few hrs sleep tonight.

 

The little RA Red Icon lights up when folks DO NOT sign up for a newsletter. A cool side effect from knowing too much to be dangerous.

 

I dont even know to know that I dont know enough :lol:

Edited by graysonhobby
Link to comment
Share on other sites

Might be offtopic but...assigned to Pricebreaks per Product for SPPC

 

For all of you, who want to have a minimum orderquantity per product instead of the Quantityblocks, here is the hack:

includes/classes/PriceFormatter.php

  // changed for minimum orderquantity per product
 function adjustQty($qty) {
	// Force QTY_BLOCKS granularity
	$qb = $this->getQtyBlocks();
	if ($qty < 1) $qty = 1;
	if ($qb >= 1) {
	  if ( ($this->getcartquantity()<$qb) && ($qty>$qb) ) {
		$qty = $qty;
	  } elseif ($this->getcartquantity()>=$qb) {
		$qty = $qty;
	  } else {
		$this->updatecartquantity($qb);
		$qty = 1;
		if ($qty < $qb) {
		  $qty = $qb;
		}
	  }
	}
	return $qty;
 }

/* Original function for quantityblocks
 function adjustQty($qty) {
	// Force QTY_BLOCKS granularity
	$qb = $this->getQtyBlocks();
	if ($qty < 1) $qty = 1;
	if ($qb >= 1) {
	  if ($qty < $qb) $qty = $qb;
	  if (($qty % $qb) != 0) $qty += ($qb - ($qty % $qb));
	}
	return $qty;
 }
*/
 // Additional function to update cart
 function updatecartquantity($qb) {
global $cart;
$cart->update_quantity($this->productsID, $qb, $attributes = '');
 }
 // Additional function to get the actual cartquantity
 function getcartquantity() {
global $cart;
$cartquantity = $cart->get_quantity($this->productsID);
return $cartquantity;
 }

Might be, there is another smarter way to code this, but it works :thumbsup:

 

what section of priceformatter.php do you replace and add this instead

 

Thanks

 

Tarek

RACESPEC

Link to comment
Share on other sites

Tarek

what section of priceformatter.php do you replace and add this instead

function adjustQty is replacedfunction updatecartquantity and getcartquantity are added.

Does not work properly for products with attributes!

Link to comment
Share on other sites

Okay, I installed the contribution and appearently didn't do something right. I'm getting this error when the catalog loads (or rather doesn't):

Parse error: parse error, unexpected ';', expecting T_OLD_FUNCTION or T_FUNCTION or T_VAR or '}' in /homepages/24/d151309427/htdocs/testing/catalog/includes/classes/shopping_cart.php on line 577

Actually, it is a missing } to close off function add_cart on line 217.

 

Also, when I go into product attributes, the pop up window has a cancel button, but no save button. I can mouse over and have the tooltip text where the button should be, but no button and if I click in the area where the tool tip shows the word "save" it does nothing.
Read the quote again you used as the first one in your post and you will see that the answer was staring you in the face.
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...