Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

Can someone please tell me if once installed this contribution can be turned off in admin?
No, but as long as there are no users in another customer group than retail or as long there are no group prices nobody will notice the difference :)
Link to comment
Share on other sites

Is there a way to remove sales tax for virtual items (downloads) for all Customer Groups, but still charge tax on shipped items?

 

Group setings are:

Show prices with/without tax = Show prices without tax

Tax Exempt - No

 

I thought by default osC does not charge tax on virtual items, but the cart is charging sales tax for both.

I'm not familiar with downloads but do you mean you have the product in two versions: one as a shipped item and one as a download? If there is no physical product I would assume you can set the tax class to none when editing the product?
Link to comment
Share on other sites

My general.php:

 

line 1494: function tep_get_hide_status($hide_status_products, $customer_group_id, $temp_post_get_array) {

It's ok no ?

Seems so. There are actually two files called general.php: one in the admin section and one in the catalog section. You need to add those functions to the one in the catalog section.

If that is not the case I'm out of ideas. I mean tep_not_null is a function in the same file and is used in class order.php so it has to be loaded.

Link to comment
Share on other sites

Other problem:

autre problème :

Parse error: parse error, unexpected $ in /homepages/18/d174112975/htdocs/demo/includes/modules/product_listing.php on line 316

 

?> <==== line 315 !!!!

?????

 

My Sql 5

MySQL 5 has nothing to do with this. Some tiny error in the code I presume.
Link to comment
Share on other sites

In my admin/categories.php I am apparently missing something for setting the hide product/category from customer group on a Master Product. I can set it on slave products and then it shows me that change has been made with the little icon on the page that lists the products. But, when I try to set it for the Master Product - I check the box to hide the product from a group and then I click on preview and update and the change is not saved
Master products has as you correctly mention it's own section:

//Master Products		
   case 'insert_master':
   case 'update_master':

You should add the hide logic a little further (looks very much like the update_product part:

		  $products_date_available = (date('Y-m-d') < $products_date_available) ? $products_date_available : 'null';
// BOF Separate Pricing Per Customer, hide products and categories from groups
$hide_from_these_groups = '@,';
		 if ( $HTTP_POST_VARS['hide'] ) { // if any of the checkboxes are checked
			   foreach($HTTP_POST_VARS['hide'] as $val) {
			   $hide_from_these_groups .= tep_db_prepare_input($val).','; 
			   } // end foreach
		   }
$hide_from_these_groups = substr($hide_from_these_groups,0,strlen($hide_from_these_groups)-1); // remove last comma
// EOF Separate Pricing Per Customer, hide products and categories from groups

Etcetera because you also need to make a change to the $sql_data_array a few lines further.

Link to comment
Share on other sites

So - if I were to add the "and find in set" bit to the query performed by catalog/allprods.php and then add the above code snippet to the includes/modules/allprods.php (which is the page that displays the results) do you think that would do what I need it to?
No, you can't add a "and find in set" after "where bla, bla" and "order by bla" in the query.
We did at some point modify the allprods pages (both of them) for both SPPC and Master Products. So I do have the SPPC code in there to find prices and a separate query for specials and specials prices - etc... I believe it came from the code that goes into the product_listing.php page for SPPC.
Then you have a list of the product_id's which you can pass to tep_get_hide_status. Look in class shopping_cart and how it is done in the function restore_contents to look for the hidden status and unset products from the array.
Link to comment
Share on other sites

BTW - would you happen to understand how to change an infobox that lists things only one row per page (so you have to click the "next" at the bottom to go see the next row) so that it will simply show multiple rows?
Use the class split_page_results.php? Modules/product_listing.php uses that... What page is displayed is passed onto the code via the get parameter page ($page_holder = 'page').
Link to comment
Share on other sites

Hi there;

I'm here asking for a little advice. I have my retail

section almost finished and hopefully should go live soon.

After finishing that end, I plan to wholesale some of my

merchandise. Would this be a good contrib to add to my

site to achieve the seperation of retail and wholesale

priceing? If so, is there a full version of SPPC to install?

Also, I have PWA installed. Will there be any type of

conflict?

 

Any advice would be most appreciated.

 

Thanks,

Karen

Link to comment
Share on other sites

I'm here asking for a little advice. I have my retail

section almost finished and hopefully should go live soon.

After finishing that end, I plan to wholesale some of my

merchandise. Would this be a good contrib to add to my

site to achieve the seperation of retail and wholesale

priceing?

It is the right contribution for achieving that but SPPC is rather a large and pretty complicated contribution to add for inexperienced webmasters. Given the fact that you use an image on the front page of the site you are working on that refers to a file on your PC: file:///C:/Documents and Settings/Karen/My Documents/********_008.jpg I think you might not have the basic skills to add this to your site and get the conflicts resolved (some changes need to be made for PWA I believe).

So my suggestion is to first read a book on how PHP works and delay adding this till after you done that.

Link to comment
Share on other sites

It is the right contribution for achieving that but SPPC is rather a large and pretty complicated contribution to add for inexperienced webmasters. Given the fact that you use an image on the front page of the site you are working on that refers to a file on your PC: file:///C:/Documents and Settings/Karen/My Documents/********_008.jpg I think you might not have the basic skills to add this to your site and get the conflicts resolved (some changes need to be made for PWA I believe).

So my suggestion is to first read a book on how PHP works and delay adding this till after you done that.

 

Hi JanZ;

Thank you for your reply. I looked at the install instructions for

the contrib, and I agree, it's a bit over my head lol. I have a

programer friend I may ask to install it for me. And, yes, there

are still a few pictures I need to change the location on. But I'm

getting there lol.

 

Take care,

Karen

Link to comment
Share on other sites

Hi there. I've just installed this excellent contribution, and am very impressed with it. Many thanks to its author/s!

 

I'm using MySQL v5.0.27 and PHP v5.2.0. Consequently I had trouble with the 1066 error (Not unique table/alias: 'pd'). I installed JanZ's fix here and it has fixed the problem - but only partially.

 

Now, when I do a search (either with the Search field, or with the Manufacturer's dropdown) the search results come back with no picture, no name, no price... no details at all.

 

noproductidzo4.gif

 

It appears that the products_id variable is not being passed through, because the URL on each product is this:

http://mydomain.com/catalog/product_info.php?manufacturers_id=1&products_id=&osCsid=020b250d5380b42e925a5d750a07a897

 

I've tried searching for this problem, but have had no luck. Can anyone help me please?

Edited by Pseudonym_l33t
Link to comment
Share on other sites

Master products has as you correctly mention it's own section:

Etcetera because you also need to make a change to the $sql_data_array a few lines further.

 

Thank you JanZ - got that part working and now it appears to be working with All Products too! YAY! Still have to check that it is hiding categories and get it working with Dynamenu and SiteMap ;)

~Tracy
 

Link to comment
Share on other sites

Thank you JanZ - got that part working and now it appears to be working with All Products too! YAY! Still have to check that it is hiding categories and get it working with Dynamenu and SiteMap ;)

 

Well - I'm having some issues with Dynamenu and Hide Products for SPPC playing nicely together <_<

 

I have added the "and find_in_set" bit to the queries, and the $sppc_customer_group_id to the globals (from a previous post here)- I didn't see any other necessary code from the edits for boxes/categories.php so I'm not sure what I need to tweak at this point.

 

I have modified my Dynamenu to include products as well as categories - so I have a bit of code in my includes/functions/general.php file - this is just above the changes for the Hide Products for SPPC mod:

//for products in Dynamenu
function tep_products_in_category($category_id, $language = '', $include_inactive = false) {

global $languages_id, $sppc_customer_group_id;

if (empty($language)) $language = $languages_id;

if ($include_inactive) {
$products_query = tep_db_query("select p.products_id, p.products_master_status, pd.products_name as product, pd.products_id as product_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = p2c.products_id and p2c.categories_id = '" . $category_id . "' AND pd.language_id = '" . (int)$language . "' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 and p.products_id = pd.products_id AND p.products_master_status='1' order by p.products_sort_order asc, pd.products_name");
} else {
$products_query = tep_db_query("select p.products_id, p.products_master_status, pd.products_name as product, pd.products_id as product_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_id = p2c.products_id and p2c.categories_id = '" . $category_id . "' AND pd.language_id = '" . (int)$language . "' and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 and p.products_id = pd.products_id AND p.products_master_status='1' order by p.products_sort_order asc, pd.products_name");
}

return $products_query;
}

 

Then - in the dm_categories.php we have:

// Create the root category list
function tep_make_cat_dmlist($rootcatid = 0, $maxlevel = 0){

global $cPath_array, $show_full_tree, $languages_id, $sppc_customer_group_id;

global $idname_for_menu, $cPath_array, $show_full_tree, $languages_id, $sppc_customer_group_id;

// Modify category query if not fetching all categories (limit to root cats and selected subcat tree)
	if (!$show_full_tree) {
	$parent_query	= 'AND (c.parent_id = "0"';	

			if (isset($cPath_array)) {

				$cPath_array_temp = $cPath_array;

				foreach($cPath_array_temp AS $key => $value) {
						$parent_query	.= ' OR c.parent_id = "'.$value.'"';
					}

					unset($cPath_array_temp);
			}	

	$parent_query .= ')';				
	} else {
	$parent_query	= '';	
	}		

	$result = tep_db_query('select c.categories_id, c.sort_order, cd.categories_id, cd.categories_name, c.parent_id, p.products_id, p.products_master_status, pd.products_id, pd.products_name from ' . TABLE_CATEGORIES . ' c, ' . TABLE_CATEGORIES_DESCRIPTION . ' cd, ' . TABLE_PRODUCTS . ' p, ' . TABLE_PRODUCTS_DESCRIPTION . ' pd where c.categories_id = cd.categories_id and p.products_id = pd.products_id and p.products_master_status = 1 and cd.language_id="' . (int)$languages_id .'" and find_in_set("' . $customer_group_id . '", categories_hide_from_groups) = 0 and find_in_set("'.$customer_group_id.'", products_hide_from_groups) = 0 '.$parent_query.' order by sort_order, cd.categories_name');

	while ($row = tep_db_fetch_array($result)) {				
	$table[$row['parent_id']][$row['categories_id']] = $row['categories_name'];
}

$output .= tep_make_cat_dmbranch($rootcatid, $table, 0, $maxlevel);

return $output;
}

// Create the branches off the category list
function tep_make_cat_dmbranch($parcat, $table, $level, $maxlevel) {

global $cPath_array, $menu_use_titles, $menu_icon_file, $divide_subcats, $divide_subcats_text, $sppc_customer_group_id;

	$lvl_adjust = 1;

$list = $table[$parcat];

// Build data for menu
	while(list($key,$val) = each($list)){

			if (isset($cPath_array) && in_array($key, $cPath_array)) {
		$this_expanded = '1';
		$this_selected = 'dmselected';						
	} else {
		$this_expanded = '';
		$this_selected = '';									
		}	

	if (!$level) {
				unset($GLOBALS['cPath_set']);
					$GLOBALS['cPath_set'][0] = $key;
		$cPath_new = 'cPath=' . $key;

	} else {
					$GLOBALS['cPath_set'][$level] = $key;		
		$cPath_new = 'cPath=' . implode("_", array_slice($GLOBALS['cPath_set'], 0, ($level+1)));

					$this_subcat_count++;
	}

			if ($menu_use_titles) {
				$this_title = $val;
			} else {
				$this_title = '';				
			}				

	if (SHOW_COUNTS == 'true') {
		$products_in_category = tep_count_products_in_category($key);
		if ($products_in_category > 0) {
			$val .= ' (' . $products_in_category . ')';
		}
	}

			// Output for file to be parsed by PHP Layers Menu
			// Each line (terminated by a newline "\n" is a pipe delimited string with the following fields:
			// [dots]|[text]|[link]|[title]|[icon]|[target]|[expanded]
			// dots - number of dots signifies the level of the link '.' root level items, '..' first submenu, etc....
			// text - text for link; title - tooltip for link; icon - icon for link; target - "dmselected" CSS class if item is selected
			// expanded - signifies if the node is expanded or collapsed by default (applies only to tree style menus)

			// Add "more" submenu if dividing subcategories
			if ($this_subcat_count > $divide_subcats && $divide_subcats) {
		$output .= str_repeat(".", $level+$lvl_adjust).'|'.$divide_subcats_text.'||'.$this_title.'|'.$menu_icon_file.'|'.$this_selected.'|'.$this_expanded."\n";							 
				$this_subcat_count = 1;
					$lvl_adjust ++;
			}

	$output .= str_repeat(".", $level+$lvl_adjust).'|'.$val.'|'.tep_href_link(FILENAME_DEFAULT, $cPath_new).'|'.$this_title.'|'.$menu_icon_file.'|'.$this_selected.'|'.$this_expanded."\n";							 
// mikeys product listing
$products_in_category_query = tep_products_in_category($key);

while ($products_in_category = tep_db_fetch_array($products_in_category_query)) {

$product_id_h = 'products_id='.$products_in_category ['product_id'];
$product_name_h = $products_in_category ['product'];

if ($GLOBALS['products_id'] == $products_in_category ['product_id']) {
$that_expanded = '1';
$that_selected = 'dmselected';
} else {
$that_expanded = '';
$that_selected = '';
}

if ($menu_use_titles) {
$that_title = $product_name_h;
} else {
$that_title = '';
}

$output .= str_repeat(".", $level+2).'|'.$product_name_h.'|'.tep_href_link(FILENAME_PRODUCT_INFO, $product_id_h).'|'.$that_title.'|'.$menu_icon_file.'|'.$that_selected.'|'.$that_expanded."\n";
} //EOF mikeys product listing				

	if ((isset($table[$key])) AND (($maxlevel > $level + 1) OR ($maxlevel == '0'))) {
		$output .= tep_make_cat_dmbranch($key,$table,$level + $lvl_adjust,$maxlevel);
	}

	} // End while loop

return $output;
}

 

Do I need to somewhere have this bit of code?

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

 

If so - where should I put it? Do you see any other reason that these two don't seem to be working together?

 

Thank you in advance :blush:

~Tracy
 

Link to comment
Share on other sites

Hi there. I've just installed this excellent contribution, and am very impressed with it. Many thanks to its author/s!

 

I'm using MySQL v5.0.27 and PHP v5.2.0. Consequently I had trouble with the 1066 error (Not unique table/alias: 'pd'). I installed JanZ's fix here and it has fixed the problem - but only partially.

 

I remember that I had to mess with the advanced_search pages a bit before getting them working correctly. I honestly don't remember all of the tweaks I had to make - but I would be more than happy to email you my advanced search pages (keep in mind I have other mods installed as well) and you could do a comparison of the files and see if that helps you locate what you need :)

 

Just PM me with your email addy and I'll be happy to send them along :thumbsup:

~Tracy
 

Link to comment
Share on other sites

Well - I'm having some issues with Dynamenu and Hide Products for SPPC playing nicely together <_<

 

I have added the "and find_in_set" bit to the queries, and the $sppc_customer_group_id to the globals (from a previous post here)- I didn't see any other necessary code from the edits for boxes/categories.php so I'm not sure what I need to tweak at this point.

 

Found the problem - just need to change $sppc_customer_group_id to $customer_group_id and now it seems to be working :thumbsup:

 

Now for the SiteMap :blush:

~Tracy
 

Link to comment
Share on other sites

QUOTE(EricK @ Jan 26 2007, 05:29 AM) *

Is there a way to remove sales tax for virtual items (downloads) for all Customer Groups, but still charge tax on shipped items?

 

Group setings are:

Show prices with/without tax = Show prices without tax

Tax Exempt - No

 

I thought by default osC does not charge tax on virtual items, but the cart is charging sales tax for both.

 

I'm not familiar with downloads but do you mean you have the product in two versions: one as a shipped item and one as a download? If there is no physical product I would assume you can set the tax class to none when editing the product?

Jan - thanks for your reply. Each product has a download option or shipped option, similar to the demo product at http://demo.oscommerce.com/product_info.php?products_id=22

 

Only the box option (shipped) pays local sales tax, not the download option ... however the cart is charging sales tax to all groups for both options. I've been looking for places to insert an if statement, but have no luck. Do you know where sales tax can be disabled for all customer groups for virtual products?

 

Thanks again,

EricK

Link to comment
Share on other sites

I've tried searching for this problem, but have had no luck. Can anyone help me please?
Are you sure it is not a problem with includes/modules/product_listing.php? All instances of $listing['field_name'] in there should be replaced with $listing[$x]['field_name'] (after adding the logic to pick-up group prices of course). If not, than no picture, description, price etc.
Link to comment
Share on other sites

I've been looking for places to insert an if statement, but have no luck. Do you know where sales tax can be disabled for all customer groups for virtual products?
So basically it depends on an attribute? Since I guess you are not showing tax on product_info.php and in the shopping cart, only adding it on checking out, I assume you can get away with changing the function calculate in includes/classes/shopping_cart.php

 

In there you will find a line $products_tax = tep_get_tax_rate($product['products_tax_class_id']);

 

It is already known if the product has attributes (it is looping through the contents of the shopping cart) so you could wrap that line in an if/else statement (if (this and this attribute is set) { $products_tax = 0; } else { $products_tax = tep_get_tax_rate($product['products_tax_class_id']); } ).

 

It's a bit of a hack, but I assume it will work.

Link to comment
Share on other sites

It is already known if the product has attributes (it is looping through the contents of the shopping cart) so you could wrap that line in an if/else statement (if (this and this attribute is set) { $products_tax = 0; } else { $products_tax = tep_get_tax_rate($product['products_tax_class_id']); } ).

Thanks, I tried this but still shows sales tax on checkout_confirmation.php

 

if (($order->content_type == 'virtual') || ($order->content_type == 'virtual_weight')) {

$products_tax = 0;

} else {

$products_tax = tep_get_tax_rate($product['products_tax_class_id']);

}

 

I'll work on it some more.

Cheers,

EricK

Link to comment
Share on other sites

I tried this but still shows sales tax on checkout_confirmation.php

 

if (($order->content_type == 'virtual') || ($order->content_type == 'virtual_weight')) {

$products_tax = 0;

} else {

$products_tax = tep_get_tax_rate($product['products_tax_class_id']);

}

I don't know if the class $order is already populated there. Anyway, you would have to declare $order a global in that class or function otherwise that function has no knowledge or $order->content_type...

 

Therefore, I was more thinking along the lines of if (isset( $this->contents[$products_id]['attributes']['5']) && $this->contents[$products_id]['attributes']['5'] == 10) { etcetera

 

Haven't tried this though... The numbers 5 and 10 come from the demo osC.

Link to comment
Share on other sites

hi guys !

 

i have SPPC working great, including hiding products and catagories from users and groups etc:.

 

I was wondering whether there is a way to , say instead of entering the exact price for any particular customer group, enter a percentage off the retail price?

 

 

Example

Retail - $50

Wholesale $45

Wholesale 1 - $40

 

Could this be done by doing

Retail - $50

Wholesale - 10% off

Wholesale - 20% off

 

And the next big question is could this be done for an entire product group.

 

As you could imagine entering individual prices for each product can get a bit tedious, having to calculate yourself, and knowing every other product in that particular group is the same percentage off

 

hope that makes sense, if anybody can help that would be great,

 

Cheers !!

 

dlyxzen

Link to comment
Share on other sites

I'm having an issue which i haven't been able to find a previous post about.

 

Since installing SPPC 4 (which i believe is supported in this topic) and SPPC Price Break 4.15, my installation now runs painfully slow.

 

After examining my apache logs i found these errors:

 

[Tue Jan 30 14:13:59 2007] [error] [client IP ADDRESS] ModSecurity: Warning. Operator EQ match: 0. [id "960015"] [msg "Request Missing an Accept Header"] [hostname "webserver"] [uri "/E_P_Script"] [unique_id "OTEiDcCoAMcAAAxoAPgAAAD3"]

 

------------------------------------------------------------------------------------------------------------------------

 

[Tue Jan 30 14:12:26 2007] [error] [client 61.88.19.82] ModSecurity: Warning. Match of "rx \\\\b(?:(?:i(?:nterplay|hdr|d3)|(?:(?:ex|jf)i|%pd)f|m(?:ovi|thd)|r(?:ar!|iff)|f(?:lv|ws)|varg|.ra|cws)\\\\b|gif)" against "RESPONSE_BODY" required. [id "970902"] [msg "PHP source code leakage"] [severity "WARNING"] [hostname "URL"] [uri "/index.php"] [unique_id "M54ypMCoAMcAAAxoAO8AAAD4"]

 

------------------------------------------------------------------------------------------------------------------------

 

Sometimes i have it where the page runs ok, then it will slow down. sometimes the pictures on the site will load, othertimes no. im hoping someone can help me!!

Link to comment
Share on other sites

Hi everybody,

 

This contrib seemed to install properly and things seem to be working fine for different groups etc. but i do have one small problem though on the product_listing.php page...

 

When i click onto a category on the catalog side, it lists the products in the category except that all the products which it lists are the exact same product. Has anyone else had this problem or would anyone know which bit of code to even begin looking at?

 

Have a look at this page to see what i mean: http://www.bwear.ie/catalog/index.php/cPath/21_28

 

Thanks for any help!

Link to comment
Share on other sites

Hi everybody,

 

This contrib seemed to install properly and things seem to be working fine for different groups etc. but i do have one small problem though on the product_listing.php page...

 

When i click onto a category on the catalog side, it lists the products in the category except that all the products which it lists are the exact same product. Has anyone else had this problem or would anyone know which bit of code to even begin looking at?

 

Have a look at this page to see what i mean: http://www.bwear.ie/catalog/index.php/cPath/21_28

 

Thanks for any help!

 

Had to rename the folder and use a backup til this problem is sorted. Have a look at this link instead:

 

http://www.bwear.ie/catalog_sppc/index.php/cPath/22_35

 

thanks.

Edited by sonictrip.net
Link to comment
Share on other sites

Had to rename the folder and use a backup til this problem is sorted.
You use a non-standard product listing (includes/product_listing.php) which might have confused you when you were adding the changes needed for SPPC to work. Basically, the "normal" product_listing does a query and then while getting the rows one by one the output is being made. In SPPC first all the rows are collected and stored in an array. Then all the products_id's are known and with those the group prices are picked up, changed in that array if different and then the same is done for the special prices.
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...