Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

New Products Page not showing Special Prices


donisi

Recommended Posts

Hello,

 

I am using OSCommerce version 2.3.1

 

Each product has a list price and some products have a special price.  On the New Products page (products_new.php), it currently only shows the list price for my products. I would like my site to show the following for products on sale:

 

$10

$7

 

If the product is not on sale, I would like this page to only show the list price:

 

$10

 

My first page (index.php) shows the items correctly with the strikeout if the product is on sale.

 

Here is my coding for products_new.php:

 

 

<?php
/*
  $Id$

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

  Copyright © 2010 osCommerce

  Released under the GNU General Public License
*/

  require('includes/application_top.php');

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

  $breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_PRODUCTS_NEW));

  require(DIR_WS_INCLUDES . 'template_top.php');
?>

<h1><?php echo HEADING_TITLE; ?></h1>

<div class="contentContainer">
  <div class="contentText">

<?php
  $products_new_array = array();

  $products_new_query_raw = "select p.products_id, pd.products_name, p.products_image, p.products_price, p.products_tax_class_id, p.products_date_added, p.products_model,p.products_quantity,p.products_weight, m.manufacturers_name, (SELECT 1 FROM ".TABLE_PRODUCTS_ATTRIBUTES." WHERE products_id = p.products_id LIMIT 1) AS products_has_attribute from " . TABLE_PRODUCTS . " p left join " . TABLE_MANUFACTURERS . " m on (p.manufacturers_id = m.manufacturers_id), " . TABLE_PRODUCTS_DESCRIPTION . " pd where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '" . (int)$languages_id . "' order by p.products_date_added DESC, pd.products_name";
 
  $maxitems = MAX_DISPLAY_PRODUCTS_NEW - (MAX_DISPLAY_PRODUCTS_NEW %3) ;
  $products_new_split = new splitPageResults($products_new_query_raw, $maxitems);

  if (($products_new_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '1') || (PREV_NEXT_BAR_LOCATION == '3'))) {
?>

    <div>
      <span style="float: right;"><?php echo TEXT_RESULT_PAGE . ' ' . $products_new_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></span>

      <span><?php echo $products_new_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS_NEW); ?></span>
    </div>

    <br />

<?php
  }
?>

<?php
  if ($products_new_split->number_of_rows > 0) {
?>

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

<?php
    $products_new_query = tep_db_query($products_new_split->sql_query);


    /*while ($products_new = tep_db_fetch_array($products_new_query)) {
      if ($new_price = tep_get_products_special_price($products_new['products_id'])) {
        $products_price = '<del>' . $currencies->display_price($products_new['products_price'], tep_get_tax_rate($products_new['products_tax_class_id'])) . '</del> <span class="productSpecialPrice">' . $currencies->display_price($new_price, tep_get_tax_rate($products_new['products_tax_class_id'])) . '</span>';
      } else {
        $products_price = $currencies->display_price($products_new['products_price'], tep_get_tax_rate($products_new['products_tax_class_id']));
      }
?>
      <tr>
        <td width="<?php echo SMALL_IMAGE_WIDTH + 10; ?>" valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $products_new['products_image'], $products_new['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a>'; ?></td>
        <td valign="top" class="main"><?php echo '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $products_new['products_id']) . '"><strong><u>' . $products_new['products_name'] . '</u></strong></a><br />' . TEXT_DATE_ADDED . ' ' . tep_date_long($products_new['products_date_added']) . '<br />' . TEXT_MANUFACTURER . ' ' . $products_new['manufacturers_name'] . '<br /><br />' . TEXT_PRICE . ' ' . $products_price; ?></td>



        <td align="right" valign="middle" class="smallText"><?php echo tep_draw_button(IMAGE_BUTTON_IN_CART, 'cart', tep_href_link(FILENAME_PRODUCTS_NEW,tep_get_all_get_params(array('action')) . 'action=buy_now&products_id=' . $products_new['products_id'])); */?></td>


      </tr>
<?php
   // }
?>

    </table>
-->

<?php
echo tep_product_listing_content( $products_new_query, $currencies);
  } else {
?>

    <div>
      <?php echo TEXT_NO_NEW_PRODUCTS; ?>
    </div>

<?php
  }

  if (($products_new_split->number_of_rows > 0) && ((PREV_NEXT_BAR_LOCATION == '2') || (PREV_NEXT_BAR_LOCATION == '3'))) {
?>

    <br />

    <div>
   
      <?php if (!isset($_GET['allpages'])) { ?>
      <span style="float: right;"><?php echo TEXT_RESULT_PAGE . ' ' . $products_new_split->display_links(MAX_DISPLAY_PAGE_LINKS, tep_get_all_get_params(array('page', 'info', 'x', 'y'))); ?></span>
      <?php } ?>
      <span><?php echo $products_new_split->display_count(TEXT_DISPLAY_NUMBER_OF_PRODUCTS) ;
  if (isset($_GET['allpages']))
  {
echo  '    <a href="' . tep_href_link(basename($PHP_SELF),  tep_get_all_get_params(array('page', 'info', 'x', 'y')) . 'page=' . 1, $request_type) . '" class="pageResults" title="split">'.sprintf(TEXT_DISPLAY_NUMBERS_PER_PAGE,$products_new_split->number_of_rows_per_page).'</a> ';
  }
  else if ($products_new_split->number_of_rows>$listing_split->number_of_rows_per_page) {
echo '    <a href="' . tep_href_link(basename($PHP_SELF), tep_get_all_get_params(array('page', 'info', 'x', 'y')) . 'allpages', $request_type). '" class="pageResults" title="'.TEXT_DISPLAY_ALL.'">'.TEXT_DISPLAY_ALL.'</a> ';
  }
   ?></span>
    </div>

<?php
  }
?>

  </div>
</div>

<?php
  require(DIR_WS_INCLUDES . 'template_bottom.php');
  require(DIR_WS_INCLUDES . 'application_bottom.php');
?>
 

Link to comment
Share on other sites

you messed up your page, go find the origial catalog/products_new.php

 

and look for the difference, I see some /* comment character before the main while loop where the special price is retrieved

 

 

you can use winmerge to compare files, or pay a little for beyondcompare , pretty damn good tool for comparisons

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

Thanks for the reply bruyndoncx.  The OSCommerce site was setup by another and I "inherited" the current code.  Would I accomplish the same thing by adding an if/else statement to this current line of code?

 

<?php
echo tep_product_listing_content( $products_new_query, $currencies);
  } else {
?>

    <div>
      <?php echo TEXT_NO_NEW_PRODUCTS; ?>
    </div>

< ?php

Link to comment
Share on other sites

sorry, I'm not familiar with tep_product_listing_content

 

@@burt do you know where that comes from ?

KEEP CALM AND CARRY ON

I do not use the responsive bootstrap version since i coded my responsive version earlier, but i have bought every 28d of code package to support burts effort and keep this forum alive (albeit more like on life support).

So if you are still here ? What are you waiting for ?!

 

Find the most frequent unique errors to fix:

grep "PHP" php_error_log.txt | sed "s/^.* PHP/PHP/g" |grep "line" |sort | uniq -c | sort -r > counterrors.txt

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...