Jump to content
  • Checkout
  • Login
  • Get in touch


The e-commerce.

random link to products, can this be done?


Recommended Posts



I have a site here http://www.maka.ie/site and my shop is here http://www.maka.ie/store


On the site i have some products listed on the side, But i placed them there by hand and they dont change at all. Is it possible to put some code on my site that will link to the shop and display 2 or 3 products plus there prices and a buy now button. If i refreshed the site it would change.


Has anyone done this and do you think it's possible to do



Link to comment
Share on other sites

  • 2 weeks later...

Ok i figured out a way to do this in my head but getting it to work is another thing,


I found the code in the "whats new" area and it will work as it changes products everytime you refresh the page.

here is the code


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

 osCommerce, Open Source E-Commerce Solutions

 Copyright © 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 " . 

<!-- whats_new //-->
$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">' . 


tep_get_tax_rate($random_product['products_tax_class_id'])) . '</span>';
} else {
  $whats_new_price = $currencies->display_price($random_product['products_price'], 


$info_box_contents = array();
$info_box_contents[] = array('align' => 'center',
							 '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);

new infoBox($info_box_contents);
<!-- whats_new_eof //-->


Now how do i get it to appear on my site in the side area www.maka.ie/index.php the product there now is just static.


I tried putting the code in the txt file and linking to using

<?php include("products1.txt") ?>

But this didnt work.


Does anyone know a way i can place the code and get it working?



Link to comment
Share on other sites

catelog/includes/column_right.php add this code

require(DIR_WS_BOXES . 'whats_new.php');


then in catelog/includes/languages/english.php change the part below in bold to whatever you want the box header to display


// whats_new box text in includes/boxes/whats_new.php

define('BOX_HEADING_WHATS_NEW', 'What\'s New?');

My Contributions


Stylesheet With Descriptions Glassy Grey Boxtops Our Products Meta Tags On The Fly

Password Protect Admin

"No matter where you go....There you are" - Buccaroo Bonsai

Link to comment
Share on other sites

  • 2 weeks later...

Nothing is working so far.


what i need it on this site www.maka.ie for random stock to appear on the right side, i have placed stock there to show what i need.


But i can't figure how what code i need to have there.


Does anyone know ?

Link to comment
Share on other sites


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

  • Create New...