| ||||||||||
![]() |
Shopping cart software Solutions for online shops and malls | |||||||||
![]() |
![]() |
|
X-Cart Home | ![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
Simple Custom Menu Revisited - Categorymenu | ||||
![]() |
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
![]() I have updated the procedure which may be of use to others.
It was inspired by a post from member Cambo re moving categories between menus .... well Im using the code posted below myself. Thanks for the idea cambo See below
__________________
V 4.3.1 Live: Developing on PHP 5.3.0 MySQL server 5.0.75-community-log MySQL client 5.1.36 Web server Apache/2.2.11 (Unix) mod_ssl/2.2.11 Windows 7 64bit on a Toshiba Satellite P500 ADELAIDE, SOUTH AUSTRALIA |
|||||||
#2
|
|||||||
|
|||||||
![]() This is the revamped version. It requires you use phpmyadmin dont be afraid
Lets say you have a shop that sells cars, spare parts and tyres. You would like to have the spare parts and tyre categories in their own menus, so you need a Spares menu and a Tyres menu, and be able to move your Spares and Tyres categories to the new menus - without messing up your xcart!!!!. PLEASE BACK UP YOUR DATA FIRST AND MAKE COPIES OF MODIFIED FILES 1. In Admin->Languages, create two new labels lbl_spares_menu, Spare Parts, Spare Parts lbl_tyres_menu, Tyres, Tyres 2. Start up phpMyAdmin and click your xcart_categories table. Select the Structure tab. About half way down you will see an "Add fields" section. We want to Add 1 Field AFTER categoryidpath. Click Go button. In the Field box type in catmenu In the Type Box select VARCHAR In the Length/Values type 12 - if you want longer menu names feel free but they might wrap you can ignore collation and attributes fields, Null should be "not null". In the Default box type in a name for your main menu, this is currently THE menu you already have. I chose default. Click on "save". All your categories now have a field called catmenu with a value of default 3. Create Two New Menus In skin1\customer, make two copies of categories.tpl. Rename one to spareparts.tpl, the other to tyres.tpl. Open categoroes.tpl for editing and look for this code: {section name=cat_num loop=$categories} <FONT class="CategoriesList"><A href="home.php?cat={$categories[cat_num].categoryid}" class="VertMenuItems">{$categories[cat_num].category}</A></FONT><BR> {/section} Replace it with this code: Code:
In your two menus, replace the line {if $categories[cat_num].catmenu =="default"} with {if $categories[cat_num].catmenu =="spares"} and {if $categories[cat_num].catmenu =="tyres"} You may wish to change the first line of comment code in each menu to reflect the new menu name. Also, the last line of categories.tpl is {include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_NEWcategories menu_content=$smarty.capture.menu } So you need to replace the menu_title=$lng.lbl_NEWcategories with your previousley created labels. If you have done everything correctly to this point, your shop will function as before, since all your categories have a catmenu value of default. 4. Open up skin1\customer\home.tpl After the line { include file="customer/categories.tpl" } add this: Code:
5. Open the file skin1\admin\main\category_modify.tpl Around line 75 is this line: <TD height="10"><INPUT type="text" name="order_by" size="5" value="{if $category_error ne ""}{$smarty.post.order_by}{elseif $mode ne "add"}{$current_category.order_by}{/if}"> </td> </tr> Directly after the </tr> tag paste this code: Code:
6. Open the file admin\category.modify.php Note: This is under the Root (shop, store whatever), NOT skin1\admin !!! Around line 132 you will see this: # Update general data of category # db_query("UPDATE $sql_tbl[categories] SET category= .... etc Above the db_query line paste this code: Code:
db_query("UPDATE $sql_tbl[categories] SET category='$category_name', description='$description' etc insert catmenu='$cat_menu' so it now looks like: db_query("UPDATE $sql_tbl[categories] SET category='$category_name',catmenu= '$cat_menu', description='$description' etc 7. Last one - open, again from Root, include\categories.php Around line 76 look for: $to_search = "$sql_tbl[categories].categoryid,$sql_tbl[categories].parentid,$sql_tbl[categories].categoryid_path, etc right after $sql_tbl[categories].categoryid_path, add $sql_tbl[categories].catmenu, Your shop should still function as before if you have got it all right Log into admin and select a category to modify. You should see a drop-down right after "position" called "Category Menu". There should be One entry - "default". You now have two choices, you can go into phpmyadmin and manually enter the names "spares" or "tyres" in the catmenu field for their respective categories, this is probably the fastest. If you do, then the dropdown will have 3 different menu names "default", "spares" and "tyres". At the moment, all categories under the same menu will have an entry, so if there are 6 categories under"spares" there will be 6 entries called "spares" in the dropdown. If I were smarter I would create a new table with catmenuid and catmenu fields and use this, but I havent got that far yet. Perhaps someone else could do it and tell me? Your other choice is to add a new category from admin, this time you will see a "New Category Menu" dropdown below the "category Menu" box. If you enter a new name - and it needs to be a valid menu - spares or tyres, or any other menu you have created - or you will get no output - your new category will appear in that menu. Now, if you modify any category, you can seleect which menu you want it to show up in from this screen. I hope people can follow this - enjoy vixnfox ********ADDED THIS BIT OMITTED BEFORE***************** In root, init.php look for the sql_table=array and add "memberships_lng" => "xcart_memberships_lng", Code:
and most important, in the category_modify php, just before the closing ?> tag add this Code:
PS You can also manually change the names in PHPMyadmin in the xcart_categories table catmenu fields.
__________________
V 4.3.1 Live: Developing on PHP 5.3.0 MySQL server 5.0.75-community-log MySQL client 5.1.36 Web server Apache/2.2.11 (Unix) mod_ssl/2.2.11 Windows 7 64bit on a Toshiba Satellite P500 ADELAIDE, SOUTH AUSTRALIA |
|||||||
#3
|
|||||||
|
|||||||
![]() Hi Vixnfox,
Thanks for coding it out and simplify it. Would you have a sample website? Thanks in advance
__________________
X-Cart version 4.x (Most likely will be the latest version) |
|||||||
#4
|
|||||||
|
|||||||
![]() My website is at
http://ifgdesignz.com.au Its a tad slow loading - not sure if its me or the hosting company (Netregistry) vixnfox PS I have added a bit to the end of the post, pls read it
__________________
V 4.3.1 Live: Developing on PHP 5.3.0 MySQL server 5.0.75-community-log MySQL client 5.1.36 Web server Apache/2.2.11 (Unix) mod_ssl/2.2.11 Windows 7 64bit on a Toshiba Satellite P500 ADELAIDE, SOUTH AUSTRALIA |
|||||||
#5
|
|||||||
|
|||||||
![]() Hi there
I need a bit of help as i would love to implement this mod. I need another menu on my side bar home page. Firstly, I am very new to html/website design etc. So sorry for the silly question, but where is myphpadmin? And secondly, before i go chopping and changing things (i have backed up)...will this mod be compatible with my store design, as i have horizontal categories? My site is: http://www.sunsetcrystals.com.au/home.php?shopkey=1234 Thanks so much.
__________________
Sunset X-Cart Gold v4.1.8 |
|||||||
#6
|
|||||||||
|
|||||||||
![]() Netregistry is super slow....
I get many customers contating me who host with netregistry and find it very slow... Quote:
__________________
eCommerce - Strategy / Design / Development / Marketing / Maintenance Call within Australia: Phone: 1300 648 274 | Mobile: 0417 241 950 Call outside Australia: +61 417 241 950 | Email: results@mitash.com | Skype: mitashau | Web: www.mitash.com |
|||||||||
#7
|
|||||||
|
|||||||
![]() If possible, could someone help me out re post #5? Many thanks.
__________________
Sunset X-Cart Gold v4.1.8 |
|||||||
#8
|
|||||||
|
|||||||
![]() There is an alternative to this approach. Code the custom menu in static html and put it in categories.tpl. This will simply midification steps once it is set up and you do not need to mess around database. It will also not slow down xcart like has been reported by people having large amount of sub-categories.
|
|||||||
#9
|
|||||||
|
|||||||
![]() Thanks so much for your help, dsoong...i shall try that. Sounds alot easier too.
Cheers, Paula
__________________
Sunset X-Cart Gold v4.1.8 |
|||||||
#10
|
|||||||
|
|||||||
![]() Has anyone tried this out for version 4.1.9.
I am stuck at step 3. This line of code doesn't exist in customers/categories.tpl {section name=cat_num loop=$categories} ---------------------------------------------------------------------- (my categories.tpl looks like this) {* $Id: categories.tpl,v 1.26 2005/11/17 06:55:37 max Exp $ *} {capture name=menu} {if $active_modules.Fancy_Categories ne ""} {include file="modules/Fancy_Categories/categories.tpl"} {assign var="fc_cellpadding" value="0"} {else} {if $config.General.root_categories eq "Y"} {foreach from=$categories item=c} <font class="CategoriesList"><a href="home.php?cat={$c.categoryid}" class="VertMenuItems">{$c.category}</a></font><br /> {/foreach} {else} {foreach from=$subcategories item=c key=catid} <font class="CategoriesList"><a href="home.php?cat={$catid}" class="VertMenuItems">{$c.category}</a></font><br /> {/foreach} {/if} {/if} {/capture} { include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_categories menu_content=$smarty.capture.menu cellpadding=$fc_cellpadding} ---------------------------------------------------------------------- What should I doooooo???? Thanks in advance.
__________________
Gold 4.4.2 with 'some' customisation Site review: http://forum.x-cart.com/showthread.php?t=63075 |
|||||||
|
|||
X-Cart forums © 2001-2020
|