You are here:  » Category name allowed characters?

Support Forum



Category name allowed characters?

Submitted by paul30 on Sun, 2008-09-28 22:57 in

Hello David, just a quick question :

Can Master Categories have dash cymbals in their names?

Example: Aaaaa-Aaa AAAA AAAA

Thanks
Pasha

Submitted by support on Mon, 2008-09-29 03:32

Hi Pasha,

The "-" character as this is used by the URL re-write system in-place of the space character, so it would be removed at the top of search.php and no results given i'm afraid...

Cheers,
David.

Submitted by paul30 on Mon, 2008-09-29 04:43

Ok, - are there any other characters allowed (which would not interfere with the system)? Like _ or anything else?

I mean I see that the admin interface does not let me add almost anything except alphanumeric characters (I was able to add a dot :) ) - Just trying to find a way to separate my categories ala:

Guitar- Electric guitar pickups
Guitar- Pedals effects

so that the list in the Categories page (the one that lists all categories A-Z) and my drop down menus would look usable (A to Z grouped by instrument)

I tried using the same method and Without the Slash or some kind of separation the names are hard to read, so I started to look for a "separator" like "-" "_" or double space, or anything of that nature.

Thanks in advance
Pasha

Submitted by support on Mon, 2008-09-29 08:03

Hello Pasha,

Possible options that won't interfere with the URLs are perhaps *, for example:

Guitar * Electric guitar pickups

...or pipe, for example:

Guitar | Electric guitar pickups

Whichever character you wish to use, 2 modifications need to be made to permit the character when setting up the category; and then not to strip it during the "normalisation" during search.

For the first part, the permitted characters are checked using this code on line 16 of admin/categories.php:

if(!ereg("^[0-9a-zA-Z\. ]{0,255}$",widget_posted($_POST["name"])))

To permit "*" for example, change this as follows:

if(!ereg("^[0-9a-zA-Z\.* ]{0,255}$",widget_posted($_POST["name"])))

...and then at the top of search.php, you will find this code on line 4:

$q = (isset($_GET["q"])?tapestry_normalise($_GET["q"],":\."):"");

...change this as follows:

$q = (isset($_GET["q"])?tapestry_normalise($_GET["q"],":\.*"):"");

Hope this helps!

Cheers,
David.

Submitted by paul30 on Mon, 2008-09-29 09:27

Got it thank you very much!

Submitted by paul30 on Tue, 2008-09-30 07:29

Ok this is perhaps my last question (I really value your time and thats why I dont enjoy bothering you so much) :(

I tried the method above and it worked from the technical point of view, but messed up some URLs, so I decided to try going a different way about it.

So to refresh the subject, all I need is to have my categories sorted A to Z By Instrument.

I have my Master Categories (the ones I have mapped all the similar products to), so I added a field (catSort ) to the categories table, and in that field I added the corresponding "instruments" so that I could query the categories sorted by the "catSort" field, - instead of the "ORDER BY category" - I could "ORDER BY catSort", - the problem is that I am not that good with mySql queries, and the query I need to modify is selecting categories from products, (not categories) so I guess I will need something like "LEFT JOIN" in the query, but when it comes to such a complex queries it starts looking Chinese to me, and I was trying for hours, and I just can not get the right query, so I decided to (again) ask for your help...

current "categories" table structure is:

id | name | alternates | catSort

The products table is unchanged, here is the query as it is now:

$sql = "SELECT DISTINCT category FROM `".$config_databaseTablePrefix."products` WHERE ".$where." ORDER BY category";

So theoretically I need to: select distinct category from products WHERE ".$where." order by catSort - (which is in "categories" table, but in the "name" field of the "categories" table the category name will match the "category" field of the "products" table)

I would Really appreciate any of your input on this...

Thanks a lot in advance!
Pasha

Submitted by support on Tue, 2008-09-30 07:41

Hello Pasha,

Just a quick question which could make this much more straight forward - are you mapping every category in your site to a "master category"? This would mean that the category index can be generated directory from the categories table instead of having to SELECT DISTINCT from the products table...

Cheers,
David.

Submitted by paul30 on Tue, 2008-09-30 07:59

Not every, but my goal is to map around 90% of them as from what I see some of the categories/brands dont need mapping...

Thanks a lot!

Submitted by paul30 on Tue, 2008-09-30 08:05

I think I just got your question, and I am afraid that I do need a Distinct From Products, because this query is also used to display categories beside the listed products, so that only the categories that correspond to the found products will get listed...

Cheers.
Pasha

Submitted by paul30 on Tue, 2008-09-30 08:13

I am sorry for multiple messages, I am just thinking as we go...

On the other hand maybe it is easier to add a query/ssi command to the import routine so that all the categories in the product table will update the catSort field (if it is set) to match the catSort field in the categories table??

Submitted by support on Tue, 2008-09-30 09:50

Hi Pasha,

That's along the lines of what I was thinking - have you added a catSort field to your products table also? (it is effectively going to become a top level category field...

Cheers,
David.

Submitted by paul30 on Tue, 2008-09-30 10:13

No, I just thought about this as I wrote it... I can add it, if needed though...

Submitted by support on Wed, 2008-10-01 08:40

Hello Pasha,

Yes - if you add the field to the main products table; then if you could email me your includes/admin.php just so I know exactly what code you're working with we'll take it from there...

Cheers,
David.