Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

Hi all,

 

I have a problem with SPPC.

When i start my webshop, it doesn't show the pictures of the products next to it. The link of the descibtion works, but not the link of the pictures itself. It says, there isn't a product.

 

Second when i try to add a product to the shopping cart, it gives an error:

 

1052 - Column: 'products_id' in where clause is ambiguous

 

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

 

[TEP STOP]

 

Can someone please give me some tips, so i can dissolve the problem?

If i need to post more information, no problem, just say which information you need.

 

Thanks in advance!

 

Regards, Gijs

Link to comment
Share on other sites

Gijs,

See the post previous to yours for the query you need to change (in includes/classes/shopping_cart.php function add_cart).

 

Hi JanZ,

 

Did that and it worked.

Solved that problem! Thanks.

 

New problem is when i click on the different categories, i get the productlist, but don't see the pictures belonging to the specific product. It's a red cross and links to a page, which says there isn't a product.

 

The link via the text works tho..

 

Any tips?

 

Thanks.

 

regards,

 

Gijs

Link to comment
Share on other sites

If you copied all the code from this post into your shopping cart you have a problem because in the function restore_contents there is additional code for the Hide products from customers for SPPC contribution.

 

The only thing that needed to be changed in the SPPP attributes mod is one query in the function add_cart because it wasn't compatible with MySQL4 (but worked fine in MySQL5):

// BOF SPPC attribute hide check, original query expanded to include attributes
	$check_product_query = tep_db_query("select p.products_status, options_id, options_values_id, attributes_hide_from_groups, '0' as hide_attr_status from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_ATTRIBUTES . " using(products_id) where p.products_id = '" . (int)$products_id . "'");

MySQL would complain about products_id being ambiguous in version 4 (because you make a join between the two tables on that products_id it shouldn't make the slightest difference which products_id you take...).

Thank yoy very much, Janz. Now, all perfectly. Notwithstanding, with the other code for Hide products, commenting the line 118, (//$hide_status_products = tep_get_hide_status($hide_status_products, $this->cg_id, $temp_post_get_array)), also go (apparently). Newly Thank you and Happy new year.

Edited by Marcial
Link to comment
Share on other sites

New problem is when i click on the different categories, i get the productlist, but don't see the pictures belonging to the specific product. It's a red cross and links to a page, which says there isn't a product.
Are you sure you used the modules/product_listing.php from the package or did you add the code yourself (because you have a template?). Then perhaps you didn't change a $listing['field_name'] to $listing[$x]['field_name'] ... real easy to miss one.

 

Not new year yet :) but <lang=nl>"een goed uiteinde"</lang>.

Link to comment
Share on other sites

No, that should work fine IMHO.

 

Well - I am totally lost now :( I have added the

&& $this->cg_id != '1'

to all of the if statements (except the last one which seems to control whether or not things are properly removed from the database on "remove") and the option still shows up for both customer groups instead of just retail (which is cg_id 0).

 

This is what the code looks like now:

class freeamount {
var $code, $title, $description, $icon, $enabled;

// class constructor
function freeamount() {
  global $order, $customer;
  if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {
  $this->ccg_id = $_SESSION['sppc_customer_group_id'];
  } else {
 $this->cg_id = '0';
 }
  $this->code = 'freeamount';
  $this->title = MODULE_SHIPPING_FREEAMOUNT_TEXT_TITLE;
  $this->description = MODULE_SHIPPING_FREEAMOUNT_TEXT_DESCRIPTION;
  $this->sort_order = MODULE_SHIPPING_FREEAMOUNT_SORT_ORDER;
  $this->icon ='';
  $this->enabled = ((MODULE_SHIPPING_FREEAMOUNT_STATUS == 'True') ? true : false);

  if ( ($this->enabled == true) && ($this->cg_id != '1') && ((int)MODULE_SHIPPING_FREEAMOUNT_ZONE > 0) ) {

	$check_flag = false;
	$check_query = tep_db_query("select zone_id, zone_country_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_FREEAMOUNT_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
	$order_shipping_country = $order->delivery['country']['id'];

	while ($check = tep_db_fetch_array($check_query)) {

	  if ($check['zone_id'] < 1 && $this->cg_id != '1') {
		$check_flag = true;
		break;
//		  } elseif ($check['zone_id'] == $order->delivery['zone_id']) {
	  } elseif ($check['zone_country_id'] == $order->delivery['country']['id'] && $this->cg_id != '1') {
		$check_flag = true;
		break;
	  }
	}
	if ($check_flag == false && $this->cg_id != '1') {
	  $this->enabled = false;
	}
 }
}

// class methods
function quote($method = '') {
  global $order, $cart, $shipping_weight;

  $dest_country = $order->delivery['country']['id'];
  $currency = $order->info['currency'];
  $get_total = false;
  $get_weight = false;
  $cart_total = $cart->show_total();

	if (MODULE_SHIPPING_FREEAMOUNT_HIDE_SPECIALS == 'True' && $this->cg_id != '1') {
	  // 28-9-2005 Check for articles on special which should not get free shipment
	  // Adjust the cart total price for this
	  $total_specials = 0;
	  if ($cart->count_contents() > 0 && $this->cg_id != '1') {
		 $products = $cart->get_products();
		 for ($i=0, $n=sizeof($products); $i<$n; $i++) {
			if ($special_price = tep_get_products_special_price($products[$i]['id']) && $this->cg_id != '1') {
			   $products_price = $special_price;
			   $total_specials += $products_price;
			}
		 }
	  }

	  $cart_total = $cart_total - $total_specials;
	}

  if ($cart_total < MODULE_SHIPPING_FREEAMOUNT_AMOUNT && $this->cg_id != '1')
  {
	if (MODULE_SHIPPING_FREEAMOUNT_DISPLAY == 'True' && $this->cg_id != '1')
	   {
		$this->quotes['error'] = MODULE_SHIPPING_FREEAMOUNT_TEXT_ERROR;
	   }
	$get_total = false;
   } else {
	$get_total = true;
   }

  if ($shipping_weight > MODULE_SHIPPING_FREEAMOUNT_WEIGHT_MAX && $this->cg_id != '1')
	  {
		if (MODULE_SHIPPING_FREEAMOUNT_DISPLAY == 'True' && $this->cg_id != '1')
		   {
			  $this->quotes['error'] = MODULE_SHIPPING_FREEAMOUNT_TEXT_TO_HEIGHT;
		   }
		$get_weight = false;
  } else {
   $get_weight = true;
  }

if (($get_total == true && $get_weight == true && $this->cg_id != '1'))
{
	$this->quotes = array('id' => $this->code,
							'module' => MODULE_SHIPPING_FREEAMOUNT_TEXT_TITLE,
							'methods' => array(array('id' => $this->code,
							'title' => MODULE_SHIPPING_FREEAMOUNT_TEXT_WAY,
							'cost' => MODULE_SHIPPING_FREEAMOUNT_COST)));
}


  if ($this->cg_id != '1' && tep_not_null($this->icon)) $this->quotes['icon'] = tep_image($this->icon, $this->title);

  return $this->quotes;

}

function check() {
  if (!isset($this->_check)) {
	$check_query = tep_db_query("select configuration_value from " . TABLE_CONFIGURATION . " where configuration_key = 'MODULE_SHIPPING_FREEAMOUNT_STATUS'");
	$this->_check = tep_db_num_rows($check_query);
  }
  return $this->_check;
}

function install() {
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Free Shipping with Minimum Purchase', 'MODULE_SHIPPING_FREEAMOUNT_STATUS', 'True', 'Do you want to offer minimum order free shipping?', '6', '7', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id,  sort_order, date_added) values ('Maximum Weight', 'MODULE_SHIPPING_FREEAMOUNT_WEIGHT_MAX', '10', 'What is the maximum weight you will ship?', '6', '8', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, set_function, date_added) values ('Enable Display', 'MODULE_SHIPPING_FREEAMOUNT_DISPLAY', 'True', 'Do you want to display text way if the minimum amount is not reached?', '6', '7', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id,  sort_order, date_added) values ('Minimum Cost', 'MODULE_SHIPPING_FREEAMOUNT_AMOUNT', '50.00', 'Minimum order amount purchased before shipping is free?', '6', '8', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id,  sort_order, set_function, date_added) values ('Disable for Specials', 'MODULE_SHIPPING_FREEAMOUNT_HIDE_SPECIALS', 'True', 'Do you want to disable free shipping for products on special?', '6', '7', 'tep_cfg_select_option(array(\'True\', \'False\'), ', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, date_added) values ('Sort Order', 'MODULE_SHIPPING_FREEAMOUNT_SORT_ORDER', '0', 'Sort order of display.', '6', '0', now())");
  tep_db_query("insert into " . TABLE_CONFIGURATION . " (configuration_title, configuration_key, configuration_value, configuration_description, configuration_group_id, sort_order, use_function, set_function, date_added) values ('Shipping Zone', 'MODULE_SHIPPING_FREEAMOUNT_ZONE', '0', 'If a zone is selected, only enable this shipping method for that zone.', '6', '0', 'tep_get_zone_class_title', 'tep_cfg_pull_down_zone_classes(', now())");
  }

function remove() {
  tep_db_query("delete from " . TABLE_CONFIGURATION . " where configuration_key in ('" . implode("', '", $this->keys()) . "')");
}

  function keys() {
 $keys = array(
	   'MODULE_SHIPPING_FREEAMOUNT_STATUS',
	   'MODULE_SHIPPING_FREEAMOUNT_WEIGHT_MAX',
	   'MODULE_SHIPPING_FREEAMOUNT_SORT_ORDER',
	   'MODULE_SHIPPING_FREEAMOUNT_DISPLAY',
	   'MODULE_SHIPPING_FREEAMOUNT_HIDE_SPECIALS',
	   'MODULE_SHIPPING_FREEAMOUNT_AMOUNT',
	   'MODULE_SHIPPING_FREEAMOUNT_ZONE'
	   );
 return $keys;
  }
}

 

What am I missing? Would it be easier to add the ability to choose the Customer Group in the Admin page (like how you choose the Shipping Zone)? Am I possibly adding that bit of code somewhere I shouldn't be? I'll keep playing with it and hope that you might be able to glance at it and see what I've done wrong in the meantime :blush:

~Tracy
 

Link to comment
Share on other sites

Well - I am totally lost now :( I have added the
&& $this->cg_id != '1'

to all of the if statements (except the last one which seems to control whether or not things are properly removed from the database on "remove") and the option still shows up for both customer groups instead of just retail (which is cg_id 0).

 

What am I missing? Would it be easier to add the ability to choose the Customer Group in the Admin page (like how you choose the Shipping Zone)? Am I possibly adding that bit of code somewhere I shouldn't be? I'll keep playing with it and hope that you might be able to glance at it and see what I've done wrong in the meantime :blush:

 

OMG - I think I stumbled upon getting it right :blush: I'm still testing to make sure, but it appears to be working properly so far. I took the

&& $this->cg_id != '1'

back out of the if statements and then re-edited just this portion of the code:

// class constructor
function freeamount() {
  global $order, $customer;
  if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {
  $this->ccg_id = $_SESSION['sppc_customer_group_id'];
  } else {
 $this->cg_id = '0';
 }
  $this->code = 'freeamount';
  $this->title = MODULE_SHIPPING_FREEAMOUNT_TEXT_TITLE;
  $this->description = MODULE_SHIPPING_FREEAMOUNT_TEXT_DESCRIPTION;
  $this->sort_order = MODULE_SHIPPING_FREEAMOUNT_SORT_ORDER;
  $this->icon ='';
  $this->enabled = ((MODULE_SHIPPING_FREEAMOUNT_STATUS == 'True') ? true : false);

  if ( ($this->enabled == true) && ((int)MODULE_SHIPPING_FREEAMOUNT_ZONE > 0) ) {

	$check_flag = false;
	$check_query = tep_db_query("select zone_id, zone_country_id from " . TABLE_ZONES_TO_GEO_ZONES . " where geo_zone_id = '" . MODULE_SHIPPING_FREEAMOUNT_ZONE . "' and zone_country_id = '" . $order->delivery['country']['id'] . "' order by zone_id");
	$order_shipping_country = $order->delivery['country']['id'];

	while ($check = tep_db_fetch_array($check_query)) {

	  if ($check['zone_id'] < 1 && $this->cg_id != '1') {
		$check_flag = true;
		break;
//		  } elseif ($check['zone_id'] == $order->delivery['zone_id']) {
	  } elseif ($check['zone_country_id'] == $order->delivery['country']['id'] && $this->cg_id != '1') {
		$check_flag = true;
		break;
	  }
	}
	if ($this->cg_id != '0' OR $check_flag == false) {
	  $this->enabled = false;
	}
 }
}

 

It appears that this section of the code determines whether or not the option is available. So I added the

&& $this->cg_id != '1'

to the two if statements that cause $check_flag to = true, and then I crossed my fingers and added

$this->cg_id != '0' OR

to the statement causes $check_flag to ==false.

 

Now - two questions - one is does the above code look correct to you? The other, is the "OR" operator ok to use? I've not used that before and I wasn't sure if it was a valid operator to have in a statement or not - LOL :blush:

 

I don't think I need a separate free shipping module for the wholesale group because we only offer the free shipping in the U.S. and the U.S. zone only uses the Table Rate - which automatically has anything over $200 as a shipping cost of $0. But is it possible to somehow add a message for orders over $200 in the wholesale customer group that they qualified for free shipping so they aren't confused when they just see the shipping rate as $0 ?

~Tracy
 

Link to comment
Share on other sites

I don't think anybody has written a contribution for this yet. I think you need to at least add code to the functions calculate and get_products in includes/classes/shopping_cart.php. You could put those products ID's in an array and then in the beginning of these functions see if $this->contents and that array of product ID's have one in common. If so set a variable you already declared to be zero to 1 and then when the price is queried check the product id first, if it is 46 then product_price is zero.

 

Hopefully, that will be enough to cover everything.

 

WOW! Well - it might just be easier to send them a gift certificate for $3.00 off their next order! I will go through my PHP books and see if I can learn enough to try to create what you have described though :blush:

~Tracy
 

Link to comment
Share on other sites

Now - two questions - one is does the above code look correct to you? The other, is the "OR" operator ok to use? I've not used that before and I wasn't sure if it was a valid operator to have in a statement or not - LOL
Much better at least than the one where you added that statement to about everything :)

The OR operator in php is two pipe charaters (the pipe character on my keyboard next to the enter key, [shift] backslash key: |)

I don't think I need a separate free shipping module for the wholesale group because we only offer the free shipping in the U.S. and the U.S. zone only uses the Table Rate - which automatically has anything over $200 as a shipping cost of $0. But is it possible to somehow add a message for orders over $200 in the wholesale customer group that they qualified for free shipping so they aren't confused when they just see the shipping rate as $0 ?
Can't you just check if the shipping cost is zero ($order->info['shipping_cost'] I assume) and then add a text on the place you like?
Link to comment
Share on other sites

Much better at least than the one where you added that statement to about everything :)

The OR operator in php is two pipe charaters (the pipe character on my keyboard next to the enter key, [shift] backslash key: |)

Can't you just check if the shipping cost is zero ($order->info['shipping_cost'] I assume) and then add a text on the place you like?

 

Ok - so I should replace the word "OR" with "||" in the code?

 

Yes, if I actually understood PHP much better than I currently do, I am sure I could just check the shipping cost and then add the text - but I have no idea yet what file to do that in and how or where to add the text to get it to show up where I want it and when I want it - LOL :blush: I am sure I will be revisiting that endeavor before too awful long - in the meantime I found a contribution that might solve my other issue of needing to make a product free if purchased with another product - it's called 2gether Discount (http://www.oscommerce.com/community/contributions,3929) - I'm in the process of checking it out right now and hopefully it will do what I need :)

~Tracy
 

Link to comment
Share on other sites

Ok - so I should replace the word "OR" with "||" in the code?

 

Yes, if I actually understood PHP much better than I currently do, I am sure I could just check the shipping cost and then add the text - but I have no idea yet what file to do that in and how or where to add the text to get it to show up where I want it and when I want it - LOL :blush: I am sure I will be revisiting that endeavor before too awful long - in the meantime I found a contribution that might solve my other issue of needing to make a product free if purchased with another product - it's called 2gether Discount (http://www.oscommerce.com/community/contributions,3929) - I'm in the process of checking it out right now and hopefully it will do what I need :)

 

Well - it looks like I'll be hitting the PHP books - LOL The 2gether Discount looked promising - but the creator hasn't posted to their support thread since Oct. 12th even though others have posted questions - so I don't have high hopes of hearing an answer back anytime soon :( I might be able to learn something from the code though - although they had it setup to use a database table.

 

I think these are my last two big issues though - getting the discount for the product that is free when purchased with certain other products and then setting up the ability for people to enter a discount code from their physical product catalog or a postcard and get a discount off of their order (that one I'm pretty sure I've seen modules for so I'm going to look for it) :)

 

Oh - if you could let me know if I should change the "or" to "||" in that one bit of code that would be great! Thank you soooo much for all of your help Jan - you are awesome!! :thumbsup:

~Tracy
 

Link to comment
Share on other sites

I don't think anybody has written a contribution for this yet. I think you need to at least add code to the functions calculate and get_products in includes/classes/shopping_cart.php. You could put those products ID's in an array and then in the beginning of these functions see if $this->contents and that array of product ID's have one in common. If so set a variable you already declared to be zero to 1 and then when the price is queried check the product id first, if it is 46 then product_price is zero.

 

Hopefully, that will be enough to cover everything.

 

Ok - I am trying to work through how to do this but I'm not real clear yet on the syntax of PHP as to where you need quotes or parenthesis and the {} symbols - etc...

 

So - here is the rough sketch (so to speak)

$freePacket = array ('70', '71', '150, '151', '156', '157', '158', '159', '162', '163', '164', '165', '172', '173', '174', '202', '208', '213');

function calculate() {
  $this->total = 0;
  $this->weight = 0;
  $this->disc = 0;
  if (!is_array($this->contents)) return 0;

  reset($this->contents);
  while (list($products_id, ) = each($this->contents)) {
	$qty = $this->contents[$products_id]['qty'];

 if $this->contents[$products_id] == 206 && $this->contents[$products_id] == $freePacket
	$this->disc = 3
 else
	$this->disc = 0

 

I placed the calculate function from the file you mentioned above into my notepad and then added the $freePacket array, the $this->disc = 0; and the if statement at the end. But I am pretty sure that I need some sort of quotes or {} or something in that if statement - and I have no idea if I'm even on the right track - LOL :blush: Does this look even close to starting to create what you said to? I realize that next I have to figure out how to tell the calculations to subtract that 3 from the subtotal - but I figure I'll start with the beginning and see if I can even get the code right to check for what I need - :blush:

~Tracy
 

Link to comment
Share on other sites

Hello, it wanted to know the code so that sppc in this file works if it is possible.

 

?php
//REMOVE THIS LINES IF YOU DON'T WANT TO SHOW THE HEADER
 $header_star_product = array();
 $header_star_product[] = array('align' => 'center', 'text' => sprintf(STAR_TITLE));
 new contentBoxHeading($header_star_product);
//END OF -REMOVE THIS LINES IF YOU DON'T WANT TO SHOW THE HEADER-

 function tep_star_product_with_attributes($products_id) {
 $attributes_query = tep_db_query("select count(*) as count from " . TABLE_PRODUCTS_ATTRIBUTES . " where products_id = '" . (int)$products_id . "'");
 $attributes = tep_db_fetch_array($attributes_query);

 if ($attributes['count'] > 0) {
return true;
 }
 else {
return false;
}
 }

 $star_products_query = tep_db_query("select substring(pd.products_description, 1, 598) as products_description, p.products_id, p.products_image, p.manufacturers_id, p.products_price, IF(s.status, s.specials_new_products_price, NULL) as specials_new_products_price, IF(s.status, s.specials_new_products_price, p.products_price) as final_price, p.products_tax_class_id, sp.product_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_STAR_PRODUCT . " sp left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where p.products_id = pd.products_id and p.products_status = '1' and pd.products_description != '' and p.products_id=sp.product_id and pd.language_id = '" . $languages_id . "'");
 $star_products = tep_db_fetch_array($star_products_query);
 $star_products['products_name'] = tep_get_products_name($star_products['products_id']);
 $evita_cortar_palabras = explode( ' ',  $star_products["products_description"] );
array_pop( $evita_cortar_palabras );
$star_products["products_description"]  = implode( ' ', $evita_cortar_palabras );

if (!tep_star_product_with_attributes($star_products['products_id'])) {
 $star_products["0"] = array('align' => 'center',
				  'params' => 'width="100%" valign="top"',
								  'text' => '<tr>
							 <td height="15%" width="85%" class="star-product-title">' . $star_products['products_name'] . '</td>
					   <td align="right"  height="100%" width="15%" rowspan="2"><a href="' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $star_products['products_id']) . '"' . ' target="popup"' . ' onClick="window.open(this.href, this.target, \'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width=' . SMALL_IMAGE_WIDTH . ', height=' . SMALL_IMAGE_HEIGHT . '\').focus(); return false;">' . tep_image(DIR_WS_IMAGES . $star_products['products_image'], $star_products['products_name'], SMALL_IMAGE_WIDTH*2, SMALL_IMAGE_HEIGHT*2) . '</a></td>
					 </tr>
					 <tr>
					   <td height="80%" width="85%" class="star-product">'. strip_tags($star_products["products_description"]) . '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, "products_id=" . $star_products["products_id"]). '">' . STAR_READ_MORE . '</a></td>
					 </tr>
					 <tr>
					   <td height="5%" width="85%" class="star-product-price" align="center">'.
$currencies->display_price($star_products['final_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</td>
					 </tr>
					 <tr>
					   <td><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, "products_id=" . $star_products["products_id"]). '">' . tep_image(DIR_WS_LANGUAGES . $language . '/images/buttons/more_info.gif') . '</a>' . tep_draw_separator('pixel_trans.gif', '10', '10') . '<a href="' . tep_href_link(FILENAME_DEFAULT, tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $star_products['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_IN_CART) . '</a></td>
					 </tr>');
$star_products_output = array_slice($star_products, sizeof($star_products)-1);
new contentBox($star_products_output);
}

else {
 $star_products["0"] = array('align' => 'center',
				  'params' => 'width="100%" valign="top"',
								  'text' => '<tr>
							 <td height="15%" width="85%" class="star-product-title">' . $star_products['products_name'] . '</td>
					   <td align="right"  height="100%" width="15%" rowspan="2"><a href="' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $star_products['products_id']) . '"' . ' target="popup"' . ' onClick="window.open(this.href, this.target, \'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, copyhistory=no, width=' . SMALL_IMAGE_WIDTH . ', height=' . SMALL_IMAGE_HEIGHT . '\').focus(); return false;">' . tep_image(DIR_WS_IMAGES . $star_products['products_image'], $star_products['products_name'], SMALL_IMAGE_WIDTH*2, SMALL_IMAGE_HEIGHT*2) . '</a></td>
					 </tr>
					 <tr>
					   <td height="80%" width="85%" class="star-product">'. strip_tags($star_products["products_description"]) . '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, "products_id=" . $star_products["products_id"]). '">' . STAR_READ_MORE . '</a></td>
					 </tr>
					 <tr>
					   <td height="5%" width="85%" class="star-product-price" align="center">'.
$currencies->display_price($star_products['final_price'], tep_get_tax_rate($listing['products_tax_class_id'])) . '</td>
					 </tr>
					 <tr>
					   <td><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, "products_id=" . $star_products["products_id"]). '">' . tep_image(DIR_WS_LANGUAGES . $language . '/images/buttons/more_info.gif') . '</a>' . tep_draw_separator('pixel_trans.gif', '10', '10') . '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $star_products['products_id']) . '">' . tep_image_button('button_buy_now.gif', IMAGE_BUTTON_IN_CART) . '</a></td>
					 </tr>');
new contentBox($star_products);
}
?>

 

if please they could help with the code.

 

thank you very much

Link to comment
Share on other sites

Hi JanZ,

 

I am attempting to install the Hide Products from Customer Groups for SPPC v2.0.1 and I'm running into a problem :blush:

 

It doesn't seem to be working for me at the moment and I'm guessing it has to do with getting it to work with the other contrib's I have installed. The first thing that I thought of was that there is a product_info.php inside the includes/modules/sts_inc folder

 

Would you happen to already know the changes needed to get this working with STS? Just figured I'd ask before I go and post the code for the page for you to see what needs tweaking :blush:

 

I'm also curious - I had this bit of code on the column_right.php page in the area you said to replace - but it wasn't listed in the lines of code to be replaced or in the lines of code doing the replacing:

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

 

Do we not need that bit of code in the column_right.php page anymore?

 

Oh - I do have Master Products installed as well, and saw that much of the code to be changed had also been modified by Master Products - so I went through it all by hand to edit it making sure the p.products_master and p.products_master_status or p.products_listing items were in the queries they needed to be in, etc...

 

Anyway - I'm at least not getting any errors at the moment - but that makes it harder to tell why it's not wanting to work. I have one product that I entered that I only want available to wholesale customers. So - doesn't this mean that I should only see that product if I am logged in as a wholesaler? If I'm not logged in, or logged in as Retail - I should not see the product - correct?

 

Example: http://mmherbs.dreamhosters.com/pararid-p-79.html

(The case should only show for wholesale customers)

 

Being that I am not getting any errors (that I've found so far) but I am also not having success I'm guessing I need to add code to one of the STS pages - what do you think?

~Tracy
 

Link to comment
Share on other sites

Hi JanZ,

 

I am attempting to install the Hide Products from Customer Groups for SPPC v2.0.1 and I'm running into a problem :blush:

 

PS - is there a debug print_r($somethinghere) I could put into one of the pages that would give us enough information to know what part is not functioning properly?

 

PSS - it not only shows the supposedly hidden product - but it also allows me to go through checkout with it as well. Is there maybe somewhere in admin that I am supposed to "Install" or "turn on" the Hide Products from Customer Groups for SPPC feature? I went through the product catalog and set the slave product to be hidden from Retail - is that all I need to do?

~Tracy
 

Link to comment
Share on other sites

I am attempting to install the Hide Products from Customer Groups for SPPC v2.0.1 and I'm running into a problem :blush:

 

It doesn't seem to be working for me at the moment and I'm guessing it has to do with getting it to work with the other contrib's I have installed. The first thing that I thought of was that there is a product_info.php inside the includes/modules/sts_inc folder

 

Would you happen to already know the changes needed to get this working with STS? Just figured I'd ask before I go and post the code for the page for you to see what needs tweaking

I know nothing of STS. But from your description of the problem you seem to have an issue with product_info.php. The "hide" logic is added to the $product_check_query in the beginning of the file. For the Hide Products mod the code to ascertain the $customer_group_id is moved to before that $product_check_query. If you haven't than that might be the problem.
I'm also curious - I had this bit of code on the column_right.php page in the area you said to replace - but it wasn't listed in the lines of code to be replaced or in the lines of code doing the replacing:

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

 

Do we not need that bit of code in the column_right.php page anymore?

That is code from a contribution, it is up to you if you still want that box or not. It is not standard osC code.
PS - is there a debug print_r($somethinghere) I could put into one of the pages that would give us enough information to know what part is not functioning properly?
No, not really. If it works you don't see the page (although there are a lot of places were a product can turn up, in seach for example), if it doesn't you do :D

 

PSS - it not only shows the supposedly hidden product - but it also allows me to go through checkout with it as well. Is there maybe somewhere in admin that I am supposed to "Install" or "turn on" the Hide Products from Customer Groups for SPPC feature? I went through the product catalog and set the slave product to be hidden from Retail - is that all I need to do?
Yes, that is all you need to do. If you checked in as wholesale than there is nothing wrong. If you logged-in as retail it should have been thrown out of the cart in the function restore_contents in includes/classes/shopping_cart.php.
Link to comment
Share on other sites

Francisco,

Hello, it wanted to know the code so that sppc in this file works if it is possible.
I think this changed part should give you correct prices (haven't tested it though)

 

// BOF SPPC: next query: specials left out
 $star_products_query = tep_db_query("select substring(pd.products_description, 1, 598) as products_description, p.products_id, p.products_image, p.manufacturers_id, p.products_price, pd.products_name, NULL as specials_new_products_price, p.products_price as final_price, p.products_tax_class_id, sp.product_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_STAR_PRODUCT . " sp where p.products_id = pd.products_id and p.products_status = '1' and pd.products_description != '' and p.products_id=sp.product_id and pd.language_id = '" . $languages_id . "'");
 $star_products = tep_db_fetch_array($star_products_query);
// pd.products_name added to query
 // $star_products['products_name'] = tep_get_products_name($star_products['products_id']);

// global variable (session) $sppc_customer_group_id -> local variable customer_group_id

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

// get customer group price if customer not retail
if ($customer_group_id != '0') {
 $pg_query = tep_db_query("select customers_group_price as price from " . TABLE_PRODUCTS_GROUPS . " pg where pg.products_id = '" . $star_products['products_id'] . "' and pg.customers_group_id = '".$customer_group_id."' ");
	 if ($cg_price = tep_db_fetch_array($pg_query)) {
		 $star_products['products_price'] = $cg_price['price'];
		 $star_products['final_price'] = $cg_price['price'];
	 }
}

// get special price for the customer group, tep_get_products_special_price is aware of customer group
if ($special_price = tep_get_products_special_price($star_products['products_id'])) {
	$star_products['specials_new_products_price'] = $special_price;
	$star_products['final_price'] = $special_price;
}
// EOF SPPC	
 $evita_cortar_palabras = explode( ' ',  $star_products["products_description"] );
array_pop( $evita_cortar_palabras );
$star_products["products_description"]  = implode( ' ', $evita_cortar_palabras );

Link to comment
Share on other sites

Francisco,

I think this changed part should give you correct prices (haven't tested it though)

 

// BOF SPPC: next query: specials left out
 $star_products_query = tep_db_query("select substring(pd.products_description, 1, 598) as products_description, p.products_id, p.products_image, p.manufacturers_id, p.products_price, pd.products_name, NULL as specials_new_products_price, p.products_price as final_price, p.products_tax_class_id, sp.product_id from " . TABLE_PRODUCTS . " p, " . TABLE_PRODUCTS_DESCRIPTION . " pd, " . TABLE_STAR_PRODUCT . " sp where p.products_id = pd.products_id and p.products_status = '1' and pd.products_description != '' and p.products_id=sp.product_id and pd.language_id = '" . $languages_id . "'");
 $star_products = tep_db_fetch_array($star_products_query);
// pd.products_name added to query
 // $star_products['products_name'] = tep_get_products_name($star_products['products_id']);

// global variable (session) $sppc_customer_group_id -> local variable customer_group_id

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

// get customer group price if customer not retail
if ($customer_group_id != '0') {
 $pg_query = tep_db_query("select customers_group_price as price from " . TABLE_PRODUCTS_GROUPS . " pg where pg.products_id = '" . $star_products['products_id'] . "' and pg.customers_group_id = '".$customer_group_id."' ");
	 if ($cg_price = tep_db_fetch_array($pg_query)) {
		 $star_products['products_price'] = $cg_price['price'];
		 $star_products['final_price'] = $cg_price['price'];
	 }
}

// get special price for the customer group, tep_get_products_special_price is aware of customer group
if ($special_price = tep_get_products_special_price($star_products['products_id'])) {
	$star_products['specials_new_products_price'] = $special_price;
	$star_products['final_price'] = $special_price;
}
// EOF SPPC	
 $evita_cortar_palabras = explode( ' ',  $star_products["products_description"] );
array_pop( $evita_cortar_palabras );
$star_products["products_description"]  = implode( ' ', $evita_cortar_palabras );

 

I have Star Product also. I have tested it and it works. Thank You! I would appreciate if you could adapt the above code for "Hide products" as well.

 

Thanks again! :)

Link to comment
Share on other sites

I would appreciate if you could adapt the above code for "Hide products" as well.
:huh: I downloaded that contribution this evening and it only let you set one (1) product as a star product.

 

If you want to be able to set a different star product for each customer group you would have to add customers_group_id smallint UNSIGNED NOT NULL default '0' to the table star_product, move the customer_group lookup code to above the query and add and sp.customers_group_id = '" . $customer_group_id. "' to the query. Make sure that you have that table filled with phpMyAdmin because the admin part is not changed for SPPC. Or did you mean something else?

Link to comment
Share on other sites

:huh: I downloaded that contribution this evening and it only let you set one (1) product as a star product.

 

If you want to be able to set a different star product for each customer group you would have to add customers_group_id smallint UNSIGNED NOT NULL default '0' to the table star_product, move the customer_group lookup code to above the query and add and sp.customers_group_id = '" . $customer_group_id. "' to the query. Make sure that you have that table filled with phpMyAdmin because the admin part is not changed for SPPC. Or did you mean something else?

 

Hi, JanZ!

 

I have Hide products from customer groups for SPPC 2.0.1 installed also, and what I mean is to be able to hide the Star Product from certain customer groups. And yes, it would have been good if one could add more than one product as a Star.

 

There is another contribution called Impulse Item that is good in that products can be added to the Shopping Cart page and there being used as a temptation, like in physical stores where they place candy and such at the Checkout. If you can find the time, please would you mind look into that contribution aswell.

Link to comment
Share on other sites

Janz, to thank of all heart well and I to like to request please that you reviewed when you have available the archives that I need so that my Web comienze to work and where after to have leido the 155 pages not to find anything clear in addition to the code which I walk looking for.

 

if you can help ire little by little me writing the archives that I have left to cause that they are compatible with sppc and if your aid is possible to be been thankful to you eternally.

 

Modulo central de Productos Destacados

(Contribucion Featured Products,

version: Featured Products 1.5.8 Complete Pack - de nicko107 - de fecha 11 Oct 2006 )

archivo: catalog/includes/modules/featured.php

 

?>
<!-- featured_products //-->
<?php
if(FEATURED_PRODUCTS_DISPLAY == 'true')
{
 $featured_products_category_id = $new_products_category_id;
 $cat_name_query = tep_db_query("select categories_name from " . TABLE_CATEGORIES_DESCRIPTION . " where categories_id = '" . $featured_products_category_id . "' limit 1");
 $cat_name_fetch = tep_db_fetch_array($cat_name_query);
 $cat_name = $cat_name_fetch['categories_name'];
 $info_box_contents = array();

 if ( (!isset($featured_products_category_id)) || ($featured_products_category_id == '0') ) {
$info_box_contents[] = array('align' => 'left', 'text' => '<a class="headerNavigation" href="' . tep_href_link(FILENAME_FEATURED_PRODUCTS) . '">' . TABLE_HEADING_FEATURED_PRODUCTS . '</a>');

 list($usec, $sec) = explode(' ', microtime());
 srand( (float) $sec + ((float) $usec * 100000) );
 $mtm= rand();

$featured_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price, p.products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id left join " . TABLE_FEATURED . " f on p.products_id = f.products_id where p.products_status = '1' and f.status = '1' order by rand($mtm) DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS);
 } else {
$info_box_contents[] = array('align' => 'left', 'text' => sprintf(TABLE_HEADING_FEATURED_PRODUCTS_CATEGORY, $cat_name));
$subcategories_array = array();
tep_get_subcategories($subcategories_array, $featured_products_category_id);
$featured_products_category_id_list = tep_array_values_to_string($subcategories_array);
if ($featured_products_category_id_list == '') {
  $featured_products_category_id_list .= $featured_products_category_id;
} else {
  $featured_products_category_id_list .= ',' . $featured_products_category_id;
}
$featured_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, s.status as specstat, s.specials_new_products_price, p.products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c using(products_id) left join " . TABLE_CATEGORIES . " c using(categories_id) left join " . TABLE_FEATURED . " f on p.products_id = f.products_id left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id where c.parent_id = '" . $featured_products_category_id . "' and p.products_status = '1' and f.status = '1' order by rand() DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS);
}

 $row = 0;
 $col = 0; 
 $num = 0;
 while ($featured_products = tep_db_fetch_array($featured_products_query)) {
$num ++; if ($num == 1) { new contentBoxHeading($info_box_contents); }
$featured_products['products_name'] = tep_get_products_name($featured_products['products_id']);
if($featured_products['specstat']) {
  $info_box_contents[$row][$col] = array('align' => 'center',
									   'params' => 'class="smallText" width="33%" valign="top"',
									   'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . $featured_products['products_name'] . '</a><br><s>' . $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '</s><br><span class="productSpecialPrice">' . 
									   $currencies->display_price($featured_products['specials_new_products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])) . '</span>');
} else {
  $info_box_contents[$row][$col] = array('align' => 'center',
									   'params' => 'class="smallText" width="33%" valign="top"',
									   'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products['products_image'], $featured_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products['products_id']) . '">' . $featured_products['products_name'] . '</a><br>' . $currencies->display_price($featured_products['products_price'], tep_get_tax_rate($featured_products['products_tax_class_id'])));
}	
$col ++;
if ($col > 2) {
  $col = 0;
  $row ++;
}
 }
 if($num) {

  new contentBox($info_box_contents);
 }
} else // If it's disabled, then include the original New Products box
{
  // include (DIR_WS_MODULES . FILENAME_NEW_PRODUCTS); // disable for dont show if desactive the feature module
}
?>
<!-- featured_products_eof //-->

 

thank you very much janz beforehand by your inestimable and disinterested aid.

Link to comment
Share on other sites

happy new year!

 

I´ve searched through this thread but I did not find the answer to my question.

 

I just installed SPPC 4.1.1. and it is working fine BUT ;-)

 

In admin panel I am able to create new groups. When I want to edit a customer I get this error:

 

Warning: reset() [function.reset]: Passed variable is not an array or object in /www/htdocs/..../..../admin/includes/classes/object_info.php on line 17

Warning: Variable passed to each() is not an array or object in /www/htdocs/..../..../admin/includes/classes/object_info.php on line 18

 

and no database entries are shown (name etc. )

 

any idea? many thanx

 

Moni

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