Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

But ... let's say I have a product to $50 by default. I have also created a new customer group called "Test". Inside the product administration I enter a new price for the Test group -- let's say $100. Where is this change seen? I thought all users in this group would see $100 instead of $50 when they're logged in at the website viewing the actual product?
Yes, they will.
Link to comment
Share on other sites

As soon as I install SPPC_Price_Break_v1_02 and the update the prices come on the website (like 1.00 - 2.00) with the quantities.

But if I order 10 pieces it still keeps 20,00 in the shopping cart instead of 10,00.

So the price breaks are visible on the website but don't get calculated in the basket.

Seems straight forward enough for me, since SPPC price breaks already has SPPC in it... The calculations showing up wrong in the shopping cart and shopping cart box would mean something is wrong with the function get_products in includes/classes/shopping_cart.php and maybe the function calculate.

 

Why don't you post those two and we can see what you got so far?

Link to comment
Share on other sites

Yes, they will.

 

Right... then I have a new problem... what I noticed is that the individual prices for each group are saved in the database, but the system fails to change the prize when you're looking at the product logged in as a customer in of the groups. Which file(s) take(s) care of this part?

Link to comment
Share on other sites

I'm trying to tweak my customer testimonials contribution to check for hidden products or categories (as well as pull testimonials specific to the category or product page the viewer is on).

 

I've been using the reviews box as a guideline (as it was also updated for Hide Products for SPPC) and I have apparently missed something. I keep getting this error, just what row it is on changes as I move the if(!tep_sessioin_is_registered('sppc_customer_group_id')) block of code :

 

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in

 

I originally had the check for the customer group id at the very beginning of the file (no php above it except the commented out page $Id and such) - still had the error and it always wants to point to one of the lines in this block of code.

 

Do you see any reason for this? I looked up the error and it supposedly means I've forgotten an ending ";" somewhere - but why it would generate that error for the customer group block of code when there is nothing above it to end is beyond me :S

 

This is what I have at the moment - do you see anything that would cause the error?

<tr>
<td>
<?php
$info_box_contents = array();
$info_box_contents[] = array('align' => 'left',
							 'text'  => BOX_HEADING_CUSTOMER_TESTIMONIALS
							);
new TestimonialsBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_CUSTOMER_TESTIMONIALS, '', 'NONSSL'));

// BOF Hide products and categories from groups
if(!tep_session_is_registered('sppc_customer_group_id')) { 
  $customer_group_id = '0';
  } else {
  $customer_group_id = $sppc_customer_group_id;
  }

  $random_testimonial = "select t.testimonials_id, t.products_id, t.testimonials_title, t.testimonials_url, t.testimonials_url_title, t.testimonials_name, t.testimonials_last_name, t.testimonials_html_text, t.status, p2c.categories_id FROM " . TABLE_CUSTOMER_TESTIMONIALS . " t LEFT JOIN " . TABLE_PRODUCTS " . p USING(products_id) LEFT JOIN " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c USING(products_id) LEFT JOIN " . TABLE_CATEGORIES . " c USING(categories_id) WHERE t.status = 1";

 if (isset($HTTP_GET_VARS['products_id'])) {
  $random_testimonial .= " and t.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'";
}
 if (isset($HTTP_GET_VARS['categories_id'])) {
$random_testimonial .= " and p2c.categories_id = '" . (int)$HTTP_GET_VARS['categories_id'] . "'";
}
$random_testimonial .= " and find_in_set('" . $customer_group_id . "', products_hide_from_groups) = 0 ";
$random_testimonial .= " and find_in_set('" . $customer_group_id . "', categories_hide_from_groups) = 0 ";
$random_testimonial .= " ORDER BY rand() LIMIT 1 ";
$random_testimonial = tep_random_select($random_testimonial);

if ($random_testimonial) {

$testimonial = substr(embedded_href_replace($random_testimonial['testimonials_html_text']), 0, 400);

$info_box_contents = array();
$info_box_contents[] = array('align' => 'left',
							 'text'  => $testimonial . '<br><br><a href="' . tep_href_link(FILENAME_CUSTOMER_TESTIMONIALS, 'testimonial_id=' . $random_testimonial['testimonials_id']) .  '">' . 'Full Testimony...</a><br><b>~' . $random_testimonial['testimonials_title'].' '.$random_testimonial['testimonials_last_name'].'</b>'
							 );
new TestimonialsBox($info_box_contents);
?>
		</td>
	  </tr>
<?php
 }
?>

~Tracy
 

Link to comment
Share on other sites

Which file(s) take(s) care of this part?
login.php is setting the session parameters for recognition of the group. You can find out what is set by (e.g.) adding in the footer of a page:

echo '<pre>';
print_r($_SESSION);

You should see sppc_customer_group_id. Of course there could be something wrong in product_info.php where it shows the price, but if you add it to the cart and the correct price is still not shown the error is not there.

Link to comment
Share on other sites

I keep getting this error, just what row it is on changes as I move the if(!tep_sessioin_is_registered('sppc_customer_group_id')) block of code :

 

Parse error: syntax error, unexpected T_CONSTANT_ENCAPSED_STRING in

 

I originally had the check for the customer group id at the very beginning of the file (no php above it except the commented out page $Id and such) - still had the error and it always wants to point to one of the lines in this block of code.

I don't see what could be causing the problem but I ran into some strange errors (could have been that) when I copied and pasted code from a webpage. Invisible utf-8 characters (spaces) caused errors in the PHP code.

 

If you use Windows, download the file and open and save it in Notebook. That should get rid of the utf-8 spaces (or remove them and add them with your own editor. Could be in between words too...)

 

Oh, and don't bother mentioning me in the install file. Next thing you know is people thinking I know something about Dynamenu too :)

Link to comment
Share on other sites

I don't see what could be causing the problem but I ran into some strange errors (could have been that) when I copied and pasted code from a webpage. Invisible utf-8 characters (spaces) caused errors in the PHP code.

 

I wouldn't have thought of that - I'll check - but I did it all through DreamWeaver :huh:

 

Oh, and don't bother mentioning me in the install file. Next thing you know is people thinking I know something about Dynamenu too :)

 

Ok - that's why I was asking :thumbsup:

~Tracy
 

Link to comment
Share on other sites

I don't see what could be causing the problem but I ran into some strange errors (could have been that) when I copied and pasted code from a webpage. Invisible utf-8 characters (spaces) caused errors in the PHP code.

 

If you use Windows, download the file and open and save it in Notebook. That should get rid of the utf-8 spaces (or remove them and add them with your own editor. Could be in between words too...)

 

Well - I tried the save it in Notepad method - didn't do me any good though - I might just re-write the stinker in Notepad and see if that does any better :blink:

~Tracy
 

Link to comment
Share on other sites

JanZ: The array contains sppc_customer_group_id with the value == 1, so that part seems to work fine.
Perhaps you should use this on product_info.php:

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';
 }

instead of:

if(!tep_session_is_registered('sppc_customer_group_id')) {
 $customer_group_id = '0';
 } else {
  $customer_group_id = $sppc_customer_group_id;
 }

Link to comment
Share on other sites

Well - I tried the save it in Notepad method - didn't do me any good though - I might just re-write the stinker in Notepad and see if that does any better :blink:

 

For Pete's Sake! - :lol:

 

While re-typing I found it! It was a reversed . " at the end of a table in the query! :blush:

~Tracy
 

Link to comment
Share on other sites

I think the error is in the new PriceFormatter.php and/or PriceFormatterStore.php

 

I put back the old (from backup from previous working OSC) shopping_cart.php and the error remained the same (no quantity pricings).

I put back the old PriceFormatter.php and the basket changed the prices to quantity pricings.

I put in again the new shopping_cart.php and it still works.

I compared all the files with my files and I don't see anything that is out of the ordinary apart from two things. Both in PriceFormatter.php and PriceFormatterStore.php a long line in the sql (in pf around line 222 and in pfs around line 44) there are line endings in the text like in pfs:

" p.products_price1_qty,p.products_price2_qty,p.products_price3_qty,p.products_pri
ce4_qty, p.products_price5_qty,p.products_price6_qty,p.products_price7_qty,p.products_pri
ce8_qty," .
	" p.products_qty_blocks," .

Similar thing in pf:

$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_pri
ce4_qty, p.products_price5_qty,p.products_price6_qty,p.products_price7_qty,p.products_pri
ce8_qty," .
	" p.products_qty_blocks," .

This would surely give errors but I don't know if they are in your files or are caused by the posting...

You did add the code for $pfs = new PriceFormatterStore to application_top.php did you?

Link to comment
Share on other sites

I think you mean in the middle the productlisting, this is in the file categories.php if i'm not mistaking.

 

Yes, I'm talking about the table that shows all products in the categories in the middle of the page, but it doesn't seem to be in categories.php...

Link to comment
Share on other sites

Yes, I'm talking about the table that shows all products in the categories in the middle of the page, but it doesn't seem to be in categories.php...
Product listing.... what about catalog/includes/modules/product_listing.php ?
Link to comment
Share on other sites

I think the error is in the new PriceFormatter.php and/or PriceFormatterStore.php
Once you start adding products to the cart, PriceFormatterStore.php kicks in. But since it is an object you can print it out to see what it contains. Might give more info on what is happening (or not).

Add to e.g. a footer:

echo '<pre>';
print_r($pfs);

Link to comment
Share on other sites

Actually, you forgot about three $listing's in the code. The trickiest one is the fact that $product_contents is not reset (nulled) so it stays the same all the time. The code that is working for me (starts around line 251, not till the end):

// make sure $product_contents is filled with new stuff:
   unset($product_contents);
}

 

Hi Janz, thank for that, it seemed to sort the problem of duplicate products anyway! :)

 

One more thing though, the products are showing up ok now, when you click the thumbnails, the product description loads up with the correct product_id but when you click the "details" button or "Buy now" button, there doesnt seem to be a product_id associated with these particular buttons so i was wondering how to make the same product link which is working on the thumbnails, work on the details and buy now buttons as well??

 

Here's the bit of code i think affects this:

 

if (isset($HTTP_GET_VARS['manufacturers_id'])) {
		  $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'manufacturers_id=' . $HTTP_GET_VARS['manufacturers_id'] . '&products_id=' . $listing[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing[$x]['products_image'], $listing[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>';
		} else {
		  $lc_text = '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $listing[$x]['products_image'], $listing[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a> ';
		}
		break; // EOF Separate Pricing per Customer
	  case 'PRODUCT_LIST_BUY_NOW':
		$lc_align = 'center';
		$lc_text = '<a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $listing[$x]['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_BUY_NOW) . '</a> ';

		break;
	}

	$list_box_contents[$cur_row][] = array('align' => $lc_align,
										   'params' => 'class="productListing-data"',
										   'text'  => $lc_text);
	$product_contents[] = $lc_text;	   
  }


  $product_query = tep_db_query("select products_description  from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . (int)$listing['products_id'] . "' and language_id = '" . (int)1 . "'");
  $product = tep_db_fetch_array($product_query);
  $new_products['products_description'] = $product['products_description'];

 

Thanks!

Link to comment
Share on other sites

Hi

 

I'd be really grateful for a little help with SPPC. I installed v415 on a brand new installation of MS2.2 (060817), that tested fine. I then installed SPPC attributes mod rev. 1. Now when I click add to cart for either a retail or a wholesale customer I get the following error:

 

1052 - Column 'products_id' in where clause is ambiguous

 

select products_status, options_id, options_values_id, attributes_hide_from_groups, '0' as hide_attr_status from products left join products_attributes using(products_id) where products_id = '29'

 

[TEP STOP]

 

Many thanks

Katie

Link to comment
Share on other sites

One more thing though, the products are showing up ok now, when you click the thumbnails, the product description loads up with the correct product_id but when you click the "details" button or "Buy now" button, there doesnt seem to be a product_id associated with these particular buttons so i was wondering how to make the same product link which is working on the thumbnails, work on the details and buy now buttons as well??
If you go back to my original post with the fixes you will see that there are three more places where a [$x] were added. I think you oversaw that :)
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...