Duplicate Seo Names In Database

Does anyone know why I would have two SEO names that are the same in the database?



help-faq



appears twice. See screenshot attached.



I'd be grateful for anyone's help in figuring out how this could have happened, whether it's a problem, and how to fix it.

Screen Shot 2014-10-04 at 3.40.25 PM.png

Looks like one us for Company 1, and the other is for Company 0

I only have one company. :-)



Also, I have a feature variant that I misspelled and I can’t get rid of it. Maybe it doesn’t matter. I delete the name from the SEO Names table and it disappears. Then I go to try to delete it from the product_feature_variant_descriptions table and it just keeps coming back. So does the SEO Name.



I also can’t delete or change any of the feature variants or seo names from the backend of CS-Cart. It acts like it does, but then the stuff magically re-appears.



I’ve spent a couple of hours chasing my tail on this and starting to feel a bit aggravated.

Here is another duplicate. You can see that the company ID seems to be random. Why would this be?



[attachment=8497:Screen Shot 2014-10-04 at 4.13.06 PM.png]

Screen Shot 2014-10-04 at 4.13.06 PM.png

It's exactly this buggy behavior why I abandoned my complete installation and started over from scratch. We are currently filling a fresh install with thousands of products/options. I am waiting with sharing products between stores and adding any languages as it went south when we did that.

I would much like to understand when and why this happens.

Do you have multiple languages?

Doesn't the company value of '0' indicate the content is available for ALL stores (if you have multiple stores set up)?

This doesn't explain WHY you would find an SEO name for a Feature, like author name, with an SEO name for ALL stores & another for just store #1, much less HOW that happens.

Here is a fun Sunday morning query I wrote to show (and count) duplicate SEO names:

[sql]SELECT a., b.totalCount AS Duplicate

FROM cscart_seo_names a

INNER JOIN

(

SELECT name, COUNT(
) totalCount

FROM cscart_seo_names

GROUP BY name

) b ON a.name = b.name

WHERE b.totalCount >= 2

[/sql]



All my duplicates are in Categories - which is fine because the WHOLE SEO URL includes the Parent Category + the Sub Category, which means the fully assembled SEO URL is unique and I do have Sub Categories with the same name in different Parent Categories.

Category names (type=c) should be unique with object_id.



In a single store installation, the company_id is zero and it takes special handling in the coee to get the real company_id.

[quote name='P-Pharma' timestamp='1412519230' post='193393']

Do you have multiple languages?

[/quote]



No, just English. I started with a v2.x installation back in 2009, upgraded to 3.x, then upgraded to 4.x Now I'm on 4.2.2 Always stayed with the Pro version (or whatever they call it…maybe it's called Ultimate now).



Only ever had one storefront/company and one language. It seems pretty weird to me. I've gone through the SEO Names table manually in phpMyAdmin and think I've eliminated all the duplicates but who knows.

I would guess that at some point you've had more than one store defined (could have been during 1st upgrade to V4). Your image shows a number of 1/0 company_id's and if you're running one store (I.e. can't see an “all stores” in the upper left of admin header) then the company_id should be zero.



Having 2 names with different company_id's should be fine. It should grab the right one.

Did you run the query created by Magpie Don? Do you have duplicated seo names for all objects? Or just these examples?

[quote name='eComLabs' timestamp='1412580141' post='193423']

Did you run the query created by Magpie Don? Do you have duplicated seo names for all objects? Or just these examples?

[/quote]



I just ran the query and got 2 duplicates. As I say, I ran through it manually. These last two have one for each company ID, 0 and 1.



This whole “two companies” thing is still a mystery to me because at no time was I aware of defining two companies or stores and my current site shows only one store defined in the backend.

[quote name='kingsleypress' timestamp='1412593647' post='193437']

I just ran the query and got 2 duplicates. As I say, I ran through it manually. These last two have one for each company ID, 0 and 1.



This whole “two companies” thing is still a mystery to me because at no time was I aware of defining two companies or stores and my current site shows only one store defined in the backend.

[/quote]



I do not think that this can cause any problem in your store, but post it as a bug to the bug tracker

[quote name='tbirnseth' timestamp='1412539602' post='193403']

In a single store installation, the company_id is zero and it takes special handling in the core to get the real company_id.

[/quote]



I'm not sure this is true in v4.

V4 is now all Ultimate with multi-store capability and the first thing you must do when installing, for even a single store, is to create a store/company and CS-Cart assigns this store/company as Company 1 (company_id = 1). All my products are assigned to Company 1. I have content pages and categories that are assigned to Company 0 and that content is displayed in the store.



I think when company_id is set to 0, it is content available for ALL stores because CSC assumes that other stores could be set up.

So it should be theoretically possible to universally set company_id = 0 OR company_id = 1 IF you only have one store. It shouldn't make any difference. It doesn't make any difference in my store.

I know it to be true since you have to use code like below to get the company_id in admin on a signle-store installation.


?company_id = Registry::get('runtime.forced_company_id')
? Registry::get('runtime.forced_company_id')
: Registry::get('runtime.company_id');



Just do a search of the functions directory for 'forced_company_id' and you will see.



My bet in Kingsley's case that it's leftovers from his original store import or conversion to V4.



Otherwise it will use zero which is the default for “all stores” but in a single compnay installation there is no “all stores”. They call it the “simple ultimate view”.