Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

I am still trying to figure it out
Looks like your "old working new not working" code is the easiest to fix (although I understand the point is moot):

//OLD WORKING _ NEW NOT WORKING
		case 'PRODUCT_LIST_BUY_NOW':
		$lc_align = 'center';
		$lc_text = '<form name="cart_quantity" method="post" action="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('action')) . 'action=add_product&products_id=' . $listing[$x]['products_id']) . '"><input type="hidden" name="products_id" value="' . $listing[$x]['products_id'] . '"><input type="text" name="prod_listing_quantity" value="1" maxlength="3" size="3"><br />' . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</form>';
		break;

 // customer adds a product from the products page
  case 'add_product' :	if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
//	original			   $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+quantity, $HTTP_POST_VARS['id']);
// for price-break-1.11.3
							 $cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id'])) + $HTTP_POST_VARS['prod_listing_quantity'], $HTTP_POST_VARS['id']);
						  }// etcetera

Link to comment
Share on other sites

i have also one more little question.. is there a way so see which categorie have which categories_id or must i just look and try which is which?
You can see it with phpMyAdmin in the table categories_description or in the osC admin if you hover over the (i) icon: where the link show cID you see the categories_id. You can also do a "view source" of the page admin/categories.php and look at the source code of the drop-down menu. You will find them all there (the option value). For example, this is the source code of the example categories that you get when you install osC:

<form name="goto" action="http://your _ shop/shop/admin/categories.php" method="get">Go To: <select name="cPath" onChange="this.form.submit();"><option value="0">Top</option><option value="1">Hardware</option><option value="17">???CDROM Drives</option><option value="4">???Graphics Cards</option><option value="8">???Keyboards</option><option value="16">???Memory</option><option value="9">???Mice</option><option value="6">???Monitors</option><option value="5">???Printers</option><option value="7">???Speakers</option><option value="2">Software</option><option value="19">???Action</option><option value="18">???Simulation</option><option value="20">???Strategy</option><option value="3">DVD Movies</option><option value="10">???Action</option><option value="13" SELECTED>???Cartoons</option><option value="12">???Comedy</option><option value="15">???Drama</option><option value="11">???Science Fiction</option><option value="14">???Thriller</option></select></form>

Link to comment
Share on other sites

When I come to checkout_confirmation.php, the Shipping Address and the Shipping Method shows up right, but the products doesn't and no Billing Information at all shows up.
The interesting thing is that SPPC does not add code to that page, because prices are no longer involved (well added to the database and therefore "fixed"). Looks like something that has to do with PWA.
What about shopping_cart_pbpc.php? Maybe OTF-code has to be there also?
You don't need that file. It is the shopping_cart class for a mod of a mod (price break per category).
Link to comment
Share on other sites

I put in the echo statements and gave it a go. It seems that this problem is specific to just some specific catagories. I can probably live with it by making new catagories and then manually creating the products again, but not knowing why will bug me.

 

It keeps giving me the:

 

(for what ever product etc. it is for.)

 

....when I try to copy the products in this catagory even with the echo statements in there (not that they would change anything I don't think).

I don't get it, the error message of (0,24) being a duplicate key should come up after the echo's. The query that throws that error comes after those echo's. That is why I was interested in the duplicate id, because that becomes zero (not possible) in the error of (0,24). Weird.
Now I just need to find out why my per item shipping module keeps adding two extra packages.
Don't know that module. Pretty strange though... Is that the multi vendor shipping module (pretty complicated one...).
Link to comment
Share on other sites

I don't get it, the error message of (0,24) being a duplicate key should come up after the echo's. The query that throws that error comes after those echo's. That is why I was interested in the duplicate id, because that becomes zero (not possible) in the error of (0,24). Weird.

 

If I go into the database and delete the enter in products_to_catagories then try to copy the product, I can do it, but only once because it writes the 0,1 back in again. This only happens in certain catagories. Other ones work fine.

 

Don't know that module. Pretty strange though... Is that the multi vendor shipping module (pretty complicated one...).

I didn't install the Multi Vendor shipping because of all the changes needed in the other contributions. I'm sure I would have messed it all up.

The "per item module" is the one that ships with the out of the box osC. I just changed the english section so it would be for a specific courier called Fastway. I can't get any help on that one anywhere in the entire osC forums.

I like these mods, there fun! ...65 70 72 75 80 85 125+ contributions installed and counting...

 

Tools I'm using: OSC2.2 milestone2, Filezilla for FTP, PHP Designer 2007PE (nice), Araxis Merge 6.5 to compare files, XP(my box), Remote Server is shared Apache 1.3 Cpanel, CURL, and PHPmyAdmin through my hosts Cpanel to mess up the database.

Link to comment
Share on other sites

Said,

i had forgetten so set the status 1 in sql..
I don't understand that one. This is for example the first sql in the includes/boxes/categories.php for enable disable categories:

// #################### Added Enable / Disable Categories ##############
//  $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");
 $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' and c.categories_status = '1' order by sort_order, cd.categories_name");
// #################### End Added Enable / Disable Categories ##############

What you need now is to have changed that last query to:

// BOF SPPC Hide categories from groups

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

//  $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' order by sort_order, cd.categories_name");
 $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.parent_id from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '0' and c.categories_id = cd.categories_id and cd.language_id='" . (int)$languages_id ."' and find_in_set('".$customer_group_id."', categories_hide_from_groups) = 0 order by sort_order, cd.categories_name");
// EOF SPPC Hide categories from groups

Of course all those queries that are mentioned and changed in enable/disable categories should be adapted likewise (but in a file you only need the if(!tep_session_is_registered('sppc_customer_group_id')) { etcetera once).

Link to comment
Share on other sites

Said,

how can i say him, that when status=0, he just hide the categorie from the retail customers and visitors. and what must i change in the code, so that i should be able so change the status?
Below would be the admin part for hide categories for groups for SPPC. You already did the sql query needed:

SQL query needed for this mod

ALTER TABLE categories ADD categories_hide_from_groups VARCHAR(255) DEFAULT '@' NOT NULL;

Code changes in admin section:

admin/includes/languages/english/categories.php

**ADD**

// BOF SPPC hide categories from groups
define('TEXT_HIDE_CATEGORIES_FROM_GROUPS', 'Hide categories from groups:');
// EOF SPPC hide categories from groups

admin/categories.php (line numbers refer to the SPPC version with hide products for groups added)

Line 38-42

**REPLACE**

  case 'update_category':
	if (isset($HTTP_POST_VARS['categories_id'])) $categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);
	$sort_order = tep_db_prepare_input($HTTP_POST_VARS['sort_order']);

	$sql_data_array = array('sort_order' => $sort_order);

**WITH**

  case 'update_category':
	if (isset($HTTP_POST_VARS['categories_id'])) $categories_id = tep_db_prepare_input($HTTP_POST_VARS['categories_id']);
// BOF Separate Pricing Per Customer, hide categories from groups
	  $hide_cats_from_these_groups = '@,';
		 if ( $HTTP_POST_VARS['hide_cat'] ) { // if any of the checkboxes are checked
		foreach($HTTP_POST_VARS['hide_cat'] as $val) {
		$hide_cats_from_these_groups .= tep_db_prepare_input($val).','; 
		} // end foreach
		$hide_cats_from_these_groups = substr($hide_cats_from_these_groups,0,strlen($hide_cats_from_these_groups)-1); // remove last comma
  }

	$sort_order = tep_db_prepare_input($HTTP_POST_VARS['sort_order']);

	$sql_data_array = array('sort_order' => $sort_order,
			 'categories_hide_from_groups' => $hide_cats_from_these_groups);
// EOF Separate Pricing Per Customer, hide categories from groups

Line 901-909

**REPLACE**

$categories_count = 0;
$rows = 0;
if (isset($HTTP_GET_VARS['search'])) {
  $search = tep_db_prepare_input($HTTP_GET_VARS['search']);

  $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and cd.categories_name like '%" . tep_db_input($search) . "%' order by c.sort_order, cd.categories_name");
} else {
  $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by c.sort_order, cd.categories_name");
}

**WITH**

  $categories_count = 0;
$rows = 0;
if (isset($HTTP_GET_VARS['search'])) {
  $search = tep_db_prepare_input($HTTP_GET_VARS['search']);
// BOF SPPC hide category from groups
  $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified, c.categories_hide_from_groups from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and cd.categories_name like '%" . tep_db_input($search) . "%' order by c.sort_order, cd.categories_name");
} else {
  $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified, c.categories_hide_from_groups from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by c.sort_order, cd.categories_name");
}
// EOF SPPC hide categories from groups

Line 1003

**AFTER**

$heading = array();
$contents = array();

**ADD**

// BOF SPPC hide categories from groups
$hide_customers_group_query = tep_db_query("select customers_group_id, customers_group_name from " . TABLE_CUSTOMERS_GROUPS . " order by customers_group_id");
$hide_cats_from_groups_array = explode(',',$cInfo->categories_hide_from_groups);
$hide_cat_from_groups_array = array_slice($hide_cats_from_groups_array, 1); // remove "@" from the array
  while ($hide_customers_group = tep_db_fetch_array($hide_customers_group_query)) {
	$customers_groups[] = array('id' => $hide_customers_group['customers_group_id'], 'text' => $hide_customers_group['customers_group_name']);  
  }
// EOF SPPC hide categories from groups

Line 1017

**AFTER**

	$contents[] = array('text' => '<br>' . TEXT_CATEGORIES_NAME . $category_inputs_string);
	$contents[] = array('text' => '<br>' . TEXT_CATEGORIES_IMAGE . '<br>' . tep_draw_file_field('categories_image'));
	$contents[] = array('text' => '<br>' . TEXT_SORT_ORDER . '<br>' . tep_draw_input_field('sort_order', '', 'size="2"'));

**ADD**

// BOF SPPC hide categories from groups
	$category_hide_string = '<br>'. "\n" . TEXT_HIDE_CATEGORIES_FROM_GROUPS;
	 for ($i = 0; $i < count($customers_groups); $i++) {
   $category_hide_string .= '<br>' . "\n" . tep_draw_checkbox_field('hide_cat[' . $customers_groups[$i]['id'] . ']',  $customers_groups[$i]['id'] , 0) . '??' . $customers_groups[$i]['text']; 
	  }
	$contents[] = array('text' => $category_hide_string);
// EOF SPPC hide categories from groups

Line 1034

**AFTER**

	$contents[] = array('text' => '<br>' . TEXT_EDIT_CATEGORIES_NAME . $category_inputs_string);
	$contents[] = array('text' => '<br>' . tep_image(DIR_WS_CATALOG_IMAGES . $cInfo->categories_image, $cInfo->categories_name) . '<br>' . DIR_WS_CATALOG_IMAGES . '<br><b>' . $cInfo->categories_image . '</b>');
	$contents[] = array('text' => '<br>' . TEXT_EDIT_CATEGORIES_IMAGE . '<br>' . tep_draw_file_field('categories_image'));
	$contents[] = array('text' => '<br>' . TEXT_EDIT_SORT_ORDER . '<br>' . tep_draw_input_field('sort_order', $cInfo->sort_order, 'size="2"'));

**ADD**

// BOF SPPC hide categories from groups
	$category_hide_string = '<br>'. "\n" . TEXT_HIDE_CATEGORIES_FROM_GROUPS;
	 for ($i = 0; $i < count($customers_groups); $i++) {
   $category_hide_string .= '<br>' . "\n" . tep_draw_checkbox_field('hide_cat[' . $customers_groups[$i]['id'] . ']',  $customers_groups[$i]['id'] , (in_array($customers_groups[$i]['id'], $hide_cat_from_groups_array)) ? 1: 0) . '??' . $customers_groups[$i]['text']; 
	  }
	$contents[] = array('text' => $category_hide_string);
// EOF SPPC hide categories from groups

Link to comment
Share on other sites

I've just installed SPPC and the Quantity Break contrib and when I go into Admin to click onto "Customer Groups" I get the following:

 

"Access Denied

 

No Right Permission Access

Please contact your Web Administrator to request

more access or if you found any problem. "

 

Can anyone help me out or at least give me an idea of what I need to check -thanks in advance.

Allan Young

Link to comment
Share on other sites

boy do i feel stupid, the only reason the quantity thing was not working with the old code what because the "name" of the quantity input box was "quantity" instead of "cart_quantity" and that made it work.

 

Thanks again for your help, you guys helped greatly in my quest to solve this.

Link to comment
Share on other sites

I keep looking at MVS to deal with my problem of selecting certain methods of shipping for certain products and to prevent Fedex1 and my newly adapted Zipship (Fastway Couriers - Ontario now) from returning incorrect shipping rates when the maximum package weight is exceded.

 

My question is, should I install (should read "try to install") MVS or just forget it because it would be far too complex to merge MVS with SPPC, and a dozen other contributions?

I like these mods, there fun! ...65 70 72 75 80 85 125+ contributions installed and counting...

 

Tools I'm using: OSC2.2 milestone2, Filezilla for FTP, PHP Designer 2007PE (nice), Araxis Merge 6.5 to compare files, XP(my box), Remote Server is shared Apache 1.3 Cpanel, CURL, and PHPmyAdmin through my hosts Cpanel to mess up the database.

Link to comment
Share on other sites

I've just installed SPPC and the Quantity Break contrib and when I go into Admin to click onto "Customer Groups" I get the following:

 

"Access Denied

 

No Right Permission Access

Please contact your Web Administrator to request

more access or if you found any problem. "

 

Can anyone help me out or at least give me an idea of what I need to check -thanks in advance.

 

OK, this one is fixed. But I get a 1054 - Unknown column 'products_price1' in 'field list' error when I try to add a product.

Allan Young

Link to comment
Share on other sites

Hi all,

 

points on: Hide Products from customergroups for SPPC

 

Case:

Product is hidden from wholesale group.

 

now add that product to cart as a retail / not logged in customer, than login with the wholesale account.

The product is still in the shoppingcart...and can be bought.

 

Shouldn't be.

 

If this case is discussed here allready, than i'm sorry, but i didn't find the page.

 

Thanks for help!!!

G?tz

Link to comment
Share on other sites

G?tz,

Case:

Product is hidden from wholesale group.

 

now add that product to cart as a retail / not logged in customer, than login with the wholesale account.

The product is still in the shoppingcart...and can be bought.

Good point, I'm pretty sure this is not prevented in the current version. I think it can be stopped by adding code to the function restore_contents in the class shopping_cart. I will take a look at it.
Link to comment
Share on other sites

JanZ,

 

Thanks fot this amazing contrib!!!!

 

My problem is that I have also installed de "Featured Products" contribution. I have read your last anwsers to herot and tryed your solutions in pages 105 and 116 but doesn't seem to work for me.. :(

 

I only want that the /includes/modules/featured.php that is shown in the index page in stead of the previous new products one, shows the disccouted prices one the member has loggin.. (as it does in the rest of the spaces)

 

 

Thanks for your great support! :blush:

Link to comment
Share on other sites

G?tz,

Case:

Product is hidden from wholesale group.

 

now add that product to cart as a retail / not logged in customer, than login with the wholesale account.

The product is still in the shoppingcart...and can be bought.

I think I fixed it with the following changed function restore_contents in includes/classes/shopping_cart.php:

	function restore_contents() {
// BOF Separate Pricing Per Customer 
  global $customer_id, $sppc_customer_group_id;

  if (!tep_session_is_registered('customer_id')) return false;

  if(!tep_session_is_registered('sppc_customer_group_id')) { 
	$this->cg_id = '0';
	  } else {
	$this->cg_id = $sppc_customer_group_id;
 }
// EOF Separate Pricing Per Customer  

// insert current cart contents in database
  if (is_array($this->contents)) {
	reset($this->contents);
	while (list($products_id, ) = each($this->contents)) {
	  $qty = $this->contents[$products_id]['qty'];
	  $product_query = tep_db_query("select products_id from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");
	  if (!tep_db_num_rows($product_query)) {
		tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET . " (customers_id, products_id, customers_basket_quantity, customers_basket_date_added) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id) . "', '" . $qty . "', '" . date('Ymd') . "')");
		if (isset($this->contents[$products_id]['attributes'])) {
		  reset($this->contents[$products_id]['attributes']);
		  while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
			tep_db_query("insert into " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " (customers_id, products_id, products_options_id, products_options_value_id) values ('" . (int)$customer_id . "', '" . tep_db_input($products_id) . "', '" . (int)$option . "', '" . (int)$value . "')");
		  }
		}
	  } else {
		tep_db_query("update " . TABLE_CUSTOMERS_BASKET . " set customers_basket_quantity = '" . $qty . "' where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products_id) . "'");
	  }
	}
  }

// reset per-session cart contents, but not the database contents
  $this->reset(false);
// BOF SPPC hide products from groups
  $products_query = tep_db_query("select cb.products_id, cb.customers_basket_quantity, p.products_hide_from_groups from " . TABLE_CUSTOMERS_BASKET . " cb left join " . TABLE_PRODUCTS . " p using(products_id) where customers_id = '" . (int)$customer_id . "'");
  while ($products = tep_db_fetch_array($products_query)) {
$hide_from_array = explode(',', $products['products_hide_from_groups']);
// only add those products that are not hidden for this customer to the object shoppingCart
if (!in_array($this->cg_id, $hide_from_array)) { 
	  $this->contents[$products['products_id']] = array('qty' => $products['customers_basket_quantity']);
// attributes
	  $attributes_query = tep_db_query("select products_options_id, products_options_value_id from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and products_id = '" . tep_db_input($products['products_id']) . "'");
	  while ($attributes = tep_db_fetch_array($attributes_query)) {
	  $this->contents[$products['products_id']]['attributes'][$attributes['products_options_id']] = $attributes['products_options_value_id'];
	  }
} else {
 $products_to_delete_from_cb[] = $products['products_id'];
}// end else/if (!in_array($customer_group_id, $hide_from_array)
  } // end while ($products = tep_db_fetch_array($products_query))

  // delete from the database those products that are hidden from this customer
  if (tep_not_null($products_to_delete_from_cb)) {
	  $no_of_iterations = count($products_to_delete_from_cb);
// since the products_id in the table customer_basket and customer_basket_attributes can contain
// attributes like 1{4}2{3}6 we need to delete them one by one for the two tables
for ($y = 0; $y < $no_of_iterations; $y++) {
	tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET . " where customers_id = '" . (int)$customer_id . "' and (products_id = '" . (int)$products_to_delete_from_cb[$y] . "' or products_id REGEXP '^" .  (int)$products_to_delete_from_cb[$y] . "{');");
tep_db_query("delete from " . TABLE_CUSTOMERS_BASKET_ATTRIBUTES . " where customers_id = '" . (int)$customer_id . "' and (products_id = '" . (int)$products_to_delete_from_cb[$y] . "' or products_id REGEXP '^" .  (int)$products_to_delete_from_cb[$y] . "{');");
} // end for ($y = 0; $y < $no_of_iterations; $y++)
  } // end if (tep_not_null($products_to_delete_from_cb))
// BOF SPPC hide products from groups

  $this->cleanup();
}

Link to comment
Share on other sites

Any clue how to combine it with the "Hide price if 0$"??

 

I have looked the Hide Price if $0 for "Quantity Price Breaks for SPPC 4.1.1" but doesn't say anything about featured... :wacko:

 

I think the fact is in this piece of code...

 

'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products[$x]['products_image'], $featured_products[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products[$x]['products_id']) . '">' . $featured_products[$x]['products_name'] . '</a><br><s>' . $currencies->display_price($featured_products[$x]['products_price'], tep_get_tax_rate($featured_products[$x]['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' .
$currencies->display_price($featured_products[$x]['specials_new_products_price'], tep_get_tax_rate($featured_products[$x]['products_tax_class_id'])) . '</span>');
} else {
$info_box_contents[$row][$col] = array('align' => 'center',
'params' => 'class="smallText" width="' . (floor(100 / $no_of_columns)) . '%" valign="top" style="padding-top: 4px; '. ( $row < $last_row ? 'border-bottom: 1px ' . $border_style_h . ' ' . $color_h . '; ': '') . ( $col < ($no_of_columns - 1) ? 'border-right: 1px ' . $border_style_v . ' ' . $color_v . ';"': '"'),
'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products[$x]['products_image'], $featured_products[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products[$x]['products_id']) . '">' . $featured_products[$x]['products_name'] . '</a><br>' . $currencies->display_price($featured_products[$x]['products_price'], tep_get_tax_rate($featured_products[$x]['products_tax_class_id'])));

Edited by Mookie_Jam
Link to comment
Share on other sites

Scott,

 

So many good things and yet so hard. I'm working on a Commercial package. I baselined it on the 2.2 core with the 1.7 Multi-Store add-on. Needed the pricing you have been working on and starting going in my own direction. Then I just stumbled accross your thread today.

 

Data table wise, because of what I need I built my pricing on discounts, from the retail, using retail as the base price, with Group wide discounts and individual account discounts. I put the individual discount into a table named >>payment<< as I need a pre-approved and on-record payment method for each corporate account my system uses.

 

Anyway was wondering if there was a possibility of combining the Commercial Package

 

(see at: http://www.oscommerce.com/community/contributions,4157),

 

with the Seperate Pricing and the Multi-store contributions, so we have a solid package with best (or complete) features of all and best install (best when done in one step, would even like to include the base code as well, if possible.)

 

Please read over my features document, and if you know other contribs that will short cut my dev time, let me know!

 

Thanks!

 

OMR

Link to comment
Share on other sites

Hi all,

 

I like the "Admin SPPC hide categories from groups" from Jan!

 

Just a little addition:

To see in the list of categories, which one is hidden and where,

I've added the red bullets...

 

Below would be the admin part for hide categories for groups for SPPC. You already did the sql query needed:

 

admin/categories.php (line numbers refer to the SPPC version with hide products for groups added)

 

in admin/categories.php move JanZ $hide_customers_group_query (after line 1003) directly under the $categories_queries so it looks like this:

 

	$categories_count = 0;
$rows = 0;
if (isset($HTTP_GET_VARS['search'])) {
  $search = tep_db_prepare_input($HTTP_GET_VARS['search']);
// BOF SPPC hide category from groups
  $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified, c.categories_hide_from_groups from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and cd.categories_name like '%" . tep_db_input($search) . "%' order by c.sort_order, cd.categories_name");
} else {
  $categories_query = tep_db_query("select c.categories_id, cd.categories_name, c.categories_image, c.parent_id, c.sort_order, c.date_added, c.last_modified, c.categories_hide_from_groups from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where c.parent_id = '" . (int)$current_category_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' order by c.sort_order, cd.categories_name");
}


$hide_customers_group_query = tep_db_query("select customers_group_id, customers_group_name from " . TABLE_CUSTOMERS_GROUPS . " order by customers_group_id");
while ($hide_customers_group = tep_db_fetch_array($hide_customers_group_query)) {
   $customers_groups[] = array('id' => $hide_customers_group['customers_group_id'], 'text' => $hide_customers_group['customers_group_name']);  
}
// EOF SPPC hide categories from groups




Line 1003


$heading = array();
$contents = array();
// BOF SPPC hide category from groups
$hide_cats_from_groups_array = explode(',',$cInfo->categories_hide_from_groups);
$hide_cat_from_groups_array = array_slice($hide_cats_from_groups_array, 1); // remove "@" from the array
// EOF SPPC hide categories from groups

Now add code to admin/categories.php...

 

**AFTER**
			<td class="dataTableHeadingContent"><?php echo TABLE_HEADING_CATEGORIES_PRODUCTS; ?></td>


**ADD**
			<td class="dataTableHeadingContent" align="right"><?php echo TABLE_HEADING_HIDE_CATEGORIES; ?></td>




**AFTER**

			<td class="dataTableContent" align="center"><?php echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, tep_get_path($categories['categories_id'])) . '">' . tep_image(DIR_WS_ICONS . 'folder.gif', ICON_FOLDER) . '</a> <b>' . $categories['categories_name'] . '</b>'; ?></td>


**ADD**
			<td class="dataTableContent" align="center">
<?php
// BOF SPPC hide categories from groups
  $hide_cats_from_groups_array = explode(',',$categories['categories_hide_from_groups']);
  $hide_cat_from_groups_array = array_slice($hide_cats_from_groups_array, 1); // remove "@" from the array
// echo count($customers_groups);
  for ($i = 0; $i < count($customers_groups); $i++) {
	if (in_array($customers_groups[$i]['id'], $hide_cat_from_groups_array)) {
	  echo tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_ICON_STATUS_RED, 10, 10) . '  ';
	} else {
	  echo tep_image(DIR_WS_IMAGES . 'pixel_trans.gif', IMAGE_ICON_STATUS_GREEN, 10, 10) . '  ';
	}
  }
// EOF SPPC hide categories from groups
?></td>

To see the hidden status of products in the productslist we need to add the field p.products_hide_from_groups to the selects:

 

**REPLACE**
if (isset($HTTP_GET_VARS['search'])) {
  $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p2c.categories_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and pd.products_name like '%" . tep_db_input($search) . "%' order by pd.products_name");
} else {
  $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by pd.products_name");
}


**WITH**
if (isset($HTTP_GET_VARS['search'])) {
  $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p2c.categories_id, p.products_hide_from_groups from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and pd.products_name like '%" . tep_db_input($search) . "%' order by pd.products_name");
} else {
  $products_query = tep_db_query("select p.products_id, pd.products_name, p.products_quantity, p.products_image, p.products_price, p.products_date_added, p.products_last_modified, p.products_date_available, p.products_status, p.products_hide_from_groups from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c where p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' and p.products_id = p2c.products_id and p2c.categories_id = '" . (int)$current_category_id . "' order by pd.products_name");
}




**BEFORE**
			<td class="dataTableContent" align="center">
<?php
  if ($products['products_status'] == '1') {
	echo tep_image(DIR_WS_IMAGES . 'icon_status_green.gif', IMAGE_ICON_STATUS_GREEN, 10, 10) . '  <a href="' . tep_href_link(FILENAME_CATEGORIES, 'action=setflag&flag=0&pID=' . $products['products_id'] . '&cPath=' . $cPath) . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_red_light.gif', IMAGE_ICON_STATUS_RED_LIGHT, 10, 10) . '</a>';
  } else {
	echo '<a href="' . tep_href_link(FILENAME_CATEGORIES, 'action=setflag&flag=1&pID=' . $products['products_id'] . '&cPath=' . $cPath) . '">' . tep_image(DIR_WS_IMAGES . 'icon_status_green_light.gif', IMAGE_ICON_STATUS_GREEN_LIGHT, 10, 10) . '</a>  ' . tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_ICON_STATUS_RED, 10, 10);
  }
?></td>


**ADD**
			<td class="dataTableContent" align="center">
<?php
// BOF SPPC hide products from groups
  $hide_products_from_groups_array = explode(',',$products['products_hide_from_groups']);
  $hide_product_from_groups_array = array_slice($hide_products_from_groups_array, 1); // remove "@" from the array
// echo count($customers_groups);
  for ($i = 0; $i < count($customers_groups); $i++) {
	if (in_array($customers_groups[$i]['id'], $hide_product_from_groups_array)) {
	  echo tep_image(DIR_WS_IMAGES . 'icon_status_red.gif', IMAGE_ICON_STATUS_RED, 10, 10) . '  ';
	} else {
	  echo tep_image(DIR_WS_IMAGES . 'pixel_trans.gif', IMAGE_ICON_STATUS_GREEN, 10, 10) . '  ';
	}
  }
// EOF SPPC hide products from groups
?></td>

And in admin/includes/languages/english/categories.php

 

**ADD**

define('TABLE_HEADING_HIDE_CATEGORIES', 'Hidden');

 

Of course it could be made to make the bullets clickable to change the hidden status, but...

G?tz

Link to comment
Share on other sites

I like the "Admin SPPC hide categories from groups" from Jan!
I am working on it at the moment. I "finished" the admin part (added a bit more than the stuff I posted to add info on groups it is hidden for to the column on the right, at the bottom to see if a category or product is hidden) and went through the changes to half of the files. I left out the bullet part that enable/disable categories had so far. I will take a look tomorrow how to fit this in. Sounds like a nice extra touch.

 

Going through all the files is more work than I thought :) but then it always is...

 

Thanks for helping out.

Of course it could be made to make the bullets clickable to change the hidden status, but...
That wouldn't really work I think if you have more than one group (for which group do want to hide it?).
Link to comment
Share on other sites

To avoid having the categories show up in the drop-down menu in advanced_search.php you have to change the function tep_get_categories in includes/function/general.php (around line 600):

  function tep_get_categories($categories_array = '', $parent_id = '0', $indent = '') {
global $languages_id;

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

$categories_query = tep_db_query("select c.categories_id, cd.categories_name from " . TABLE_CATEGORIES . " c, " . TABLE_CATEGORIES_DESCRIPTION . " cd where parent_id = '" . (int)$parent_id . "' and c.categories_id = cd.categories_id and cd.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', categories_hide_from_groups) = 0 order by sort_order, cd.categories_name");
// EOF Hide categories from groups
while ($categories = tep_db_fetch_array($categories_query)) {
  $categories_array[] = array('id' => $categories['categories_id'],
							  'text' => $indent . $categories['categories_name']);

  if ($categories['categories_id'] != $parent_id) {
	$categories_array = tep_get_categories($categories_array, $categories['categories_id'], $indent . '  ');
  }
}

return $categories_array;
 }

 

I have contibution Cool Menu installed.

Hiding Categories from other groups than the retail (0) group did not work.

After adding $sppc_customer_group_id to the globals in the function above, it works.

 

  function tep_get_categories($categories_array = '', $parent_id = '0', $indent = '') {
global $languages_id, $sppc_customer_group_id;

 

G?tz

Link to comment
Share on other sites

After adding $sppc_customer_group_id to the globals in the function above, it works.
I'm 99.9% sure it should also be added to the function I changed. To be honest, I don't think I tested it, but I will when I get to that file :)

 

Regarding MS3 or version 3... quite a different animal. I only looked at a few files before that server was closed down but I think I saw the way prices are handled is quite different in the shopping cart class. In MS2.2 the function calculate is called but in MS3 the price is added to the object variables (which does make sense).

 

Oh well, perhaps there is enough time before the official release to get at least the basic SPPC version for version 3 ready.

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