Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

One other page with a difference in code that could be problematic:

 

catalog/products_new.php

 

Just after this line of code:

<td valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new[$x]['products_id']) . '"><b><u>' . $products_new[$x]['products_name'] . '</u></b></a><br>' . TEXT_DATE_ADDED . ' ' . tep_date_long($products_new[$x]['products_date_added']) . '<br>' . TEXT_MANUFACTURER . ' ' . $products_new[$x]['manufacturers_name'] . '<br><br>' . TEXT_PRICE . ' ' . $products_price; ?></td>

 

Is this for Master Products

<!--Master Products //-->		   
<?php if ($products_new['products_master_status'] != '1' && $products_new['products_master'] =='0') {
?>				
		<td align="right" valign="middle" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCTS_NEW, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new[$x]['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>'; ?></td>
<?php
} elseif ($products_new['products_master'] != '0') {
?>
		<td align="right" valign="middle" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_master']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>'; ?></td>
<?php
} else {
?>			
		<td align="right" valign="middle" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '">' . tep_image_button('button_in_cart.gif', IMAGE_BUTTON_IN_CART) . '</a>'; ?></td>
<?php
}
?>
<!--Master Products EOF //-->

 

So far I haven't spotted anything that I can see obviously would affect a customer groups ability to checkout. But at least if nothing else I'll learn if any of these other items could cause issues down the road if they aren't tweaked to work with the Hide Products for SPPC contrib :blush:

~Tracy
 

Link to comment
Share on other sites

  if ( $cart->count_contents() > 0 ) {
include(DIR_WS_BOXES . 'suggested_accessories.php');
 }

 

What would be the proper way to adjust that bit of code for Hide Products?

The code in includes/boxes/suggested_accessories.php :)
Anything there look to you like it could cause a problem?
At least not the problem that you cannot checkout. Either application_top.php or checkout_shipping.php is sending you back to the shopping cart page or the link checkhout shipping does not go to checkout_shipping.php but to shopping_cart.php. Or something strange, I don't how STS works.
Link to comment
Share on other sites

I have added the entire sql file and I am still getting the message; 1054 - Unknown column 'attributes_hide_from_groups' in 'where clause'

 

the file I added was appc_v41_install.sql

 

Please let me know if this is the right one.

Yes, that is good, but the attributes_hide_from_groups is from the add-on for the attributes and that also needed some sql to add:

CREATE TABLE `products_attributes_groups` (
 `products_attributes_id` int(11) NOT NULL default '0',
 `customers_group_id` smallint(5) NOT NULL default '0',
 `options_values_price` decimal(15,4) NOT NULL default '0.0000',
 `price_prefix` char(1) NOT NULL default '',
 `products_id` int(11) NOT NULL default '0',
 PRIMARY KEY  (`customers_group_id`,`products_attributes_id`)
) TYPE=MyISAM;

ALTER TABLE `products_attributes`
ADD `attributes_hide_from_groups` varchar(255) NOT NULL default '@';

At least the last one seems not to have been executed...

Link to comment
Share on other sites

The code in includes/boxes/suggested_accessories.php :)

At least not the problem that you cannot checkout. Either application_top.php or checkout_shipping.php is sending you back to the shopping cart page or the link checkhout shipping does not go to checkout_shipping.php but to shopping_cart.php. Or something strange, I don't how STS works.

 

Well - I think I've posted all the differences in application_top.php already. checkout_shipping.php wasn't even touched by adding the Hide Products contrib :huh:

 

I can't find a Checkout button in checkout_shipping.php but I do have one in catalog/shopping_cart.php - it looks like this:

<td align="right" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '">' . tep_image_button('button_checkout.gif', IMAGE_BUTTON_CHECKOUT) . '</a>'; ?></td>

 

I don't know of anywhere else to look for the code for that button. It just seems really weird to me that it is only affecting one customer group :huh:

 

I'm going to test what happens if I comment out the line of code in application_top that says if the cart is empty to re-load the shopping_cart page and see what happens <_<

~Tracy
 

Link to comment
Share on other sites

Francisco,

Hello Janz to be able to respond me to my questions if it is possible that they are in the previous page? the same thing is by not post 2 times. thanks and a hug
When you asked about the featured_products the post I linked to contained the code for the box also. Regarding srolling specials, if you look in the includes/boxes/specials.php and see how that is changed it is very, very similar to the way that needs to be changed in the scrolling specials.
Link to comment
Share on other sites

I'm going to test what happens if I comment out the line of code in application_top that says if the cart is empty to re-load the shopping_cart page and see what happens <_<

 

Ok - I meant the code in checkout_shipping.php - LOL But anyway, I commented it out completely and it still won't let me go past the shopping cart as a Wholesale customer :( Apparently it isn't the cart contents that is causing it. I will check on the STS forum and see if there is any other spot for the code that runs the checkout button :blink:

~Tracy
 

Link to comment
Share on other sites

But anyway, I commented it out completely and it still won't let me go past the shopping cart as a Wholesale customer :( Apparently it isn't the cart contents that is causing it. I will check on the STS forum and see if there is any other spot for the code that runs the checkout button
Does it happen when you change user group when logging-in or do you use another user for checking wholesale. Just guessing... this seems to defy all logic.
Link to comment
Share on other sites

Does it happen when you change user group when logging-in or do you use another user for checking wholesale. Just guessing... this seems to defy all logic.

 

I am using my master account to log in. So I log in and choose "Retail" for my customer type and it allows me to go through checkout like it should. But if I log in and choose "Wholesale" for my customer type it won't let me get past the shopping_cart.php page.

 

It doesn't seem to matter if I try first as a Retail or as a Wholesale customer - I get the same results regardless. :blink:

~Tracy
 

Link to comment
Share on other sites

I am using my master account to log in. So I log in and choose "Retail" for my customer type and it allows me to go through checkout like it should. But if I log in and choose "Wholesale" for my customer type it won't let me get past the shopping_cart.php page.

 

It doesn't seem to matter if I try first as a Retail or as a Wholesale customer - I get the same results regardless. :blink:

 

PS - I've also posted on Master Products and SPPC to see if there are any files in those respective contributions that affect the function of the Checkout button. I e-mailed Kristen as well just in case the new Discount Coupon Codes that I'm helping test affects it in any way. I don't think any of those 3 affect it - but all I can do is wait and see :blush:

~Tracy
 

Link to comment
Share on other sites

PS - I've also posted on Master Products and SPPC to see if there are any files in those respective contributions that affect the function of the Checkout button. I e-mailed Kristen as well just in case the new Discount Coupon Codes that I'm helping test affects it in any way. I don't think any of those 3 affect it - but all I can do is wait and see :blush:

 

Well - I'm not sure if this is it or not - but I found includes/modules/sts_inc/product_info.php file that has a few queries in it and has been updated to work with SPPC and Master Products - so maybe it needs some changes for Hide Products for SPPC too?

 

$products_id=intval($_GET['products_id']);
// Create variables for product ID, added in v4.0.6	
$template['productid'] = $products_id;
$template['productsid'] = $products_id; // Just for consistende with osC names

// Start the "Add to Cart" form
$template_pinfo['startform'] = tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_slave'));
// Add the hidden form variable for the Product_ID
$template_pinfo['startform'] .= tep_draw_hidden_field('products_id', $products_id);
$template_pinfo['endform'] = "</form>";

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

// Get product information from products_id parameter
$product_info_query = tep_db_query("select p.products_master_status, p.products_id, pd.products_name, pd.products_description, p.products_model, p.products_quantity, p.products_image, pd.products_url, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_date_available, p.manufacturers_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = '" . $products_id . "' and pd.products_id = p.products_id and pd.language_id = '" . (int)$languages_id . "'");
$product_info = tep_db_fetch_array($product_info_query);

// START Master Products
$master_query = tep_db_query("select products_id from " . TABLE_PRODUCTS . " where products_master =  '" . (int)$HTTP_GET_VARS['products_id'] . "'");
   $results = tep_db_fetch_array($master_query);

// BOF Separate Price per Customer

	$scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $products_id . "' and customers_group_id =  '" . $customer_group_id . "'");
	if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) {
	$product_info['products_price']= $scustomer_group_price['customers_group_price'];
}
// EOF Separate Price per Customer
$products_price = '<s>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</s> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
} else {

// BOF Separate Price per Customer
	$scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . $products_id . "' and customers_group_id =  '" . $customer_group_id . "'");
	if ($scustomer_group_price = tep_db_fetch_array($scustomer_group_price_query)) {
	$product_info['products_price']= $scustomer_group_price['customers_group_price'];
}
// EOF Separate Price per Customer


  $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
}

if ($product_info['products_price']>0) {
  $qty_array = array();
  for ($i=0; $n2 = (($product_info['products_quantity'] < 20) ? $product_info['products_quantity'] : 20), $i <= $n2; $i++) {
	$qty_array[] = array('id' => $i, 'text' => $i); 
  }
  if (($product_info['products_quantity'] > 0) || (STOCK_CHECK == 'false')) {
	$template_pinfo['qtyproducts']= TEXT_QUANTITY . '  ' . tep_draw_pull_down_menu('Qty_ProdId_' . $product_info['products_id'], $qty_array);
  } else {
	  $template_pinfo['qtyproducts']= TEXT_STOCK;
					  }
}				

$template_pinfo['slaveproducts']='';
if (($results['products_id'] != null) && ($product_info['products_master_status'] == 1)) {
  $sts->start_capture();
	  echo ' ';
  include(DIR_WS_MODULES . FILENAME_MASTER_PRODUCTS);
	  echo ' ';
  $sts->stop_capture ('slaveproducts', 'box');
  $template_pinfo['slaveproducts']= $sts->template['slaveproducts'];
	}
// END Master Products

$template_pinfo['regularprice'] = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
  $template_pinfo['regularpricestrike'] = "<s>" . $template_pinfo['regularprice'] . "</s>";
  $template_pinfo['specialprice'] = $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id']));
} else {
  $template_pinfo['specialprice'] = '';
  $template_pinfo['regularpricestrike'] = $template_pinfo['regularprice'];
}

$template_pinfo['productname'] = $product_info['products_name'];
$template_pinfo['productmodel'] =  $product_info['products_model'];

if (tep_not_null($product_info['products_image'])) {
 $template_pinfo['imagesmall'] = tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"');
 $template_pinfo['imagelarge'] = tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), '','','');
 $template_pinfo['product_popup']= '<script language="javascript"><!--'."\n".
							   'document.write(\'<a href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . (int)$products_id) . '\\\')">' . $template_pinfo['imagesmall'] . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>\');'."\n".
							   '//--></script>'."\n".
							   '<noscript>'."\n".
							   '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">'.$template_pinfo['imagesmall'] . '<br>' . TEXT_CLICK_TO_ENLARGE .'</a>'."\n".
							   '</noscript>'."\n";
} else {
 $template_pinfo['imagesmall'] ='';
 $template_pinfo['imagelarge'] ='';
 $template_pinfo['product_popup']='';	
}

$template_pinfo['productdesc'] = stripslashes($product_info['products_description']); 

// Get the number of product attributes (the select list options)
$products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");
$products_attributes = tep_db_fetch_array($products_attributes_query);
// If there are attributes (options), then...
if ($products_attributes['total'] > 0) {
 // Print the options header
 $template_pinfo['optionheader'] = TEXT_PRODUCT_OPTIONS;

 // Select the list of attribute (option) names
 $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' order by popt.products_options_name");

 while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
$products_options_array = array();
$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");

// For each option name, get the individual attribute (option) choices
while ($products_options = tep_db_fetch_array($products_options_query)) {
  $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);

  // If the attribute (option) has a price modifier, include it
  if ($products_options['options_values_price'] != '0') {
	$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
  }

}

// If we should select a default attribute (option), do it here
if (isset($cart->contents[$_GET['products_id']]['attributes'][$products_options_name['products_options_id']])) {
  $selected_attribute = $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']];
} else {
  $selected_attribute = false;
}

$template_pinfo['optionnames'] .= $products_options_name['products_options_name'] . ':<br>'; 
$template_pinfo['optionchoices'] .=  tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute) . "<br>"; 
 }
} else {
 // No options, blank out the template variables for them
 $template_pinfo['optionheader'] = '';
 $template_pinfo['optionnames'] = '';
 $template_pinfo['optionchoices'] = '';
}

// See if there are any reviews
$reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$_GET['products_id'] . "'");
$reviews = tep_db_fetch_array($reviews_query);
if ($reviews['count'] > 0) {
 $template_pinfo['reviews'] = TEXT_CURRENT_REVIEWS . ' ' . $reviews['count']; 
} else {
 $template_pinfo['reviews'] = '';
}

// See if there is a product URL
if (tep_not_null($product_info['products_url'])) {
 $template_pinfo['moreinfolabel'] = TEXT_MORE_INFORMATION;
 $template_pinfo['moreinfourl'] = tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false); 
} else {
 $template_pinfo['moreinfolabel'] = '';
 $template_pinfo['moreinfourl'] = '';
}

$template_pinfo['moreinfolabel'] = str_replace('%s', $template_pinfo['moreinfourl'], $template_pinfo['moreinfolabel']);

// See if product is not yet available
if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
 $template_pinfo['productdatelabel'] = TEXT_DATE_AVAILABLE;
 $template_pinfo['productdate'] = tep_date_long($product_info['products_date_available']);
} else {
 $template_pinfo['productdatelabel'] = TEXT_DATE_ADDED;
 $template_pinfo['productdate'] = tep_date_long($product_info['products_date_added']); 
}

// Strip out %s values
$template_pinfo['productdatelabel'] = str_replace('%s.', '', $template['productdatelabel']);

// See if any product reviews
$template_pinfo['reviewsurl'] = tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params());
$template_pinfo['reviewsbutton'] = tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS);
$template_pinfo['addtocartbutton'] = tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART);

// See if any "Also Purchased" items. Feature added in v4.0.6
$sts->start_capture();
if ((USE_CACHE == 'true') && empty($SID)) {
  echo tep_cache_also_purchased(3600);
} else {
  include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
}
$sts->stop_capture ('alsopurchased'); // Get the result to the main array
$template_pinfo['alsopurchased']= $sts->template['alsopurchased']; // Put it in the product info

~Tracy
 

Link to comment
Share on other sites

Does it happen when you change user group when logging-in or do you use another user for checking wholesale. Just guessing... this seems to defy all logic.

 

WOOHOO!!! Kristen found it!! It was in the includes/classes/order.php file - I had apparently missed an edit I should have done when updating the files for testing v3.0 Discount Coupon Codes. Apparently something was happening in the order.php file that was causing the Subtotal to show as 0 - which was causing the checkout_shipping.php file, in the check order total minimum section, to send the Wholesale customer back to the shopping cart page because they have a minimum order amount and it thought the order subtotal was $0.

 

YAY!!! :D :D It all seems to be working now - and at least this is something that is already fixed in the Discount Coupon Codes v3.0 contrib - so when it's out of testing and ready for launch it shouldn't be a problem for others :thumbsup:

 

Ok - now on to the next project- adding another contrib - LOL ;)

~Tracy
 

Link to comment
Share on other sites

Ok - I'm back to modifying some of my extra pages/contributions so that they work properly with Hide Products and Categories from Customer Groups for SPPC.

 

I have the All Products contribution installed to allow the customer to browse a list of all of our products from A-Z.

 

I know I need to add

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

 if ($customer_group_id == '0')  {
$listing_sql = "NEW QUERY HERE"
}else{
$listing_sql = "NEW 2nd QUERY HERE"

 

I'm not very good at these queries yet and this one looks much much different from the others that Hide Products has modified so I'm guessing it's outdated for MySQL 5. What would you recommend as the best way to re-write this query? As is I'm not even quite sure where to add the "and find in set" bit :huh:

// listing all products
$listing_sql = "select p.products_id, p.products_master_status, p.products_model, pd.products_name, pd.products_description, p.products_image, p.products_price, p.products_tax_class_id, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id AND p.products_master_status = 1 and pd.language_id = '" . $languages_id . "' left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id  $where order by pd.products_name";

 

Thank you :)

~Tracy
 

Link to comment
Share on other sites

Hello i have this error :

Fatal error: Call to undefined function: tep_get_hide_status() in /homepages/18/d174112975/htdocs/demo/includes/classes/shopping_cart.php on line 77

 

 

 

the changes in shopping cart are ok :

// BOF SPPC hide products and categories from groups
		$no_of_products_in_basket = 0;
  while ($_products = tep_db_fetch_array($products_query)) {
	$temp_post_get_array[] = $_products['products_id'];
			$products[] = $_products;
			$no_of_products_in_basket += 1;
		}
 if ($no_of_products_in_basket > 0) {
			$hide_status_products = array();
	[color=#FF0000]line77=====>[/color]	$hide_status_products = tep_get_hide_status($hide_status_products, $this->cg_id, $temp_post_get_array);
			for ($i=0; $i < $no_of_products_in_basket; $i++) {
				foreach($hide_status_products as $key => $subarray) {
					if ($subarray['products_id'] == tep_get_prid($products[$i]['products_id']) && $subarray['hidden'] == '0') {
				// not hidden for this customer, can be added to the object shoppingCart
	$this->contents[$products[$i]['products_id']] = array('qty' => $products[$i]['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[$i]['products_id']) . "'");
					  while ($attributes = tep_db_fetch_array($attributes_query)) {
					  $this->contents[$products[$i]['products_id']]['attributes'][$attributes['products_options_id']] = $attributes['products_options_value_id'];
					  }
					} elseif ($subarray['products_id'] == tep_get_prid($products[$i]['products_id']) && $subarray['hidden'] == '1') {
// product is hidden for the customer, don't add to object shoppingCart, delete from db next
							 $products_to_delete_from_cb[] = $products[$i]['products_id'];
					} // end if/elseif
				}// end foreach ($hide_status_products as $key => $subarray)
  } // end for ($i=0; $i < $no_of_products_in_basket; $i++)

 // 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))
} // end if ($no_of_products_in_basket > 0)
// EOF SPPC hide products and categories from groups

 

the changes in :

catalog/includes/functions/general.php

catalog/includes/application_top.php are ok

 

MS2

Edited by NEMROD34
Link to comment
Share on other sites

Hello i have this error :

Fatal error: Call to undefined function: tep_get_hide_status() in /homepages/18/d174112975/htdocs/demo/includes/classes/shopping_cart.php on line 77

 

the changes in :

catalog/includes/functions/general.php

catalog/includes/application_top.php are ok

Sure? Since tep_get_hide_status was added to catalog/includes/functions/general.php you shouldn't have gotten that error. You didn't paste it in general.php after the closing PHP tag ( ?> ) did you?
Link to comment
Share on other sites

I have the All Products contribution installed to allow the customer to browse a list of all of our products from A-Z.

 

I know I need to add

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

 if ($customer_group_id == '0')  {
$listing_sql = "NEW QUERY HERE"
}else{
$listing_sql = "NEW 2nd QUERY HERE"

I'm not sure about the second part for hide products. Since the queries there always use the $customer_group_id it doesn't need to be different necessarily. I would advice to change the first part to:

  if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {
 $customer_group_id = $_SESSION['sppc_customer_group_id'];
 } else {
  $customer_group_id = '0';
 }

The reason is that $_SESSION['sppc_customer_group_id'] is always available but $sppc_customer_group_id might not be a global (yet).

 

I'm not very good at these queries yet and this one looks much much different from the others that Hide Products has modified so I'm guessing it's outdated for MySQL 5. What would you recommend as the best way to re-write this query? As is I'm not even quite sure where to add the "and find in set" bit

That's a royal pain. It was for a good reason that tep_get_hide_status was added to the functions because one product might be in several categories. So in a query like this you cannot really join it with products_to_categories and then join again with categories to find out if it is in a hidden category. If the product is in more than one category it will be shown more than once...

 

You can add the products_hide_from_groups in the query but you have to put that in the $where. Since tep_get_hide_status looks for that too you can skip that (see further).

// listing all products
$listing_sql = "select p.products_id, p.products_master_status, p.products_model, pd.products_name, pd.products_description, p.products_image, p.products_price, p.products_tax_class_id,  NULL as specials_new_products_price, p.products_date_added, m.manufacturers_name from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on p.manufacturers_id = m.manufacturers_id left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on p.products_id = pd.products_id AND p.products_master_status = 1 and pd.language_id = '" . $languages_id . "'  $where order by pd.products_name";

What I would try to do (but I haven't looked at the code for all products) is to first get a list of product_id's (like is done in the product listing), send the array of product_id's to tep_get_hide_status and also do a query for the specials (depending on customer group id being zero or something else makes that quite different, different tables) and then remove the product when it should be hidden (see the previous post with the shopping_cart code for inspiration) and add the special prices.

Link to comment
Share on other sites

What I would try to do (but I haven't looked at the code for all products) is to first get a list of product_id's (like is done in the product listing), send the array of product_id's to tep_get_hide_status and also do a query for the specials (depending on customer group id being zero or something else makes that quite different, different tables) and then remove the product when it should be hidden (see the previous post with the shopping_cart code for inspiration) and add the special prices.

 

Ok - I admit I'm lost :( I'll look at it again with a fresh set of eyes tomorrow. I'm not sure if I need specials though- as the only thing that happens with a "special" is that a product gets a discounted price on it. The way I use the all products contrib. is just one big long list of all of the products in the store from A-Z. I just show their names (no prices) and then when the customer clicks on it the resulting page will give them the appropriate information for price. It only shows the Master Products and they don't have prices anyway ;)

 

I think all it needs to do is make sure that none of the product names it gets from the database should be hidden from that customer group. :blush:

~Tracy
 

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?

 

I have been working on adapting the Thumbnail Quick Category Browse contrib. all day - I've finally got the query pulling all of the products in the category AND subcategories that the browser is in - but it only lists one row before making you click to see the next.

 

What I want is (I thought) a simple list of all of the product names (with links) for product in any given category and it's sub-categories. It seems I have the list, but instead of being listed as:

 

Product A

Product B

Product C

etc....

 

I have:

 

Product A

 

displaying 1 to 1 of 57 products etc.....

 

My limited abilities are just causing me nothing but stress with this one today. >_< If anybody knows how to change something so it displays multiple rows the info would be greatly appreciated :D I had tried doing this at one point through Dreamweaver - but the script that it uses to cause the "do while" function to work doesn't do anything but cause errors when I use it in an osC site :(

~Tracy
 

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.

 

Thanks,

EricK

Link to comment
Share on other sites

Hi All,

 

I am using SPPC + Price Breaks plus another 1/2 dozen contribs....

(so I am a bit on topic!)

 

Now Im asked if I could add a feature to display products that should be considered by a shopper, when they are viewing the details of a given product.

 

These contribs seem to be available to make this happen.

Related Products3.3 or XSell2.3 or Family Products 3.4

 

Can anyone assist with advice on which of these contribs are best ?

Link to comment
Share on other sites

Hello JanZ, thanks for reply.

 

My general.php:

// BOF SPPC, hide products and categories from groups

function tep_get_hide_status_single($customer_group_id, $pid_for_hide) {

$hide_query = tep_db_query("select find_in_set('" . $customer_group_id . "', products_hide_from_groups) as hide_or_not, find_in_set('" . $customer_group_id . "', categories_hide_from_groups) as in_hidden_category from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) left join " . TABLE_CATEGORIES . " c using(categories_id) where p.products_id = '" . $pid_for_hide . "'");

// since a product can be in more than one category (linked products) we have to check for the

// possibility of more than one row returned

while ($_hide_product_array = tep_db_fetch_array($hide_query)) {

$hide_product_array[] = $_hide_product_array;

}

foreach ($hide_product_array as $key => $hide_product_sub_array) {

if ($hide_product_sub_array['hide_or_not'] != '0') {

$hide_product = true;

}

// if the product is also present in a category that is not hidden it should be possible

// to buy it, delete it, get notifications etcetera

elseif ($hide_product_sub_array['in_hidden_category'] == '0') {

$hide_product = false;

// no need to continue with foreach

break;

} elseif ($hide_product_sub_array['in_hidden_category'] != '0') {

$hide_product = true;

}

} // end foreach ($hide_product_array as $key => $hide_product_sub_array)

return $hide_product;

}

 

function tep_get_hide_status($hide_status_products, $customer_group_id, $temp_post_get_array) {

foreach ($temp_post_get_array as $key => $value) {

$int_products_id = tep_get_prid($value);

// the November 13 updated MS2.2 function tep_get_prid

// can return false with an invalid products_id

if ($int_products_id != false ) {

$int_products_id_array[] = $int_products_id;

}

$list_of_products_ids = implode(',', $int_products_id_array);

} // end foreach ($temp_post_get_array as $key => $value)

 

$hide_query = tep_db_query("select p.products_id, find_in_set('".$customer_group_id."', products_hide_from_groups) as hide_or_not, find_in_set('".$customer_group_id."', categories_hide_from_groups) as in_hidden_category from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) left join " . TABLE_CATEGORIES . " c using(categories_id) where p.products_id in (" . $list_of_products_ids . ")");

// since a product can be in more than one category (linked products) we have to check for the

// possibility of more than one row returned for each products_id where "hide_or_not"

// is the same for every row, but "in_hidden_category" can be different

unset($int_products_id_array); // start over

$int_products_id_array = array();

if (tep_not_null($hide_status_products)) {

foreach($hide_status_products as $key => $subarray) {

$int_products_id_array[] = $hide_status_products['products_id'];

}

} // end if (tep_not_null($hide_status_products))

while ($hide_products_array = tep_db_fetch_array($hide_query)) {

$cat_hidden = '1';

$prod_hidden = '0';

if ($hide_products_array['hide_or_not'] != '0') {

$prod_hidden = '1';

} elseif ($hide_products_array['in_hidden_category'] == '0') {

$cat_hidden = '0';

}

if ($prod_hidden == '0' && $cat_hidden == '0') {

$hidden = '0';

} else {

$hidden = '1';

}

if (in_array($hide_products_array['products_id'], $int_products_id_array)) {

foreach($hide_status_products as $key => $subarray) {

if ($subarray['products_id'] == $hide_products_array['products_id']) {

if ($subarray['hidden'] == '1' && $subarray['prod_hidden'] == '0' && $cat_hidden == '0') {

// product is not a hidden one and now found to be in a category that is not hidden

$hide_status_products[$key]['hidden'] = '0';

}

} // end if ($subarray['products_id'] == $hide_products_array['products_id'])

} // end foreach ($hide_status_products as $key => $subarray)

} else {

$hide_status_products[] = array('products_id' => $hide_products_array['products_id'], 'hidden' => $hidden, 'prod_hidden' => $prod_hidden);

}

$int_products_id_array[] = $hide_products_array['products_id'];

} // end while

return $hide_status_products;

}

// EOF SPPC, hide products and categories from groups

 

?>

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

It's ok no ?

Edited by NEMROD34
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

 

 

But :

// Attributes in product list for QTpro - EOF

break;

}

 

$list_box_contents[$cur_row][] = array('align' => $lc_align,

'params' => 'class="productListing-data"',

'text' => $lc_text);

 

}

}

 

new productListingBox($list_box_contents);

 

$list_box_contents = array();

 

$list_box_contents[0] = array('params' => 'class="productListing-odd"');

$list_box_contents[0][] = array('params' => 'class="productListing-data"',

'text' => TEXT_NO_PRODUCTS);

 

new productListingBox($list_box_contents);

}

 

if ( ($listing_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3')) ) {

?>

<table border="0" width="100%" cellspacing="0" cellpadding="2">

<tr>

<td class="smallText"><?php echo $listing_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS); ?></td>

<td class="smallText" align="right"><?php echo TEXT_RESULT_PAGE . ' ' . $listing_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></td>

</tr>

</table>

<?php

}

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

?????

 

My Sql 5

Link to comment
Share on other sites

What I would try to do (but I haven't looked at the code for all products) is to first get a list of product_id's (like is done in the product listing), send the array of product_id's to tep_get_hide_status and also do a query for the specials (depending on customer group id being zero or something else makes that quite different, different tables) and then remove the product when it should be hidden (see the previous post with the shopping_cart code for inspiration) and add the special prices.

 

Hi JanZ,

 

I'm going through the code for the all products contrib. Right now I have it showing the results through allprods.php (rather than product_listing.php). It appears as though I should be able to use the code from master_listing.php (which is also used in place of product_listing.php) for the Hide Products modifications.

 

Looking through master_listing.php - the main difference I see is that the "and find in set" part was added to the query (in master_products.php) and the following bit of code was added to the master_listing.php page:

// BOF SPPC Hide products and categories from groups
$master_sql .= " and find_in_set('".$customer_group_id."', products_hide_from_groups) = 0 ";
$master_sql .= " and find_in_set('".$customer_group_id."', c.categories_hide_from_groups) = 0 ";
// EOF SPPC Hide products and categories from groups

 

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?

 

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.

 

Anyway - it looks (in my brain at least) like it should do the trick - just thought I'd verify :blush:

 

I can post the code if you would like (just trying not to fill the screen again - LOL) :blush:

~Tracy
 

Link to comment
Share on other sites

Hi JanZ,

 

Anyway - it looks (in my brain at least) like it should do the trick - just thought I'd verify :blush:

 

I can post the code if you would like (just trying not to fill the screen again - LOL) :blush:

 

Ugh - found a glitch >_<

 

I made the edits to the allprods pages - but I can't test to see if it worked at the moment because my attempt to test it found a separate issue <_<

 

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 :(

 

Being that my admin/categories.php file is now over 1900 lines in length I don't really want to post it here. Could you let me know what bit of code is causing the change to save in the database so I can then find where in my long file it's missing? That page is sooo modified at the moment that I have a hard time even attempting WinMerge with it at the moment - and with the duplicate info for Master Products (one section for slaves and one for masters) it's hard for me to pinpoint what I missed without knowing what I'm looking for.

 

If you know which bit of code does that - then I can see where it was placed for the slave products so I'll know where to look in the code for the master products :blush:

 

Thank you!

~Tracy
 

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