X-Cart: shopping cart software

X-Cart forums (https://forum.x-cart.com/index.php)
-   Dev Questions (https://forum.x-cart.com/forumdisplay.php?f=20)
-   -   How to Add a Simple Custom Menu (https://forum.x-cart.com/showthread.php?t=19871)

Cambo 09-05-2006 04:05 AM

Re: How to Add a Simple Custom Menu
 
Quote:

Originally Posted by laurieblake
I am down under like you and confused about who else hosts IN AUS.
laurieblake


You could try Grant at The Web Factory <http://www.webfactory.com.au/> he hosts my X-Carts and the speed is good.

vixnfox 09-05-2006 04:12 PM

Re: How to Add a Simple Custom Menu
 
vipstore....
the products page is generated using numerous variables such as products per page as set in your store settings. While there probably is a way to put a product on a static page so it behaves like any other product from your normal categories. Im thinking you could create your own customer/main products.tpl and product.tpl templates and hijack the loop.categories and loop.products much the same way as filtering the categories for the custom menu. Its a good idea tho - custom product pages.

vixnfox

Cambo 09-09-2006 10:27 PM

Re: How to Add a Simple Custom Menu
 
When I add the admin > languages > english > add new entry > select topic > languages > variable : lbl_faqmenu_content

I get the following error message "The label name contains a restricted character. Please choose a different name."

X-Cart 4.1.3 this time

vixnfox 09-09-2006 10:56 PM

Re: How to Add a Simple Custom Menu
 
ok you dont select "languages" from your "select Topic". You want it to be either a label or text. The text option allows you to write quite lengthy HTML eg:
Select Topic -> Text
variable name = txt_yourname, Value = " <font color ="red"> Welcome to my nightmare</font><br><h4>Hope you enjoy the view</h4><br>

labels are a little more restrictive since they are meant more for item descriptors.eg

Select Topic->Label
variable name = lbl_mymenuname, value ="X-Rated Videos"

try that

vixnfox

Cambo 09-09-2006 11:15 PM

Re: How to Add a Simple Custom Menu
 
Thanks vixnfox, It turns out the invalid character was a space, I was including everything up to th word "value" as the "variable" but more correctly it is

"Select topic" > label (or text I guess)

"Variable" > lbl_faqmenu_swarovski

"Value" > name Swarovski FAQ, Value Swarovski Crystals

cheers,

Cambo 09-10-2006 12:19 AM

Re: How to Add a Simple Custom Menu
 
I may be getting a bit lost here.

I managed to create the new menu <http://joe.webfactory.com.au/xcart/home.php> it is now called "new equipment" under "used equipment" .

I don't know where the category listing swarovski crystals has gone :-(

Now, how do I get some of the categories currently residing under used equipment to move down and be automatically listed under new equipment?

Alternatively, how do I assign product categories to the "New Equipment" menu? They currently all list under used equipment (which used to be called "categories") in the admin.

vixnfox 09-10-2006 02:29 AM

Re: How to Add a Simple Custom Menu
 
Hi Cambo,
First of all, since I wrote this I have learned a bit more about how x-cart works, and I have simplified the process. If you notice on my page
http://ifgdesignz.com.au
I have added a category menu also. Lets use your example to create a custom menu. This is a pure categories menu. Note: I have put created files in skin1\customer
Firstly, lets create your "New Equipment Menu" - which you have already done:
1. skin1\customer\home.tpl

{if $categories ne "" and ($active_modules.Fancy_Categories ne "" or $config.General.root_categories eq "Y" or $subcategories ne "")}
{ include file="customer/categories.tpl" } {* This is x-carts category menu *}

<br>
{include file="customer/new_equipment.tpl" } {* this is your new menu *}

2. new_equipment.tpl

{* $Id: new_equipment.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].categoryid}
{if $tmp > 500}
<FONT class="CategoriesList"><A href="home.php?cat={$categories[cat_num].categoryid}" class="VertMenuItems">{$categories[cat_num].category}</A></FONT><BR>

{/if}
{/section}
{else} {section name=cat_num loop=$subcategories}
<FONT class="CategoriesList"><A href="home.php?cat={$subcategories[cat_num].categoryid}" class="VertMenuItems">{$subcategories[cat_num].category}</A></FONT><BR>
{/section}
{/if}
{/if}
{/capture}
{ include file="menu.tpl" dingbats="dingbats_categorie.gif" menu_title=$lng.lbl_new_equipment menu_content=$smarty.capture.menu }

Note that this is essentially the same as categories.tpl except for the lines:
Code:

{assign var="tmp" value=$categories[cat_num].categoryid}
{if $tmp >500}
<FONT class="CategoriesList"><A href="home.php?cat={$categories[cat_num].categoryid}" class="VertMenuItems">{$categories[cat_num].category}</A></FONT><BR>
{/if}


3. and in Categories.tpl
Code:

{assign var="tmp" value=$categories[cat_num].categoryid}
{if $tmp < 501}
<FONT class="CategoriesList"><A href="home.php?cat={$categories[cat_num].categoryid}" class="VertMenuItems">{$categories[cat_num].category}</A></FONT><BR>
{/if}


Note carefully the filter for the category ID numbers. This was a bit tricky to do. If you go into phpmyadmin and look at the xcart_categories table you can easily retrieve the category ID numbers for your filter. Unfortunately, If you add a new category, xcart assigns the next highest number for the category ID and this can stuff things up. You have two choices, and unchecking autoincrement is not the wisest. Here is what I suggest.
Find the highest category id number in your xcart_categories table, lets say its 200.
To add your new category to your new menu, create a new category, go into phpmy admin and find it then change its category id to, say 501 BEFORE you add any products. Can you see where this is going? Then you simply filter:
{if $tmp < 501} in categories.tpl and
{if $tmp > 500} in new_equipment.tpl
To add another category to your main menu, just follow the same steps and pick a number < 501 that hasnt already been used. You can have as many menus as you like, and although there is probably a far better way to do it, this way costs you nothing.

For information, the category ID is used in the following xcart tables:
xcart_categories
xcart_products_categories
xcart_categories_subcount
but im pretty sure that the other two table entries are not filled in until you add a product to the menu. BTW xcart will increment the highest number when you add a category, so if your new menu is the one you add a category to, it will have an ID of 502.

If you can follow all of this, then the
Quote:

Now, how do I get some of the categories currently residing under used equipment to move down and be automatically listed under new equipment?
problem should be solved.

Note also that if you already have products in a category you want to move to another menu (in your case probably) you WILL have to find and replace the category ID in the THREE tables or create categories with a slightly different name, change the ID and re-assign the products to the new category, delete the old one and rename it back to what you want. errrrrr. That might have confused you now sorry, but thats actually how I did it, lucky I didnt have too products yet.

I dont know if this is allowed, but I have started a new thread with this reply for further discussion, find it here

http://forum.x-cart.com/showthread.php?t=24790

vixnfox

vixnfox 09-11-2006 06:29 PM

Re: How to Add a Simple Custom Menu
 
CODE REWORKED NEW BETTER METHOD POSTED

http://forum.x-cart.com/showthread.php?t=24790


vixnfox

fmoses 01-06-2009 04:38 PM

Re: How to Add a Simple Custom Menu
 
I can't seem to get this to work, I got the added box, but i just can't get the links to come through. see www.anythingindian.biz the free stuff section. Basically I'm trying to move the created pages from the help section to this new section that i wanted to create. I'm not very experienced and just work by trial and error with a lot of backing up of files. But what i'v enoticed is that it doesn't seem to link or acccess the indiannews.php, or indiannews.php and make it a viable link. I can totally omit those two files, and it doesn't affect the look or the function. Now under the lbl though in languages i remove Indian News and place the line <a href = "http://www.anythingindian.biz/store/news-from-india-pg-28.html" target="_blank">Indian News</a> it becomes a link again. I'm not sure if this is the correct way of doing it. Also if this is the method, how do i add more menu items to that box, as i'd like to move many of the items from the help menu to this box. I added another label and added it to the frestuffmenu.tpl file and it shows it right next to the previous link not below it. Also the distance of the text from the left doesn't match the other boxes. How do i correct that as well.

These are the contents of the files i have, and i made the labels, and edited the two files accordingly.

indiannews.php
<?php

# $Id: indiannews.php #

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

?>


freestuffmenu.tpl
{* $Id: freestuffmenu.tpl *}
{$lng.lbl_freestuffmenu_indiannews}

indiannews.tpl
{* $Id: indiannews.tpl *}

{include file="page_title.tpl" title=$lng.lbl_freestuffmenu_indiannews}
{capture name=dialog}
<a href = "http://www.anythingindian.biz/store/news-from-india-pg-28.html" target="_blank">Indian News</a>
{/capture}
{include file="dialog.tpl" title=$lng.lbl_freestuffmenu_indiannews content=$smarty.capture.dialog extra="width=100%"}

Not sure where i went wrong, if anyone can show me, thanks.

fmoses 01-13-2009 11:27 PM

Re: How to Add a Simple Custom Menu
 
It's cool got it too work, used the following article

http://forum.x-cart.com/showthread.php?t=24054&highlight=creating+a+new+me nu+for+static+pages

and worked perfectly for what i needed. I wish they had a better search in this forum cause it's really tough to find things some times.


All times are GMT -8. The time now is 06:11 PM.

Powered by vBulletin Version 3.5.4
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.