X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   Random Manufacturers in Manufacturer menu box (https://forum.x-cart.com/showthread.php?t=13914)

BCSE 07-01-2007 03:52 PM

Re: Random Manufacturers in Manufacturer menu box
 
Yes if you just find
ORDER BY <Something here>
you can replace that with
ORDER BY Rand()

Hope that helps!

Carrie

MBA 08-01-2007 12:21 PM

Re: Random Manufacturers in Manufacturer menu box
 
Quote:

Originally Posted by BCSE
Here's a quick mod to show random manufacturers in the Manufacturer menu box. Great for stores that have lots of manufacturers.

Open up modules/Manufacturers/customer_manufacturers.php
Find this line:
Code:

$manufacturers_menu = func_query("SELECT * FROM $sql_tbl[manufacturers] USE INDEX (avail) WHERE avail = 'Y' ORDER BY orderby LIMIT ".($config['Modules']['manufacturers_limit']));

Change it to this:
Code:

$manufacturers_menu = func_query("SELECT * FROM $sql_tbl[manufacturers] USE INDEX (avail) WHERE avail = 'Y' ORDER BY RAND() LIMIT ".($config['Modules']['manufacturers_limit'])); # BCSE changed

Carrie


Hi Carrie,

I assume one could list specific manufacturers in the manufacturer menu box by using the ORDER BY, but how would I call manufacturerid=21 and manufacturerid=832 specifically? Hope this isn't a huge deviation from the topic?

MBA 08-02-2007 06:55 PM

Re: Random Manufacturers in Manufacturer menu box
 
onto it here -

SELECT 'manufacturer_id' FROM 'xcart_manfacturers' WHERE 'manufacturer_id'
= 53 or WHERE 'manufacturer_id' = 60 or WHERE 'manufacturer_id' = 100

ORDER BY 'manufacturer_id'

The syntax isn't exactly right, but this should do it. Would someone help me with the syntax of the php as the is driving me nuts?

BCSE 08-02-2007 07:18 PM

Re: Random Manufacturers in Manufacturer menu box
 
Try this
SELECT 'manufacturer_id' FROM 'xcart_manfacturers' WHERE 'manufacturer_id'
= 53 or 'manufacturer_id' = 60 or 'manufacturer_id' = 100 ORDER BY 'manufacturer_id'

Basically take out the extra "where"'s

Carrie

MBA 08-08-2007 08:26 PM

Re: Random Manufacturers in Manufacturer menu box
 
Quote:

Originally Posted by BCSE
Try this
SELECT 'manufacturer_id' FROM 'xcart_manfacturers' WHERE 'manufacturer_id'
= 53 or 'manufacturer_id' = 60 or 'manufacturer_id' = 100 ORDER BY 'manufacturer_id'

Basically take out the extra "where"'s

Carrie


Bingo! Did it. Cheers.

BCSE 08-10-2007 01:27 PM

Re: Random Manufacturers in Manufacturer menu box
 
Great! :D

Carrie

RPMOffroad 10-28-2013 01:45 PM

Re: Random Manufacturers in Manufacturer menu box
 
Carrie you've done so much for me already ( the whole image checker module revamp you did last week) I hate to ask for any more. Is there a updated version of this for 4.4.5? The customer_manufacturers.php is a little different in this version.

BCSE 10-28-2013 07:17 PM

Re: Random Manufacturers in Manufacturer menu box
 
Hi! Boy you dug up an OLD thread. :D

For 4.4.5, look in the modules/Manufacturers/func.php and look for:
Code:

function func_get_manufacturers_list($avail_only = false, $limit = 0) {

Below that you will see:
Code:

. " ORDER BY orderby, manufacturer"
replace the orderby, manufacturer with Rand() like this:
Code:

. " ORDER BY Rand()"

I haven't tried it but it should work unless I missed something obvious.

Carrie

RPMOffroad 10-29-2013 05:14 AM

Re: Random Manufacturers in Manufacturer menu box
 
Its confirmed, you are a X-Cart Goddess!! Thanks again Carrie. :) Its amazing what you can do with this stuff!! Any testing on anything you want to do I am your guinea pig.:D/

BCSE 10-30-2013 08:03 AM

Re: Random Manufacturers in Manufacturer menu box
 
Quote:

Originally Posted by RPMOffroad
Its confirmed, you are a X-Cart Goddess!! Thanks again Carrie. :) Its amazing what you can do with this stuff!! Any testing on anything you want to do I am your guinea pig.:D/


Thanks! You're so kind! I'm glad it worked! :)

Carrie


All times are GMT -8. The time now is 03:40 AM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.