Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Seperate Pricing Per Customer v3.5


scendent

Recommended Posts

Hello everybody!

 

First of all I want to say a big Thanks to everyone spending time for coding and sharing their knowledge in the form of contributions and support in the forums!

 

I have no php knowledges and am not able to solve this problem for myself:

 

I want to build in "JanZ?s SPPC attributes mod" but I?m not able to get it work because I have already the "Option Type Feature" and "Attribute Sort Order" Contributions installed in the part of product_info.php.

I tried several times but always received Parse errors.

 

So could someone please be so kind and add this part of JanZ?s mod:

 

// BOF SPPC attributes mod
   $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id 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 . "'");
$list_of_prdcts_attributes_id = '';
$products_options = array(); // makes sure this array is empty again
   while ($_products_options = tep_db_fetch_array($products_options_query)) {
$products_options[] = $_products_options;
$list_of_prdcts_attributes_id .= $_products_options['products_attributes_id'].",";
}

 if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0') {
	$select_list_of_prdcts_attributes_ids = "(" . substr($list_of_prdcts_attributes_id, 0 , -1) . ")";
$pag_query = tep_db_query("select products_attributes_id, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES_GROUPS . " where products_attributes_id IN " . $select_list_of_prdcts_attributes_ids . " AND customers_group_id = '" . $customer_group_id . "'");
while ($pag_array = tep_db_fetch_array($pag_query)) {
 $cg_attr_prices[] = $pag_array;
}

// substitute options_values_price and prefix for those for the customer group (if available)
if ($customer_group_id != '0' && tep_not_null($cg_attr_prices)) {
for ($n = 0; $n < count($products_options); $n++) {
 for ($i = 0; $i < count($cg_attr_prices); $i++) {
  if ($cg_attr_prices[$i]['products_attributes_id'] == $products_options[$n]['products_attributes_id']) {
  $products_options[$n]['price_prefix'] = $cg_attr_prices[$i]['price_prefix'];
  $products_options[$n]['options_values_price'] = $cg_attr_prices[$i]['options_values_price'];
  }
 } // end for ($i = 0; $i < count($cg_att_prices); $i++)
}
   } // end if ($customer_group_id != '0' && (tep_not_null($cg_attr_prices))
 } // end if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0')

 for ($n = 0; $n < count($products_options); $n++) {
	 $products_options_array[] = array('id' => $products_options[$n]['products_options_values_id'], 'text' => $products_options[$n]['products_options_values_name']);
	 if ($products_options[$n]['options_values_price'] != '0') {
	   $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options[$n]['price_prefix'] . $currencies->display_price($products_options[$n]['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
	 }
   }
// EOF SPPC attributes mod

 

to this part of my current product_info.php:

 

 

		  <table border="0" cellspacing="0" cellpadding="2">
		<tr>
		  <td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td>
		</tr>
<?php
		//clr 030714 update query to pull option_type
  $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name, popt.products_options_type, popt.products_options_length, popt.products_options_comment 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)) {
			//clr 030714 add case statement to check option type
	switch ($products_options_name['products_options_type']) {
	  case PRODUCTS_OPTIONS_TYPE_TEXT:
		//CLR 030714 Add logic for text option
		$products_attribs_query = tep_db_query("select distinct patrib.options_values_price, patrib.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = '" . $products_options_name['products_options_id'] . "'");
		$products_attribs_array = tep_db_fetch_array($products_attribs_query);
		$tmp_html = '<input type="text" name ="id[' . TEXT_PREFIX . $products_options_name['products_options_id'] . ']" size="' . $products_options_name['products_options_length'] .'" maxlength="' . $products_options_name['products_options_length'] . '" value="' . $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$products_options_name['products_options_id']] .'">  ' . $products_options_name['products_options_comment'];
		if ($products_attribs_array['options_values_price'] != '0') {
		  $tmp_html .= '(' . $products_attribs_array['price_prefix'] . $currencies->display_price($products_attribs_array['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .')';
		}
?>
		<tr>
		  <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
		  <td class="main"><?php echo $tmp_html;  ?></td>
		</tr>
<?php
		break;

	  case PRODUCTS_OPTIONS_TYPE_TEXTAREA:
		//CLR 030714 Add logic for text option
		$products_attribs_query = tep_db_query("select distinct patrib.options_values_price, patrib.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = '" . $products_options_name['products_options_id'] . "'");
		$products_attribs_array = tep_db_fetch_array($products_attribs_query);
	$tmp_html = '<textarea onKeyDown="textCounter(this,\'progressbar' . $products_options_name['products_options_id'] . '\',' . $products_options_name['products_options_length'] . ')" 
							   onKeyUp="textCounter(this,\'progressbar' . $products_options_name['products_options_id'] . '\',' . $products_options_name['products_options_length'] . ')" 
							   onFocus="textCounter(this,\'progressbar' . $products_options_name['products_options_id'] . '\',' . $products_options_name['products_options_length'] . ')" 
							   wrap="soft" 
							   name="id[' . TEXT_PREFIX . $products_options_name['products_options_id'] . ']" 
							   rows=5 
							   id="id[' . TEXT_PREFIX . $products_options_name['products_options_id'] . ']" 
							   value="' . $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$products_options_name['products_options_id']] . '"></textarea>
					<div id="progressbar' . $products_options_name['products_options_id'] . '" class="progress"></div>
					<script>textCounter(document.getElementById("id[' . TEXT_PREFIX . $products_options_name['products_options_id'] . ']"),"progressbar' . $products_options_name['products_options_id'] . '",' . $products_options_name['products_options_length'] . ')</script>';?>	<!-- DDB - 041031 - Form Field Progress Bar //-->
		<tr>
<?php
		if ($products_attribs_array['options_values_price'] != '0') {
?>
		  <td class="main"><?php echo $products_options_name['products_options_name'] . '<br>(' . $products_options_name['products_options_comment'] . ' ' . $products_attribs_array['price_prefix'] . $currencies->display_price($products_attribs_array['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . ')'; ?></td>
<?php	   } else {
?>
		  <td class="main"><?php echo $products_options_name['products_options_name'] . '<br>(' . $products_options_name['products_options_comment'] . ')'; ?></td>
<?php		}
?>
		  <td class="main"><?php echo $tmp_html;  ?></td>
		</tr>
<?php
		break;

	  case PRODUCTS_OPTIONS_TYPE_RADIO:
		//CLR 030714 Add logic for radio buttons
		$tmp_html = '<table>';
		$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 = '" . $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "'");
		$checked = true;
		while ($products_options_array = tep_db_fetch_array($products_options_query)) {
		  $tmp_html .= '<tr><td class="main">';
		  $tmp_html .= tep_draw_radio_field('id[' . $products_options_name['products_options_id'] . ']', $products_options_array['products_options_values_id'], $checked);
		  $checked = false;
		  $tmp_html .= $products_options_array['products_options_values_name'];
		  $tmp_html .=$products_options_name['products_options_comment'];
		  if ($products_options_array['options_values_price'] != '0') {
			$tmp_html .= '(' . $products_options_array['price_prefix'] . $currencies->display_price($products_options_array['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
		  }
		  $tmp_html .= '</tr></td>';
		}
		$tmp_html .= '</table>';
?>
		<tr>
		  <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
		  <td class="main"><?php echo $tmp_html;  ?></td>
		</tr>
<?php
		break;
	  case PRODUCTS_OPTIONS_TYPE_CHECKBOX:
		//CLR 030714 Add logic for checkboxes
		$products_attribs_query = tep_db_query("select distinct patrib.options_values_id, patrib.options_values_price, patrib.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = '" . $products_options_name['products_options_id'] . "'");
		$products_attribs_array = tep_db_fetch_array($products_attribs_query);
		echo '<tr><td class="main">' . $products_options_name['products_options_name'] . ': </td><td class="main">';
		echo tep_draw_checkbox_field('id[' . $products_options_name['products_options_id'] . ']', $products_attribs_array['options_values_id']);
		echo $products_options_name['products_options_comment'];
		if ($products_attribs_array['options_values_price'] != '0') {
		  echo '(' . $products_attribs_array['price_prefix'] . $currencies->display_price($products_attribs_array['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
		}
		echo '</td></tr>';
		break;
	  default:
		//clr 030714 default is select list
		//clr 030714 reset selected_attribute variable
		$selected_attribute = false;
			$products_options_array = array();
			// BOF: WebMakers.com Added: Attributes Copy and Sort
 if ( PRODUCTS_OPTIONS_SORT_BY_PRICE !='1' ) {
	$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 . "'" . " order by pa.products_options_sort_order, pov.products_options_values_name");
 } else {
	$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 . "'" . " order by pa.products_options_sort_order, pa.options_values_price");
 }
// EOF: WebMakers.com Added: Attributes Copy and Sort
			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']);
			  $original_price = $product_info['products_price'];

   $option_price = $products_options['options_values_price'];

   $show_price = 0.0 + $original_price + $option_price; // force float (in case) using the 0.0;

   if ($new_price)

   $show_price = 0.0 + $new_price + $option_price; // force float (in case) using the 0.0;



   $products_options_array[sizeof($products_options_array)-1]['text'] .= ' ('

   . $currencies->display_price2( $show_price, tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
			}

			if (isset($cart->contents[$HTTP_GET_VARS['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;
			}
?>
		<tr>
		  <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
		  <td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td>
		</tr>
<?php
	}  //clr 030714 end switch
  } //clr 030714 end while
?>
	  </table>
<?php
} //clr 030714 end if
?>
	</td>
  </tr>

 

Thank you very much and

Best regards,

Hondo

Link to comment
Share on other sites

i can sort customers by name and/or pricing group... i need to be able to sort orders the same way... how can i do this?

Did you get rid of the voices in your head? Do you now miss them and the things that they said?

-David Gilmour

Link to comment
Share on other sites

Hi All!

One part that had me scratching my head for a minute until I "saw" it was in admin/categories. One section appeared to be in the same place as Bundled Products, but it was really just a new section to add in; and another section appeared to be in the same place as Header Tag Controller, but again it was just a new section to add in. So if anyone has either of those mods, they work good together with SPPC.

 

I think I can use this with my plan even with the bundles, as I can set the retail price as a "package deal" and set Tier One and Tier Two at their respective %-off of retail prices. Then I will not have to attempt to separate a bundle for wholesale customers, nor hide them from same. That is how I will approach it for now.

Does this mean that there is hope for us who wants to use the SPPC and Bundled Products contributions together?

//Micke

Link to comment
Share on other sites

We want to set certain people (and only certain people) up as resellers. This should give them two things: a 30% discount for themselves, and the ability to refer people to the site at discounts of 10%. They can give people a PIN that, when they create an account, makes them eligible for this 10% off all purchases in this account. We'd like the resellers to also be able to see, under their own login, a report of all the sales done with their PIN that they hand out.

Just thought I'd put a bit of an update here (as well as in my initial thread) for two purposes - to help out others trying to do similar things, and to see if there's any suggestions for the rest of the steps I need to take.

 

I have done the following:

 

- Re-added account creation ability to the site (I was running solely on PWA before)

- Integrated the base SPPC contribution

- Added a group "Resellers" that gets a 30% discount on all products. This will be done manually, as these need to be controlled and PINs assigned.

- Added a group "Pro Customers" that gets a 10% discount on all products.

- Note: the discounts were done by modifying the SQL queries from here.

- Changed references from company_tax_id to PIN. This was done a number of places, although I'm not 100% I've got all of them yet.

- Moved the PIN field from the address_book table into the customers table. This just seems a more consistant place to put it for this purpose, since it's per customer (not per address). Steps for this can be found here.

- Created table customers_pins in the db to hold the valid PINs.

- Adapted create_account.php to check the PIN and automatically add to the "Pro Customers" group if the PIN is there and valid. If invalid, return error; if blank, put in default retail group. I based this off the post here. The changes I made to the referenced code were to add the following code into the error-checking section at the top:

	$pin_flag = false;
if ($pin != '') {
	$query = "select id from " . TABLE_CUSTOMERS_PINS . " where pin = '" . $pin . "'";
	$get_pins_query = tep_db_query($query);
	$get_pins = tep_db_fetch_array($get_pins_query);
}
if ($get_pins['id'] == '') {
	$messageStack->add('create_account', ENTRY_PIN_ERROR);
	$error = true;
}
else {  $pin_flag = true; }

 

Also, when setting up the $sql_data_array, I added:

	if ($pin_flag == true) {
	$sql_data_array['customers_group_id'] = '1';
}

  $sql_data_array['entry_pin'] = $pin;

 

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

Thanks to JanZ for all the great bits of code I referenced above. Still working on the following points:

 

- Need to add back in the ability to login up front (so they can see their discount while shopping), ability to change account, etc... all removed when PWA was initially installed. Should be easy.

- On that note, I may add the contribution to see the regular price and then their discounted price. Show Price List for SPPC? I think?

- Also, it'd be nice to show how much they saved on the final confirmation page. Not sure about that one yet.

- I modified the "How Did You Hear About Us" contrib to be on the order_info.php (to work w/ PWA). Now that I've added account creation back in (in addition to PWA), I'll have to merge those somehow. Also, the PINs collected here could probably count as the source, since they got them from a particular person. Ugh.

- Create reports that show the sales being done under accounts with each PIN. Have master reports on all PINs for the admin, and inidividual reports for each pro about their PIN only.

- Link the ability to see these individual reports to the pros' regular account logins.

- Oh, and I believe there's something coming that will give more control over attribute pricing? I'll have to keep an eye on that, since everything's supposed to be at a 10% discount, but some of my products have attributes that add to the base cost, and 10% is not getting taken off those charges.

 

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

 

Thanks again for all the help so far, and any suggestions you may have for the rest of the project. Some of the remaining mods aren't strictly SPPC related, so feel free to comment on the project on its own thread here.

Edited by teleute
Link to comment
Share on other sites

Hmmm...for some reason I appear to have lost the ability to edit the previous post. Anyway, I forgot one thing that's solely SPPC related that I seem to be having an issue with. I assume I've botched the edits slightly, but if anyone can help point me in the right direction that'd be great. Re: pricing - when I edit a product and try to add pricing for my groups, it wipes out the main price and puts in 0 (regardless of whether the box is checked, whether I've put in another price, etc...). I can set them directly in the db and it works perfectly, but not through admin. Also, when I edit a product in this manner, it suddenly becomes inactive (likely because of the $0? Not sure).

 

Thanks!

Link to comment
Share on other sites

Hmmm...for some reason I appear to have lost the ability to edit the previous post. Anyway, I forgot one thing that's solely SPPC related that I seem to be having an issue with. I assume I've botched the edits slightly, but if anyone can help point me in the right direction that'd be great. Re: pricing - when I edit a product and try to add pricing for my groups, it wipes out the main price and puts in 0 (regardless of whether the box is checked, whether I've put in another price, etc...).

 

Fixed this - was just a botched job on the modification of /admin/categories.php.

 

Anyway, trouble I'm having now - trying to install Show Price List 3.5 (just the solo one, not w/ Price Breaks or anything). It says:

 

Find the following lines between line  81 and 105 starting with :

$product_info_query = tep_db_query("select p.products_id,

ends just before: 

if (tep_not_null($product_info['products_model'])) } )

 

Problem is, I don't have the line "if (tep_not_null($product_info['products_model']))" anywhere in my entire cart. Not even in my backups before the SPPC install, and not after. Any ideas? Thanks!

Link to comment
Share on other sites

Anyway, trouble I'm having now - trying to install Show Price List 3.5 (just the solo one, not w/ Price Breaks or anything). It says:

 

Find the following lines between line  81 and 105 starting with :

$product_info_query = tep_db_query("select p.products_id,

ends just before: 

if (tep_not_null($product_info['products_model'])) } )

 

Problem is, I don't have the line "if (tep_not_null($product_info['products_model']))" anywhere in my entire cart. Not even in my backups before the SPPC install, and not after. Any ideas? Thanks!

 

Hi,

 

It's impossible you don't have this line if you use SPPC 4.1

 

Do you edit and search the good file --> catalog/product_info.php ?

 

If you take this file from a vierge SPPC 4.1 installation, you gonna find this line, it's sure. Double check please and be back to us. :thumbsup:

John

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

osCommerce 2.3.4 Bootstrap Edge

Link to comment
Share on other sites

Mea Culpa, it's my fault... :-"

 

Search for the following lines :

 

	$product_info_query = tep_db_query("select 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 = '" . (int)$HTTP_GET_VARS['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);

tep_db_query("update " . TABLE_PRODUCTS_DESCRIPTION . " set products_viewed = products_viewed+1 where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and language_id = '" . (int)$languages_id . "'");

if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
// BOF Separate Price per Customer

	$scustomer_group_price_query = tep_db_query("select customers_group_price from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$HTTP_GET_VARS['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 = '" . (int)$HTTP_GET_VARS['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 (tep_not_null($product_info['products_model'])) {

 

If you take this file from a vierge SPPC 4.1 installation, you gonna find this line, it's sure. Be back to me if it's ok after that ? I will have to update this. Thank you to point me to this. You're the first. :thumbsup:

John

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

osCommerce 2.3.4 Bootstrap Edge

Link to comment
Share on other sites

I just installed Add Multiple Products to Cart, in columns, for SPPC

http://www.oscommerce.com/community/contributions,3606

 

But there is a problem with Display Add Multiples column. When insert quantity in the box and click "add to cart " button, nothing is added.

 

Could anybody help me with this please?

 

I also need to install these contributions. Is there anybody who could help me to install it, please? I?ll pay for it.

 

Buy/Add button removal if quantity = 0(for SPPC w/ Column Product Listing)

 

http://www.oscommerce.com/community/contri...Products/page,3

 

Show Price list for SPPC 4.1 v1.0

 

http://www.oscommerce.com/community/contributions,3561

 

Hide products from customer groups for SPPC

 

http://www.oscommerce.com/community/contributions,3059

Link to comment
Share on other sites

I just installed Add Multiple Products to Cart, in columns, for SPPC

http://www.oscommerce.com/community/contributions,3606

 

But there is a problem with Display Add Multiples column. When insert quantity in the box and click "add to cart " button, nothing is added.

 

Could anybody help me with this please?

And how are we supposed to help with that? Apart from mentioning that you probably made an error adding this contribution, or failed to add something that is mentioned in the instructions there is nothing we can look at: code, links...
Link to comment
Share on other sites

And how are we supposed to help with that? Apart from mentioning that you probably made an error adding this contribution, or failed to add something that is mentioned in the instructions there is nothing we can look at: code, links...

 

Hi ALL,

I have the same problem.... :blink:

Link to comment
Share on other sites

I have the same problem....
Oh, I hoped there would be at least someone with a crystal ball or psychic gifts.

 

Just one suggestion... was there a "register globals" problem that was fixed with a contribution? That contribution uses its own (new, not standard) POST variables for the quantity....

Link to comment
Share on other sites

Oh, I hoped there would be at least someone with a crystal ball or psychic gifts.

 

Just one suggestion... was there a "register globals" problem that was fixed with a contribution? That contribution uses its own (new, not standard) POST variables for the quantity....

 

Thank you for replay

I used the Add Multiple Products to Cart, in columns, for SPPC from 9 Oct 2005

 

This time I used the WinMerge to check each file. There were some differences mainly in application_top.php

 

For example:

I the cotribution's application_top.php file is

 

$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']);

 

but in my file was this

 

$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']);

 

I did all the changes according to the contribs' files and now it doesn't work at all.

 

Now i get this message:

 

1054 - Unknown column 'p.products_id' in 'on clause'

 

select count(p.products_id) as total from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join specials_retail_prices s on p.products_id = s.products_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 = '18'

 

[TEP STOP]

 

Thanks

Link to comment
Share on other sites

Now i get this message:

 

1054 - Unknown column 'p.products_id' in 'on clause'

 

select count(p.products_id) as total from products_description pd, products p left join manufacturers m on p.manufacturers_id = m.manufacturers_id, products_to_categories p2c left join specials_retail_prices s on p.products_id = s.products_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 = '18'

The changed for application_top.php in the contribution is the correct one to use.

 

The error you get is because of MySQL 5. If you want to use Hide Products for SPPC go ahead with that now. Do the sql changes in PhpMyAdmin and then add the changes for catalog/index.php first (or preferably use the file from the package) to get rid of the error. Only the last update of this August is not implemented in there. I don't remember if it also has changes in index.php.

Link to comment
Share on other sites

And how are we supposed to help with that? Apart from mentioning that you probably made an error adding this contribution, or failed to add something that is mentioned in the instructions there is nothing we can look at: code, links...

Hi,

When I add items they dont get added to the cart, but rather it is reset to 1. What could be the problem.

The link is http://www.bolt.com.au/shop/index.php?cPat...767&sort=3a

 

I have installed the SPPC 4.15

Link to comment
Share on other sites

The changed for application_top.php in the contribution is the correct one to use.

 

The error you get is because of MySQL 5. If you want to use Hide Products for SPPC go ahead with that now. Do the sql changes in PhpMyAdmin and then add the changes for catalog/index.php first (or preferably use the file from the package) to get rid of the error. Only the last update of this August is not implemented in there. I don't remember if it also has changes in index.php.

 

Ok, thank you very much for replay.

 

I will try to install now ?Hide products from customer groups for SPPC? from 6 Aug 2006. I will run the install_h_p_a_c_f_cg_sppc.sql file and change the index first. If there are no changes for index.php in this version i will look for older version.

 

Thanks a lot, will post if it works or not.

Link to comment
Share on other sites

When I add items they dont get added to the cart, but rather it is reset to 1. What could be the problem.
There a number of things that could be wrong here. Looking at the HTML code of that page I spot two things:

<form name="buy_now" action="http://www.bolt.com.au/shop/index.php?cPath=268_1767&sort=3a&action=buy_now&products_id=&osCsid=7648eb093db1d8902b00675d9680bf49" method="POST">
<table cellSpacing="0" cellPadding="0" width="100%">
<tr>
<td align="right" width="25%"><input type="text" name="buyqty" value="1" size=4></td>
<td align="center" width="75%" valign="absmiddle">
<input type="image" src="includes/languages/english/images/buttons/button_in_cart.gif" border="0" alt="Add to Cart" title=" Add to Cart " align=absmiddle></td>
</tr>
</table>
</form>

One: in the code above the GET variable for products_id is empty action=buy_now&products_id=&osCsid and there is also no hidden input that contains the products_id. So how is application_top.php ever going to know what product is added to the cart?

Second: the name of input for the quantity is "buyqty", that should match which what is in application_top.php (medved had "cart_quantity" as the name of the input).

Third, the button for the add to cart button is not visible and when I wanted to load it in a new tab the server replied with a 500 error. But that has nothing to do with your problem.

Link to comment
Share on other sites

There a number of things that could be wrong here. Looking at the HTML code of that page I spot two things:

<form name="buy_now" action="http://www.bolt.com.au/shop/index.php?cPath=268_1767&sort=3a&action=buy_now&products_id=&osCsid=7648eb093db1d8902b00675d9680bf49" method="POST">
<table cellSpacing="0" cellPadding="0" width="100%">
<tr>
<td align="right" width="25%"><input type="text" name="buyqty" value="1" size=4></td>
<td align="center" width="75%" valign="absmiddle">
<input type="image" src="includes/languages/english/images/buttons/button_in_cart.gif" border="0" alt="Add to Cart" title=" Add to Cart " align=absmiddle></td>
</tr>
</table>
</form>

One: in the code above the GET variable for products_id is empty action=buy_now&products_id=&osCsid and there is also no hidden input that contains the products_id. So how is application_top.php ever going to know what product is added to the cart?

Second: the name of input for the quantity is "buyqty", that should match which what is in application_top.php (medved had "cart_quantity" as the name of the input).

Third, the button for the add to cart button is not visible and when I wanted to load it in a new tab the server replied with a 500 error. But that has nothing to do with your problem.

 

Thanks a million. Will look into it...

Link to comment
Share on other sites

Hi All!

Now I have succeeded in installing JanZ's Featured Products V1.5.2 adapted for Separate Pricing Per Customer v4.1 2006/02/26.

 

If I've got it right, all that is left for me is to tweak the sql query's to match those from Hide products and categories from groups 2006/06/04 in includes/featured.php and catalog/featured_products.php.

 

Before I start..

Has anyone attempted to do this before?

How did you do it?

What happened?

 

//Micke

Link to comment
Share on other sites

Hi All!

 

To hide products from groups in includes/modules/featured.php JanZ's Featured Products V1.5.2 adapted for Separate Pricing Per Customer v4.1 2006/02/26, change the sql query from:

$featured_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, NULL as specstat, NULL as specials_new_products_price, p.products_price, pd.products_name from " . TABLE_PRODUCTS . " p left join " . TABLE_FEATURED . " f using(products_id) left join " . TABLE_PRODUCTS_DESCRIPTION . " pd using(products_id) where p.products_status = '1' and f.status = '1' and pd.language_id = '" . (int)$languages_id . "' order by rand($mtm) DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS);

to:

$featured_products_query = tep_db_query("select p.products_id, p.products_image, p.products_tax_class_id, NULL as specstat, NULL as specials_new_products_price, p.products_price, pd.products_name from " . TABLE_PRODUCTS . " p left join " . TABLE_FEATURED . " f using(products_id) left join " . TABLE_PRODUCTS_DESCRIPTION . " pd using(products_id) where p.products_status = '1' and f.status = '1' and find_in_set('" . $customer_group_id . "', products_hide_from_groups) = 0 and pd.language_id = '" . (int)$languages_id . "' order by rand($mtm) DESC limit " . MAX_DISPLAY_FEATURED_PRODUCTS);

Works for me...

//Micke

Link to comment
Share on other sites

Hi All!

For those of you who, like me, has to "hide price if $0" in includes/modules/featured.php...

Add:

//BOF Here's if price is 0
} elseif ($featured_products[$x]['products_price'] == 0) {
$info_box_contents[$row][$col] = array('align' => 'center',
'params' => 'class="smallText" width="' . (floor(100 / $no_of_columns)) . '%" valign="top" style="padding-top: 4px; '. ( $row < $last_row ? 'border-bottom: 1px ' . $border_style_h . ' ' . $color_h . '; ': '') . ( $col < ($no_of_columns - 1) ? 'border-right: 1px ' . $border_style_v . ' ' . $color_v . ';"': '"'),
'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products[$x]['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $featured_products[$x]['products_image'], $featured_products[$x]['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $featured_products[$x]['products_id']) . '">' . $featured_products[$x]['products_name'] . '</a><br>' . ( TEXT_CALL_FOR_PRICE ));
//EOF Here's if price is 0

before:

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

You have to install the Hide Price if $0 for "Quantity Price Breaks for SPPC 4.1.1" contribution first, of course...

//Micke

Link to comment
Share on other sites

Hello everybody,

 

I?m still working on implementing JayZ?s SPPC attributes mod which he posted on the following side of this thread:

 

http://www.oscommerce.com/forums/index.php?sho...mp;#entry646036

 

 

I have two problems for the moment:

 

1. I can?t get the attibutes to be shown in the dropdown of the product_info although I filled in the data in the "products_attributes_groups" table. In the dropdown is still only the standard price shown.

 

Here is the part of my product_info.php:

 

	   <table border="0" cellspacing="0" cellpadding="2">
		<tr>
		  <td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td>
		</tr>
<?php
		//clr 030714 update query to pull option_type
  $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name, popt.products_options_type, popt.products_options_length, popt.products_options_comment 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)) {
			//clr 030714 add case statement to check option type
	switch ($products_options_name['products_options_type']) {
	  case PRODUCTS_OPTIONS_TYPE_TEXT:
		//CLR 030714 Add logic for text option
		$products_attribs_query = tep_db_query("select distinct patrib.options_values_price, patrib.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = '" . $products_options_name['products_options_id'] . "'");
		$products_attribs_array = tep_db_fetch_array($products_attribs_query);
		$tmp_html = '<input type="text" name ="id[' . TEXT_PREFIX . $products_options_name['products_options_id'] . ']" size="' . $products_options_name['products_options_length'] .'" maxlength="' . $products_options_name['products_options_length'] . '" value="' . $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$products_options_name['products_options_id']] .'">  ' . $products_options_name['products_options_comment'];
		if ($products_attribs_array['options_values_price'] != '0') {
		  $tmp_html .= '(' . $products_attribs_array['price_prefix'] . $currencies->display_price($products_attribs_array['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .')';
		}
?>
		<tr>
		  <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
		  <td class="main"><?php echo $tmp_html;  ?></td>
		</tr>
<?php
		break;

	  case PRODUCTS_OPTIONS_TYPE_TEXTAREA:
		//CLR 030714 Add logic for text option
		$products_attribs_query = tep_db_query("select distinct patrib.options_values_price, patrib.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = '" . $products_options_name['products_options_id'] . "'");
		$products_attribs_array = tep_db_fetch_array($products_attribs_query);
	$tmp_html = '<textarea onKeyDown="textCounter(this,\'progressbar' . $products_options_name['products_options_id'] . '\',' . $products_options_name['products_options_length'] . ')" 
							   onKeyUp="textCounter(this,\'progressbar' . $products_options_name['products_options_id'] . '\',' . $products_options_name['products_options_length'] . ')" 
							   onFocus="textCounter(this,\'progressbar' . $products_options_name['products_options_id'] . '\',' . $products_options_name['products_options_length'] . ')" 
							   wrap="soft" 
							   name="id[' . TEXT_PREFIX . $products_options_name['products_options_id'] . ']" 
							   rows=5 
							   id="id[' . TEXT_PREFIX . $products_options_name['products_options_id'] . ']" 
							   value="' . $cart->contents[$HTTP_GET_VARS['products_id']]['attributes_values'][$products_options_name['products_options_id']] . '"></textarea>
					<div id="progressbar' . $products_options_name['products_options_id'] . '" class="progress"></div>
					<script>textCounter(document.getElementById("id[' . TEXT_PREFIX . $products_options_name['products_options_id'] . ']"),"progressbar' . $products_options_name['products_options_id'] . '",' . $products_options_name['products_options_length'] . ')</script>';?>	<!-- DDB - 041031 - Form Field Progress Bar //-->
		<tr>
<?php
		if ($products_attribs_array['options_values_price'] != '0') {
?>
		  <td class="main"><?php echo $products_options_name['products_options_name'] . '<br>(' . $products_options_name['products_options_comment'] . ' ' . $products_attribs_array['price_prefix'] . $currencies->display_price($products_attribs_array['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . ')'; ?></td>
<?php	   } else {
?>
		  <td class="main"><?php echo $products_options_name['products_options_name'] . '<br>(' . $products_options_name['products_options_comment'] . ')'; ?></td>
<?php		}
?>
		  <td class="main"><?php echo $tmp_html;  ?></td>
		</tr>
<?php
		break;

	  case PRODUCTS_OPTIONS_TYPE_RADIO:
		//CLR 030714 Add logic for radio buttons
		$tmp_html = '<table>';
		$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . $products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . $languages_id . "'");
		$checked = true;
		while ($products_options_array = tep_db_fetch_array($products_options_query)) {
		  $tmp_html .= '<tr><td class="main">';
		  $tmp_html .= tep_draw_radio_field('id[' . $products_options_name['products_options_id'] . ']', $products_options_array['products_options_values_id'], $checked);
		  $checked = false;
		  $tmp_html .= $products_options_array['products_options_values_name'];
		  $tmp_html .=$products_options_name['products_options_comment'];
		  if ($products_options_array['options_values_price'] != '0') {
			$tmp_html .= '(' . $products_options_array['price_prefix'] . $currencies->display_price($products_options_array['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
		  }
		  $tmp_html .= '</tr></td>';
		}
		$tmp_html .= '</table>';
?>
		<tr>
		  <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
		  <td class="main"><?php echo $tmp_html;  ?></td>
		</tr>
<?php
		break;
	  case PRODUCTS_OPTIONS_TYPE_CHECKBOX:
		//CLR 030714 Add logic for checkboxes
		$products_attribs_query = tep_db_query("select distinct patrib.options_values_id, patrib.options_values_price, patrib.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = '" . $products_options_name['products_options_id'] . "'");
		$products_attribs_array = tep_db_fetch_array($products_attribs_query);
		echo '<tr><td class="main">' . $products_options_name['products_options_name'] . ': </td><td class="main">';
		echo tep_draw_checkbox_field('id[' . $products_options_name['products_options_id'] . ']', $products_attribs_array['options_values_id']);
		echo $products_options_name['products_options_comment'];
		if ($products_attribs_array['options_values_price'] != '0') {
		  echo '(' . $products_attribs_array['price_prefix'] . $currencies->display_price($products_attribs_array['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
		}
		echo '</td></tr>';
		break;
	  default:
		//clr 030714 default is select list
		//clr 030714 reset selected_attribute variable
		$selected_attribute = false;
			$products_options_array = array();
			// BOF: WebMakers.com Added: Attributes Copy and Sort
 if ( PRODUCTS_OPTIONS_SORT_BY_PRICE !='1' ) {
	$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id 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 . "'" . " order by pa.products_options_sort_order, pov.products_options_values_name");
 } else {
	$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, pa.products_attributes_id 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 . "'" . " order by pa.products_options_sort_order, pa.options_values_price");
 }
// EOF: WebMakers.com Added: Attributes Copy and Sort
$list_of_prdcts_attributes_id = '';
$products_options = array(); // makes sure this array is empty again
			while ($products_options = tep_db_fetch_array($products_options_query)) {
		$products_options[] = $_products_options;
$list_of_prdcts_attributes_id .= $_products_options['products_attributes_id'].",";
}

 if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0') {
	$select_list_of_prdcts_attributes_ids = "(" . substr($list_of_prdcts_attributes_id, 0 , -1) . ")";
$pag_query = tep_db_query("select products_attributes_id, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES_GROUPS . " where products_attributes_id IN " . $select_list_of_prdcts_attributes_ids . " AND customers_group_id = '" . $customer_group_id . "'");
while ($pag_array = tep_db_fetch_array($pag_query)) {
 $cg_attr_prices[] = $pag_array;
}

// substitute options_values_price and prefix for those for the customer group (if available)
if ($customer_group_id != '0' && tep_not_null($cg_attr_prices)) {
for ($n = 0; $n < count($products_options); $n++) {
 for ($i = 0; $i < count($cg_attr_prices); $i++) {
  if ($cg_attr_prices[$i]['products_attributes_id'] == $products_options[$n]['products_attributes_id']) {
  $products_options[$n]['price_prefix'] = $cg_attr_prices[$i]['price_prefix'];
  $products_options[$n]['options_values_price'] = $cg_attr_prices[$i]['options_values_price'];
  }
 } // end for ($i = 0; $i < count($cg_att_prices); $i++)
}
   } // end if ($customer_group_id != '0' && (tep_not_null($cg_attr_prices))
 } // end if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0')

 for ($n = 0; $n < count($products_options); $n++) {
			  $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);
			  $original_price = $product_info['products_price'];

   $option_price = $products_options['options_values_price'];

   $show_price = 0.0 + $original_price + $option_price; // force float (in case) using the 0.0;

   if ($new_price)

   $show_price = 0.0 + $new_price + $option_price; // force float (in case) using the 0.0;



   $products_options_array[sizeof($products_options_array)-1]['text'] .= ' ('

   . $currencies->display_price2( $show_price, tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
			}

			if (isset($cart->contents[$HTTP_GET_VARS['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;
			}
?>
		<tr>
		  <td class="main"><?php echo $products_options_name['products_options_name'] . ':'; ?></td>
		  <td class="main"><?php echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute); ?></td>
		</tr>
<?php
	}  //clr 030714 end switch
  } //clr 030714 end while
?>
	  </table>

 

 

2. When I go to shopping_cart.php I receive an SQL 1064 error:

 

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 '))' at line 1

 

SELECT products_attributes_id, options_values_price, price_prefix FROM products_attributes WHERE products_id=123 AND ((options_id=4 AND options_values_id=))

 

Here is the part of my shopping_cart.php:

 

// attributes price
// BOF SPPC attributes mod
	if (isset($this->contents[$products_id]['attributes'])) {
	  reset($this->contents[$products_id]['attributes']);
   $where = " AND ((";
	while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
	 $where .= "options_id = '" . (int)$option . "' AND options_values_id = '" . (int)$value . "') OR (";
   }
   $where=substr($where, 0, -5) . ')';

   $attribute_price_query = tep_db_query("SELECT products_attributes_id, options_values_price, price_prefix FROM " . TABLE_PRODUCTS_ATTRIBUTES . " WHERE products_id = '" . (int)$products_id . "'" . $where ."");

   if (tep_db_num_rows($attribute_price_query)) {
	   $list_of_prdcts_attributes_id = '';
			 // empty array $attribute_price
			 $attribute_price = array();
	   while ($attributes_price_array = tep_db_fetch_array($attribute_price_query)) {
	   $attribute_price[] =  $attributes_price_array;
	   $list_of_prdcts_attributes_id .= $attributes_price_array['products_attributes_id'].",";
		}
	   if (tep_not_null($list_of_prdcts_attributes_id) && $this->cg_id != '0') {
	 $select_list_of_prdcts_attributes_ids = "(" . substr($list_of_prdcts_attributes_id, 0 , -1) . ")";
 $pag_query = tep_db_query("select products_attributes_id, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES_GROUPS . " where products_attributes_id IN " . $select_list_of_prdcts_attributes_ids . " AND customers_group_id = '" . $this->cg_id . "'");
 while ($pag_array = tep_db_fetch_array($pag_query)) {
	 $cg_attr_prices[] = $pag_array;
 }

 // substitute options_values_price and prefix for those for the customer group (if available)
 if ($customer_group_id != '0' && tep_not_null($cg_attr_prices)) {
	for ($n = 0; $n < count($attribute_price); $n++) {
	 for ($i = 0; $i < count($cg_attr_prices); $i++) {
		 if ($cg_attr_prices[$i]['products_attributes_id'] == $attribute_price[$n]['products_attributes_id']) {
			$attribute_price[$n]['price_prefix'] = $cg_attr_prices[$i]['price_prefix'];
			$attribute_price[$n]['options_values_price'] = $cg_attr_prices[$i]['options_values_price'];
		 }
	 } // end for ($i = 0; $i < count($cg_att_prices); $i++)
	  }
	} // end if ($customer_group_id != '0' && (tep_not_null($cg_attr_prices))
  } // end if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0')
// now loop through array $attribute_price to add up/substract attribute prices

  for ($n = 0; $n < count($attribute_price); $n++) {
		if ($attribute_price[$n]['price_prefix'] == '+') {
		  $this->total += $qty * tep_add_tax($attribute_price[$n]['options_values_price'], $products_tax);
		} else {
		  $this->total -= $qty * tep_add_tax($attribute_price[$n]['options_values_price'], $products_tax);
	}
  } // end for ($n = 0; $n < count($attribute_price); $n++)
	  } // end if (tep_db_num_rows($attribute_price_query))
	} // end if (isset($this->contents[$products_id]['attributes']))
  }
}
// EOF SPPC attributes mod

// function attributes_price changed partially according to FalseDawn's post
// http://www.oscommerce.com/forums/index.php?showtopic=139587
// changed completely for Separate Pricing Per Customer, attributes mod
  function attributes_price($products_id) {
// global variable (session) $sppc_customer_group_id -> class variable cg_id
  global $sppc_customer_group_id;

  if(!tep_session_is_registered('sppc_customer_group_id')) {
  $this->cg_id = '0';
  } else {
  $this->cg_id = $sppc_customer_group_id;
  }
if (isset($this->contents[$products_id]['attributes'])) {
  reset($this->contents[$products_id]['attributes']);
  $where=' AND ((';
  while (list($option, $value) = each($this->contents[$products_id]['attributes'])) {
	$where .= 'options_id=' . $option . ' AND options_values_id=' . $value . ') OR (';
  }
  $where=substr($where, 0, -5) . ')';

  $attribute_price_query = tep_db_query('SELECT products_attributes_id, options_values_price, price_prefix FROM ' . TABLE_PRODUCTS_ATTRIBUTES . ' WHERE products_id=' . (int)$products_id . $where);

  if (tep_db_num_rows($attribute_price_query)) {
   $list_of_prdcts_attributes_id = '';
   while ($attributes_price_array = tep_db_fetch_array($attribute_price_query)) {
$attribute_price[] =  $attributes_price_array;
$list_of_prdcts_attributes_id .= $attributes_price_array['products_attributes_id'].",";
   }

   if (tep_not_null($list_of_prdcts_attributes_id) && $this->cg_id != '0') {
	$select_list_of_prdcts_attributes_ids = "(" . substr($list_of_prdcts_attributes_id, 0 , -1) . ")";
$pag_query = tep_db_query("select products_attributes_id, options_values_price, price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES_GROUPS . " where products_attributes_id IN " . $select_list_of_prdcts_attributes_ids . " AND customers_group_id = '" . $this->cg_id . "'");
while ($pag_array = tep_db_fetch_array($pag_query)) {
 $cg_attr_prices[] = $pag_array;
}

// substitute options_values_price and prefix for those for the customer group (if available)
if ($customer_group_id != '0' && tep_not_null($cg_attr_prices)) {
for ($n = 0; $n < count($attribute_price); $n++) {
 for ($i = 0; $i < count($cg_attr_prices); $i++) {
  if ($cg_attr_prices[$i]['products_attributes_id'] == $attribute_price[$n]['products_attributes_id']) {
  $attribute_price[$n]['price_prefix'] = $cg_attr_prices[$i]['price_prefix'];
  $attribute_price[$n]['options_values_price'] = $cg_attr_prices[$i]['options_values_price'];
  }
 } // end for ($i = 0; $i < count($cg_att_prices); $i++)
}
   } // end if ($customer_group_id != '0' && (tep_not_null($cg_attr_prices))
 } // end if (tep_not_null($list_of_prdcts_attributes_id) && $customer_group_id != '0')
// now loop through array $attribute_price to add up/substract attribute prices

 for ($n = 0; $n < count($attribute_price); $n++) {
	   if ($attribute_price[$n]['price_prefix'] == '+') {
		 $attributes_price += $attribute_price[$n]['options_values_price'];
	   } else {
		 $attributes_price -= $attribute_price[$n]['options_values_price'];
	   }
 } // end for ($n = 0; $n < count($attribute_price); $n++)
  return $attributes_price;
  } else { // end if (tep_db_num_rows($attribute_price_query))
	return 0;
  }
}  else { // end if (isset($this->contents[$products_id]['attributes']))
  return 0;
}
 } // end of function attributes_price, modified for SPPC with attributes

 

I would be very happy if someone could find the reasons of my problems!

 

Best regards,

Carsten

Link to comment
Share on other sites

SELECT products_attributes_id, options_values_price, price_prefix FROM products_attributes WHERE products_id=123 AND ((options_id=4 AND options_values_id=))
You get that errror because the options_values_id is empty. Could the option_type thingy you have installed be the cause of that?
Link to comment
Share on other sites

(JanZ @ Oct 15 2006, 01:09 PM)

 

The changed for application_top.php in the contribution is the correct one to use.

 

The error you get is because of MySQL 5. If you want to use Hide Products for SPPC go ahead with that now. Do the sql changes in PhpMyAdmin and then add the changes for catalog/index.php first (or preferably use the file from the package) to get rid of the error. Only the last update of this August is not implemented in there. I don't remember if it also has changes in index.php.

 

 

 

Ok, thank you very much for replay.

 

I will try to install now ?Hide products from customer groups for SPPC? from 6 Aug 2006. I will run the install_h_p_a_c_f_cg_sppc.sql file and change the index first. If there are no changes for index.php in this version i will look for older version.

 

Thanks a lot, will post if it works or not.

 

SO i have already installed ?Hide products from customer groups for SPPC? from 6 Aug 2006. Everything seems to be all right. No error messages.

 

Thank you all who worked so hard on this contrib. I do appreciate it.

 

But please help with this questions:

 

1.

In the admin, I hided one entire category. On the website, in the category box the name of the category is still visible, but once I clicked the category link it didn't show the products. So is this how the contrib is suppose to work? To be able to see the category but not the products that are in it?

 

2.

I have 6 products in a category. I?ve decided to hide the last one. And it is hidden. So that?s great. But together with the image, is hidden also the styled table with the blue background. Is it possible to fix it?

 

1.jpg

 

before hiding the product

 

2.jpg

 

after hiding the product.

 

Is there any way how to fill the cut out space with the blue color?

 

3.

After installing ?Add Multiple Products to Cart, in columns, for SPPC? I still have problem with Display Add Multiples column. When I insert quantity in the box and click "add to cart " button, nothing is added. Does anybody knows in which page could be a problem?

 

Thanks

Link to comment
Share on other sites

1.

In the admin, I hided one entire category. On the website, in the category box the name of the category is still visible, but once I clicked the category link it didn't show the products. So is this how the contrib is suppose to work? To be able to see the category but not the products that are in it?

 

I know on my computer, sometimes I have to login with another customer name who doesn't have access to that catagory, so I can validate the hidden catagory is hidden.

 

I think it happens because the catagory was hidden after the session started, or you didn't get completely logged out.

 

Thanks,

Kristine

Kristine

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