Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

* * Random Products instead of new monhly products * *


zebra001

Recommended Posts

Posted

OK OK OK... I am told this has been answered before, but can someone who has successfully acheived this please tell me how or direct me in the correct direction.

 

How do you display random products instead of monthly products on the default.php page?

Please if you answer or plan to help me don't answer with there is a contribution or search the forum it has been asked before...Not much help.

 

 

I've searched..

 

If you know of a contribution or a place in the forum please give me the URL.

 

Thanks

Posted

if ( (!isset($new_products_category_id)) || ($new_products_category_id == '0') ) {

$new_products_query = tep_db_query("select 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 where products_status = '1' order by RAND() DESC limit " . MAX_DISPLAY_NEW_PRODUCTS);

} else {

$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 = '" . $new_products_category_id . "' and p.products_status = '1' order by RAND() DESC limit " . MAX_DISPLAY_NEW_PRODUCTS);

}

Ian-san

Flawlessnet

Posted

Suggestion to Core Team: Might as well remove the search button if every question is going to be answered time and time again.

Posted

Thats the right code but I really dont know where to put it on default.php, may I have a little more detail on how to set it up. Thanks

Posted

On new_products.php look for "p.products_date_added" (no "")

 

 

Change p.products_date_added in both cases to RAND()

 

HTH

 

Thanks to Ian for the code which works a treat....

Citizen of US Minor Outlying Islands

Posted

I've been looking for this, however I am very new at this. Where exactly does that code go please??????????

Posted

Craig

 

Hope this will clarify it for you

 

1. Look for the file new_products.php. Its in includesmodules

 

2. Open it in your text editor (we use Cute HTML as it doen't add spaces).

 

3. Search for both instances of

p.products_date_added

 

4. Replace both instances with

RAN()
.

 

5. Save and upload...

 

or

 

1. Open the file and cut and paste the block of code Ian has posted above.

 

HTH

Citizen of US Minor Outlying Islands

Posted
Suggestion to Core Team:  Might as well remove the search button if every question is going to be answered time and time again.

Gary, finding things with the search feature is worse than a needle in a haystack sometimes. I have and will continue to ask questions that have already been answered because sometimes you just plain can't guess the exact words used by the original poster in the historical thread where your question is answered. I also run a forum like this on my site and consider it part of my job to re-answer questions because I can't expect all of my users to spend 45 minutes fishing through posts just to find an answer. 5-10 mins sure, but its not always that easy.

 

HTL

.

www.hairlosstalk.com

Consumer Hair Loss Information & Support

Posted
Suggestion to Core Team:  Might as well remove the search button if every question is going to be answered time and time again.

Gary, finding things with the search feature is worse than a needle in a haystack sometimes. I have and will continue to ask questions that have already been answered because sometimes you just plain can't guess the exact words used by the original poster in the historical thread where your question is answered. I also run a forum like this on my site and consider it part of my job to re-answer questions because I can't expect all of my users to spend 45 minutes fishing through posts just to find an answer. 5-10 mins sure, but its not always that easy.

 

HTL

 

Sometimes it is difficult, but you simply need to refine your search terms. It works - but people are just plain lazy.

 

Remember that on your site, the forum (I'd have thought) produces income for you, and/or helps to gain and retain new paying customers.

 

Here, no-one is paid. BIG difference, chalk and cheese.

Posted

I have to say that in general I agree with Gary - mostly, it seems that we answer questions too easiliy on these forums and by PM when the answer already exists.

 

Searching may not be great but it is a good learning experience - you never know what you might find!

 

In this case, I thought that this might be a good place to store the answer to this question as the heading of the subject was accurate albeit the bold fonts a bit of a mistake. I have been asked about random product display more than 10 times now by PM as I use it on my store.

 

I actually have three ways to show the order of products on the home page, switchable from Admin, at my whim - normal, random and manually.

 

I would recommend to anyone doing this type of simple mod to comment out the old code rather than replace it as they might want to return to the original again later.

 

And thanks to emanresu for putting the answer in two words rarther than my 100 :!:

Ian-san

Flawlessnet

Posted

I have to agree that the search process can take a long time. Ian, you have spent a significant amount of time answering this question, but by doing so a new way was discovered.

 

Take this opportunity to put the answer in the FAQ section. You will then have a permanent and easy to find place for a great answer.

 

You could even explain the advantages to each solution.

 

Next time (and there will be a next time) you can point to the FAQ. As the FAQ's increase it will become obvious to new users that that is the best place to start.

 

I appreciate the time you put into this forum. By organizing the forum, it becomes more powerful and easier to maintain.

 

aj

"Of the things we think, say or do:

Is it the TRUTH?

Is it FAIR to all concerned?

Will it build GOODWILL and BETTER FRIENDSHIPS?

Will it be BENEFICIAL to all concerned?"

Posted
Remember that on your site, the forum (I'd have thought) produces income for you, and/or helps to gain and retain new paying customers.

I only wish that were true :lol: HLT is primarily an information site, and there is about 300 static pages of content in front of the product center (which only contains about 7 products)... and that doesn't even include the hundreds of pages in the forum. As a result, I literally see about 0.0005% of my traffic ever making it to my store. I get your point, but the numbers show that my time there is pretty much equivilent to free help :) I repeat myself over and over because I know most people aren't search engine savvy.

 

In any case, I consider myself a great searcher and have had a hell of a time trying to find things on here that I *know* have been discussed before. Part of it is how search results are displayed in PHPBB. It's not like google. They don't give you summaries to see if you've found what you want, there are three different links for each search result which would confuse any newbie, and none of those links takes you to the actual post containing the keyword. You have to fish the entire thread (even if its 15 pages long for the keyword in question.

 

Oh well. I only commented because I have and probably will ask more stupid questions in the future, and don't want to get yelled at :) :) :)

 

HLT

.

www.hairlosstalk.com

Consumer Hair Loss Information & Support

Posted

I tried changing p.products_date_added to RAN() but it didn't change anything.

Where do i put the code from Ian? I see where it starts, I don't know where it's supposed to end

Posted
and none of those links takes you to the actual post containing the keyword. You have to fish the entire thread (even if its 15 pages long for the keyword in question.

 

Try searching for "almaden" (1st thing I could think of) and click the radio button in the extra options (in the search page) that says: o posts o topics

 

Up the number of characters per post (again in the search page) and you get the answer right there with no more clicks.

 

It's simply a matter of using the search functions correctly...

Archived

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

×
×
  • Create New...