Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Hide products from customer groups for SPPC 201


Guest

Recommended Posts

I installed the above contribution and the admin section seems fine but when you try to log onto the site you get

Parse error: syntax error, unexpected T_CASE in /www/f/fhceramics/shops/htdocs/includes/application_top.php on line 418
and here is 407 to 429 of application_top.php
				 		// BOF SPPC, Hide products and categories from groups
																foreach($hide_status_products as $key => $subarray) {
																  if ($subarray['products_id'] == tep_get_prid($HTTP_POST_VARS['products_id'][$i]) && $subarray['hidden'] == '0') {
							  $cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes, false);

																} // end foreach($hide_status_products as $key => $subarray)
					// EOF SPPC, Hide products and categories from groups								}
						  }
						  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						  break;
  // customer adds a product from the products page
(this is line 418)	  case 'add_product' :	if (isset($HTTP_POST_VARS['products_id']) && is_numeric($HTTP_POST_VARS['products_id'])) {
							$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['cart_quantity'], $HTTP_POST_VARS['id']);							  }
						  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						  break;
  // performed by the 'buy now' button in product listings and review page
  case 'buy_now' :		if (isset($HTTP_GET_VARS['products_id'])) {
							if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
							  tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
							} else {
							  $cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+1);
							}
						  }

 

Please help me to get my site back up. Thanks in advance.

Edited by FHCeramics
Link to comment
Share on other sites

I installed the above contribution and the admin section seems fine but when you try to log onto the site you get and here is 407 to 429 of application_top.php
You are missing two "}" in the part above case 'add_product' : One right above } // end foreach($hide_status_products as $key => $subarray) and the one after // EOF SPPC, Hide products and categories from groups ended up on the same line as that comment, so give an enter after the comment and that should fix it.

 

So the whole piece you posted should look like:

		// BOF SPPC, Hide products and categories from groups
																foreach($hide_status_products as $key => $subarray) {
																  if ($subarray['products_id'] == tep_get_prid($HTTP_POST_VARS['products_id'][$i]) && $subarray['hidden'] == '0') {
							  $cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes, false);
																	}
																} // end foreach($hide_status_products as $key => $subarray)
		// EOF SPPC, Hide products and categories from groups
							}
						  }
						  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						  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'])) {
							$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);
						  }
						  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						  break;
  // performed by the 'buy now' button in product listings and review page
  case 'buy_now' :		if (isset($HTTP_GET_VARS['products_id'])) {
							if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
							  tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
							} else {
							  $cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+1);
							}
						  }

Link to comment
Share on other sites

Thanks JanZ, that got my site back up, but now there is another glitch and I'm not sure which section to check of this contributions changes. The glitch only appears on the category and sub-category pages, the index page and product pages seem fine. Here is what the glitch is

on the right side where the right column should be, instead of the column, you get the title "Categories" a icon box, then underneath you get " 1109 - unknown table 'p' in field list select count (p.products_id) as total (TEP STOP)
, would I look in the column_right.php or categories.php for the solution. I greatly appreciate the help.
You are missing two "}" in the part above case 'add_product' : One right above } // end foreach($hide_status_products as $key => $subarray) and the one after // EOF SPPC, Hide products and categories from groups ended up on the same line as that comment, so give an enter after the comment and that should fix it.

 

So the whole piece you posted should look like:

		// BOF SPPC, Hide products and categories from groups
																foreach($hide_status_products as $key => $subarray) {
																  if ($subarray['products_id'] == tep_get_prid($HTTP_POST_VARS['products_id'][$i]) && $subarray['hidden'] == '0') {
							  $cart->add_cart($HTTP_POST_VARS['products_id'][$i], $HTTP_POST_VARS['cart_quantity'][$i], $attributes, false);
																	}
																} // end foreach($hide_status_products as $key => $subarray)
		// EOF SPPC, Hide products and categories from groups
							}
						  }
						  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						  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'])) {
							$cart->add_cart($HTTP_POST_VARS['products_id'], $cart->get_quantity(tep_get_uprid($HTTP_POST_VARS['products_id'], $HTTP_POST_VARS['id']))+1, $HTTP_POST_VARS['id']);
						  }
						  tep_redirect(tep_href_link($goto, tep_get_all_get_params($parameters)));
						  break;
  // performed by the 'buy now' button in product listings and review page
  case 'buy_now' :		if (isset($HTTP_GET_VARS['products_id'])) {
							if (tep_has_product_attributes($HTTP_GET_VARS['products_id'])) {
							  tep_redirect(tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $HTTP_GET_VARS['products_id']));
							} else {
							  $cart->add_cart($HTTP_GET_VARS['products_id'], $cart->get_quantity($HTTP_GET_VARS['products_id'])+1);
							}
						  }

Link to comment
Share on other sites

now there is another glitch and I'm not sure which section to check of this contributions changes. The glitch only appears on the category and sub-category pages, the index page and product pages seem fine. Here is what the glitch is , would I look in the column_right.php or categories.php for the solution.
Looking at the source code of the page (found your site in your profile) it seems that instead of calling the modules/new_products.php the modules/product_listing.php (?) or something else is called. The select count(p.products_id) as total is typically code generated by the splitPageResults class. Since your site doesn't show new products I would start looking at the includes/modules/new_products.php file.

 

There is also something wrong with:

  if (isset($HTTP_GET_VARS['info_message']) && tep_not_null($HTTP_GET_VARS['info_message'])) {
?>

begin visible on the page.

 

Also the $nbsp in the Javascript should end with a ; :)

document.write('Only?');document.write(days+1 + ' Days To Seeleys

Link to comment
Share on other sites

Thanks again JanZ, got the last two problems that you caught fixed and changed the new products.php back to what it originally was but with no success, so it must be something else, here is what it shows on the source code for the affected pages at the end

	 <td>New Products For August</td>
 </tr>
</table>
</td>
 </tr>
</table>
<!-- new_products_eof //-->
</td>
	  </tr>
	</table></td>
  </tr>
</table></td>
<td width="100%" valign="top"><table border="0" width="100%" cellspacing="0" cellpadding="0">
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading">Categories</td>
		<td align="right"><img src="images/" width="57" height="40" border="0" alt="Categories" title="Categories"></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><img src="images/pixel_trans.gif" width="100%" height="10" border="0" alt=""></td>
  </tr>
  <tr>
	<td><font color="#000000"><b>1109 - Unknown table 'p' in field list<br><br>select count(p.products_id) as total <br><br><small><font color="#ff0000">[TEP STOP]</font></small><br><br></b></font>

, and here is the code from the unaffected pages

  </tr>
</table>
</td>
 </tr>
</table>
<!-- new_products_eof //-->
</td>
	  </tr>
	</table></td>
  </tr>
</table></td>
<!-- body_text_eof //-->
<td width="125" valign="top"><table border="0" width="125" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<!-- shopping_cart //-->
	  <tr>
		<td>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr>
<td height="14" class="infoBoxHeading"><img src="images/infobox/corner_right_left.gif" width="11" height="14" border="0" alt=""></td>
<td width="100%" height="14" class="infoBoxHeading">Shopping Cart</td>
<td height="14" class="infoBoxHeading" nowrap><a href="http://shops.fhceramics.com/shopping_cart.php"><img src="images/infobox/arrow_right.gif" width="12" height="10" border="0" alt="more" title="more"></a><img src="images/infobox/corner_right.gif" width="11" height="14" border="0" alt=""></td>
 </tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="1" class="infoBox">
 <tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="3" class="infoBoxContents">
 <tr>
<td><img src="images/pixel_trans.gif" width="100%" height="1" border="0" alt=""></td>
 </tr>
 <tr>
<td class="boxText">0 items</td>
 </tr>
 <tr>
<td><img src="images/pixel_trans.gif" width="100%" height="1" border="0" alt=""></td>
 </tr>
</table>
</td>
 </tr>
</table>
		</td>
	  </tr>
<!-- shopping_cart_eof //-->
<!-- information //-->
	  <tr>
		<td>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr>
<td height="14" class="infoBoxHeading"><img src="images/infobox/corner_right_left.gif" width="11" height="14" border="0" alt=""></td>
<td width="100%" height="14" class="infoBoxHeading">We Accept</td>
<td height="14" class="infoBoxHeading" nowrap><img src="images/pixel_trans.gif" width="11" height="14" border="0" alt=""></td>
 </tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="1" class="infoBox">
 <tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="3" class="infoBoxContents">
 <tr>
<td><img src="images/pixel_trans.gif" width="100%" height="1" border="0" alt=""></td>
 </tr>
 <tr>
<td align="center" class="boxText"><img src="images/credit-cards-square.gif" width="94" height="64" border="0" alt=""></td>
 </tr>
 <tr>
<td><img src="images/pixel_trans.gif" width="100%" height="1" border="0" alt=""></td>
 </tr>
</table>
</td>
 </tr>
</table>
		</td>
	  </tr>
<!-- information_eof //-->
<!-- newsdesk //-->
<tr>
	<td>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr>
<td height="14" class="infoBoxHeading"><img src="images/infobox/corner_right_left.gif" width="11" height="14" border="0" alt=""></td>
<td width="100%" height="14" class="infoBoxHeading">Latest News</td>
<td height="14" class="infoBoxHeading" nowrap><img src="images/pixel_trans.gif" width="11" height="14" border="0" alt=""></td>
 </tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="1" class="infoBox">
 <tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="4" class="infoBoxContents">
 <tr class="smallText" valign="top">
<td align="left" class="smallText" valign="top"><a class="smallText" href="http://shops.fhceramics.com/newsdesk_info.php?newsdesk_id=8">Family Heirloom Ceramics Expands</a><br><a class="smallText" href="http://shops.fhceramics.com/newsdesk_info.php?newsdesk_id=7">1 - Redesigning of website</a><br><a class="smallText" href="http://shops.fhceramics.com/newsdesk_info.php?newsdesk_id=6">Doc Holiday Artist Has Agreed to teach Seminar</a><br><a class="smallText" href="http://shops.fhceramics.com/newsdesk_info.php?newsdesk_id=5">Exciting Changes occur at Family Heirloom Ceramics</a><br></td>
 </tr>
</table>
</td>
 </tr>
</table>

<!-- newsdesk_eof //-->
	</td>
</tr>

<!-- events_calendar //-->

 <tr>
<td>
		<iframe name="calendar" id="calendar" class="calendarBox" 
			align="center" valign="top" marginwidth="0" marginheight="0" frameborder="0" scrolling="no"
			src="calendar_content.php?_month=&_year=" 
		>Sorry, you browser does not support iframes.</iframe>

</td>
 </tr>
<!-- events_calendar //-->
<!-- customer testimonials //-->
<!-- customer testimonials_eof //-->
<!-- reviews //-->
	  <tr>
		<td>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr>
<td height="14" class="infoBoxHeading"><img src="images/infobox/corner_right_left.gif" width="11" height="14" border="0" alt=""></td>
<td width="100%" height="14" class="infoBoxHeading">Reviews</td>
<td height="14" class="infoBoxHeading" nowrap><a href="http://shops.fhceramics.com/reviews.php"><img src="images/infobox/arrow_right.gif" width="12" height="10" border="0" alt="more" title="more"></a><img src="images/pixel_trans.gif" width="11" height="14" border="0" alt=""></td>
 </tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="1" class="infoBox">
 <tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="3" class="infoBoxContents">
 <tr>
<td><img src="images/pixel_trans.gif" width="100%" height="1" border="0" alt=""></td>
 </tr>
 <tr>
<td class="boxText">There are currently no product reviews</td>
 </tr>
 <tr>
<td><img src="images/pixel_trans.gif" width="100%" height="1" border="0" alt=""></td>
 </tr>
</table>
</td>
 </tr>
</table>
		</td>
	  </tr>
<!-- reviews_eof //-->
<!-- languages //-->
	  <tr>
		<td>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr>
<td height="14" class="infoBoxHeading"><img src="images/infobox/corner_right_left.gif" width="11" height="14" border="0" alt=""></td>
<td width="100%" height="14" class="infoBoxHeading">Languages</td>
<td height="14" class="infoBoxHeading" nowrap><img src="images/pixel_trans.gif" width="11" height="14" border="0" alt=""></td>
 </tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="1" class="infoBox">
 <tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="3" class="infoBoxContents">
 <tr>
<td><img src="images/pixel_trans.gif" width="100%" height="1" border="0" alt=""></td>
 </tr>
 <tr>
<td align="center" class="boxText"> <a href="http://shops.fhceramics.com/index.php?language=en"><img src="includes/languages/english/images/icon.gif" width="24" height="15" border="0" alt="English" title="English"></a> </td>
 </tr>
 <tr>
<td><img src="images/pixel_trans.gif" width="100%" height="1" border="0" alt=""></td>
 </tr>
</table>
</td>
 </tr>
</table>
		</td>
	  </tr>
<!-- languages_eof //-->
<!-- currencies //-->
	  <tr>
		<td>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr>
<td height="14" class="infoBoxHeading"><img src="images/infobox/corner_right_left.gif" width="11" height="14" border="0" alt=""></td>
<td width="100%" height="14" class="infoBoxHeading">Currencies</td>
<td height="14" class="infoBoxHeading" nowrap><img src="images/pixel_trans.gif" width="11" height="14" border="0" alt=""></td>
 </tr>
</table>
<table border="0" width="100%" cellspacing="0" cellpadding="1" class="infoBox">
 <tr>
<td><table border="0" width="100%" cellspacing="0" cellpadding="3" class="infoBoxContents">
 <tr>
<td><img src="images/pixel_trans.gif" width="100%" height="1" border="0" alt=""></td>
 </tr>
 <tr>
<td align="center" class="boxText"><form name="currencies" action="http://shops.fhceramics.com/index.php" method="get"><select name="currency" onChange="this.form.submit();" style="width: 100%"><option value="USD" SELECTED>US Dollar</option><option value="CAD">Canadian Dollar</option></select></form></td>
 </tr>
 <tr>
<td><img src="images/pixel_trans.gif" width="100%" height="1" border="0" alt=""></td>
 </tr>
</table>
</td>
 </tr>
</table>
		</td>
	  </tr>
<!-- currencies_eof //-->
<!-- right_navigation_eof //-->
</table></td>
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<table border="0" width="100%" cellspacing="0" cellpadding="1">
 <tr class="footer">
<td class="footer">??Monday 14 August, 2006??</td>
<td align="right" class="footer">??6402 requests since Wednesday 19 April, 2006??</td>
 </tr>
</table>
<br>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr>
<td align="center" class="smallText">
Copyright ? 2003 <a href="http://www.oscommerce.com" target="_blank">osCommerce</a><br>Powered by <a href="http://www.oscommerce.com" target="_blank">osCommerce</a>	</td>
 </tr>
</table>
<br>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
 <tr>
<td align="center"><a href="http://shops.fhceramics.com/redirect.php?action=banner&goto=1" target="_blank"><img src="images/banners/oscommerce.gif" width="760" height="155" border="0" alt="osCommerce" title="osCommerce"></a></td>
 </tr>
</table>
<!-- footer_eof //-->
<br>
</body>
</html>

, hopefully this will give one of you an idea of where I should start looking to correct the problem. Again thanks for any help as when it comes to php I am a newbie.

 

Looking at the source code of the page (found your site in your profile) it seems that instead of calling the modules/new_products.php the modules/product_listing.php (?) or something else is called. The select count(p.products_id) as total is typically code generated by the splitPageResults class. Since your site doesn't show new products I would start looking at the includes/modules/new_products.php file.

 

There is also something wrong with:

  if (isset($HTTP_GET_VARS['info_message']) && tep_not_null($HTTP_GET_VARS['info_message'])) {
?>

begin visible on the page.

 

Also the $nbsp in the Javascript should end with a ; :)

document.write('Only?');document.write(days+1 + ' Days To Seeleys

Link to comment
Share on other sites

Don't know if this will help solve where to look for the glitch but it only appears on category and subcategory pages where the categories have sub-categories... hope this helps

Link to comment
Share on other sites

Don't know if this will help solve where to look for the glitch but it only appears on category and subcategory pages where the categories have sub-categories... hope this helps
I guess once the error is found it all makes perfect sense, but not in this moment. I guess there is a } missing or something like that.

 

The quickest way out I think it to go back to the backup of your file before you added the hide categories and then try again. It might be something in the first 150 lines...

Link to comment
Share on other sites

  • 1 month later...

I tested out this contrib on my sandbox store and all worked fine. I then set up a new store for a customer of mine and immediately installed both SPPC and Hide for SPPC. The first mod works as advertized, but the Hide mod doesn't work.

This is my set up - 3 groups, Retail, Wholesale, and VIP. I also have 5 top level categories - Livestock, Supplies, Deadstock, Merchandise, VIP.

When I created top level category VIP I hid it from Retail and Wholesale; however it continues to show itself for guests except on the login page, and it shows for logged in users that are not in the VIP group except on the 'My Account' page.

 

A possibly unrelated issue that I'm having is that the 'Checkout' link isn't working right. If I hover over the link it shows the correct location, which should be something like:

 

https://secure.technospider.com/~ts_tgearheart/catalog/checkout_shipping.php?osCsid=xxx

 

But when I click on it part of the correct link is stripped out like so:

 

https://secure.technospider.com/catalog/checkout_shipping.php?osCsid=xxx

 

That obviously creates an error. Even if I copy the link and paste it, it pastes correctly but when I press enter it gets rewritten with the missing directory.

 

The shop is located at http://www.tarantulaspiders.com/catalog/ - I'd really appreciate any help.

 

Thanks,

David

 

PS - I know I'm using a self-signed security cert, if you could just trust it for the sake of testing I'd appreciate it.

Link to comment
Share on other sites

When I created top level category VIP I hid it from Retail and Wholesale; however it continues to show itself for guests except on the login page, and it shows for logged in users that are not in the VIP group except on the 'My Account' page.
The interesting thing is that if you open the store for the first time, the VIP doesn't show, once you hit a subdirectory or any other page it does and if you go to the front page again it now shows up (unless you throw away the osCsid cookie and do a reload, then it is gone again).

 

Do you have caching enabled? If so, perhaps the cache was fillled when you were browsing as a customer from a group that is allowed to see VIP?

 

No clue about the SSL stuff I'm afraid. Perhaps a configure setting? I believe there is a thread on SSL in the General Support part.

Link to comment
Share on other sites

The interesting thing is that if you open the store for the first time, the VIP doesn't show, once you hit a subdirectory or any other page it does and if you go to the front page again it now shows up (unless you throw away the osCsid cookie and do a reload, then it is gone again).

 

Do you have caching enabled? If so, perhaps the cache was fillled when you were browsing as a customer from a group that is allowed to see VIP?

I do, but I deleted the cache files in the admin section, then reset my browser and the issue still persists. I then went into the admin section again and turned caching off completely and the problem went away. Then I went to my test server and turned cache on and the problem started there as well. So there probably needs to be an update to the mod to make it work correctly with cache turned on.

 

No clue about the SSL stuff I'm afraid. Perhaps a configure setting? I believe there is a thread on SSL in the General Support part.

That sucks, I was hoping for, " Oh yeah, change line 468 of blah.php and all your problems will go away."

Oh well.

 

The catalog files themselves are safe to move to another installation as long as I change the configure.php files correctly right? I'm thinking I should just package up my working test environment and move it to the production site.

Link to comment
Share on other sites

i'm having a bit of trouble with the hide products from customer groups contrib. when i modify index.php as suggested in the instructions for version 2.01 of this contrib, i get mysql syntax errors when attempting to view product categories, e.g. view /catalog/index.php?cPath=21:

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and find_in_set('0', products_hide_from_groups) = 0 and find_in_set('0', c.cate' at line 1

 

select count(p.products_id) as total and find_in_set('0', products_hide_from_groups) = 0 and find_in_set('0', c.categories_hide_from_groups) = 0

 

[TEP STOP]

 

AFAICT, this comes from the concatenated mysql statements that the contrib adds in lines 205-250 of index.php:

 

// BOF SPPC Hide products and categories from groups

$listing_sql .= " and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 ";

$listing_sql .= " and find_in_set('" . $customer_group_id . "', c.categories_hide_from_groups) = 0 ";

// EOF SPPC Hide products and categories from groups

 

i will try re-editing index.php as suggested in the contrib instructions even though i couldn't find any errors in my first editing attempt. the apache logs didn't show any PHP errors, so any further insights as to the problem would be appreciated. the admin interface does appear to be working.

 

btw, i'm running mysql-5.0.21.

Link to comment
Share on other sites

i'm having a bit of trouble with the hide products from customer groups contrib. when i modify index.php as suggested in the instructions for version 2.01 of this contrib, i get mysql syntax errors when attempting to view product categories, e.g. view /catalog/index.php?cPath=21:

 

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and find_in_set('0', products_hide_from_groups) = 0 and find_in_set('0', c.cate' at line 1

 

select count(p.products_id) as total and find_in_set('0', products_hide_from_groups) = 0 and find_in_set('0', c.categories_hide_from_groups) = 0

 

[TEP STOP]

 

AFAICT, this comes from the concatenated mysql statements that the contrib adds in lines 205-250 of index.php:

 

// BOF SPPC Hide products and categories from groups

$listing_sql .= " and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 ";

$listing_sql .= " and find_in_set('" . $customer_group_id . "', c.categories_hide_from_groups) = 0 ";

// EOF SPPC Hide products and categories from groups

 

i will try re-editing index.php as suggested in the contrib instructions even though i couldn't find any errors in my first editing attempt. the apache logs didn't show any PHP errors, so any further insights as to the problem would be appreciated. the admin interface does appear to be working.

 

btw, i'm running mysql-5.0.21.

It is not a matter of the MySQL version, it works fine on MySQL 5.0.12. However, the query should be:

select count(p.products_id) as total from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id left join specials_retail_prices s on p.products_id = s.products_id, products_to_categories p2c left join categories c using(categories_id) where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id = '19' and find_in_set('0', products_hide_from_groups) = 0 and find_in_set('0', c.categories_hide_from_groups) = 0

Something is very wrong in your file.

Perhaps you should try the index.php from the package and add other contributions to that, instead of the other way around...

Link to comment
Share on other sites

It is not a matter of the MySQL version, it works fine on MySQL 5.0.12. However, the query should be:

select count(p.products_id) as total from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id left join specials_retail_prices s on p.products_id = s.products_id, products_to_categories p2c left join categories c using(categories_id) where p.products_status = '1' and p.products_id = p2c.products_id and pd.products_id = p2c.products_id and pd.language_id = '1' and p2c.categories_id = '19' and find_in_set('0', products_hide_from_groups) = 0 and find_in_set('0', c.categories_hide_from_groups) = 0

Something is very wrong in your file.

Perhaps you should try the index.php from the package and add other contributions to that, instead of the other way around...

 

this instance of osC is heavily patched with contribs. if i were to use the original index.php, it would muck up my current live store.

 

the join commands you list remind me that i did have to fiddle a fair amount to fix the mysql syntax for the SPPC edits since the way join commands are evaluated had changed. i have read another thread where you have commented on this issue. i'll take a closer look at these edits and see if i can straighten these issues out.

 

is there a way to automate the application of the myriad file edits for contribs that will work on *nix? if not, let me know since i'm considering writing some C code to do this in the near future, as i find the manual editing to be very error-prone.

 

thx for your suggestions

Link to comment
Share on other sites

is there a way to automate the application of the myriad file edits for contribs that will work on *nix? if not, let me know since i'm considering writing some C code to do this in the near future, as i find the manual editing to be very error-prone.

On Windows I have read on several occasions that Compare and Merge (commercial) is the absolute best. A FOSS tool is KDiff3 that I personally haven't used on my Mac for merging, but it is a nice tool to find and show file differences.

 

On *nix (including Mac's of course) the classical tools are the diff and patch commands. Say you have the index.php from SPPC and the index.php from Hide products for groups for SPPC then you could use (other files as example):

diff -ub catalog4/admin/products_attributes.php cat_sppc/admin/products_attributes.php > cat_sppc/products_attributes.php.diff

The "u" in -ub is to make a unified diff which also uses surrounding lines of text to find differences (preferred way of doing it) and the "b" tells diff to ignore white-space difference. The second file in the command is the one with the changes (so diff -ub old_file new_file > patch_file).

 

To apply the changes in the patch_file (diff or patch appear to be the accepted extensions and because of Windows diff is probably preferred and most used anyway) you likely will want to see if the patch will not throw any errors. Then you first use:

patch --dry-run file_to_patch patch_file

and if everything seems to work fine you apply the patch. I would say use the command to also create a backup of the original file (with a .orig extension).

So having the diff in the same directory as the file to change and having changed path to that directory:

patch -b products_attributes.php products_attributes.php.diff

will create the patched file products_attributes.php and the backup products_attributes.php.orig.

 

I have only toyed with these commands so I haven't tried to use it on very different files but if you are on *nix anyway it is worth a try IMO.

Link to comment
Share on other sites

  • 7 months later...

when i hide a product and i finde it in the shop (lets say over the search) and would like to add it to cart or view the details i get...

[b]Fatal error[/b]: Class messagestack: Cannot inherit from undefined class  tablebox in  [b]/homepages/34/d70134280/htdocs/includes/classes/message_stack.php[/b]  on line [b]20[/b]

 

Thank you for your reply!

Link to comment
Share on other sites

when i hide a product and i finde it in the shop (lets say over the search) and would like to add it to cart or view the details i get...

[b]Fatal error[/b]: Class messagestack: Cannot inherit from undefined class  tablebox in  [b]/homepages/34/d70134280/htdocs/includes/classes/message_stack.php[/b]  on line [b]20[/b]

If you have a product hidden, you shouldn't be able to find it with search :)

 

The file that loads the class tablebox is includes/classes/boxes.php and is loaded right after the shopping cart actions (add, delete etc.) around line 500 in application_top.php:

// infobox
 require(DIR_WS_CLASSES . 'boxes.php');

Perhaps something went wrong when you added the code for hide products (which is rather elaborate on that page) so that that statement is now hidden inside an if/else?

Link to comment
Share on other sites

If you have a product hidden, you shouldn't be able to find it with search :)

 

yes, you are right! but i use newsletter products that i send to wholesale customers and they recive a email with links to the product! so when they click on that link it comes up that error message! i would more likely to have it say something like "Please log in to view product!"

 

is it possible?

 

MR-M

Link to comment
Share on other sites

yes, you are right! but i use newsletter products that i send to wholesale customers and they recive a email with links to the product! so when they click on that link it comes up that error message! i would more likely to have it say something like "Please log in to view product!"

 

is it possible?

Probably yes if you change some code (haven't tried it myself). You could add a get variable to the link in your newsletter say product_info.php?products_id=###&instruction=gotologin

Then in the top of product_info there is a query that checks if there is a product with that id and is the result is retrieved:

$product_check = tep_db_fetch_array($product_check_query);

 

A little further you find its use:

 

if ($product_check['total'] < 1) {

 

If you bring it higher up (also) before the rest of the page is displayed with a check on the get variable in your newsletter you can do a redirect to login.php with another get parameter with the products_id, show the message please login and after they login you redirect them to the page with the products_id. The redirect in login.php is already used there:

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

	if (sizeof($navigation->snapshot) > 0) {
	  $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
	  $navigation->clear_snapshot();
	  tep_redirect($origin_href);
	} else {
	  tep_redirect(tep_href_link(FILENAME_DEFAULT));
	}

Just add some additional code for your case :)

Link to comment
Share on other sites

  • 9 months later...

how can i only hide the price of the product rather than the product itself

 

ie it would say Please login to see the price. and also this should only apply for SELECTED products from admin. ie a tick box sayin hide from non-members

 

can anyone help me

 

 

Many Many Thanks in advance

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