Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Recommended Posts

Posted

Hello, it's a simple thing, I know, but I'm not that big on programming. I wanted to make a little box that told people of the more recent items added. Sorta mimmic the what's new and the new products.

 

so i sorta took the what's new box and chopped it. works a little, but encountered two problems.

 

1. it's still random

2. it doesn't LIST all 10

 

 

please point me in the right direction.

 

here's the code so far.

 

<?php

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

   $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('align' => 'left',

                                'text'  => BOX_HEADING_RECENTLY_ADDED

                               );

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



   if ($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 href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'products_id=' . $random_product['products_id'], 'NONSSL') . '">' . $random_product['products_name'] . '</a>'

                               );

   new infoBox($info_box_contents);

 }

?></td></tr><!-- recently added //-->

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...