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

New section with popular categories

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 11-10-2011, 07:55 AM
  David-Allan's Avatar 
David-Allan David-Allan is offline
 

eXpert
  
Join Date: Oct 2011
Location: Scotland, UK
Posts: 313
 

Default New section with popular categories

Hi Folks,

I need some help and I know how good most of you are at hacking to bits xcart.

We are looking to add a new section just above the categories on the left sidebar.

I have figured out that you can just include a tpl file and it will display it.

What i'm trying to do is add a section with our 5 most popular categories, these will be static and not dynamically generated.

Our site is www.robertsonpackaging.com

I tried editing the manufactures module but it doesnt show the same as a category would, ie its just shows a list of products.

I also tried just using html but not sure how to sort the css to look the same as the categories below which use fly out menus.

We need to have some existing categories listed above the existing categories list and then removed from the categories below. How would I go about this?

I have some limited php/html knowledge so can hack some bits together to get what i'm looking for but just can't seem to get my head round this smarty stuff just yet.

Any help with this would be greatly appreciated.

Thanks in advance

D-A
__________________
Live Version : 4.5.2
Licensed Products:
X-Cart Gold
Ability Theme
CDSEO
xCMS
Abandoned Cart
Food Packaging Scotland
Reply With Quote
  #2  
Old 11-10-2011, 08:53 AM
  JWait's Avatar 
JWait JWait is offline
 

X-Man
  
Join Date: Nov 2005
Location: California
Posts: 2,440
 

Default Re: New section with popular categories

Are you trying to include your "popular categories" within the "All Categories" box or separately? Do you want "flyout menus" or just a list?

Anyway, the easiest way is to make a "clone" of common_files/customer/categories.tpl naming it popular_categories.tpl.

Something like this...
Code:
{capture name=menu} {assign var="additional_class" value="menu-fancy-categories-list" <ul> <li{interline name=categories}><a href="LINK TO CATEGORY" title="CATEGORY NAME">CATEGORY NAME</a></li> </ul> {assign var="additional_class" value="menu-categories-list"} {/capture} {include file="customer/menu_dialog.tpl" title="Popular Categories" content=$smarty.capture.menu} {/if}

Change the part that says "<li{interline name=categories}><a href="LINK TO CATEGORY" title="CATEGORY NAME">CATEGORY NAME</a></li>" to your link and title, and repeat for each category.

Then, in customer/left_bar.tpl for whatever skin you are using, look for
{include file="customer/categories.tpl"}

and just above it add
{include file="customer/popular_categories.tpl"}

EDIT: I made a mistake and forgot to exclude "flyout menus" in my original post (fixed now)
__________________
Two Separate X-Cart Stores
Version 4.4.4 Gold - X-AOM - Vivid Dreams Aquamarine (modified) - Linux
Mods - Newest Products - View All -, and a few others. Numerous upgrades from 4.0.x series.
Integrated with Stone Edge Order Manager + POS

Version 4.1.12 Gold (fresh install) - X-AOM - Linux
Mods - XCSEO free
Reply With Quote

The following user thanks JWait for this useful post:
David-Allan (11-11-2011)
  #3  
Old 11-11-2011, 02:17 AM
  David-Allan's Avatar 
David-Allan David-Allan is offline
 

eXpert
  
Join Date: Oct 2011
Location: Scotland, UK
Posts: 313
 

Default Re: New section with popular categories

Quote:
Originally Posted by JWait
Are you trying to include your "popular categories" within the "All Categories" box or separately?
separately in a little box above the category box.
Quote:
Originally Posted by JWait
Do you want "flyout menus" or just a list?
Flyout menu's would really be the best looking option but if that is too difficult then just static categories would be fine.
Quote:
Originally Posted by JWait
Anyway, the easiest way is to make a "clone" of common_files/customer/categories.tpl naming it popular_categories.tpl.

Something like this...
Code:
{capture name=menu} {assign var="additional_class" value="menu-fancy-categories-list" <ul> <li{interline name=categories}><a href="LINK TO CATEGORY" title="CATEGORY NAME">CATEGORY NAME</a></li> </ul> {assign var="additional_class" value="menu-categories-list"} {/capture} {include file="customer/menu_dialog.tpl" title="Popular Categories" content=$smarty.capture.menu} {/if}

Change the part that says "<li{interline name=categories}><a href="LINK TO CATEGORY" title="CATEGORY NAME">CATEGORY NAME</a></li>" to your link and title, and repeat for each category.

Then, in customer/left_bar.tpl for whatever skin you are using, look for
{include file="customer/categories.tpl"}

and just above it add
{include file="customer/popular_categories.tpl"}

EDIT: I made a mistake and forgot to exclude "flyout menus" in my original post (fixed now)


Ahh ok thanks mate, so basically I use:
Code:
<li{interline name=categories}><a href="LINK TO CATEGORY" title="CATEGORY NAME">CATEGORY NAME</a></li>
for each category I want to list in between the list tags?

I'll give this a wee bash now on my dev site and see if I can get it to work.

Thank you so much for your help and speedy reply, I really appreciate it.
__________________
Live Version : 4.5.2
Licensed Products:
X-Cart Gold
Ability Theme
CDSEO
xCMS
Abandoned Cart
Food Packaging Scotland
Reply With Quote
  #4  
Old 11-11-2011, 03:11 AM
  David-Allan's Avatar 
David-Allan David-Allan is offline
 

eXpert
  
Join Date: Oct 2011
Location: Scotland, UK
Posts: 313
 

Default Re: New section with popular categories

JWAIT,

Thank you so much for your help I managed to get it to work using the following code

Code:
{capture name=menu} <ul> <li{interline name=categories}><a href="http://www.robertsonpackaging.com.previewdns.com/Bakery/}" title="Bakery Supplies">Bakery Supplies</a></li> </ul> {assign var="additional_class" value="menu-categories-list"} {/capture} {include file="customer/menu_dialog.tpl" title="Popular Categories" content=$smarty.capture.menu}

I don't know how difficult it would be to use this with the flyout module as it looks different from the other categories but it works for now which is great.

Do you know if there is a way of hiding categories in the main category list so they don't show up in the section below? like an exclude option or something like that?

I really appreciate your help with this mate, you make it look so easy

Thanks

D-A
__________________
Live Version : 4.5.2
Licensed Products:
X-Cart Gold
Ability Theme
CDSEO
xCMS
Abandoned Cart
Food Packaging Scotland
Reply With Quote
  #5  
Old 11-11-2011, 05:02 AM
  JWait's Avatar 
JWait JWait is offline
 

X-Man
  
Join Date: Nov 2005
Location: California
Posts: 2,440
 

Default Re: New section with popular categories

You might try something like this in common_files/customer/categories.tpl...
Code:
{foreach from=$categories_menu_list item=c name=categories} {if $categories[cat_num].categoryid neq XXX} <li{interline name=categories}><a href="home.php?cat={$c.categoryid}" title="{$c.category|escape}">{$c.category|amp}</a></li> {/if} {/foreach}
You should be able to get the cat_num and cat id from the "Categories" section in admin.

There are 3rd party mods that will hide categories.

Check this thread for a possible solution....
http://forum.x-cart.com/showthread.php?t=44414

You might check this thread for a different solution...
http://forum.x-cart.com/showthread.php?t=52493&page=2
__________________
Two Separate X-Cart Stores
Version 4.4.4 Gold - X-AOM - Vivid Dreams Aquamarine (modified) - Linux
Mods - Newest Products - View All -, and a few others. Numerous upgrades from 4.0.x series.
Integrated with Stone Edge Order Manager + POS

Version 4.1.12 Gold (fresh install) - X-AOM - Linux
Mods - XCSEO free
Reply With Quote
  #6  
Old 11-11-2011, 06:27 AM
  David-Allan's Avatar 
David-Allan David-Allan is offline
 

eXpert
  
Join Date: Oct 2011
Location: Scotland, UK
Posts: 313
 

Smile Re: New section with popular categories

Quote:
Originally Posted by JWait
You might try something like this in common_files/customer/categories.tpl...
Code:
{foreach from=$categories_menu_list item=c name=categories} {if $categories[cat_num].categoryid neq XXX} <li{interline name=categories}><a href="home.php?cat={$c.categoryid}" title="{$c.category|escape}">{$c.category|amp}</a></li> {/if} {/foreach}
You should be able to get the cat_num and cat id from the "Categories" section in admin.

There are 3rd party mods that will hide categories.

Check this thread for a possible solution....
http://forum.x-cart.com/showthread.php?t=44414

You might check this thread for a different solution...
http://forum.x-cart.com/showthread.php?t=52493&page=2

Thanks mate getting closer to what I need with your help

I have just turned off flyout categories as it seems too complicated to try and get this working with those. I had a look at the code and it looks very complicated.

This is the code I have used but it doesn't seem to work. It actually doesn't seem to do anything. I dont know if I have missed something.

I have it on my live site at the moment. www.robertsonpackaging.com

Here is the code I used

Code:
<ul> {foreach from=$categories_menu_list item=c name=categories} {if $categories[cat_num].categoryid neq 199 || $categories[cat_num].categoryid neq 74 || $categories[cat_num].categoryid neq 246 || $categories[cat_num].categoryid neq 43} <li{interline name=categories}><a href="home.php?cat={$c.categoryid}" title="{$c.category|escape}">{$c.category|amp}</a></li> {/if}} {/foreach} </ul>

:w
__________________
Live Version : 4.5.2
Licensed Products:
X-Cart Gold
Ability Theme
CDSEO
xCMS
Abandoned Cart
Food Packaging Scotland
Reply With Quote
  #7  
Old 11-11-2011, 07:21 AM
  JWait's Avatar 
JWait JWait is offline
 

X-Man
  
Join Date: Nov 2005
Location: California
Posts: 2,440
 

Default Re: New section with popular categories

Try changing "neq" to "ne" (I', not sure about that part being correct, its from someone else).
__________________
Two Separate X-Cart Stores
Version 4.4.4 Gold - X-AOM - Vivid Dreams Aquamarine (modified) - Linux
Mods - Newest Products - View All -, and a few others. Numerous upgrades from 4.0.x series.
Integrated with Stone Edge Order Manager + POS

Version 4.1.12 Gold (fresh install) - X-AOM - Linux
Mods - XCSEO free
Reply With Quote

The following user thanks JWait for this useful post:
David-Allan (11-14-2011)
  #8  
Old 11-14-2011, 08:39 AM
  David-Allan's Avatar 
David-Allan David-Allan is offline
 

eXpert
  
Join Date: Oct 2011
Location: Scotland, UK
Posts: 313
 

Default Re: New section with popular categories

JWait I just wanted to thank you for your help.

I have managed to get it all working now. I have even managed to remove the categories from the all categories list using an if statement that checks the the category position and if it's set to 666 it doesn't display it.

Your help is greatly appreciated.

D-A
__________________
Live Version : 4.5.2
Licensed Products:
X-Cart Gold
Ability Theme
CDSEO
xCMS
Abandoned Cart
Food Packaging Scotland
Reply With Quote
  #9  
Old 11-16-2011, 03:26 AM
  David-Allan's Avatar 
David-Allan David-Allan is offline
 

eXpert
  
Join Date: Oct 2011
Location: Scotland, UK
Posts: 313
 

Default Re: New section with popular categories

Quote:
Originally Posted by David-Allan
JWait I just wanted to thank you for your help.

I have managed to get it all working now. I have even managed to remove the categories from the all categories list using an if statement that checks the the category position and if it's set to 666 it doesn't display it.

Your help is greatly appreciated.

D-A

I'm an ejit, it doesn't actually work at all I just thought it did but hadn't noticed it had just moved the categories to the bottom of the categories list.

I guess I'll need to play about with that bit of code and see if I can get it to work.
__________________
Live Version : 4.5.2
Licensed Products:
X-Cart Gold
Ability Theme
CDSEO
xCMS
Abandoned Cart
Food Packaging Scotland
Reply With Quote
  #10  
Old 11-16-2011, 03:36 AM
  David-Allan's Avatar 
David-Allan David-Allan is offline
 

eXpert
  
Join Date: Oct 2011
Location: Scotland, UK
Posts: 313
 

Default Re: New section with popular categories

Quote:
Originally Posted by David-Allan
I'm an ejit, it doesn't actually work at all I just thought it did but hadn't noticed it had just moved the categories to the bottom of the categories list.

I guess I'll need to play about with that bit of code and see if I can get it to work.


I managed to get it working. I just replaced the code


Code:
{if $categories[cat_num].categoryid neq XXX}

With this

Code:
{if $c.order_by neq "XXX"}

That wasn't so bad as I thought.
__________________
Live Version : 4.5.2
Licensed Products:
X-Cart Gold
Ability Theme
CDSEO
xCMS
Abandoned Cart
Food Packaging Scotland
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design



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 10:21 PM.

   

 
X-Cart forums © 2001-2020