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

Category menu expand OnClick..possible ?

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design
 
Thread Tools Search this Thread
  #1  
Old 11-12-2013, 10:19 PM
 
anandat anandat is offline
 

X-Adept
  
Join Date: Jan 2004
Posts: 914
 

Question Category menu expand OnClick..possible ?

It's possible to expand category menu OnClick through some piece of Javascript code ?
I have a long list of root categories so this small modification is needed very badly.

Any one can help me please?
__________________
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
  #2  
Old 11-13-2013, 07:07 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Category menu expand OnClick..possible ?

If I am understanding what you want to do, then this should work for you:
http://jsfiddle.net/jbabey/kSQfy/1/
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote

The following 2 users thank totaltec for this useful post:
anandat (11-13-2013), qualiteam (11-13-2013)
  #3  
Old 11-13-2013, 07:47 AM
 
anandat anandat is offline
 

X-Adept
  
Join Date: Jan 2004
Posts: 914
 

Default Re: Category menu expand OnClick..possible ?

Thanks Mike for providing the solution. Can you please tell me exactly what code & in which template while & where to use this code to achieve the results?
__________________
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
  #4  
Old 11-13-2013, 08:46 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Category menu expand OnClick..possible ?

That is going to depend on your skin. You are using ideal_comfort so I would make all the changes in that skin directory. You should be a able to copy the code below, and simply paste it into a new template file that you create.

In this case I created: /ideal_responsive/customer/categories.tpl

You would likely create: /ideal_comfort/customer/categories.tpl

I took some time and tested this out, for now you can see it working at my test site: http://trainingpen.com/

I've modified the script to show and hide the div, clicking the link will expand and collapse. I also commented out the unnecessary part that hid other divs.

Code:
{* df14bc9e9dec4a3332552facb2c31eaaf22d39a2, v5 (xcart_4_4_2), 2010-12-17 15:12:37, categories.tpl, aim vim: set ts=2 sw=2 sts=2 et: *} <script type="text/javascript"> {literal} $(document).ready(function() { $('a.title').click(function() { var correspondingDiv = $(this).parent().next('div'); if (!correspondingDiv.is(':hidden')) { correspondingDiv.hide(150); return; } // hide other divs //$('.workdiv').hide(150); // show this one correspondingDiv.toggle(150); }); }); {/literal} </script> <div> <a href="#" id="1" class="title" name="1"><h2>Expand Categories</h2></a> </div> <div id="workdiv1" class="workdiv" style="display:none"> {if $categories_menu_list ne '' or $fancy_use_cache} {capture name=menu} {if $active_modules.Flyout_Menus} {include file="modules/Flyout_Menus/categories.tpl"} {assign var="additional_class" value="menu-fancy-categories-list"} {else} <ul> {foreach from=$categories_menu_list item=c name=categories} <li{interline name=categories}><a href="home.php?cat={$c.categoryid}" title="{$c.category|escape}">{$c.category|amp}</a></li> {/foreach} </ul> {assign var="additional_class" value="menu-categories-list"} {/if} {/capture} {include file="customer/menu_dialog.tpl" title=$lng.lbl_categories content=$smarty.capture.menu} {/if} </div>

If you feel I have earned it, you can thank me with a PayPal payment to mike@babymonkeystudios.com
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote

The following user thanks totaltec for this useful post:
anandat (11-14-2013)
  #5  
Old 11-14-2013, 05:38 AM
 
anandat anandat is offline
 

X-Adept
  
Join Date: Jan 2004
Posts: 914
 

Default Re: Category menu expand OnClick..possible ?

Hi Mike,
Thanks a lot for the code. This is the solution I was looking for.
How ever there are small issues.

1)Since the "categories" menu is replaced by link "expand categories" it does not look good & it will tough for the customers to find out that link. The ideal solution would be it should display category menu with 5 categories link & then it should display link "expand categories" or "See More".

2) Also there is one small issue exists. Just click on "expand categories" now click on any category link so you be taken to that particular category page. Now again click to "expand categories" & you will see it will take you to the home page !

Note: This issue does not exists at your demo site.

I am not sure what is the correct way to implement this code but I have done following steps to integrate the code. I am using ideal comfort template.

1) I saved your code at as \skin\common_files\customer\categories_new.tpl
2) I opened skin\ideal_comfort\customer\left_bar.tpl & replaced
the code {include file="customer/categories.tpl"} with {include file="customer/categories_new.tpl"}

I hope it's correct.
__________________
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
  #6  
Old 11-14-2013, 08:33 AM
  totaltec's Avatar 
totaltec totaltec is offline
 

X-Guru
  
Join Date: Jan 2007
Location: Louisville, KY USA
Posts: 5,823
 

Default Re: Category menu expand OnClick..possible ?

Anandat,
You're welcome. This could certainly be done, but would require more effort. The changes you made sound correct, I don't know why
it is not behaving the same for you. Perhaps try to save categories.tpl as a .bak file, and them place the changes in that file directly? Perhaps there is some Javascript Conflict in the console?

I cannot support you further on this, I think I have taken it far enough for free advice. I think you will need to hire a developer to complete this work for you.
__________________
Mike White - Now Accepting new clients and projects! Work with the best, get a US based development team for just $125 an hour. Call 1-502-773-6454, email mike at babymonkeystudios.com, or skype b8bym0nkey

XcartGuru
X-cart Tutorials | X-cart 5 Tutorials

Check out the responsive template for X-cart.
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions > Changing design


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 07:36 AM.

   

 
X-Cart forums © 2001-2020