| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Sort by manufacturer | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Sort by manufacturer
I've done this in 4.3, but it should be similar in older versions:
in include/search.php make the following changes: 1) Find these lines right near the top of the file: "orderby" => func_get_langvar_by_name("lbl_default") ); And right below that add: # sort by manufacturer mod begins if(!$manufacturerid) $sort_fields["manufacturer"] = func_get_langvar_by_name("lbl_manufacturer"); #sort by manuf mod # sort by manufacturer mod ends 2) At around line 630 there's a switch case. Right before these lines: default: $sort_string = "$sql_tbl[products].product"; Add: # sort by manufacturer mod begins case "manufacturer": $left_joins['manufacturers'] = array( "on" => "$sql_tbl[manufacturers].manufacturerid = $sql_tbl[products].manufacturerid" ); $sort_string = "$sql_tbl[manufacturers].manufacturer $direction"; break; # sort by manufacturer mod ends 3) Make sure to run WWW.YOURSITE.com/cleanup.php That's it!
__________________
xcart v. 4.18-4.4 |
|||||||
#2
|
|||||||||
|
|||||||||
Re: Sort by manufacturer
it is not working for me. "brand" sort option is not appearing near the others. still checking what is going on.
could you post a photo with one of your categories where brand sort link appears? I think this change will be more effective only if Manufacturer is a drop down list. When choosing a manufacturer, only the items associated with that manufacturer will be listed.
__________________
X-Cart Next: Business 5.2 (learning and testing) X-Cart Classic: Gold and Gold Plus 4.7 Lots of Modules and Customizations OS in use: Red Hat Enterprise, Fedora, CentOS, Debian, Ubuntu, Linux Mint, Kali Linux Ideas for Server configuration (basicaly): Nginx/Pound (reverse proxy), Apache/Nginx (webserver), Squid/Varnish (cache server), HHVM or (PHP-FPM + PHP 5.6 + opcache), MariaDB/Percona MySQL Server, Redis (storing sessions) You can catch my ideas here: http://ideas.x-cart.com |
|||||||||
#3
|
|||||||
|
|||||||
Re: Sort by manufacturer
You can see the mod at work here:
http://rodengray.com/shop/Men.html What you're describing is a filter, the ability to select a category, then filter the results by brand (only showing one brand at a time). This mod shows all the results, but groups them by the name of the manufacturer alphabetically. There is a mod that sort of does the opposite of what you describe available for free here: http://www.bcsengineering.com/store/free-manufacturer-categories-mod.html?&MMCF_xfManuCat It filters manufacturers by category instead of category by manufacturer. There's also the Power Filter module, which works on categories only: http://www.xcartmod.com/cart/product/power-filter.html
__________________
xcart v. 4.18-4.4 |
|||||||
#4
|
|||||||||
|
|||||||||
Re: Sort by manufacturer
Any idea for 4.4? I tried to use this but no go.
__________________
Industrial Webworks Various xcart versions from 4.1.19 gold - 4.7 gold http://www.industrialwebworks.net |
|||||||||
#5
|
|||||||
|
|||||||
Re: Sort by manufacturer
Here's updated instructions for 4.4:
1) Find these lines right near the top of the file: $sort_fields = array( 'productcode' => 'lbl_sku', 'title' => 'lbl_product', 'price' => 'lbl_price', 'orderby' => 'lbl_default', ); And right below that add: # sort by manufacturer mod begins if(!$manufacturerid) $sort_fields["manufacturer"] = 'lbl_manufacturer'; #sort by manuf mod # sort by manufacturer mod ends 2) At around line 905 there's a switch case. Right before these lines: default: $sort_string = "$sql_tbl[products].product"; Add: # sort by manufacturer mod begins case 'manufacturer': $left_joins['manufacturers'] = array( 'on' => "$sql_tbl[manufacturers].manufacturerid = $sql_tbl[products].manufacturerid" ); $sort_string = "$sql_tbl[manufacturers].manufacturer $direction"; break; # sort by manufacturer mod ends 3) Make sure to run WWW.YOURSITE.com/cleanup.php That's it!
__________________
xcart v. 4.18-4.4 |
|||||||
#6
|
|||||||||
|
|||||||||
Re: Sort by manufacturer
Wow! That was a quick answer! Unfortunately, although the sort shows up, clicking on it results in "No products found".
Here's a url: http://industrialwebworks.net/breakers/home.php?cat=22
__________________
Industrial Webworks Various xcart versions from 4.1.19 gold - 4.7 gold http://www.industrialwebworks.net |
|||||||||
#7
|
|||||||
|
|||||||
Re: Sort by manufacturer
Wow, that was a really dumb mistake on my part. The trouble is with the quotes in step 2. They were single quotes before, and they need to be double quotes. I'm updating the post above and reposting what's changed below:
This: # sort by manufacturer mod begins case 'manufacturer': $left_joins['manufacturers'] = array( 'on' => '$sql_tbl[manufacturers].manufacturerid = $sql_tbl[products].manufacturerid' ); $sort_string = '$sql_tbl[manufacturers].manufacturer $direction'; break; # sort by manufacturer mod ends Should be: # sort by manufacturer mod begins case 'manufacturer': $left_joins['manufacturers'] = array( 'on' => "$sql_tbl[manufacturers].manufacturerid = $sql_tbl[products].manufacturerid" ); $sort_string = "$sql_tbl[manufacturers].manufacturer $direction"; break; # sort by manufacturer mod ends
__________________
xcart v. 4.18-4.4 |
|||||||
|
|
|||
X-Cart forums © 2001-2020
|