| ||||||||||
Shopping cart software Solutions for online shops and malls | ||||||||||
|
X-Cart Home | FAQ | Forum rules | Calendar | User manuals | Login |
Add Custom Category Menus for 4.2 | |||
|
|
Thread Tools | Search this Thread |
#1
|
|||||||
|
|||||||
Add Custom Category Menus for 4.2
Add Category Menus X-Cart 4.2
This will allow you to add category menus to your x-cart instead of using just the one “Categories” menu installed by default. I am using x-cart 4.2 and this was developed on a windows XPSP3 laptop using TopStyle Pro and WAMP Server 2.0 PLEASE BACK UP YOUR DATABASE AND EXPORT YOUR SHOP FIRST!!! I have an online jewellery store and I wanted 2 menus, one for sterling silver and one for 9ct gold. Here is how I did it. From this example you will be able to add further category menus and customize for your own needs. Decide on what menus you want. I wanted one named Sterling Silver, and one named 9ct Gold. Step 1: You need to go to your admin->languages edit language “English” Select Topic “labels” Add New Entry Variable: lbl_sterlingsilver, value Sterling Silver Add New Entry Variable: lbl_9ctgold, value 9ct Gold Enable a categories menu entry in the database[ Step 2: Using phpMyAdmin or whatever you use to get under the hood of your database do the following: Open up your xcart database and select the xcart_categories table. Click on the Structure Tab On the bottom, you have the option to add a field. We want to add a field AFTER the categoryid_path field, select and click GO button. Name the field “catmenu”, Set type to VARCHAR with a length of 12 (you can use more but might wrap the menu text) Set Default to “as Defined”, and name it “stgsilver” (or whatever you want your core menu name to be. You can call it “categories”if you want) This will be the default menu used when you add a category in admin. Step 3: We need to make the “catmenu” field appear in $categories_menu_list, so we need to edit the file /include/func/func.category.php Around line 539, add this $sql_tbl[categories].catmenu, after this $sql_tbl[categories].categoryid, (it appears twice) So it looks like this: Code:
Step 4: Make 2 copies of Skin1/customer/categories.tpl Name one sterlingsilver.tpl, the other gold.tpl Open up each in your html editor (or notepad if you wish) Look for this code: Code:
and add this line {if $c.catmenu eq'stgsilver'} {*OR WHATEVER YOU CALLED IT *******} and this {/if} so it looks like this: Code:
Last line is: {include file="customer/menu_dialog.tpl" title=$lng.lbl_categories content=$smarty.capture.menu} Change it to {include file="customer/menu_dialog.tpl" title=$lng.lbl_sterlingsilver content=$smarty.capture.menu} Save the file and then repeat this process for the other file gold.tpl (so $c.catmenu eq’gold’, and $lng.lbl_9ctgold) Step 5: Open up /skin1/customer/home.tpl and look for: {include file="customer/categories.tpl" } I replaced mine and added the new menu so it looks like this: {include file="customer/sterlingsilver.tpl" } {include file="customer/gold.tpl" } Make the entry show up in the Admin modify category page Step 6: Open the file skin1\admin\main\category_modify.tpl Around line 85 is this: Code:
Code:
Write the information to the database Step 7: Open the file admin\category.modify.php Note: This is under the Root (shop, store whatever), NOT skin1\admin !!! Around line 188 is this Code:
( insert this code: Code:
"catmenu" => $cat_menu, Se we have: Code:
If I were smarter, I would have a menus table in xcart where I could fill in the details in skin1\admin\main\category_modify.tpl <SELECT name="cat_menu"> <OPTION value="{$current_category.catmenu}">{$current_cate gory.catmenu}</OPTION> <OPTION value="stgsilver">stgsilver</OPTION> <OPTION value="gold">gold</OPTION> (* add other categories here *} </SELECT> If anyone can write a routine to do this, please let me know, else it is not too much trouble to just add another menu to the options list. I hope you find this useful. Vixnfox http://ifgdesignz.com.au
__________________
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 |
|||||||
|
|||
X-Cart forums © 2001-2020
|