Jump to content
scendent

Seperate Pricing Per Customer v3.5

Recommended Posts

Hi,

 

I have just found out that my product_info file is not showing specials at all, it is showing sppc changes depending on what group one is logged in as, but not specials.

 

I am guessing that I am currently missing some code to call(query) the specials from sppc and then to have it displayed.

 

below is my product_info file as you can see its heavily modified, if you can help with this please let us know.

 

I can say that my sppc prices work everywhere, and my special sppc prices work everywhere but in the product_info file as far as I can tell. I have looked and I can find the sppc code, but cant find anything on sppc specials code.

 

Thanks

 

 

<?php

/*

 $Id: product_info.php 1739 2007-12-20 00:52:16Z hpdl $

 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);

 /*** Begin Quotes ***/

 $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.quotes_expire < now() 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);

 $customer_query = tep_db_query("select customers_id, customers_email_address from " . TABLE_CUSTOMERS . " where customers_id = '" . $customer_id . "'");

 $customer = tep_db_fetch_array($customer_query);

 $product_check_query = tep_db_query("select count(*) as total from " . TABLE_PRODUCTS . " p left join " . TABLE_PRODUCTS_DESCRIPTION . " pd on pd.products_id = p.products_id where p.products_status = '1' and p.products_id = '" . (int)$_GET['products_id'] . "' and pd.language_id = '" . (int)$languages_id . "'");

 $product_check = tep_db_fetch_array($product_check_query);

 $cust_id_query = tep_db_query("select quotes_email_address, products_id from " . TABLE_PRODUCTS . " where products_id = " . (int)$_GET['products_id'] );

 $cust_id = tep_db_fetch_array($cust_id_query);

 if (empty($cust_id['quotes_email_address'])) {

   $invalidCust = 'false';

 }

 else if (tep_session_is_registered('customer_first_name') && tep_session_is_registered('customer_id')) {

   if ($cust_id['quotes_email_address'] == $customer['customers_email_address'] || $customer['customers_email_address'] == STORE_OWNER_EMAIL_ADDRESS)

     $invalidCust = 'false';

   else

$invalidCust = 'true';

 } else {

 $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 Pricing per Customer

 if (isset($_SESSION['sppc_customer_group_id']) && $_SESSION['sppc_customer_group_id'] != '0') {

   $customer_group_id = $_SESSION['sppc_customer_group_id'];

 } else {

   $customer_group_id = '0';

   $navigation->set_snapshot();

   tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

 }

 }

// EOF Separate Pricing 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; ?>">

<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 type="text/javascript" src="includes/js/prototype.js"></script>

<script type="text/javascript" src="includes/js/scriptaculous.js?load=effects,builder"></script>

<script type="text/javascript" src="includes/js/lightbox.js"></script>

<script type= "text/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')

}

// BOF Product Type Feature

/* DDB - 041031 - Form Field Progress Bar */

/***********************************************

* Form Field Progress Bar- By Ron Jonk- http://www.euronet.nl/~jonkr/

* Modified by Dynamic Drive for minor changes

* Script featured/ available at Dynamic Drive- http://www.dynamicdrive.com

* Please keep this notice intact

***********************************************/

function textCounter(field,counter,maxlimit,linecounter) {

// text width//

var fieldWidth =  parseInt(field.offsetWidth);

var charcnt = field.value.length;        

// trim the extra text

if (charcnt > maxlimit) { 

	field.value = field.value.substring(0, maxlimit);

} else { 

// progress bar percentage

var percentage = parseInt(100 - (( maxlimit - charcnt) * 100)/maxlimit) ;

document.getElementById(counter).style.width =  parseInt((fieldWidth*percentage)/100)+"px";

document.getElementById(counter).innerHTML="Limit: "+percentage+"%"

// color correction on style from CCFFF -> CC0000

setcolor(document.getElementById(counter),percentage,"background-color");

}

}

function setcolor(obj,percentage,prop){

obj.style[prop] = "rgb(80%,"+(100-percentage)+"%,"+(100-percentage)+"%)";

}

// EOF Product Type Feature

//--></script>

</head>

<body marginwidth="0" marginheight="0" topmargin="0" bottommargin="0" leftmargin="0" rightmargin="0">

<?php /*** Begin Header Tags SEO ***/ ?>

<a name="<?php echo $header_tags_array['title']; ?>"></a>

<?php /*** End Header Tags SEO ***/ ?>

<!-- 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 border="0" width="<?php echo BOX_WIDTH; ?>" cellspacing="0" cellpadding="2">

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

 /*** Begin Quotes ***/

 if ($invalidCust == 'true') {

?>

      <tr>

       <td><h1><?php echo HEADING_INVALID_CUSTOMER; ?></h1></td>

		</tr>

     <tr>

       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

     </tr>

     <tr>

       <td class="main"><?php echo TEXT_INVALID_CUSTOMER; ?></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 {

/*** End Quotes ***/

 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: More Pics 6  Added: , p.products_subimage1, p.products_subimage2, p.products_subimage3, p.products_subimage4, p.products_subimage5, p.products_subimage6

   $product_info_query = tep_db_query("select p.products_id, pd.products_name, p.quotes_email_address, pd.products_description, p.products_model, p.products_quantity, p.products_image, p.products_subimage1, p.products_subimage2, p.products_subimage3, p.products_subimage4, p.products_subimage5, p.products_subimage6, pd.products_url,p.products_msrp, 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 . "'");

// EOF: More Pics 6

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

   // see if rp product

   $rp_has_trial = false;

   if($product_info['products_type'] == 'recurring'){

       // recurring product

     $rp_array = array();

     $rp_product_query = tep_db_query('SELECT billingPeriod, billingFrequency, totalBillingCycles, trialBillingPeriod, trialBillingFrequency, trialTotalBillingCycles, trialAmt FROM ' . TABLE_RP_PAYPAL_PRODUCT_PROFILE . ' WHERE products_id=' . (int)$HTTP_GET_VARS['products_id']);

     if($rp_product = tep_db_fetch_array($rp_product_query)){

       // recurring data

        $rp_array = $rp_product;

        if(strlen($rp_product['trialBillingPeriod'])>0){

            $rp_has_trial = true;

        }

     }

   }

///

///

   if ($new_price = tep_get_products_special_price($product_info['products_id'])) {

// BOF Separate Pricing per Customer

     if ($customer_group_id > 0) { // only need to check products_groups if customer is not retail

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

      }

     } // end if ($customer_group_id > 0)

// EOF Separate Pricing 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 Pricing per Customer

     if ($customer_group_id > 0) { // only need to check products_groups if customer is not retail

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

    }

   } // end if ($customer_group_id > 0)

// EOF Separate Pricing 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'])) {

     $products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';

   } else {

     $products_name = $product_info['products_name'];

   }

   $products_price = '<table class="" align="right" border="0" width="100%" cellspacing="0" cellpadding="0">';

           $new_price = tep_get_products_special_price($product_info['products_id']);

           if ($product_info['products_msrp'] > $product_info['products_price'])

           $products_price .= '<tr class="PriceListBIG"><td align="right">' . TEXT_PRODUCTS_MSRP  . $currencies->display_price($product_info['products_msrp'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</td></tr>';

           if ($new_price != '')

           $products_price .= '<tr class="usualpriceBIG"><td align="right">'. TEXT_PRODUCTS_USUALPRICE . '';

            else

           $products_price .= '<tr class="pricenowBIG"><td align="right">'. TEXT_PRODUCTS_OUR_PRICE .   '';

           $products_price .=  $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</td></tr>';

           if ($new_price != '')

              {$products_price .= '<tr class="pricenowBIG"><td align="right">' . TEXT_PRODUCTS_PRICENOW .  $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</td></tr>';}

           if ($product_info['products_msrp'] > $product_info['products_price'])

             {if ($new_price != '')

               {$products_price .= '<tr class="savingBIG"><td align="right" >' . TEXT_PRODUCTS_SAVINGS_RRP .  $currencies->display_price(($product_info['products_msrp'] -  $new_price), tep_get_tax_rate($product_info['products_tax_class_id'])) .' ('. number_format(100 - (($new_price / $product_info['products_msrp']) * 100)) . '%)</td></tr>';}

             else

               {$products_price .= '<tr class="savingBIG"><td align ="right" >' . TEXT_PRODUCTS_SAVINGS_RRP . $currencies->display_price(($product_info['products_msrp'] -  $product_info['products_price']), tep_get_tax_rate($product_info['products_tax_class_id'])) . ' ('. number_format(100 - (($product_info['products_price'] / $product_info['products_msrp']) * 100)) . '%)</td></tr>';}}

           else

             {if ($new_price != '')

               {$products_price .= '<tr class="savingBIG"><td align="right" >' . TEXT_PRODUCTS_SAVINGS_RRP .  $currencies->display_price(($product_info['products_price'] -  $new_price), tep_get_tax_rate($product_info['products_tax_class_id'])) . ' ('. number_format(100 - (($new_price / $product_info['products_price']) * 100)) . '%)</td></tr>';}}

           $products_price .= '</table>';

   }

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

   }

        // rp addition here

   if(count($rp_array)>0){

        include_once(DIR_WS_CLASSES . '/paypal_rp_product_info.php');

        $rpPinfo = new paypal_rp_product_info($product_info, $rp_array, $products_price);

        $rpPinfoHeaderArr = $rpPinfo->getProductInfoHeader();

        $rpPInfoArr = $rpPinfo->getProductInfoFull();

   }

// BOF: More Pics 6

   $mopics_image_width = (MOPICS_RESTRICT_IMAGE_SIZE=='true'?SMALL_IMAGE_WIDTH:'');

   $mopics_image_height = (MOPICS_RESTRICT_IMAGE_SIZE=='true'?SMALL_IMAGE_HEIGHT:'');

   if (MOPICS_SHOW_ALL_ON_PRODUCT_INFO=='true') {

     $mopics_output = '';

     $mo_row = 1;

     $mo_col = 1;

     $mopics_images = array();

     if (tep_not_null($product_info['products_image']) && MOPICS_GROUP_WITH_PARENT == 'true') { $mopics_images[] = $product_info['products_image']; }

     for ( $mo_item=1; $mo_item<7; $mo_item++ ) {

       if (tep_not_null($product_info['products_subimage'.$mo_item])) { $mopics_images[] = $product_info['products_subimage'.$mo_item]; }

     }

     $mopics_count = sizeof($mopics_images);

     if ($mopics_count > 0) { 

    $mopics_output .= '<table border="0" cellspacing="0" cellpadding="6" align="'.MOPICS_TABLE_ALIGNMENT.'">';

       for ( $mo_item=0; $mo_item<$mopics_count; $mo_item++ ) {

         if ($mo_row<(MOPICS_NUMBER_OF_ROWS+1)) {

   	    if ($mo_col==1) {$mopics_output.='<tr>'."\n";}

           $mopics_output .= '              <td align="center" class="smallText"><script type= "text/javascript"><!--

               document.write(\'<a href="javascript:popupWindow(\\\'' . tep_href_link(FILENAME_POPUP_IMAGE, 'pID=' . $product_info['products_id'].'&invis='.(MOPICS_GROUP_WITH_PARENT=='true'?$mo_item:($mo_item+1))).'\\\')">' . tep_image(DIR_WS_IMAGES . $mopics_images[$mo_item], addslashes($product_info['products_name']), (MOPICS_RESTRICT_PARENT=='false'&&$mo_item==0&&MOPICS_GROUP_WITH_PARENT=='true'?'':$mopics_image_width), (MOPICS_RESTRICT_PARENT=='false'&&$mo_item==0&&MOPICS_GROUP_WITH_PARENT=='true'?'':$mopics_image_height), 'hspace="5" vspace="5"') . '<br><img src="images/zoom.gif" alt="zoom"><\/a>\');

               //--></script><noscript>

                 <a href="' . tep_href_link(DIR_WS_IMAGES . $mopics_images[$mo_item]) . '" target="_blank">' . tep_image(DIR_WS_IMAGES . $mopics_images[$mo_item], $product_info['products_name'], $mopics_image_width, $mopics_image_height, 'hspace="5" vspace="5"') . '<br><img  src="images/zoom.gif" alt="zoom"></a>

                 </noscript></td>'."\n";

   	    if ($mo_col==MOPICS_NUMBER_OF_COLS) { $mo_col=1; $mo_row++; $mopics_output.='</tr>'."\n"; } else { $mo_col++; }

         }

       }

       if ($mo_col!=1){ while (($mo_col++)<(MOPICS_NUMBER_OF_COLS+1)) { $mopics_output.='<td> </td>'; } $mopics_output.='</tr>'."\n"; }

       $mopics_output .= '</table>'."\n"; 

  }

   }

// EOF: More Pics 6

//DISPLAY PRODUCT WAS ADDED TO WISHLIST IF WISHLIST REDIRECT IS ENABLED

if(tep_session_is_registered('wishlist_id')) {

?>

     <tr>

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

         <tr>

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

           <?php

           if(count($rp_array)>0 and $rp_has_trial){

           // rp with trial

           ?>

           <td class="pageHeading" align="right" valign="top"><?php echo $rpPinfoHeaderArr['trial']; ?><br><?php print $rpPinfoHeaderArr['normal'];?></td>

           <?php

           // rp no trial

           }elseif (count($rp_array)>0){

           ?>

           <td class="pageHeading" align="right" valign="top"><?php print $rpPinfoHeaderArr['normal']; ?></td>

           <?php

           }else{

           // standard product

           ?>

            <td align="right" valign="top" width="10%"><?php echo $products_price; ?></td>

           <?php

           }

           ?>

         </tr>

  <tr>

	<td class="messageStackSuccess"><?php echo PRODUCT_ADDED_TO_WISHLIST; ?></td>

  </tr>

?>

<?php

	tep_session_unregister('wishlist_id');

}

//DISPLAY PRODUCT WAS ADDED TO WISHLIST IF WISHLIST REDIRECT IS ENABLED

?>

     <tr>

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

         <tr>

           <?php /*** Begin Header Tags SEO ***/ ?>

           <td valign="top"><h1><?php echo $products_name; ?></h1></td>

           <td align="right" valign="top"><?php echo $products_price; ?></td>

           <?php /*** End Header Tags SEO ***/ ?></tr>

       </table></td>

     </tr>

     <tr>

       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

     </tr>

     <tr>

       <td class="main">

<?php

         // BOF: More Pics 6

         if (MOPICS_TABLE_LOCATION=='above' && !empty($mopics_output)) {

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

           <tr>

           <td align="center" class="smallText">'.$mopics_output.'</td>

           </tr>

           </table>

            <br>'."\n";

         } else if (MOPICS_TABLE_LOCATION=='sides' && !empty($mopics_output)) {

           echo $mopics_output;

         }

         // EOF: More Pics 6

// BOF: More Pics 6    ADDED to if statement:  && MOPICS_GROUP_WITH_PARENT == 'false'

   if (tep_not_null($product_info['products_image']) && MOPICS_GROUP_WITH_PARENT == 'false') {

?>

         <table border="0" cellspacing="0" cellpadding="2" align="right">

           <tr>

             <td align="center" class="smallText">

<script type= "text/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']), (MOPICS_RESTRICT_PARENT=='false'?'':SMALL_IMAGE_WIDTH), (MOPICS_RESTRICT_PARENT=='false'?'':SMALL_IMAGE_HEIGHT), 'hspace="5" vspace="5"') . '<br><img  src="images/zoom.gif" alt="zoom"><\/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'], (MOPICS_RESTRICT_PARENT=='false'?'':SMALL_IMAGE_WIDTH), (MOPICS_RESTRICT_PARENT=='false'?'':SMALL_IMAGE_HEIGHT), 'hspace="5" vspace="5"') . '<br><img src="images/zoom.gif" alt="zoom"></a>'; ?>

<?php // EOF: More Pics 6 ?>

</noscript>

<br><br>

 <?php

//affiliate build a link begin

	if (tep_session_is_registered('affiliate_id')) {

		?>

     <?php echo '<a href="' . tep_href_link(FILENAME_AFFILIATE_BANNERS_BUILD, 'individual_banner_id=' . $product_info['products_id']) .'" target="_self">' . tep_image('includes/languages/english/images/buttons/button_affiliate_build_a_link.gif', 'Make a link') . ' </a>'; ?><?php

	}

//affiliate build a link begin

     ?>

             </td>

           </tr>

         </table>

<?php

   }

?>

         <p><?php echo stripslashes($product_info['products_description']); ?>

<?php

         // rp check for rp data

         if(count($rp_array)>0){

             print '<p>';

             if(array_key_exists('trial', $rpPInfoArr)){

                 print $rpPInfoArr['trial'] . "<br>\n";

             }

             print $rpPInfoArr['normal'];

         }

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

     // BOF Option Type Feature

     //$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_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);

		if($customer_group_id > 0 ) {

			$query = "SELECT options_values_price, price_prefix FROM `products_attributes_groups`

				WHERE products_attributes_id='".$products_attribs_array['products_attributes_id']."' AND customers_group_id='".$customer_group_id."'";
			$tmp_res = tep_db_query($query);

			if(tep_db_num_rows($tmp_res )) {
				$products_attribs_array = tep_db_fetch_array($tmp_res);
			}
		}

//            $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%		}

	// END vEDIT

	while ($products_options_array = tep_db_fetch_array($products_options_query)) {

		// START vEDIT

		if($customer_group_id > 0 ) {

			$query = "SELECT options_values_price, price_prefix FROM `products_attributes_groups`

				WHERE products_attributes_id='".$products_options_array['products_attributes_id']."' AND customers_group_id='".$customer_group_id."'";

			$tmp_res = tep_db_query($query);

			if(tep_db_num_rows($tmp_res )) {
				$tmp_row = tep_db_fetch_array($tmp_res);

				if($tmp_row['options_values_price']) {
					$products_options_array['options_values_price'] = $tmp_row['options_values_price'];
					$products_options_array['price_prefix'] = $tmp_row['price_prefix'];
				}
			}
		}	

		if ($products_options_array['products_options_values_id'] == $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']] || $no_value) {

			$checked = true;

			$no_value = false;

		} else {

			$checked = false;

		}

		// END vEDIT

		$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, patrib.products_attributes_id 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);

	if($customer_group_id > 0 ) {

			$query = "SELECT options_values_price, price_prefix FROM `products_attributes_groups`

				WHERE products_attributes_id='".$products_attributes_array['products_attributes_id']."' AND customers_group_id='".$customer_group_id."'";

			$tmp_res = tep_db_query($query);

			if(tep_db_num_rows($tmp_res )) {
				$tmp_row = tep_db_fetch_array($tmp_res);

				if($tmp_row['options_values_price']) {
					$products_attributes_array['options_values_price'] = $tmp_row['options_values_price'];
					$attributes_array['price_prefix'] = $tmp_row['price_prefix'];
				}
			}
		}

	// START vFIX

	$boxchecked = false;

	if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {					

		$boxchecked = true;

	%		}

	// END vEDIT

	while ($products_options_array = tep_db_fetch_array($products_options_query)) {

		// START vEDIT

		if($customer_group_id > 0 ) {

			$query = "SELECT options_values_price, price_prefix FROM `products_attributes_groups`

				WHERE products_attributes_id='".$products_options_array['products_attributes_id']."' AND customers_group_id='".$customer_group_id."'";

			$tmp_res = tep_db_query($query);

			if(tep_db_num_rows($tmp_res )) {
				$tmp_row = tep_db_fetch_array($tmp_res);

				if($tmp_row['options_values_price']) {
					$products_options_array['options_values_price'] = $tmp_row['options_values_price'];
					$products_options_array['price_prefix'] = $tmp_row['price_prefix'];
				}
			}
		}	

		if ($products_options_array['products_options_values_id'] == $cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']] || $no_value) {

			$checked = true;

			$no_value = false;

		} else {

			$checked = false;

		}

		// END vEDIT

		$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, patrib.products_attributes_id 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);

	if($customer_group_id > 0 ) {

			$query = "SELECT options_values_price, price_prefix FROM `products_attributes_groups`

				WHERE products_attributes_id='".$products_attributes_array['products_attributes_id']."' AND customers_group_id='".$customer_group_id."'";

			$tmp_res = tep_db_query($query);

			if(tep_db_num_rows($tmp_res )) {
				$tmp_row = tep_db_fetch_array($tmp_res);

				if($tmp_row['options_values_price']) {
					$products_attributes_array['options_values_price'] = $tmp_row['options_values_price'];
					$attributes_array['price_prefix'] = $tmp_row['price_prefix'];
				}
			}
		}

	// START vFIX

	$boxchecked = false;

	if (isset($cart->contents[$HTTP_GET_VARS['products_id']]['attributes'][$products_options_name['products_options_id']])) {					

		$boxchecked = true;

	}else {

		$boxchecked = false;	

	}

	// END vFIX 

	echo '<tr><td class="main">' . $products_options_name['products_options_name'] . ': </td><td class="main">';

	// START vFIX 

	//echo tep_draw_checkbox_field('id[' . $products_options_name['products_options_id'] . ']', $products_attribs_array['options_values_id']);

	echo tep_draw_checkbox_field('id[' . $products_options_name['products_options_id'] . ']', $products_attribs_array['options_values_id'], $boxchecked);

	// END vFIX 

	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;

     // EOF Option Type Feature 

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

       while ($products_options = tep_db_fetch_array($products_options_query)) {

		if($customer_group_id > 0 ) {

			$query = "SELECT options_values_price, price_prefix FROM `products_attributes_groups`

				WHERE products_attributes_id='".$products_options['products_attributes_id']."' AND customers_group_id='".$customer_group_id."'";

			$tmp_res = tep_db_query($query);

			if(tep_db_num_rows($tmp_res )) {
				$tmp_row = tep_db_fetch_array($tmp_res);

				if($tmp_row['options_values_price']) {
					$products_options['options_values_price'] = $tmp_row['options_values_price'];
					$products_options['price_prefix'] = $tmp_row['price_prefix'];
				}
			}
		}

         $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 

               // BOF Option Type Feature

               //echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array, $selected_attribute);

               echo tep_draw_pull_down_menu('id[' . $products_options_name['products_options_id'] . ']', $products_options_array,   $selected_attribute) . $products_options_name['products_options_comment'];

               // EOF Option Type Feature

               ?></td>

           </tr>

<?php

       // BOF Option Type Feature

       } // ends the switch clause

       // EOF Option Type Feature

     } 

  ?>

         </table>

<?php

   }

// BOF: More Pics 6

if (MOPICS_TABLE_LOCATION=='below' && !empty($mopics_output)) {

  echo ' <br>

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

           <tr>

             <td align="center" class="smallText">'.$mopics_output.'</td>

           </tr>

         </table>'."\n";

}

// EOF: More Pics 6

?>					

       </td>

     </tr>

         <tr>

       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

     </tr>

<?php

/*** Begin Quotes ***/

if (! tep_not_null($customers['customers_email_address'])) {

/*** Begin Quotes ***/

   $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

   }

/*** Begin Quotes ***/

}

/*** End Quotes ***/

   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

   }

/*** Begin Quotes ***/

if (! tep_not_null($customers['customers_email_address'])) {

/*** End Quotes ***/

   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

   }

   /*** Begin Quotes ***/

}

/*** End Quotes ***/

?>

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

                <?php

               /*** Begin Quotes ***/

                if (! tep_not_null($customers['customers_email_address'])) {

               ?>

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

              <?php

                }

               /*** End Quotes ***/

               ?><td align="center"><?php echo tep_image_submit('button_wishlist.gif', 'Add to Wishlist', 'name="wishlist" value="wishlist"'); ?></td>

               <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 width="10"><?php echo tep_draw_separator('pixel_trans.gif', '10', '1'); ?></td>

             </tr> <!--- BEGIN Header Tags SEO Social Bookmarks -->

     <?php if (HEADER_TAGS_DISPLAY_SOCIAL_BOOKMARKS == 'true')

      include(DIR_WS_MODULES . 'header_tags_social_bookmarks.php');

     ?>

     <!--- END Header Tags SEO Social Bookmarks -->

           </table></td>

         </tr>

       </table></td>

     </tr>

     <tr>

       <td><?php echo tep_draw_separator('pixel_trans.gif', '100%', '10'); ?></td>

     </tr>

     <tr>

       <td>

<?php

//added for cross -sell

   if ((USE_CACHE == 'true') && empty($SID)) {

     echo tep_cache_xsell_products(3600); //added for Xsell

     echo tep_cache_also_purchased(3600);

   } else {

     include(DIR_WS_MODULES . FILENAME_XSELL_PRODUCTS); //added for Xsell

     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'); ?>

Edited by Jan Zonjee

Getting better with mods but no programmer am I.

Share this post


Link to post
Share on other sites

I have just found out that my product_info file is not showing specials at all, it is showing sppc changes depending on what group one is logged in as, but not specials.

 

I am guessing that I am currently missing some code to call(query) the specials from sppc and then to have it displayed.

There is some duplication in there and the code is hard to read in some places due to the lack of braces (could be the cause of the problem) so I rewrote this part:

 

   if ($new_price = tep_get_products_special_price($product_info['products_id'])) {

// BOF Separate Pricing per Customer

     if ($customer_group_id > 0) { // only need to check products_groups if customer is not retail

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

             }

     } // end if ($customer_group_id > 0)

// EOF Separate Pricing 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 Pricing per Customer

     if ($customer_group_id > 0) { // only need to check products_groups if customer is not retail

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

           }

   } // end if ($customer_group_id > 0)

// EOF Separate Pricing 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'])) {

     $products_name = $product_info['products_name'] . '<br><span class="smallText">[' . $product_info['products_model'] . ']</span>';

   } else {

     $products_name = $product_info['products_name'];

   }

   $products_price = '<table class="" align="right" border="0" width="100%" cellspacing="0" cellpadding="0">';

           $new_price = tep_get_products_special_price($product_info['products_id']);

           if ($product_info['products_msrp'] > $product_info['products_price'])

           $products_price .= '<tr class="PriceListBIG"><td align="right">' . TEXT_PRODUCTS_MSRP  . $currencies->display_price($product_info['products_msrp'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</td></tr>';

           if ($new_price != '')

           $products_price .= '<tr class="usualpriceBIG"><td align="right">'. TEXT_PRODUCTS_USUALPRICE . '';

            else

           $products_price .= '<tr class="pricenowBIG"><td align="right">'. TEXT_PRODUCTS_OUR_PRICE .   '';

           $products_price .=  $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</td></tr>';

           if ($new_price != '')

              {$products_price .= '<tr class="pricenowBIG"><td align="right">' . TEXT_PRODUCTS_PRICENOW .  $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</td></tr>';}

           if ($product_info['products_msrp'] > $product_info['products_price'])

             {if ($new_price != '')

               {$products_price .= '<tr class="savingBIG"><td align="right" >' . TEXT_PRODUCTS_SAVINGS_RRP .  $currencies->display_price(($product_info['products_msrp'] -  $new_price), tep_get_tax_rate($product_info['products_tax_class_id'])) .' ('. number_format(100 - (($new_price / $product_info['products_msrp']) * 100)) . '%)</td></tr>';}

             else

               {$products_price .= '<tr class="savingBIG"><td align ="right" >' . TEXT_PRODUCTS_SAVINGS_RRP . $currencies->display_price(($product_info['products_msrp'] -  $product_info['products_price']), tep_get_tax_rate($product_info['products_tax_class_id'])) . ' ('. number_format(100 - (($product_info['products_price'] / $product_info['products_msrp']) * 100)) . '%)</td></tr>';}}

           else

             {if ($new_price != '')

               {$products_price .= '<tr class="savingBIG"><td align="right" >' . TEXT_PRODUCTS_SAVINGS_RRP .  $currencies->display_price(($product_info['products_price'] -  $new_price), tep_get_tax_rate($product_info['products_tax_class_id'])) . ' ('. number_format(100 - (($new_price / $product_info['products_price']) * 100)) . '%)</td></tr>';}}

           $products_price .= '</table>';

   }

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

   }

To:

// BOF Separate Pricing per Customer
     if ($customer_group_id > 0) { // only need to check products_groups if customer is not retail
       $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'];
    }
   } // end if ($customer_group_id > 0)
// EOF Separate Pricing per Customer

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

   $products_price = '<table class="" align="right" border="0" width="100%" cellspacing="0" cellpadding="0">';

           $new_price = tep_get_products_special_price($product_info['products_id']);

           if ($product_info['products_msrp'] > $product_info['products_price']) {

             $products_price .= '<tr class="PriceListBIG"><td align="right">' . TEXT_PRODUCTS_MSRP  . $currencies->display_price($product_info['products_msrp'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</td></tr>';

             if ($new_price != '') {
               $products_price .= '<tr class="usualpriceBIG"><td align="right">'. TEXT_PRODUCTS_USUALPRICE . '';
             }
           } else {
             $products_price .= '<tr class="pricenowBIG"><td align="right">'. TEXT_PRODUCTS_OUR_PRICE .   '';
             $products_price .=  $currencies->display_price($product_info['products_price'], tep_get_tax_rate($product_info['products_tax_class_id'])) . '</td></tr>';

             if ($new_price != '') {
               $products_price .= '<tr class="pricenowBIG"><td align="right">' . TEXT_PRODUCTS_PRICENOW .  $currencies->display_price($new_price, tep_get_tax_rate($product_info['products_tax_class_id'])) . '</td></tr>';
             }
           }
           if ($product_info['products_msrp'] > $product_info['products_price']) {
             if ($new_price != '') {

               $products_price .= '<tr class="savingBIG"><td align="right" >' . TEXT_PRODUCTS_SAVINGS_RRP .  $currencies->display_price(($product_info['products_msrp'] -  $new_price), tep_get_tax_rate($product_info['products_tax_class_id'])) .' ('. number_format(100 - (($new_price / $product_info['products_msrp']) * 100)) . '%)</td></tr>';
              } else {
               $products_price .= '<tr class="savingBIG"><td align ="right" >' . TEXT_PRODUCTS_SAVINGS_RRP . $currencies->display_price(($product_info['products_msrp'] -  $product_info['products_price']), tep_get_tax_rate($product_info['products_tax_class_id'])) . ' ('. number_format(100 - (($product_info['products_price'] / $product_info['products_msrp']) * 100)) . '%)</td></tr>';
               }
             } else {

             if ($new_price != '') {
               $products_price .= '<tr class="savingBIG"><td align="right" >' . TEXT_PRODUCTS_SAVINGS_RRP .  $currencies->display_price(($product_info['products_price'] -  $new_price), tep_get_tax_rate($product_info['products_tax_class_id'])) . ' ('. number_format(100 - (($new_price / $product_info['products_price']) * 100)) . '%)</td></tr>';
               }
             }
           $products_price .= '</table>';

Note the leaving out of the establishment of products_price in the top part because you reset that anyway. Only a query for the group price is needed. Note also that the part with $products_name was duplicated, took off the one at the bottom.

 

This seems to work for specials.

Share this post


Link to post
Share on other sites

Hi Jan,

 

thanks for the quick replay,

 

Okay that appears to work for the spcials when I am logged in it shows the customer group price (actaully it doesnt it does show you the saving from msrp compared to sale price though. but doesnt take into account specials when I am not logged in. ie specials at retail(default) rather than the extra

 

I am guessing I need a statement that thakes that into account to show special when customer group is 0?

 

Also the display prices are not quite right.

 

I am currently displaying with the mod to the file you suggsted.

 

RRP and saving and not the usual price and or the sale/ price now.

 

 

I will look at this a little more and see if I can work it out, I may be back soon though thanks again fro your help.


Getting better with mods but no programmer am I.

Share this post


Link to post
Share on other sites

Hi Jan,

 

thanks for the quick replay,

 

Okay that appears to work for the spcials when I am logged in it shows the customer group price (actaully it doesnt it does show you the saving from msrp compared to sale price though. but doesnt take into account specials when I am not logged in. ie specials at retail(default) rather than the extra

 

I am guessing I need a statement that thakes that into account to show special when customer group is 0?

 

Also the display prices are not quite right.

 

I am currently displaying with the mod to the file you suggsted.

 

RRP and saving and not the usual price and or the sale/ price now.

 

 

I will look at this a little more and see if I can work it out, I may be back soon though thanks again fro your help.

 

 

Oh dear U am gettinmg lost again, i will check everything abnd give examples to explain what i have and what I am getting


Getting better with mods but no programmer am I.

Share this post


Link to post
Share on other sites

Oh dear U am gettinmg lost again, i will check everything abnd give examples to explain what i have and what I am getting

Well, actually the $new_price (specials price) isn't shown anywhere using that code. It is only used for calculating savings.

 

Correction, it will show the special price when the $product_info['products_msrp'] < $product_info['products_price']

Edited by Jan Zonjee

Share this post


Link to post
Share on other sites

Hello All,

 

I have this SPPC 420 installed everything seems to work fine except tax exempt does not work on either "customer specific tax exempt" or "group specific tax exempt". I add <?php print_r($_SESSION); ?> to footer and I can see output results shows group tax or specific customer tax enabled no problem(i.e. [sppc_customer_group_tax_exempt] => 1 or [sppc_customer_specific_taxes_exempt] => 1 etc). Weird thing is sales tax will always added up to the cart no matter what. Hope someone from here can help solving the problem. Thanks in advance!

Share this post


Link to post
Share on other sites

Got the problem fixed! I looked over the instruction on SPPC 4.22 and found new tax.php within package under new_installations/catalog/includes/classes/tax.php. Soon as updated all tax exempt functions are working correctly!

Share this post


Link to post
Share on other sites

Well, actually the $new_price (specials price) isn't shown anywhere using that code. It is only used for calculating savings.

 

Correction, it will show the special price when the $product_info['products_msrp'] < $product_info['products_price']

 

had some code that had crawled its way to an uncommented line whilst I was doing something hence the oh it working, oh no its not situation.

 

Thanks for your help.


Getting better with mods but no programmer am I.

Share this post


Link to post
Share on other sites

Hello.

I'm uploading thousands of products every month (and delete the old ones).

I upload them successfully with my import method but I need to set ALL wholesale prices ONE BY ONE.. Is there any way to make this more easy?

 

Thank you so much!

 

Your addon is INSANE, by the way.. it helps me a lot!\

Share this post


Link to post
Share on other sites

OMG, this is perfect!

And one more thing, please..

 

The default currency in my website is "лв." (for Retail buyers).

I want when a Wholesale buyer logins to see "$" at the end of the price, not "лв.".. I don't know how to fix this..

 

Because I set the prices in dollars and now they see the dollar price with "лв." at the end.. it's confusing..

 

Thanks again!

Share this post


Link to post
Share on other sites

The default currency in my website is "лв." (for Retail buyers).

I want when a Wholesale buyer logins to see "$" at the end of the price, not "лв.".. I don't know how to fix this..

 

Because I set the prices in dollars and now they see the dollar price with "лв." at the end.. it's confusing..

It's rather a hack but it seems to work OK on the catalog side at least. Adding the function get_customer_group_id() from includes/classes/shopping_cart.php to includes/classes/currencies.php and changing the function format to (only a few lines added in the beginning):

 

   function format($number, $calculate_currency_value = true, $currency_type = '', $currency_value = '') {
     global $currency;
     $this->cg_id = $this->get_customer_group_id();
     if ($this->cg_id > 0) {
       $this->currencies['USD']['symbol_right'] = ' £';
       $this->currencies['USD']['symbol_left'] = '';
     }

     if (empty($currency_type)) $currency_type = $currency;

Seems to do the trick. Instead of $ in front of the price in a default installation of osC it shows the pound symbol after the price when logging in as other than a retail customer. Of course it needs adaptation to the currency you use.

Share this post


Link to post
Share on other sites

Hi,

 

I am having a time of it trying to get these three (SPPC 4.2.2, QPBPP 2.0, & Hide products (and categories) from customer groups for SPPC 2.0.3) to install properly together.

 

The only thing I am clear about is that the fault is mine. So, I am hoping to be advised as to the best way to go about it.

 

Here's what's been tried more than once, so far, but always ending up with sql errors:

 

Web Server Info

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

Apache: 2.2.14

PHP: 5.3.1

MySQL: 5.1.41

 

Vanilla RC2a

 

PHP 5.3 patches (deprecated function updates)

 

SPPC 4.2.2

(dropping in the file changes/updates)

 

QPBPP 2.0

(dropping in the file changes/updates over the SPPC changes/updates)

 

Hide Products for SPPC 2.0.3

(manually installing code - dropping in file changes/updates doesn't work once QPBPP has been added)

 

There are some confusing code overlapping, not quite clear areas when manually installing the Hide Products for SPPC 2.0.3 with QPBPP 2.0

 

Can you please advise me as to what would be the best and easiest way to have both of these SPPC enhancements (QPBPP 2.0 & Hide Products for SPPC 2.0.3) installed and working on a Vanilla RC2a with SPPC?

 

What am I likely doing wrong?

 

Thanks,

 

JF

Share this post


Link to post
Share on other sites

There are some confusing code overlapping, not quite clear areas when manually installing the Hide Products for SPPC 2.0.3 with QPBPP 2.0

 

Can you please advise me as to what would be the best and easiest way to have both of these SPPC enhancements (QPBPP 2.0 & Hide Products for SPPC 2.0.3) installed and working on a Vanilla RC2a with SPPC?

 

What am I likely doing wrong?

I never tried combining these three together either so I can imagine there are confusing code overlaps. It is indeed either adding QPBPP or Hide products manually.

 

I wouldn't bother adding QPBPP to the products listing in index.php though. Not worth the trouble IMHO. Solve one issue at the time I would say.

Share this post


Link to post
Share on other sites

I never tried combining these three together either so I can imagine there are confusing code overlaps. It is indeed either adding QPBPP or Hide products manually.

 

I wouldn't bother adding QPBPP to the products listing in index.php though. Not worth the trouble IMHO. Solve one issue at the time I would say.

 

Thank you for responding, and for your advice. I thought maybe I was not doing something correctly that was obvious to one who knows these contributions well.

 

Now, at least I know it is a matter of patience and perseverance.

 

JF

Share this post


Link to post
Share on other sites

It's rather a hack but it seems to work OK on the catalog side at least. Adding the function get_customer_group_id() from includes/classes/shopping_cart.php to includes/classes/currencies.php and changing the function format to (only a few lines added in the beginning):

 

   function format($number, $calculate_currency_value = true, $currency_type = '', $currency_value = '') {
     global $currency;
     $this->cg_id = $this->get_customer_group_id();
     if ($this->cg_id > 0) {
       $this->currencies['USD']['symbol_right'] = ' £';
       $this->currencies['USD']['symbol_left'] = '';
     }

     if (empty($currency_type)) $currency_type = $currency;

Seems to do the trick. Instead of $ in front of the price in a default installation of osC it shows the pound symbol after the price when logging in as other than a retail customer. Of course it needs adaptation to the currency you use.

 

So, the Retail currency will be Dollars and the Wholesale currency will be Pounds,

 

I saw that I have already get_customer_group_id in currencies.php and don't have in shopping_cart.php..?

And what part of code I need to replace for function format?

 

This is my function format at currencies.php

// class methods
   function format($number, $calculate_currency_value = true, $currency_type = DEFAULT_CURRENCY, $currency_value = '') {
     if ($calculate_currency_value) {
       $rate = ($currency_value) ? $currency_value : $this->currencies[$currency_type]['value'];
       $format_string = $this->currencies[$currency_type]['symbol_left'] . number_format($number * $rate, $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . $this->currencies[$currency_type]['symbol_right'];
// if the selected currency is in the european euro-conversion and the default currency is euro,
// the currency will displayed in the national currency and euro currency
       if ( (DEFAULT_CURRENCY == 'EUR') && ($currency_type == 'DEM' || $currency_type == 'BEF' || $currency_type == 'LUF' || $currency_type == 'ESP' || $currency_type == 'FRF' || $currency_type == 'IEP' || $currency_type == 'ITL' || $currency_type == 'NLG' || $currency_type == 'ATS' || $currency_type == 'PTE' || $currency_type == 'FIM' || $currency_type == 'GRD') ) {
         $format_string .= ' <small>[' . $this->format($number, true, 'EUR') . ']</small>';
       }
     } else {
       $format_string = $this->currencies[$currency_type]['symbol_left'] . number_format($number, $this->currencies[$currency_type]['decimal_places'], $this->currencies[$currency_type]['decimal_point'], $this->currencies[$currency_type]['thousands_point']) . $this->currencies[$currency_type]['symbol_right'];
     }

     return $format_string;
   }

 

Thanks!

Share this post


Link to post
Share on other sites

This is my function format at currencies.php

That's old... There is no more Dutch guilder (NLG), Belgian francs, German Marks etc. Obviously, you haven't upgraded to osC 2.2 RC2a...

Share this post


Link to post
Share on other sites

That's old... There is no more Dutch guilder (NLG), Belgian francs, German Marks etc. Obviously, you haven't upgraded to osC 2.2 RC2a...

 

Thank you for your reply.

Is there any way to upgrade to this version without changing the sources of the pages where's installed SPPC?

Share this post


Link to post
Share on other sites

This is my function format at currencies.php

You can still add this code to the beginning of the function as show above:

$this->cg_id = $this->get_customer_group_id();
     if ($this->cg_id > 0) {
       $this->currencies['USD']['symbol_right'] = ' $';
       $this->currencies['USD']['symbol_left'] = '';
     }

Just a matter of chaning USD to the currency you use (for retail customers).

Share this post


Link to post
Share on other sites

Thanks! Maybe I got something wrong before 2 days, but today my code looks same that you want:

 

I replaced it from:

    function format($number, $calculate_currency_value = true, $currency_type = '', $currency_value = '') {
     global $currency;

     if (empty($currency_type)) $currency_type = $currency;

 

To:

    function format($number, $calculate_currency_value = true, $currency_type = '', $currency_value = '') {
     global $currency;
     $this->cg_id = $this->get_customer_group_id();
     if ($this->cg_id > 0) {
       $this->currencies['USD']['symbol_right'] = ' $';
       $this->currencies['USD']['symbol_left'] = '';
     }

     if (empty($currency_type)) $currency_type = $currency;

 

But now I get this error when I'm trying to view the products:

Fatal error: Call to undefined method currencies::get_customer_group_id() in D:\Web\www\shopping\includes\classes\currencies.php on line 37

Share this post


Link to post
Share on other sites

Hi There,

 

Hoping somebody can help me. I have previously installed Price Breaks 1.3.6 for somebody who now has decided that they want to also have SPPC and then found the latest version of SPPC. Obviosuly there were some clashes and have been looking around for stuff to do with this and came across this contrib which looks fab. However, do I need to remove the 1.3.6 version first and the latest SPPC that I was playing with and start again. If that is the case which sets of files do I need, it is a heavily modded site already so cannot really install from fresh, but have other backups.

 

Thanks

Share this post


Link to post
Share on other sites

I have the feeling that the shipping price should be shown ex tax also but I can't find the code in neither checkout_payment.php or checkout_confirmation.php. Been too long ago I looked at that code.

 

This is still an ongoing problem for me. The shipping price passed to my credit card gateway is what ever is shown as the shipping price on the Order Confirmation page, however, "SHOW_PRICES_WITH_TAX" is always set to true for SPPC, therefore, the shipping price on the order conformation page always includes tax no matter what the customers group is set to for displaying tax. The shipping price displayed on the Order Confirmation page comes from catalog/includes/modules/order_total/ot_shipping.php and I changed the following line in that file

 

if (DISPLAY_PRICE_WITH_TAX == 'true') $order->info['shipping_cost'] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);

 

to

 

if (CUSTOMERS_GROUP_SHOW_TAX == 'true') $order->info['shipping_cost'] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);

 

but the shipping price still showns tax for a member of an SPPC ex-tax group as if it always defaults to 'true'.

 

If I can resolve this then I think I will also resolve the problem with the tax in the credit card module as the code for passing tax to the gateway is similar.

Edited by lbennett

Share this post


Link to post
Share on other sites

if (CUSTOMERS_GROUP_SHOW_TAX == 'true') $order->info['shipping_cost'] += tep_calculate_tax($order->info['shipping_cost'], $shipping_tax);

I think you should take the code from includes/functions/general.php for the tax calculations as an example:

 

// BOF Separate Pricing Per Customer, show_tax modification
// next line was original code
//    if ( (DISPLAY_PRICE_WITH_TAX == 'true') && ($tax > 0) ) {
     if (!isset($_SESSION['sppc_customer_group_show_tax'])) {
       $customer_group_show_tax = '1';
     } else {
       $customer_group_show_tax = $_SESSION['sppc_customer_group_show_tax'];
     }

    if ( (DISPLAY_PRICE_WITH_TAX == 'true') && ($tax > 0) && ($customer_group_show_tax == '1')) {
// EOF Separate Pricing Per Customer, show_tax modification

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

×