Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Normal price & specail price on product_info.php


adz1976

Recommended Posts

Hi OSC Helpers

 

I hope someone out there can help me with this problem.

 

 

On the products_info.php page:

 

I have displayed a normal price excluding vat & including vat price. Also, if there are any special price items it

shows up the special price also including & excluding vat below the normal price.

 

What I would like to do is move the special price in to a different place on the product_info page as to where it is positioned now.

 

The problem is as follows:

 

In the code below an echo $products_price is used but this displays normal price inc & exc & also special price inc & exc, if I delete this line all the prices disappear.

 

So my question is, how do I move the specail price in a different place if it is using the same echo as the normal price. ($products_price)

 

I presume I would have to change the special price ($products_price) to something else (eg, $special_price) but I dont know where to change this.

 

Please find link below of my website to show you how the prices are displayed.

http://www.macbuildingproducts.com/product_info.php?products_id=24866

 

 

Is it all done in the product_info page or are there other pages I need to change ?

 

Code:

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

<tr>

<td class="pageHeading" valign="top"><font color="#980000"><?php echo $products_name; ?></font></td>

<td class="subBar" align="right" valign="top"><font color="#000000"><b><?php echo $products_price; ?></b></font>

<br>

<table width="99%" height="42" border="0" align="right">

</table></td>

 

Hope you understand this & are able to help

 

Many thanks

 

Adam :)

Link to comment
Share on other sites

Hi Burt

 

You need to create a $special_price variable in the same way that $products_price is created.

And then use it in your page...

 

Do you know where would i create the variable, which files I need to amend, is it in the products_info.php file or somewhere else ?

 

Thanks

 

Adam :)

Link to comment
Share on other sites

If you need it to be used in product_info, then I suggest you make the variable in product_info

 

I created a new post before you replied, I created a new on as no one replied to my original one. apart from your first reply & I didnt undstand & not heard from you.

 

When you say make the variable, can you give me an example in what to do ?

 

Thanks

 

Adam

Link to comment
Share on other sites

In product_info.php find:

 

if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
  $products_price = '<del>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</del> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
   } else {
  $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
   }

 

Change it to:

 

if ($new_price = tep_get_products_special_price($product_info['products_id'])) {
  $products_price = '<del>' . $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</del> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</span>';
  $special_price = $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id']));
} else {
  $products_price = $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id']));
   }

 

Then where ever you want to show the special price:

 

<?php
if ( $special_price ) { echo $special_price; }
?>

Matt

Link to comment
Share on other sites

Hi Matt

 

Many thanks for taking the time to show me how to display special price.

Unfortunately, this code is not in my product_info.php page as I have SPPC module installed & this is why im finding it so difficult to get the special price to display seperate from the normal price.

 

Below is the code from my product_info page, hope there is a simple way to display the specail price :(

 

<?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 HTML 4.01 Transitional//EN">
<html <?php echo HTML_PARAMS; ?>>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">
<?php
# cDynamic Meta Tags
/*<title><?php echo TITLE; ?>*/
require(DIR_WS_INCLUDES . 'meta_tags.php');
#
?>
<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,resizable=yes,copyhistory=no,width=100,height=100,screenX=150,screenY=150,top=150,left=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 //-->
<!-- body //-->
<table border="0" width="100%" cellspacing="3" cellpadding="3">
 <tr>
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table width="<?php echo BOX_WIDTH; ?>" border="0" cellpadding="2" cellspacing="0">
<!-- left_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_left.php'); ?>
<!-- left_navigation_eof //-->
   </table></td>
<!-- body_text //-->
   <td width="100%" valign="top"><?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">
<?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'];
   }
?>
<?php
//  category textbox mod
if (DISPLAY_EXTRA_CATEGORIES == 'true' && DISPLAY_CATS_ON_PROD_LISTING == 'true'){
   if ($product_check['total'] >= 1) {
// now get textbox description for this *product* and display
$query = tep_db_query("select categories_description from " . TABLE_EXTRA_CATEGORIES . " left join " . TABLE_PRODUCTS_TO_CATEGORIES . " using (categories_id) where " . TABLE_PRODUCTS_TO_CATEGORIES .".products_id=" . (int)$HTTP_GET_VARS['products_id'] . " and " . TABLE_EXTRA_CATEGORIES .".language_id = '" . (int)$languages_id . "'");
while($category_info_text = tep_db_fetch_array($query)){
   if(!empty($category_info_text['categories_description'])){ // prevent output where description not set for particular language
   echo ("<tr><td colspan=\"2\"><div class=\"cat_info_box\">".$category_info_text['categories_description']."</div></td></tr>");
  }
   }
 }
}
?>
    <td><table border="0" width="100%" cellspacing="0" cellpadding="0">
	  <tr>
  <td class="pageHeading" valign="top"><font color="#980000"><?php echo $products_name; ?></font></td>
  <td class="subBar" align="right" valign="top"><font color="#000000"><b><?php echo $products_price; ?></b></font>
   <table width="99%" height="42" border="0" align="right">
</table></td>
	  </tr>
   </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"></td>
<script language="javascript"><!--
document.write('<?php echo '<a href="javascript: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
   $products_attributes_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS_OPTIONS . " popt, " . TABLE_PRODUCTS_ATTRIBUTES . " patrib where patrib.products_id='" . (int)$HTTP_GET_VARS['products_id'] . "' and patrib.options_id = popt.products_options_id and popt.language_id = '" . (int)$languages_id . "'");
   $products_attributes = tep_db_fetch_array($products_attributes_query);
   if ($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 . "' order by popt.products_options_name");
  while ($products_options_name = tep_db_fetch_array($products_options_name_query)) {
    $products_options_array = array();
    $products_options_query = tep_db_query("select pov.products_options_values_id, pov.products_options_values_name, pa.options_values_price, pa.price_prefix from " . TABLE_PRODUCTS_ATTRIBUTES . " pa, " . TABLE_PRODUCTS_OPTIONS_VALUES . " pov where pa.products_id = '" . (int)$HTTP_GET_VARS['products_id'] . "' and pa.options_id = '" . (int)$products_options_name['products_options_id'] . "' and pa.options_values_id = pov.products_options_values_id and pov.language_id = '" . (int)$languages_id . "'");
    while ($products_options = tep_db_fetch_array($products_options_query)) {
	  $products_options_array[] = array('id' => $products_options['products_options_values_id'], 'text' => $products_options['products_options_values_name']);

   if ($products_options['options_values_price'] != '0') {
	    $products_options_array[sizeof($products_options_array)-1]['text'] .= ' (' . $products_options['price_prefix'] . $currencies->display_price($products_options['options_values_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) .') ';
   }
    }
    if (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="4"'); ?>
				  <?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></form></td>
<!-- body_text_eof //-->
   <td width="<?php echo BOX_WIDTH; ?>" valign="top"><table border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">
<!-- right_navigation //-->
<?php require(DIR_WS_INCLUDES . 'column_right.php'); ?>
<!-- right_navigation_eof //-->
   </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'); ?>

 

Thanks

 

Adam

Link to comment
Share on other sites

Ah ok. You didn't mention SPPC in your original post. You will have to dig into whatever file is used to generate the price for that mod. Sorry I'm not familiar with that mod. Maybe it has a support forum you can post in?

Matt

Link to comment
Share on other sites

OK Thanks MATT

 

The file it pulls the data from is a file called PriceFormatter.php

 

The code is below from that file, can you see anything in here to get the special price displayed on it's own ?

 

<?php
/*
 $Id: PriceFormatter.php,v 1.6 2003/06/25 08:29:26 petri Exp $
 adapted for Separate Pricing Per Customer v4 2005/03/20
 including an optimization to avoid double queries for the same info
 osCommerce, Open Source E-Commerce Solutions
 http://www.oscommerce.com
 Copyright (c) 2003 osCommerce
 Released under the GNU General Public License
*/
/*
   PriceFormatter.php - module to support quantity pricing
   Created 2003, Beezle Software based on some code mods by WasaLab Oy (Thanks!)
*/
class PriceFormatter {
 var $hiPrice;
 var $lowPrice;
 var $quantity;
 var $hasQuantityPrice;
 function PriceFormatter($prices=NULL) {
   $this->productsID = -1;
   $this->hasQuantityPrice=false;
   $this->hasSpecialPrice=false;
   $this->hiPrice=-1;
   $this->lowPrice=-1;
   for ($i=1; $i<=8; $i++){
  $this->quantity[$i] = -1;
  $this->prices[$i] = -1;
   }
   $this->thePrice = -1;
   $this->specialPrice = -1;
   $this->qtyBlocks = 1;
   if($prices)
  $this->parse($prices);
 }
 function encode() {
$str = $this->productsID . ":"
    . (($this->hasQuantityPrice == true) ? "1" : "0") . ":"
    . (($this->hasSpecialPrice == true) ? "1" : "0") . ":"
    . $this->quantity[1] . ":"
    . $this->quantity[2] . ":"
    . $this->quantity[3] . ":"
    . $this->quantity[4] . ":"
 . $this->quantity[5] . ":"
 . $this->quantity[6] . ":"
 . $this->quantity[7] . ":"
    . $this->quantity[8] . ":"
    . $this->price[1] . ":"
    . $this->price[2] . ":"
    . $this->price[3] . ":"
    . $this->price[4] . ":"
 . $this->price[5] . ":"
 . $this->price[6] . ":"
 . $this->price[7] . ":"
    . $this->price[8] . ":"
    . $this->thePrice . ":"
    . $this->specialPrice . ":"
    . $this->qtyBlocks . ":"
    . $this->taxClass;
return $str;
 }
 function decode($str) {
list($this->productsID,
  $this->hasQuantityPrice,
  $this->hasSpecialPrice,
  $this->quantity[1],
  $this->quantity[2],
  $this->quantity[3],
  $this->quantity[4],
  $this->quantity[5],
  $this->quantity[6],
  $this->quantity[7],
  $this->quantity[8],
  $this->price[1],
  $this->price[2],
  $this->price[3],
  $this->price[4],
  $this->price[5],
  $this->price[6],
  $this->price[7],
  $this->price[8],
  $this->thePrice,
  $this->specialPrice,
  $this->qtyBlocks,
  $this->taxClass) = explode(":", $str);
$this->hasQuantityPrice = (($this->hasQuantityPrice == 1) ? true : false);
$this->hasSpecialPrice = (($this->hasSpecialPrice == 1) ? true : false);
 }
 function parse($prices) {
   $this->productsID = $prices['products_id'];
   $this->hasQuantityPrice=false;
   $this->hasSpecialPrice=false;
   $this->quantity[1]=$prices['products_price1_qty'];
   $this->quantity[2]=$prices['products_price2_qty'];
   $this->quantity[3]=$prices['products_price3_qty'];
   $this->quantity[4]=$prices['products_price4_qty'];
   $this->quantity[5]=$prices['products_price5_qty'];
   $this->quantity[6]=$prices['products_price6_qty'];
   $this->quantity[7]=$prices['products_price7_qty'];
   $this->quantity[8]=$prices['products_price8_qty'];
   $this->thePrice=$prices['products_price'];
   $this->specialPrice=$prices['specials_new_products_price'];
   $this->hasSpecialPrice=tep_not_null($this->specialPrice);
$this->price[1]=$prices['products_price1'];
   $this->price[2]=$prices['products_price2'];
   $this->price[3]=$prices['products_price3'];
   $this->price[4]=$prices['products_price4'];
$this->price[5]=$prices['products_price5'];
$this->price[6]=$prices['products_price6'];
$this->price[7]=$prices['products_price7'];
   $this->price[8]=$prices['products_price8'];

 /*
   Change support special prices
   If any price level has a price greater than the special
   price lower it to the special price
*/
if ($this->hasSpecialPrice == true) {
 for($i=1; $i<=8; $i++) {
  if ($this->price[$i] > $this->specialPrice)
   $this->price[$i] = $this->specialPrice;
 }
}
//end changes to support special prices
   $this->qtyBlocks=$prices['products_qty_blocks'];
   $this->taxClass=$prices['products_tax_class_id'];
   if ($this->quantity[1] > 0) {
  $this->hasQuantityPrice = true;
  $this->hiPrice = $this->thePrice;
  $this->lowPrice = $this->thePrice;
  for($i=1; $i<=8; $i++) {
if($this->quantity[$i] > 0) {
  if ($this->price[$i] > $this->hiPrice) {
 $this->hiPrice = $this->price[$i];
  }
  if ($this->price[$i] < $this->lowPrice) {
 $this->lowPrice = $this->price[$i];
  }
}
  }
   }
 }
 // function loadProductSppc is Separate Pricing Per Customer only
 function loadProductSppc($product_id, $language_id=1, $product_info)
 {
 global $sppc_customer_group_id;
 if(!tep_session_is_registered('sppc_customer_group_id')) {
 $customer_group_id = '0';
 } else {
  $customer_group_id = $sppc_customer_group_id;
 }
 if ($customer_group_id != '0') {
  $customer_group_price_query = tep_db_query("select customers_group_price, products_price1, products_price2, products_price3, products_price4, products_price5, products_price6, products_price7, products_price8, products_price1_qty, products_price2_qty, products_price3_qty, products_price4_qty, products_price5_qty, products_price6_qty, products_price7_qty, products_price8_qty, products_qty_blocks from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$product_id. "' and customers_group_id =  '" . $customer_group_id . "'");

    if ($customer_group_price = tep_db_fetch_array($customer_group_price_query)) {
    $product_info['products_price']= $customer_group_price['customers_group_price'];
for ($i = 1 ; $i < 9 ; $i++) {
 $product_info['products_price'.$i.''] = $customer_group_price['products_price'.$i.''];
 $product_info['products_price'.$i.'_qty'] = $customer_group_price['products_price'.$i.'_qty'];
} // end if ($customer_group_price = tep_db_fetch_array($customer_group_price_query))
$product_info['products_qty_blocks'] = $customer_group_price['products_qty_blocks'];
} else { // there is no price for the item in products_groups: retail price breaks need to nulled
 for ($i = 1 ; $i < 9 ; $i++) {
 $product_info['products_price'.$i.''] = '0.0000';
 $product_info['products_price'.$i.'_qty'] = '0';
 } // end if ($customer_group_price = tep_db_fetch_array($customer_group_price_query))
 $product_info['products_qty_blocks'] = '1';
}
 } // end if ($customer_group_id != '0')
 // now get the specials price for this customer_group and add it to product_info array
 $special_price_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = " . (int)$product_id . " and status ='1' and customers_group_id = '" . $customer_group_id . "'");
 if ($specials_price = tep_db_fetch_array($special_price_query)) {
  $product_info['specials_new_products_price'] = $specials_price['specials_new_products_price'];
 }
   $this->parse($product_info);
   return $product_info;
 }
   function loadProduct($product_id, $language_id=1)
 {
 global $sppc_customer_group_id;
 if(!tep_session_is_registered('sppc_customer_group_id')) {
 $customer_group_id = '0';
 } else {
  $customer_group_id = $sppc_customer_group_id;
 }
   $sql = "select pd.products_name, p.products_model, p.products_image, p.products_id," .
    " p.products_price, p.products_weight," .
    " 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," .
    " NULL as specials_new_products_price" .
    " from " . TABLE_PRODUCTS_DESCRIPTION . " pd," .
    "	  " . TABLE_PRODUCTS . " p" .
    " where p.products_status = '1'" .
    "   and p.products_id = '" . (int)$product_id . "'" .
    "   and pd.products_id = '" . (int)$product_id . "'" .
    "   and pd.language_id = '". (int)$language_id ."'";
   $product_info_query = tep_db_query($sql);
   $product_info = tep_db_fetch_array($product_info_query);
 if ($customer_group_id != '0') {
  $customer_group_price_query = tep_db_query("select customers_group_price, products_price1, products_price2, products_price3, products_price4, products_price5, products_price6, products_price7, products_price8, products_price1_qty, products_price2_qty, products_price3_qty, products_price4_qty, products_price5_qty, products_price6_qty, products_price7_qty, products_price8_qty, products_qty_blocks from " . TABLE_PRODUCTS_GROUPS . " where products_id = '" . (int)$product_id. "' and customers_group_id =  '" . $customer_group_id . "'");

    if ($customer_group_price = tep_db_fetch_array($customer_group_price_query)) {
    $product_info['products_price']= $customer_group_price['customers_group_price'];
for ($i = 1 ; $i < 9 ; $i++) {
 $product_info['products_price'.$i.''] = $customer_group_price['products_price'.$i.''];
 $product_info['products_price'.$i.'_qty'] = $customer_group_price['products_price'.$i.'_qty'];
} // end if ($customer_group_price = tep_db_fetch_array($customer_group_price_query))
$product_info['products_qty_blocks'] = $customer_group_price['products_qty_blocks'];
} else { // there is no price for the item in products_groups: retail price breaks need to nulled
 for ($i = 1 ; $i < 9 ; $i++) {
 $product_info['products_price'.$i.''] = '0.0000';
 $product_info['products_price'.$i.'_qty'] = '0';
 } // end if ($customer_group_price = tep_db_fetch_array($customer_group_price_query))
 $product_info['products_qty_blocks'] = '1';
}
 } // end if ($customer_group_id != '0')
 // now get the specials price for this customer_group and add it to product_info array
 $special_price_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = " . (int)$product_id . " and status ='1' and customers_group_id = '" . $customer_group_id . "'");
 if ($specials_price = tep_db_fetch_array($special_price_query)) {
  $product_info['specials_new_products_price'] = $specials_price['specials_new_products_price'];
 }

   $this->parse($product_info);
   return $product_info;
 }
 function computePrice($qty)
 {
$qty = $this->adjustQty($qty);
// Compute base price, taking into account the possibility of a special
$price = ($this->hasSpecialPrice === TRUE) ? $this->specialPrice : $this->thePrice;
for ($i=1; $i<=8; $i++)
 if (($this->quantity[$i] > 0) && ($qty >= $this->quantity[$i]))
  $price = $this->price[$i];
return $price;
 }
 function adjustQty($qty) {
// Force QTY_BLOCKS granularity
$qb = $this->getQtyBlocks();
if ($qty < 1)
 $qty = 1;
if ($qb >= 1)
{
 if ($qty < $qb)
  $qty = $qb;
 if (($qty % $qb) != 0)
  $qty += ($qb - ($qty % $qb));
}
return $qty;
 }
 function getQtyBlocks() {
   return $this->qtyBlocks;
 }
 function getPrice() {
   return $this->thePrice;
 }
 function getLowPrice() {
   return $this->lowPrice;
 }
 function getHiPrice() {
   return $this->hiPrice;
 }
 function hasSpecialPrice() {
   return $this->hasSpecialPrice;
 }
 function hasQuantityPrice() {
   return $this->hasQuantityPrice;
 }
 function getPriceString($style='productPriceInBox') {
   global $currencies;
   if ($this->hasSpecialPrice == true) {
 $lc_text = '<table align="top" border="0" cellspacing="0" cellpadding="0">';
    $lc_text .= '<tr><td align="center" class=' . $style. ' colspan="2">';
   $lc_text .= ' <s>'
 . $currencies->display_price($this->thePrice,
	 tep_get_tax_rate($this->taxClass))
 . '</s>  <span class="productSpecialPrice">'
 . $currencies->display_price($this->specialPrice,
	 tep_get_tax_rate($this->taxClass))
 . '</span> '
 .'</td></tr>';
   }
   else
   {
 $lc_text = '<table align="top" border="0" cellspacing="0" cellpadding="0">';
 $lc_text .= '<tr><td align="center" class=' . $style. ' colspan="2">'
 . $currencies->display_price($this->thePrice,
 tep_get_tax_rate($this->taxClass))
 . '</td></tr>';
   }
  // If you want to change the format of the price/quantity table
  // displayed on the product information page, here is where you do it.
   if($this->hasQuantityPrice == true) {
 for($i=1; $i<=8; $i++) {
  if($this->quantity[$i] > 0) {
   $lc_text .= '<tr><td class='.$style.'>'
   . $this->quantity[$i]
   .'+ </td><td class='.$style.'>'
   . $currencies->display_price($this->price[$i],
   tep_get_tax_rate($this->taxClass))
   .'</td></tr>';
  }
 }
 $lc_text .= '</table>';
  }
  else {
 if ($this->hasSpecialPrice == true) {
  $lc_text = ' <s>'
 . $currencies->display_price($this->thePrice, tep_get_tax_rate($this->taxClass))
 . '</s>  <span class="productSpecialPrice">'
 . $currencies->display_price($this->specialPrice, tep_get_tax_rate($this->taxClass))
 . '</span> ';
 }
 else {
  $lc_text = ' '
 . $currencies->display_price($this->thePrice,
	   tep_get_tax_rate($this->taxClass))
 . ' ';
 }
   }
   return $lc_text;
 }
 function getPriceStringShort() {
   global $currencies;
   if ($this->hasSpecialPrice == true) {
  $lc_text = ' <s>'
. $currencies->display_price($this->thePrice,
	 tep_get_tax_rate($this->taxClass))
. '</s>  <span class="productSpecialPrice">'
. $currencies->display_price($this->specialPrice,
	 tep_get_tax_rate($this->taxClass))
. '</span> ';
   }
   else {
  if($this->hasQuantityPrice == true) {
$lc_text = ' '
  . $currencies->display_price($this->lowPrice,
	   tep_get_tax_rate($this->taxClass))
  . ' - '
  . $currencies->display_price($this->hiPrice,
	   tep_get_tax_rate($this->taxClass))
  . ' ';
  }
  else {
$lc_text = ' '
  . $currencies->display_price($this->thePrice,
	   tep_get_tax_rate($this->taxClass))
  . ' ';
  }
   }
   return $lc_text;
 }
}
?>

Link to comment
Share on other sites

You may be a bit confused. SPPC does not add the price formatter file, that is added by quantity price breaks. If you look in the price formatter file as you posted, it mentions special prices. If they are not showing you should try posting your question in the addon forum where someone may be able to help you.

REMEMBER BACKUP, BACKUP AND BACKUP

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...