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

How to Add a Simple Custom Menu

 
Reply
   X-Cart forums > X-Cart 4 > Dev Questions
 
Thread Tools Search this Thread
  #1  
Old 02-10-2006, 05:55 PM
 
vixnfox vixnfox is offline
 

Advanced Member
  
Join Date: Feb 2006
Location: Adelaide, South Australia
Posts: 82
 

Default How to Add a Simple Custom Menu

Might be worthy of a sticky considering all the requests *tap tap mods? *

Adding A Custom Menu
Add a basic menu tab to LH menu structure. Here is what I "created" for jewellery store.
I know the end result could have been achieved using static pages, but I needed the challenge!

I wanted a "Jewellery FAQs" Menu
Decide on names: Jewellery FAQs - Menu name
Swarovski Crystals - Menu Entry
Create:
admin Languages
lbl_faqmenu_content name FAQ Menu Content, Value Jewellery FAQs
lbl_faqmenu_swarovski name Swarovski FAQ, Value Swarovski Crystals

Create a folder "ourpages" under skin1 (just to keep all your own stuff together)

We need 4 files all up, 2 for xcart setup, then 2 for each menu entry

skin1\ourpages - faqs.tpl, faqs_menu.tpl, swarovski.tpl
xcart root - swarovski.php

( I tried putting the .php file in xcart\customer, but every time I used the link, it changed all the other menu links from "xcart\" to "\xcart\customer" until I hit the back button or clicked "Home". Any Ideas why???)

1. Files to modify:
skin1\customer\home.tpl
add this line above or below the include help.tpl line
{include file="ourpages/faqs.tpl" }

skin1\customer\home_main.tpl
add this line somewhere
{elseif $main eq "swarovski" }
{include file="./ourpages/swarovski.tpl" }

2. faqs.tpl in ourpages. This is the menu
{capture name="menu"}
{include file="ourpages/faqsmenu.tpl"}
{/capture}
{ include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_faqmenu_content menu_content=$smarty.capture.menu }



3. faqs_menu.tpl in ourpages. These are the menu entries (one here only)
{* $Id: faqs_menu.tpl *}
{$lng.lbl_faqmenu_swarovski}


4. swarovski.php in xcart root (see why above)
<?php

# $Id: swarovski.php #

require "./auth.php";
require $xcart_dir."/include/categories.php";
$smarty->assign("main","swarovski");
$location[] = array(func_get_langvar_by_name("lbl_faqmenu_swarovski", ""));
# Assign the current location line
$smarty->assign("location", $location);
func_display("customer/home.tpl",$smarty);

?>

6. swarovski.tpl in ourpages. This is the content. Good Idea to save an "Empty" one to use as a dummy template for other entries.
{* $Id: swarovski.tpl *}

{include file="page_title.tpl" title=$lng.lbl_faqmenu_swarovski}
<!-- this table just adds an image and description of the page and is optional
<TABLE cellpadding="5">
<TR>
<TD>[img]{$ImagesDir}/swarovski.jpg[/img]</TD>
<TD>
{$lng.txt_swarovskiheader}
</TD></TR>
</TABLE>
-->

{capture name=dialog}

First a link to Swarovski Crystals ---- its in German !!!</h6>
<a href = "http://www.swarovski.com/index/" target="_blank">Swarovski Crystals</a>
etc ............................

{/capture}
{include file="dialog.tpl" title=$lng.lbl_faqmenu_swarovski content=$smarty.capture.dialog extra="width=100%"}

There. I hope someone finds this information useful.

vixnfox
__________________
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
Reply With Quote
  #2  
Old 04-09-2006, 10:09 AM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

Moving to Custom Mods.
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #3  
Old 04-15-2006, 01:41 PM
 
pteerapr pteerapr is offline
 

Advanced Member
  
Join Date: Feb 2006
Posts: 48
 

Default

this is a good one. Somebody was going to charge me $100 for this. Thank you.
__________________
x cart 4.4.3 gold Unix U.S.A
Reply With Quote
  #4  
Old 04-15-2006, 05:55 PM
 
balinor balinor is offline
 

Veteran
  
Join Date: Oct 2003
Location: Connecticut, USA
Posts: 30,253
 

Default

Wow, somebody was about to rip you off
__________________
Padraic Ryan
Ryan Design Studio
Professional E-Commerce Development
Reply With Quote
  #5  
Old 04-16-2006, 06:03 PM
 
vixnfox vixnfox is offline
 

Advanced Member
  
Join Date: Feb 2006
Location: Adelaide, South Australia
Posts: 82
 

Default

You can also split your main categories menu similarly by using the
Code:
$categories[cat_num].category}
to test for the name, as I have done here:

http://ifgdesignz.com.au/home.php

I can post the details if you want.

vixnfox
__________________
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
Reply With Quote
  #6  
Old 04-17-2006, 12:55 AM
 
pteerapr pteerapr is offline
 

Advanced Member
  
Join Date: Feb 2006
Posts: 48
 

Default

Yes, Please post the detail.
__________________
x cart 4.4.3 gold Unix U.S.A
Reply With Quote
  #7  
Old 04-17-2006, 02:02 AM
 
vixnfox vixnfox is offline
 

Advanced Member
  
Join Date: Feb 2006
Location: Adelaide, South Australia
Posts: 82
 

Default Splitting the category menu

Following on from above:
If you follow the link, here is how I made the photography menu.
Add the category as usual using Admin, it appears in the main category menu on the left.
Exclude the Photography and Restoration menus from categories.tpl
Code:
{section name=cat_num loop=$categories} {assign var="tmp" value = $categories[cat_num].category} {if $tmp ne "Photography" && $tmp ne "Restoration"} <FONT class="CategoriesList">{$categories[cat_num].category}</FONT> {/if} {/section}

in home.tpl find
Code:
{ include file="customer/categories.tpl" }
and add this:
Code:
{include file="ourpages/photo_menu.tpl"}


This is photomenu.tpl
Code:
* $Id: photo_menu.tpl,v 1.23 2004/06/24 09:53:29 max Exp $ *} {capture name=menu} {if $active_modules.Fancy_Categories ne ""} {include file="`$fancycategories_config.modules_path`/fancy_categories.tpl"} {else} {if $config.General.root_categories eq "Y"} {section name=cat_num loop=$categories} {assign var="tmp" value=$categories[cat_num].category} {if $tmp eq"Photography"} <FONT class="CategoriesList">{$categories[cat_num].category}</FONT> {elseif $tmp eq "Restoration"} <FONT class="CategoriesList">{$categories[cat_num].category}</FONT> {/if} {/section} {else} {section name=cat_num loop=$subcategories} <FONT class="CategoriesList">{$subcategories[cat_num].category}</FONT> {/section} {/if} {/if} {/capture} { include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_photomenu_content menu_content=$smarty.capture.menu }
... and add the label $lng.lbl_photomenu_content using Admin languages - in this case Photography.

The restoration part is not a category as such, and is added to home_main.tpl as a static page.
Code:
{elseif $main eq "restoration"} {include file="./ourpages/restoration.tpl"}



vixnfox
__________________
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
Reply With Quote
  #8  
Old 04-17-2006, 03:52 AM
 
pteerapr pteerapr is offline
 

Advanced Member
  
Join Date: Feb 2006
Posts: 48
 

Default

thank you very much. I have already shared this code with other newbies. We were frustrated of not being able to add things on to the menu in the beginning.
__________________
x cart 4.4.3 gold Unix U.S.A
Reply With Quote
  #9  
Old 04-18-2006, 03:19 AM
 
pteerapr pteerapr is offline
 

Advanced Member
  
Join Date: Feb 2006
Posts: 48
 

Default

do you know how to make the menu title itself become a link?
__________________
x cart 4.4.3 gold Unix U.S.A
Reply With Quote
  #10  
Old 04-18-2006, 04:08 AM
 
vixnfox vixnfox is offline
 

Advanced Member
  
Join Date: Feb 2006
Location: Adelaide, South Australia
Posts: 82
 

Default

you can make the label a link in Languages ie:

Photography

but you might want to make the <a> tag a css class and make the visited link the same colour as the link itself.

eg:
Photography

Code:
.yourlink A:link { COLOR: #081589; TEXT-DECORATION: none; } .yourlink A:visited { COLOR: #081589; TEXT-DECORATION: none; } .yourlink A:hover { COLOR: #FF0000; TEXT-DECORATION: underline; } .yourlink A:active { COLOR: #081589; TEXT-DECORATION: none; }
FYI x-cart uses skin1.css in the root of skin1

vixnfox
__________________
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
Reply With Quote
Reply
   X-Cart forums > X-Cart 4 > Dev Questions



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 12:00 PM.

   

 
X-Cart forums © 2001-2020