Welcome, Guest. Please login or register.
Login with username, password and session length


VirtueMart 1.1.8 - [SECURITY RELEASE] is available! Read more....

  Advanced search

247038 Posts in 67506 Topics- by 258314 Members - Latest Member: aniketana
Pages: [1]   Go Down
Print
Author Topic: Duplicated categorynames  (Read 1871 times)
BreezeKeeper
Newbie
*
Posts: 6


« on: May 16, 2011, 07:40:07 AM »

I know somebody will say "its not a bug, its a feature" .. but why i cant have duplicated categorynames on different levels ?

if i have a large productlist and therefore more than a few categories it will be unavoidable to have duplicated names like "supplies"

is there a solution ?

breezekeeper
Logged
Hutson
Global Moderator
Hero Member
*
Posts: 562



WWW
« Reply #1 on: May 16, 2011, 09:51:32 AM »

I have duplicate category names at different levels.  Not sure where your problem is?
Logged

regards
Andrew
If I have helped save you time and effort please click  to offer a  Small Donation

Website design Nottingham e-commerce design and support
BreezeKeeper
Newbie
*
Posts: 6


« Reply #2 on: May 16, 2011, 10:09:33 AM »

On Virtuemart 2.0 RC duplicated names arent allowed.

Look the category table line 108 - 119:

if (!empty($this->category_name)) {
   $db = JFactory::getDBO();

   $q = 'SELECT `category_id` FROM `#__vm_category` ';
   $q .= 'WHERE `category_name`="123' . $this->category_name . '" ';
            $db->setQuery($q);
   $category_id = $db->loadResult();
   if (!empty($category_id) && $category_id!=$this->category_id) {
      $this->setError(JText::_('COM_VIRTUEMART_CATEGORY_NAME_ALREADY_EXISTS'));
      return false;
   }
}
Logged
jjk
Advanced
Sr. Member
*****
Posts: 378


« Reply #3 on: May 16, 2011, 12:35:21 PM »

I just tested this using an SVN version from last Saturday (newer than the RC) and identical catagory names do work despite the piece of code you are concerned about. It is even possible to add the same category name twice to the top level category or the same parent category. Whatever name you add, it receives a new category_id.
I just wonder if this is working as designed? ...perhaps this kind of freedom with category names makes sense if somebody develops a multilingual shop selling i.e. "T-Shirts", which is the same in many languages...
« Last Edit: May 16, 2011, 13:03:39 PM by jjk » Logged
Milbo
Administrator
Sr. Member
*
Posts: 436


« Reply #4 on: May 16, 2011, 16:53:10 PM »

Hmmmmm interesting, bug or feature, does it work as designed? Lets discuss, if we should allow it or not.
Logged
BreezeKeeper
Newbie
*
Posts: 6


« Reply #5 on: May 16, 2011, 18:09:09 PM »

hi milbo and thanks for your post,

due to the problems which the current solution is bringing on, i dont think that there is many space to for disgusting Wink

you need duplicated categorynames on several sites.

and i see no problems if we compare the name and the parent_id, of course with the exception that the the table cant be global like it is on current svn.
Logged
jjk
Advanced
Sr. Member
*****
Posts: 378


« Reply #6 on: May 17, 2011, 02:36:13 AM »

How about doing it the Joomla way - using a category/article (product) title and an additional category/article alias? The latter is automatically derived from the title if you leave it blank. They allow duplicate category/article titles but insist on unique category/title aliases, which are used for the URL/SEO.

In Joomla, the following error message shows up when the alias exists already:
Save failed with the following error: Another category with the same parent category has the same alias
« Last Edit: May 17, 2011, 03:53:01 AM by jjk » Logged
Hutson
Global Moderator
Hero Member
*
Posts: 562



WWW
« Reply #7 on: May 17, 2011, 02:37:25 AM »

We should ALLOW duplicate category/sub-category names

Stopping duplicate sub-categories will lead to the need for larger sub/category names and hence large menu names (not desireable!)

Here is a simple example (not the best, but will suffice) even a simple structure may require this:-

CAT       Sub cat
Clothing >male
Clothing >female

CAT    Sub cat
Shoes >male
Shoes >female

If uniqueness was required we would end up with

Clothing >Clothing male
Clothing >Clothing female
Shoes >Shoes male
Shoes >Shoes female


So please do not force uniqueness as an arbitary requirement.  THe database already has a unique key.
Logged

regards
Andrew
If I have helped save you time and effort please click  to offer a  Small Donation

Website design Nottingham e-commerce design and support
jjk
Advanced
Sr. Member
*****
Posts: 378


« Reply #8 on: May 17, 2011, 06:40:26 AM »

This reminds me of a common SEO problem:
http://forum.virtuemart.net/index.php?topic=86520.0
Logged
Hutson
Global Moderator
Hero Member
*
Posts: 562



WWW
« Reply #9 on: May 17, 2011, 08:08:12 AM »

Would be great if support was there for SEO tag as well!
Logged

regards
Andrew
If I have helped save you time and effort please click  to offer a  Small Donation

Website design Nottingham e-commerce design and support
BreezeKeeper
Newbie
*
Posts: 6


« Reply #10 on: May 17, 2011, 10:47:39 AM »

if the whole category tree in the sef-url, there wont be problems.
and if the user wants to cut the sef-url like "only last category" he has to notice this
Logged
Milbo
Administrator
Sr. Member
*
Posts: 436


« Reply #11 on: May 19, 2011, 19:45:20 PM »

We removed the line which made the category name unique and added now slug/alias for categories and products to solve the seo problems. We just port it now from the router into the table check function, so that we get an easy to handle object which stores the slug automatically build by name (as joomla alias for content).
Logged
jjk
Advanced
Sr. Member
*****
Posts: 378


« Reply #12 on: May 20, 2011, 03:12:01 AM »

...most appreciated  Grin
Logged
Hutson
Global Moderator
Hero Member
*
Posts: 562



WWW
« Reply #13 on: May 20, 2011, 05:27:40 AM »

sweet!
Logged

regards
Andrew
If I have helped save you time and effort please click  to offer a  Small Donation

Website design Nottingham e-commerce design and support
Pages: [1]   Go Up
Print
Jump to: