Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Lastest products


Chryses

Recommended Posts

Posted

Hi.

 

Ther's any way, any modification to the query to show only the last X product that I've added?

 

So I don't want to see the last 30 days products, but the last X products added...

 

Anyone knows if ther's any contrib or the way to make it?

 

Tnx a lo, Jo

Posted

in the admin tool, under the heading "maximum values" there's a setting for "new products listing".

 

it says "maximum number of new products to display in new products page" -- is this what you're looking for?

Posted

Unfortunately no :blush:

 

This control the number of displayed products.

 

I want to select the last X product added to the shop B)

 

You know the way to do this?

 

I think I need to modify the query, but I don't know how...

 

Jo

Posted

order by p.products_date_added desc limit " . MAX_DISPLAY_NEW_PRODUCTS);

 

change to

 

order by p.products_id desc limit 10");

 

Change 10 to whatever number you want to show.

Posted

Tnx for reply.

 

It's similar that I want to do

 

In this way you order the array to products_id, so limit the selection to the last X

 

I want to make the array, select the last X products and order it in random or anyting.

 

I think that I need a second query, the first to collect the last X product, and the second to order it in random or other.....

 

What do you think? I'm still confused, what is the best way... :huh:

 

Jo

Posted
I think that I need a second query, the first to collect the last X product, and the second to order it in random or other.....

 

sql likes things to be in order, so assigning a random order is a bit tricky.

 

the easiest thing i can think of is, before the while() on line 32, read all the data into a single array and then randomize the order of that array. then you'd have to change the while() to iterate through that array.

 

hope this helps.

Posted

I'm looking for a similar solution, while researching I'd like to limit the number of New Products but my code looks different than what is posted here. Currently the site just keeps adding to the New Products endlessly. I'd like to place some limits on this. Here's the code:

 

<?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, m.manufacturers_name 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";

$products_new_split = new splitPageResults($products_new_query_raw,  6);

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

 

THANKS

Archived

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

×
×
  • Create New...