Jump to content
scendent

Seperate Pricing Per Customer v3.5

Recommended Posts

Ok I got my cart working ok with all products working and attributes changes pages.

 

Now I want to install sppc but it will change my products_attributes.php file.

 

here is the line I added onto

 

tep_db_query("insert into " . TABLE_PRODUCTS_ATTRIBUTES . " values (null, '" . (int)$products_id . "', '" . (int)$options_id . "', '" . (int)$values_id . "', '" . (float)tep_db_input($value_price) . "', '" . tep_db_input($price_prefix) . "', '" . (int)$attributes_sort . "')");

 

I also think that is the line sppc edits.

 

I'm stummped. I just about got it to work but need to install sppc and Quick Updates for SPPC and then everything works.

 

Thanks and sorry I'm not good with PHP at all.

Share this post


Link to post
Share on other sites
You are right, haven't thought about that.

Backup, backup, backup...

Something like:

insert into products_groups select '1' as customers_group_id, p.products_price as customers_group_price, p.products_id from products p;

 

Never mind "something like" - that's was it exactly. Thanks again for your wonderful help. Turns out I didn't even need to change the customer group pricing at all since they are linked to the customer group number. So changing the group number, in effect, changes the pricing for that group.

 

And then to set the customer group 0 pricing to 0, all I did was follow your example:

update products set products_price = '0';

 

And it's done. Very nice!

Share this post


Link to post
Share on other sites

I found a bug in the program I think

 

I ran a bare copy of OSC and added all my products. everything works great. I added SPPC v42 and Quick Updates for SPPC and when I go to Products Attributes and click on the page number or >> to change pages it always stays on page one.

 

How do I fix this.

 

Thanks

Share this post


Link to post
Share on other sites
How do I fix this.

By downloading the products_attributes.php page from this post and then adding the products sort contribution to that. Depending on where the column for the attributes hide comes (before or after the attributes sort column) you add your sorting value before or after the attributes hide value in the query.

Share this post


Link to post
Share on other sites

Hi Jan!

 

Wow - I happened to come across this thread through Google and it sure brought back pleasant memories.

It's great to SPP is still going strong - it's truly a quality mod. :thumbsup:

 

I haven't looked at osC for some time but it's nice to see you're still helping people Jan :thumbsup:

Can you imagine - 226 pages in this thread - now that's commitment :)

Edited by Marvin Miller

Best & Thanks;
Marvin
----------------------
osCommerce 2.3.3.4 

Share this post


Link to post
Share on other sites

I fluked it out and fixed by myself by compairing some code.

 

Thanks for everyones help.

 

By downloading the products_attributes.php page from this post and then adding the products sort contribution to that. Depending on where the column for the attributes hide comes (before or after the attributes sort column) you add your sorting value before or after the attributes hide value in the query.

Share this post


Link to post
Share on other sites

Hey Jan -

 

You are my SQL genius, and I am stuck as can be. Would you be willing to give me some assistance?

 

I have the all customers contribution setup and I am trying to find a way to filter the results in order to only get customers that have not placed an order. So somehow, I'm thinking, I need to first create an array of disctinct customers_id from the orders table. Then, I need to pull my customers query where the customers_id from the customers table is not in the array from the ordes table. Unless, of course, there's a much easier way to do this - LOL :blush:

 

I've been trying all day, and so far I either get all of the customers, or I get SQL errors.

 

The current working query for all of the customer info is:

 

$customers_query_raw = "SELECT c.customers_id , c.customers_default_address_id, c.customers_email_address, c.customers_dob, c.customers_telephone, c.customers_gender, a.entry_company, a.address_book_id, a.customers_id, a.entry_firstname, a.entry_lastname, a.entry_street_address, a.entry_suburb, a.entry_city, a.entry_state, a.entry_postcode, a.entry_country_id, a.entry_zone_id, z.zone_code, co.countries_name FROM " . TABLE_CUSTOMERS . " c LEFT JOIN " . TABLE_ADDRESS_BOOK . " a on c.customers_id = a.customers_id and c.customers_default_address_id = a.address_book_id JOIN " . TABLE_COUNTRIES . " co ON a.entry_country_id = co.countries_id LEFT JOIN " . TABLE_ZONES . " z ON a.entry_zone_id = z.zone_id ORDER BY $db_orderby $sorted";
$customers_query = tep_db_query($customers_query_raw);

 

I tried putting this above that query:

 

$no_orders_query = "SELECT distinct customers_id FROM " . TABLE_ORDERS . " ";
$no_orders = tep_db_query($no_orders_query);

 

and then adding to the $customers_query_raw:

WHERE c.customers_id NOT IN " . $no_orders['customers_id'] . "

 

and that didn't work right - so I thought maybe it was because I needed the $no_orders as an array - so I tried adding this beneath the $no_orders = tep_db_query($no_orders_query);

 

while ($no_orders = tep_db_fetch_array($no_orders_query) {

 

and then underneath of the $customers_query = tep_db_fetch_array($customers_query_raw); I added the closing } for the above while statement.

 

Still no dice. I know I've got to be missing something simple - or else I'm just determined that this should be easier than it is - LOL

 

Any thoughts on your end on how to get the info for just the customers that have not placed an order? :blush:

 

Thank you SOOOOOO much!!

Edited by TracyS

~Tracy
 

Share this post


Link to post
Share on other sites
I tried putting this above that query:

 

$no_orders_query = "SELECT distinct customers_id FROM " . TABLE_ORDERS . " ";
$no_orders = tep_db_query($no_orders_query);

 

and then adding to the $customers_query_raw:

WHERE c.customers_id NOT IN " . $no_orders['customers_id'] . "

 

and that didn't work right - so I thought maybe it was because I needed the $no_orders as an array - so I tried adding this beneath the $no_orders = tep_db_query($no_orders_query);

 

while ($no_orders = tep_db_fetch_array($no_orders_query) {

Look at the includes/modules/product_listing.php for SPPC that first gets the results of a query and then makes an array called $list_of_prdct_ids. A few lines further it is used with an implode: where products_id in (" . implode(',', $list_of_prdct_ids) . ")

In your case you would use NOT IN of course and the WHERE clause must appear before the ORDER BY.

Share this post


Link to post
Share on other sites
Look at the includes/modules/product_listing.php for SPPC that first gets the results of a query and then makes an array called $list_of_prdct_ids. A few lines further it is used with an implode: where products_id in (" . implode(',', $list_of_prdct_ids) . ")

In your case you would use NOT IN of course and the WHERE clause must appear before the ORDER BY.

 

Thank you very much Jan!!

I tried this:

$no_orders_query = "SELECT distinct customers_id FROM " . TABLE_ORDERS . " ";
$no_orders = tep_db_query($no_orders_query);

while ($_no_orders = tep_db_fetch_array($no_orders)) {
$no_orders[] = $_no_orders;
$list_of_cust_ids[] = $_no_orders['customers_id'];
}

$customers_query_raw = "SELECT c.customers_id , c.customers_default_address_id, c.customers_email_address, c.customers_dob, c.customers_telephone, c.customers_gender, a.entry_company, a.address_book_id, a.customers_id, a.entry_firstname, a.entry_lastname, a.entry_street_address, a.entry_suburb, a.entry_city, a.entry_state, a.entry_postcode, a.entry_country_id, a.entry_zone_id, z.zone_code, co.countries_name FROM " . TABLE_CUSTOMERS . " c LEFT JOIN " . TABLE_ADDRESS_BOOK . " a on c.customers_id = a.customers_id and c.customers_default_address_id = a.address_book_id JOIN " . TABLE_COUNTRIES . " co ON a.entry_country_id = co.countries_id LEFT JOIN " . TABLE_ZONES . " z ON a.entry_zone_id = z.zone_id where c.customers_id NOT IN (" . implode(',', $list_of_cust_ids) . ") ORDER BY $db_orderby $sorted";
$customers_query = tep_db_query($customers_query_raw);

 

And I get this error:

Warning: Cannot use a scalar value as an array in /home/.lew/domain/admin/no_order_customers.php on line 119

 

Line 119 is:

	$no_orders[] = $_no_orders;

 

What is "scalar value" ? What did I mess up? Do I need line 119 ?


~Tracy
 

Share this post


Link to post
Share on other sites

WOW! I removed line 119 and it works like a charm!!! WOO HOO!! Thank You Thank You Thank You!! :thumbsup:

 

Thank you very much Jan!!

I tried this:

$no_orders_query = "SELECT distinct customers_id FROM " . TABLE_ORDERS . " ";
$no_orders = tep_db_query($no_orders_query);

while ($_no_orders = tep_db_fetch_array($no_orders)) {
$no_orders[] = $_no_orders;
$list_of_cust_ids[] = $_no_orders['customers_id'];
}

$customers_query_raw = "SELECT c.customers_id , c.customers_default_address_id, c.customers_email_address, c.customers_dob, c.customers_telephone, c.customers_gender, a.entry_company, a.address_book_id, a.customers_id, a.entry_firstname, a.entry_lastname, a.entry_street_address, a.entry_suburb, a.entry_city, a.entry_state, a.entry_postcode, a.entry_country_id, a.entry_zone_id, z.zone_code, co.countries_name FROM " . TABLE_CUSTOMERS . " c LEFT JOIN " . TABLE_ADDRESS_BOOK . " a on c.customers_id = a.customers_id and c.customers_default_address_id = a.address_book_id JOIN " . TABLE_COUNTRIES . " co ON a.entry_country_id = co.countries_id LEFT JOIN " . TABLE_ZONES . " z ON a.entry_zone_id = z.zone_id where c.customers_id NOT IN (" . implode(',', $list_of_cust_ids) . ") ORDER BY $db_orderby $sorted";
$customers_query = tep_db_query($customers_query_raw);

 

And I get this error:

Warning: Cannot use a scalar value as an array in /home/.lew/domain/admin/no_order_customers.php on line 119

 

Line 119 is:

	$no_orders[] = $_no_orders;

 

What is "scalar value" ? What did I mess up? Do I need line 119 ?


~Tracy
 

Share this post


Link to post
Share on other sites
Hi Jan,

I hope I am not trawling old ground here but I have come up with a problem on a new install that I got the impression was fixed by "SPPC attributes mod rev. 1"

I did a clean install with RC2 + SPPC 4.2.0 and everything works fine except that for the attributes, the price still displays as the "Retail" price on product info, but when you click add to cart, the cart price shows the correct "wholesale" price.

I have also modded for sort product options (attributes) in conjunction with Options as images, which alters the option_images file. I tried reversing the mods etc, but just cannot trace the problem.

 

Any help or pointers much appreciated.

 

Just in case anyone else hits this problem as well, I discovered that this relates to the "Options for images" mod. Once this mod is switched on, it overrides products.php changes. Once the SPPc edits are replicated in options_images.php the SPPC works like a dream ! Now I can say Great work Jan !

Share this post


Link to post
Share on other sites
In principle yes, but you have to hard code that in create_account.php. It is not an admin setting or something like that.

Hi Jan,

The way I have implemented SPPC is that customers py a subscription to become part of a particular group.

 

What would be very neat is if I could designate a group to a product so that they automatically become a member of the designated group when they pay. Looking at some of the posts, this could be a good workaround for others as well where subscriptions could be set up, priced or free as needed.

 

Is this possible?

Share this post


Link to post
Share on other sites
Is this possible?

Why not? It is just a change in a column in a table. I think the best place to add it might be checkout_process.php. Check somewhere if this particular product is present in the order, set a variable from 0 to 1 and then after everything is processed the regular way, change the customer group id for the customer with an additional query.

Share this post


Link to post
Share on other sites

Hello Jan.

 

Thanks very much for your great work in this community and your Mods. They are all great. :)

 

I am running oscommerce 2.2 M2. I installed SPPC 1.46, SPPC attributes mod rev 1 and Quantity Price Breaks for Separate Pricing Per Customer. The three mods are working very well. Thank you!

 

I wanted to display the actual price on product_info.php in the attributes Pull down menu instead of displaying +/-.

 

Then I installed this contribution:

 

Actualy Price in Pull down option menus (I installed the SPPC Version)

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

 

It's a very simple mod. Only few lines to modify in product_info.php file.

 

After applying this mod, SPPC, SPPC attributes mod rev and Quantity Price Breaks for SPPC are still working fine and the shopping cart works fine as well.

 

The only problem I am having now is "Actualy Price in Pull down option menus" mod woks fine for retailers but when wholesellers log in, the attributes drop down menu is still displaying the retail prices instead of displaying the wholesale price. When wholesellers add product to cart the product is added with the correct price (wholesale price).

 

Do you have any idea on what should be changed in the "Actualy Price in Pull down option menus" mod? I know you are not the autor but I also know you are able to figure out what to do since you are one of those who wrote SPPC and Q. P. Break for SPPC. :)

 

Your help shall be highly appreciate. Thanks.

 

Below is the mod:

 

In classes/shopping_cart.php

 

I replaced:

 

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

 

With:

 

//// BOF Actual Price Pull Down v1.2.3a
$new_price ? $original_price = $new_price : $original_price = $product_info['products_price']; //// check if set special price

       $option_price = $products_options['options_values_price'];
       if ($products_options['price_prefix'] == "-") // in case price lowers, don't add values, subtract.
	$show_price = 0.0 + $original_price - $option_price; // force float (in case) using the 0.0;
else if ($products_options['price_prefix'] == "+")
       	$show_price = 0.0 + $original_price + $option_price; // force float (in case) using the 0.0;
else
       	$show_price = $original_price; // force float (in case) using the 0.0;
   //if ($products_options['options_values_price'] != '0')
   {
           $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $currencies->display_price(($products_options[$n]['options_values_price'] + $product_info['products_price']), tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
   }
//// EOF Actual Price Pull Down v1.2.3a

 

 

Thx for Helping.

 

JBS7

Share this post


Link to post
Share on other sites
Actualy Price in Pull down option menus (I installed the SPPC Version)

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

 

It's a very simple mod. Only few lines to modify in product_info.php file.

I looked that up and found that I already struggled with that once. This is what I think works best.

Change Line 188-194 in a product_info.php (SPPC version):

   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:

//// BOF Actual Price Pull Down v1.2.3a
  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 ($new_price) {
			$original_price = $new_price;
		  } else {
			$original_price = $product_info['products_price'];
		  }
		  if ($products_options[$n]['price_prefix'] == "-") // in case price lowers, don't add values, subtract 
		  {
				$show_price = 0.0 + $original_price - $products_options[$n]['options_values_price']; // force float (in case) using the 0.0;
			} else {
			  $show_price = 0.0 + $original_price + $products_options[$n]['options_values_price']; // force float (in case) using the 0.0;
			}
	  if ($products_options[$n]['options_values_price'] != '0') {
		$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $currencies->display_price( $show_price, tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
	  }
	}
// EOF Actual Price Pull Down v1.2.3a
// EOF SPPC attributes mod

That seems to work (haven't tested this with customer group prices now, but I think I did that in the past).

Share this post


Link to post
Share on other sites

Hello Jan,

 

Thanks very much for your fast reply.

 

I tried your solution and it didn't work out. The retail prices are still showing to wholesellers.

 

Any other idea?

 

Many thanks.

 

JBS7

 

BTW, sorry for my post being so wide on this page. I don't know what went wrong while posting it. Later i couldn't locate the edit button. probably disabled by the admin. :)

 

Also, I made a mistake in my previous post. I wrote classes/shopping_cart.php while I wanted to say product_info.php :D

Share this post


Link to post
Share on other sites

Hi Jan - looks like this is a great contribution that I must have! One question before I start - am I able to set up an unlimited # of groups. I'd like to set up these "groups" for each of my affiliates. My store is selling one product and each affiliate has variable pricing on the same 2 products and their attributes. Is this the answer I've been searching for?

 

Crossing my fingers in FL!

NK

Share this post


Link to post
Share on other sites
One question before I start - am I able to set up an unlimited # of groups. I'd like to set up these "groups" for each of my affiliates. My store is selling one product and each affiliate has variable pricing on the same 2 products and their attributes.

In principle there is no limit to the number of groups, although admin/categories.php would become a very long page with a lot of these groups (because of the place to put the prices for the different groups). Perhaps using "Quick Price Updates for SPPC" would work quicker then (then you have a drop-down menu for the groups).

Share this post


Link to post
Share on other sites
I tried your solution and it didn't work out. The retail prices are still showing to wholesellers.

 

Any other idea?

Just re-checked it but it works fine here. Please download version 4.2.0 or 4.2.1 and compare your product_info.php with the one from the package. Something must have gone wrong with installing I think.

BTW, sorry for my post being so wide on this page. I don't know what went wrong while posting it. Later i couldn't locate the edit button. probably disabled by the admin. :)

You got 15 minutes to edit a post.

 

The wide box is caused by the default for the tag for code being codebox. If you use [ code ] instead of [ codebox ] (without the spaces) long lines get wrapped. Not with codebox.

Also, I made a mistake in my previous post. I wrote classes/shopping_cart.php while I wanted to say product_info.php :D

I already guessed that :)

Share this post


Link to post
Share on other sites

WOnder if you can tell me - am I going to run into problems with osCommerce 2.2-MS2? REason I ask is - I set up a new installation along with your contribution and I'm getting a blank page on the categories/products page.....will try to reinstall but that's the first question I have......maybe my OS COmmerce version is conflicting?

Edited by nikikelly

Share this post


Link to post
Share on other sites

Hello everyone,

 

first I want to thank you for such a great contribution which SPPC really is. Finally I was able to run my eshop on http://www.automotoalarm.sk, but I've got this huge problem. In some way my template and SPPC aren't working together. First time there was tep_show_category error instead of list of product, now it's all blank. I spend whole last week searching for solution on this forums, but now I'm really desperate.

 

Please anyone, just send me a PM, hint or just link (if it's was already mentioned in this thread).

 

Thank you, Dafko :blush:

Share this post


Link to post
Share on other sites
WOnder if you can tell me - am I going to run into problems with osCommerce 2.2-MS2? REason I ask is - I set up a new installation along with your contribution and I'm getting a blank page on the categories/products page.....will try to reinstall but that's the first question I have......maybe my OS COmmerce version is conflicting?

If you have an old version you can still manually add this contribution. But in your case I would make sure I use the latest osC and then first run the sql file (as you are instructed in the install.html in new_installations) and then add the files from the contribution to replace the osC ones (provided this is a new install with no other contributions installed yet).

 

Otherwise using the diff's with a program I just saw mentioned in the contributions today might be something (www . sourcegear . com / diffmerge )

Share this post


Link to post
Share on other sites
First time there was tep_show_category error instead of list of product, now it's all blank. I spend whole last week searching for solution on this forums, but now I'm really desperate.

Without knowing what the actual error is you can search for ages here and find nothing. Your hosting provider likely setup PHP such that no errors are echo'ed (which makes sense security wise, but sucks if you are having errors).

 

Check with them if they have an error log somewhere (likely).

Share this post


Link to post
Share on other sites
Without knowing what the actual error is you can search for ages here and find nothing. Your hosting provider likely setup PHP such that no errors are echo'ed (which makes sense security wise, but sucks if you are having errors).

 

Check with them if they have an error log somewhere (likely).

 

That's also pretty weird since this morning I was getting this error:

Fatal error: Cannot redeclare tep_show_category() (previously declared in includes\header.php:141) in includes\boxes\categories.php on line 59

 

:'(

Share this post


Link to post
Share on other sites
Just re-checked it but it works fine here. Please download version 4.2.0 or 4.2.1 and compare your product_info.php with the one from the package. Something must have gone wrong with installing I think.

 

Hi Jan,

 

Thanks very much for your reply and also for your tips on how to post in this forum.

 

As said in my first post I installed SPPC 1.46 instead of Version 4.2.0 bcuz this last one was made for RC2 and I am running 2.2 M2. I initially installed Version 4.2.0 but I had to undo everything with my backup bcuz I was getting a lot of errors. I scanned this forum and the only solution you provided to people having the same issue was to upgrade their osCommerce. I don't wanna upgrade mine now cuz I've gotten a heavily modified site.

 

SPPC 1.46, SPPC attributes mod rev and Quantity Price Breaks for Separate Pricing Per Customer 1 are working very well. My only problem is the "Actualy Price in Pull down option menus" Mod which is keeping on displaying retail prices to wholesellers when they are logged in.

 

Below is my product_info.php with the code you sent to me. I would appreciate if you could have a look at it. :)

 

Many Thanks.

 

JBS7

 

<?php
/*
 $Id: product_info.php,v 1.97 2003/07/01 14:34:54 hpdl Exp $
  adapted for Separate Pricing Per Customer v4 and Price Break 1.11.3 2005/03/12

 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 require('includes/application_top.php');

 require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_PRODUCT_INFO);

 $product_check_query = tep_db_query("select count(*) as total 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_check = tep_db_fetch_array($product_check_query);
 // BOF Separate Price per Customer
 if(!tep_session_is_registered('sppc_customer_group_id')) {
 $customer_group_id = '0';
 } else {
  $customer_group_id = $sppc_customer_group_id;
 }
  // EOF Separate Price per Customer
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<title><?php echo TITLE; ?></title>
<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<script language="javascript"><!--
function popupWindow(url) {
 window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,res
izable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,le
ft=150')
}
//--></script>
</head>
<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">
<!-- header //-->
<?php require(DIR_WS_INCLUDES . 'header.php'); ?>
<!-- header_eof //-->
<table border="0" width="98%" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF" style="padding-bottom:3px; ">
 <tr>
  <td align="center">
<!-- body //-->
<table border="0" width="98%" cellspacing="0" cellpadding="0">
 <tr>
<td rowspan="2" width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="0">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
</table></td>
<!-- body_text //-->
<td width="100%" valign="top" style="padding:0px 5px; "><?php echo tep_draw_form('cart_quantity', tep_href_link(FILENAME_PRODUCT_INFO, tep_get_all_get_params(array('action')) . 'action=add_product')); ?><table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading"><?php $info_box_contents = array();
$info_box_contents[] = array('text' => 'Produto'); new infoBoxHeading1($info_box_contents, true, true, false);?></td>
	 </tr>
	</table></td>
  </tr>
<tr>
	<td height="399" valign="top" class="infoBox1" align="left"><table border="0" width="100%" cellspacing="3" cellpadding="0" >

<?php
 if ($product_check['total'] < 1) {
?>
  <tr>
	<td><?php new infoBox(array(array('text' => TEXT_PRODUCT_NOT_FOUND))); ?></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td align="right"><?php echo '<a href="' . tep_href_link(FILENAME_DEFAULT) . '">' . tep_image_button('button_continue.gif', IMAGE_BUTTON_CONTINUE) . '</a>'; ?></td>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
<?php
 } else {
// BOF Separate Price per Customer, Price Break 1.11.3 mod
$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, NULL as specials_new_products_price, p.products_price1, p.products_price2, p.products_price3, p.products_price4, p.products_price5, p.products_price6, p.products_price7, p.products_price8, p.products_price1_qty, p.products_price2_qty, p.products_price3_qty, p.products_price4_qty, p.products_price5_qty, p.products_price6_qty, p.products_price7_qty, p.products_price8_qty, p.products_qty_blocks, 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);
// EOF Separate Price per Customer, Price Break mod

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 . "'");

// BOF Separate Pricing per Customer, Price Break 1.11.3 mod
  $pf->loadProductSppc((int)$HTTP_GET_VARS['products_id'], (int)$languages_id, $product_info);
  $products_price = $pf->getPriceString();
// EOF Separate Pricing per Customer, Price Break 1.11.3 mod

if (tep_not_null($product_info['products_model'])) {
  $products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';
} else {
  $products_name = $product_info['products_name'];
}
?>
  <tr>
	<td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
		<td class="pageHeading" valign="top"><?php echo $products_name; ?></td>
		<td class="pageHeading" align="right" valign="top"><?php echo $products_price; ?></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td class="main">
<?php
if (tep_not_null($product_info['products_image'])) {
?>
	  <table border="0" cellspacing="0" cellpadding="2" align="right">
		<tr>
		  <td align="center" class="smallText">
<script language="javascript"><!--
document.write('<?php echo '<a href="java script:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id']) . '\\\')">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], addslashes($product_info['products_name']), SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>');
//--></script>
<noscript>
<?php echo '<a href="' . tep_href_link(DIR_WS_IMAGES . $product_info['products_image']) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $product_info['products_image'], $product_info['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT, 'hspace="5" vspace="5"') . '<br>' . TEXT_CLICK_TO_ENLARGE . '</a>'; ?>
</noscript>
		  </td>
		</tr>
	  </table>
<?php
}
?>
	  <p><?php echo stripslashes($product_info['products_description']); ?></p>
<?php
// BOF SPPC Hide attributes from customer groups
$products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0 ");

$products_attributes = tep_db_fetch_array($products_attributes_query);
if ($products_attributes['total'] > 0) {
?>
	  <table border="0" cellspacing="0" cellpadding="2">
		<tr>
		  <td class="main" colspan="2"><?php echo TEXT_PRODUCT_OPTIONS; ?></td>
		</tr>
<?php
  $products_options_name_query = tep_db_query("select distinct popt.products_options_id, popt.products_options_name from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0 order by popt.products_options_name");
  while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
	$products_options_array = array();
	$products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix, 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 . "' and find_in_set('".$customer_group_id."', attributes_hide_from_groups) = 0");
	$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')

  //// BOF Actual Price Pull Down v1.2.3a
  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 ($new_price) {
			$original_price = $new_price;
		  } else {
			$original_price = $product_info['products_price'];
		  }
		  if ($products_options[$n]['price_prefix'] == "-") // in case price lowers, don't add values, subtract 
		  {
				$show_price = 0.0 + $original_price - $products_options[$n]['options_values_price']; // force float (in case) using the 0.0;
			} else {
			  $show_price = 0.0 + $original_price + $products_options[$n]['options_values_price']; // force float (in case) using the 0.0;
			}
	  if ($products_options[$n]['options_values_price'] != '0') {
		$products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $currencies->display_price( $show_price, tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
	  }
	}
// EOF Actual Price Pull Down v1.2.3a
// EOF SPPC attributes mod

	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
  }
?>
	  </table>
<?php
}
?>
	</td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
$reviews_query = tep_db_query("select count(*) as count from " . TABLE_REVIEWS . " where products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "'");
$reviews = tep_db_fetch_array($reviews_query);
if ($reviews['count'] > 0) {
?>
  <tr>
	<td class="main"><?php echo TEXT_CURRENT_REVIEWS . ' ' . $reviews['count']; ?></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
}

if (tep_not_null($product_info['products_url'])) {
?>
  <tr>
	<td class="main"><?php echo sprintf(TEXT_MORE_INFORMATION, tep_href_link(FILENAME_REDIRECT, 'action=url&goto=' . urlencode($product_info['products_url']), 'NONSSL', true, false)); ?></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
<?php
}

if ($product_info['products_date_available'] > date('Y-m-d H:i:s')) {
?>
  <tr>
	<td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_AVAILABLE, tep_date_long($product_info['products_date_available'])); ?></td>
  </tr>
<?php
} else {
?>
  <tr>
	<td align="center" class="smallText"><?php echo sprintf(TEXT_DATE_ADDED, tep_date_long($product_info['products_date_added'])); ?></td>
  </tr>
<?php
}
?>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <tr>
	<td><table border="0" width="100%" cellspacing="1" cellpadding="2" class="infoBox">
	  <tr class="infoBoxContents">
		<td><table border="0" width="100%" cellspacing="0" cellpadding="2">
		  <tr>
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
			<td class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_REVIEWS, tep_get_all_get_params()) . '">' . tep_image_button('button_reviews.gif', IMAGE_BUTTON_REVIEWS) . '</a>'; ?></td>
			<!--  BOF price-break-1.11.3  <td class="main" align="right"><?php // echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); 
?></td> -->
			 <td class="main" align="right">
			  <table border="0" align="right">
				<tr><td align="center">
				  <?php echo TEXT_ENTER_QUANTITY . ":" . tep_draw_input_field('cart_quantity', $pf->adjustQty(1), 'size="6"'); ?>
				</td></tr>
				<tr><td align="center">
				  <?php echo tep_draw_hidden_field('products_id', $product_info['products_id']) . tep_image_submit('button_in_cart.gif', IMAGE_BUTTON_IN_CART); ?>
				</td></tr>
			  </table>
			</td> <!-- EOF price-break-1.11.3 -->
			<td width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>
		  </tr>
		</table></td>
	  </tr>
	</table></td>
  </tr>
  <tr>
	<td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>
  </tr>
  <!--   <tr>
	<td>-->
<?php
  /* if ((USE_CACHE == 'true') && empty($SID)) {
  echo tep_cache_also_purchased(3600);
} else {
  include(DIR_WS_MODULES . FILENAME_ALSO_PURCHASED_PRODUCTS);
}*/
 }
?>
<!--	</td>
  </tr>-->
  </table></td></tr>
	<tr>
		<td><?php  new infoBoxFooter(''); ?></td>
	</tr>
</table></form></td>
<!-- body_text_eof //-->
<td width="<?php echo BOX_WIDTH_RIGHT; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH_RIGHT; ?>" cellspacing="0" cellpadding="0">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
</table></td>
 </tr>
</table>
</td>
 </tr>
</table>
<!-- body_eof //-->

<!-- footer //-->
<?php require(DIR_WS_INCLUDES . 'footer.php'); ?>
<!-- footer_eof //-->
<br>
</body>
</html>
<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×