Follow us on Twitter X-Cart on Facebook Wiki
Shopping cart software Solutions for online shops and malls
 

Random Manufacturers in Manufacturer menu box

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 05-10-2005, 12:14 PM
  BCSE's Avatar 
BCSE BCSE is online now
 

X-Guru
  
Join Date: Apr 2003
Location: Ohio - bcsengineering.com
Posts: 3,063
 

Default Random Manufacturers in Manufacturer menu box

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
__________________
Custom Development, Custom Coding and Pre-built modules for X-cart since 2002!

We support X-cart versions 3.x through 5.x!

Home of the famous Authorize.net DPM & CIM Modules, Reward Points Module, Point of Sale module, Speed Booster modules and more!


Over 200 X-cart Mods available & Thousands of Customizations Since 2002 - bcsengineering.com

Please E-Mail us for questions/support!
Reply With Quote
  #2  
Old 05-16-2005, 05:07 AM
 
mffowler mffowler is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Melbourne, Australia
Posts: 811
 

Default

Wow, I just happened to need that for our new X-Mall. Thanks Carrie!

- Mike
__________________
4.1.9
Reply With Quote
  #3  
Old 05-16-2005, 07:14 AM
  BCSE's Avatar 
BCSE BCSE is online now
 

X-Guru
  
Join Date: Apr 2003
Location: Ohio - bcsengineering.com
Posts: 3,063
 

Default

Glad I could help! Such a simple mod but would be very useful to many stores. Should be an option in the x-cart admin I think.

Carrie
__________________
Custom Development, Custom Coding and Pre-built modules for X-cart since 2002!

We support X-cart versions 3.x through 5.x!

Home of the famous Authorize.net DPM & CIM Modules, Reward Points Module, Point of Sale module, Speed Booster modules and more!


Over 200 X-cart Mods available & Thousands of Customizations Since 2002 - bcsengineering.com

Please E-Mail us for questions/support!
Reply With Quote
  #4  
Old 05-16-2005, 11:42 AM
 
mffowler mffowler is offline
 

X-Adept
  
Join Date: Mar 2003
Location: Melbourne, Australia
Posts: 811
 

Default

An option, definitely! Manufactureres is a module, so a checkbox in module settings would suffice. I could see though that some stores still need to have control over their order, but it would be a nice way to get people to try different manufacturers, which often is a good result.

Thanks and we quite enjoy your X-mall feature... it adds a whole other dimension to using XC.

- Mike
__________________
4.1.9
Reply With Quote
  #5  
Old 05-16-2005, 06:38 PM
  BCSE's Avatar 
BCSE BCSE is online now
 

X-Guru
  
Join Date: Apr 2003
Location: Ohio - bcsengineering.com
Posts: 3,063
 

Default

Glad you like the X-mall.

Carrie
__________________
Custom Development, Custom Coding and Pre-built modules for X-cart since 2002!

We support X-cart versions 3.x through 5.x!

Home of the famous Authorize.net DPM & CIM Modules, Reward Points Module, Point of Sale module, Speed Booster modules and more!


Over 200 X-cart Mods available & Thousands of Customizations Since 2002 - bcsengineering.com

Please E-Mail us for questions/support!
Reply With Quote
  #6  
Old 06-18-2007, 06:28 AM
 
anandat anandat is offline
 

X-Adept
  
Join Date: Jan 2004
Posts: 914
 

Default Re: Random Manufacturers in Manufacturer menu box

Hello Carrie,
I am getting following mysql error I guess due to version change. Can you please post the code for version 4.1.7 ?

INVALID SQL: 1064 : You have an error in your SQL syntax. Check the manual that corresponds to your MySQL server version for the right syntax to use near '' at line 1
SQL QUERY FAILURE:SELECT * FROM xcart_manufacturers USE INDEX (avail) WHERE avail = 'Y' ORDER BY RAND() LIMIT
__________________
X-Cart: 4.7.7 LIVE
Skin:Ultra by xcartmods.co.uk
X-cart Modules: | ACR, Rich Google Search, Customer Testimonials | Cloud Search, | Websitecm: CDSEO (2.1.9)
---------------
Server: Linux
php: 5.3
mysql: 5.0.89
----------------
Reply With Quote
  #7  
Old 06-23-2007, 10:56 PM
 
g0t0pless g0t0pless is offline
 

eXpert
  
Join Date: Jul 2003
Posts: 360
 

Default Re: Random Manufacturers in Manufacturer menu box

I am using 4.1.8, and I have no matching code in my customer_manufactuers.php file.

Here is my file:

ustomer_manufacturers.php,v 1.12.2.1 2007/03/22 13:54:54 svowl Exp $
#

if ( !defined('XCART_START') ) { header("Location: ../"); die("Access denied"); }

$manufacturers_menu = func_query_first_cell("SELECT COUNT(*) FROM $sql_tbl[manufacturers] USE INDEX (avail) WHERE avail = 'Y'");
if ($manufacturers_menu > 0) {
if ($config["Manufacturers"]["manufacturers_limit"] > 0)
$smarty->assign("show_other_manufacturers", $manufacturers_menu>$config["Manufacturers"]["manufacturers_limit"]);
$manufacturers_menu = func_query("SELECT $sql_tbl[manufacturers].*, IF($sql_tbl[images_M].id IS NULL, '', 'Y') as is_image, $sql_tbl[images_M].image_path, IFNULL($sql_tbl[manufacturers_lng].manufacturer, $sql_tbl[manufacturers].manufacturer) as manufacturer, IFNULL($sql_tbl[manufacturers_lng].descr, $sql_tbl[manufacturers].descr) as descr FROM $sql_tbl[manufacturers] USE INDEX (avail) LEFT JOIN $sql_tbl[manufacturers_lng] ON $sql_tbl[manufacturers].manufacturerid = $sql_tbl[manufacturers_lng].manufacturerid AND $sql_tbl[manufacturers_lng].code = '$shop_language' LEFT JOIN $sql_tbl[images_M] ON $sql_tbl[manufacturers].manufacturerid = $sql_tbl[images_M].id WHERE $sql_tbl[manufacturers].avail = 'Y' ORDER BY $sql_tbl[manufacturers].orderby, $sql_tbl[manufacturers].manufacturer".(($config["Manufacturers"]["manufacturers_limit"] > 0) ? " LIMIT ".$config["Manufacturers"]["manufacturers_limit"] : ""));
$smarty->assign("manufacturers_menu", $manufacturers_menu);
}

?>
__________________
4.1.7
X-Cart Gold
Product Configurator Module
Advanced Order Management Module
RMA Module
Feature Compare Module
Blue Dream theme by 7Dana.com
Reply With Quote
  #8  
Old 06-30-2007, 01:17 PM
  BCSE's Avatar 
BCSE BCSE is online now
 

X-Guru
  
Join Date: Apr 2003
Location: Ohio - bcsengineering.com
Posts: 3,063
 

Default Re: Random Manufacturers in Manufacturer menu box

Try this.
Find the:
$manufacturers_menu = func_query(
line in the modules/Manufacturers/customer_manufacturers.php file.

Then find this in that line:
ORDER BY orderby

and change it to:
ORDER BY RAND()

Let me know if that doesn't work. Should be all you need to do though.

Thanks!

Carrie
__________________
Custom Development, Custom Coding and Pre-built modules for X-cart since 2002!

We support X-cart versions 3.x through 5.x!

Home of the famous Authorize.net DPM & CIM Modules, Reward Points Module, Point of Sale module, Speed Booster modules and more!


Over 200 X-cart Mods available & Thousands of Customizations Since 2002 - bcsengineering.com

Please E-Mail us for questions/support!
Reply With Quote
  #9  
Old 06-30-2007, 08:06 PM
 
g0t0pless g0t0pless is offline
 

eXpert
  
Join Date: Jul 2003
Posts: 360
 

Default Re: Random Manufacturers in Manufacturer menu box

Sorry, no matches found.

The closest thing I could find is this:

ORDER BY $sql_tbl[manufacturers].orderby,
__________________
4.1.7
X-Cart Gold
Product Configurator Module
Advanced Order Management Module
RMA Module
Feature Compare Module
Blue Dream theme by 7Dana.com
Reply With Quote
  #10  
Old 06-30-2007, 10:03 PM
  Jon's Avatar 
Jon Jon is offline
 

X-Guru
  
Join Date: Oct 2002
Location: Vancouver, Canada
Posts: 4,200
 

Default Re: Random Manufacturers in Manufacturer menu box

^ That's the same match, replace it.
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump


All times are GMT -8. The time now is 12:15 AM.

   

 
X-Cart forums © 2001-2020