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)
-   -   Manufacturer Categories mod! Free! (https://forum.x-cart.com/showthread.php?t=32213)

thatcrazyartguy 12-29-2009 11:12 AM

Re: Manufacturer Categories mod! Free!
 
Quote:

Originally Posted by thatcrazyartguy
I was wondering if there is anyway to list each category as a heading, then list each sub category under it instead of listing the same main category more than once. For example, if it lists

CATEGORY A/SUBCATEGORY A
CATEGORY A/SUBCATEGORY B
CATEGORY A/SUBCATEGORY C
CATEGORY B/SUBCATEGORY A
CATEGORY B/SUBCATEGORY B

I could make it list...

CATEGORY A
SUB A
SUB B
SUB C

CATEGORY B
SUB A
SUB B

Anyway to do this?


I actually figured this out. If anyone wants to know how to do this, just let me know here. It may not be the most elegant way, but it works for me. Check it out at www.tennesseespeedsport.com, and pick a manufacturer to see it in action.

paryaei 12-30-2009 03:40 AM

Re: Manufacturer Categories mod! Free!
 
Hi

I am really interested to know how to do this. If you could please post the code I would really appreciate it.

thatcrazyartguy 12-31-2009 11:31 AM

Re: Manufacturer Categories mod! Free!
 
Quote:

Originally Posted by paryaei
Hi

I am really interested to know how to do this. If you could please post the code I would really appreciate it.


Sure...

Here is what I added to manufacturer_categories.php

First, I added a new value to the $man_categories array called "master_header".

Then...

I made a new array called "master_headers" that contains all the main headings based on the "category_path" of the category data. This is the same value that is applied to the "master_header" key of $man_categories.

This is directly under "$mode = ' ';" (around line 67)

---------------------------------------
$master_headers = array();
$count = "0";
foreach($man_categories as $k=>$v){
$get_top = explode("/",$man_categories[$k]['category_path']);
$man_categories[$k]['master_header'] = $get_top[0];
if(!in_array($get_top[0],$master_headers)){
$master_headers[$count] = $get_top[0];
$count++;
}
}
sort($master_headers);
$smarty->assign("master_headers",$master_headers);
---------------------------------------

This is what I changed in manufacturer_categories.tpl

This replaces the foreach loop in the original.
Just below <hr class="mcat_hr"> - Replaces Lines 60 - 77

It begins by looping through each of the values of the "master_headers" array. Then, it loops through $man_categories displaying all the links and info for each category that falls under the corresponding main headers.

----------------------------------------
{foreach item=master from=$master_headers}
<div style="margin:1em 0 1em 0">
<div style="background-color:#f8f008; font-size:18px; padding:.5em; margin-bottom:.25em">{$master}</div>
{foreach item=mcat from=$man_categories}
<div style="padding-left:1em">
{if ($mcat.master_header eq $master)}
<a href=
"{$catalogs.customer}/manufacturers.php?manufacturerid={$manufacturerid} &catid={$mcat.categoryid}"
style="font-size:12px" class="mcat_link">{$manufacturer.manufacturer} {$mcat.category}</a><br />
{/if}
</div>
{/foreach}
</div>
{/foreach}
----------------------------------------
your {else} should begin just below the code above.

I hope this helps. Any comments or suggestions on this would be very welcome.

JB

Stizerg 02-09-2010 01:54 AM

Re: Manufacturer Categories mod! Free!
 
Quote:

Originally Posted by thatcrazyartguy
Sure...
Here is what I added to manufacturer_categories.php
First, I added a new value to the $man_categories array called "master_header".
Then...
This is what I changed in manufacturer_categories.tpl


Which version of x-cart is it for? I can't find this files in 4.1 or 4.2?

spence88mph 02-21-2010 03:43 PM

Re: Manufacturer Categories mod! Free!
 
Damn, I have installed this mod, I get the category list but when you click each one the product area stays blank, I've been over the install twice and applied the patch, any ideas?!

V. 4.1.9

http://www.spacadia.com.au

TruVu 02-22-2010 06:09 AM

Re: Manufacturer Categories mod! Free!
 
Is there a mod like this one for the related items to have category > sub-category links? Preferably a drop down from the category to the sub-category for related items.

Herb

BCSE 02-23-2010 07:48 PM

Re: Manufacturer Categories mod! Free!
 
Sorry for the delay in replying to this thread. We've had a lot of illness in the office this week. If you're having an issue with it on your site, please drop us an email or support ticket. That will ensure it's not only myself getting the message, then my whole team can and can help out if I'm busy covering for those that are out.


The recent versions of X-cart have many different categories.tpl file which makes having install instructions for this one impossible to have an exact match sometimes for code to find.

Thank you!

Carrie

thatcrazyartguy 04-28-2010 05:18 AM

Re: Manufacturer Categories mod! Free!
 
I have this mod installed, and I changed some things in it, but now I actually have a small problem I can't figure out.

I now want to add a link under the manufacturers' page that can list all products by each manufacturer. After installing this mod, I can't figure out how to do this. Anyone know?

Phoenixone 02-28-2011 09:07 PM

Re: Manufacturer Categories mod! Free!
 
hi everyone i have this mod installed and i really wish it to have the following structure

"Manufacturer Name" "Category"

eg: "Asus" "Graphics Cards"

here is the current code:

Quote:

{foreach item=mcat from=$man_categories}
<a href="{$catalogs.customer}/manufacturers.php?manufacturerid={$manufacturerid} &catid={$mcat.categoryid}" style="font-size:12px" class="mcat_link">{$mcat.category}</a><br />
{/foreach}

i got the full category path replaced by just the category so thats done now i just need it to show the manufacturers name

i tried {$mcat.manufacturer} but didnt work

please could someone help! i think it would work much better in terms of SEO than the current way?

view my example:

Phoenix Tech Asus

Learner 04-01-2011 12:55 AM

Re: Manufacturer Categories mod! Free!
 
Hi,
Will this work for latest 4.4.2??

Also If I want to display category on the top as well as product display (as usual) at the bottom..How to achieve that??

Thanks..


All times are GMT -8. The time now is 04:45 PM.

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