Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

what's new


Guest

Recommended Posts

in catalog\includes\whats_new.php there should be a line like this:

'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a><br>' . $whats_new_price);

 

replace it with this

 

'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '></a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a><br>' . $whats_new_price);

 

Backup your file first

Link to comment
Share on other sites

i don't have a what's new in catalog/includes

 

in catalog/includes/boxes/whatsnew.php i have this:

 

<?php
/*
 $Id: whats_new.php,v 1.31 2003/02/10 22:31:09 hpdl Exp $

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

 Copyright (c) 2003 osCommerce

 Released under the GNU General Public License
*/

 if ($random_product = tep_random_select("select products_id, products_image, products_tax_class_id, products_price from " . TABLE_PRODUCTS . " where products_status = '1' order by products_date_added desc limit " . MAX_RANDOM_SELECT_NEW)) {
?>
<!-- whats_new //-->
         <tr>
           <td>
<?php
   $random_product['products_name'] = tep_get_products_name($random_product['products_id']);
   $random_product['specials_new_products_price'] = tep_get_products_special_price($random_product['products_id']);

   $info_box_contents = array();
   $info_box_contents[] = array('text' => BOX_HEADING_WHATS_NEW);

   new infoBoxHeading($info_box_contents, false, false, tep_href_link(FILENAME_PRODUCTS_NEW));

   if (tep_not_null($random_product['specials_new_products_price'])) {
     $whats_new_price = '<s>' . $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</s><br>';
     $whats_new_price .= '<span class="productSpecialPrice">' . $currencies->display_price($random_product['specials_new_products_price'], tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>';
   } else {
     $whats_new_price = $currencies->display_price($random_product['products_price'], tep_get_tax_rate($random_product['products_tax_class_id']));
   }

   $info_box_contents = array();
   $info_box_contents[] = array('align' => 'center',
                                'text' => '<a class="whatsnew" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a class="whatsnew" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a><br>');

   new infoBox($info_box_contents);
?>
           </td>
         </tr>
<!-- whats_new_eof //-->
<?php
 }
?>

Link to comment
Share on other sites

Sorry, yes you right I missed the boxes dir.

 

So here is the original line from your file

 

'text' => '<a class="whatsnew" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $random_product['products_image'], $random_product['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a class="whatsnew" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a><br>');

 

and the new line:

 

'text' => '<a class="whatsnew" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">' . $random_product['products_name'] . '</a><br>' . $whats_new_price . '<br><a class="whatsnew" href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id']) . '">View More</a>');

Link to comment
Share on other sites

Now from what you mentioned let me understand is it the whats new box you want to modify or the new products in the index page? Can you be more specific?

 

That line should modify the box.

Link to comment
Share on other sites

ok then open file catalog\includes\modules\new_products.php In there it should be this line of code:

'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], SMALL_IMAGE_WIDTH, SMALL_IMAGE_HEIGHT) . '</a><br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br>' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])));

 

Replace it with this line:

'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br>' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '<br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">View More...</a>');

 

Hopefully should do what you need. Havent checked for the quotes if there is a problem let me know I'll double check the syntax.

 

Backup first

Link to comment
Share on other sites

seems to have worked, but how can i make it all in a table, so it spans the width of the page, like:

 

product name -- short desc -- price -- more info

 

right now it looks like:

name

price

view more

Link to comment
Share on other sites

if you remove the <br> tags should take out the new lines now.... do you want to have 1 item per row or multiple items? You could set it up in a separate table alltogether but that will require more mods.

 

To simplify your work use a variable and add the text progressively for each row or cell once you've done with the table row/cell you could add it to the $info_box_contents[$row][$col] array.

Link to comment
Share on other sites

i removed the <br> tags, but now they are still next to eachother, like:

name - price - view more name - price - view more

 

i would like it to be:

name - price - view more

name - price - view more

 

only i would like to add maybe a 50 character part of the description, if it doesn't require any heavy modding, so it would look like:

name - short desc - price - view more

name - short desc - price - view more

Link to comment
Share on other sites

ok so I assume one item per row.

In the same file this line:

'params' => 'class="smallText" width="33%" valign="top"',

sets up the width each item allocates so the default is 3 items per row hence the 33%.

 

To begin try changing the width to 100% and this code to switch rows columns

 

    $col ++;
   if ($col > 2) {
     $col = 0;
     $row ++;
   }

 

replace the above lines with this

      $row ++;

 

so col is always 0 and row is incrementing with each item

Link to comment
Share on other sites

If you install the "short description" contribution should be fairly simple. You will then have to modify in the same file 2 things

 

(Make sure you have the contrib installed before modifying your files)

 

1. Retrieve from the sql query the short description field. So this line:

$new_products_query = tep_db_query("select distinct p.products_id, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);

 

will be like this:

$new_products_query = tep_db_query("select distinct p.products_id, p.short_desc, p.products_image, p.products_tax_class_id, if(s.status, s.specials_new_products_price, p.products_price) as products_price from " . TABLE_PRODUCTS . " p left join " . TABLE_SPECIALS . " s on p.products_id = s.products_id, " . TABLE_PRODUCTS_TO_CATEGORIES . " p2c, " . TABLE_CATEGORIES . " c where p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and c.parent_id = '" . (int)$new_products_category_id . "' and p.products_status = '1' order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);

 

2. The line that was modified earlier:

'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br>' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '<br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">View More...</a>');

 

will now be something like this:

'text' => '<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products['products_name'] . '</a><br>' . $currencies->display_price($new_products['products_price'], tep_get_tax_rate($new_products['products_tax_class_id'])) . '<br><a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $new_products['products_id']) . '">' . $new_products[short_desc] . '</a>');

 

You need to format it accordingly of course, but it should give you the idea.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...