Advertisement:

Author Topic: Complete database with ALL Car Makes & Models for car attributes plugin  (Read 17757 times)

lexosc

  • Sr. Member
  • ****
  • Posts: 344
I got some help in here so now i contribute back, i have spend a lot of time to add all the important models and makes to car attributes plugin one by one so now i share it with you.

I found also that smart had subaru models inside it...

i was careful but if you find any mistake please inform me :)

Edit: uploaded fixed database (ignore the error when importing models it will still work)

updated the database again removed 3 foreign keys
« Last Edit: September 07, 2013, 06:07:14 pm by alexgr »

classifyme

  • Newbie
  • *
  • Posts: 43
Re: Complete database with ALL Car Makes & Models for car attributes plugin
« Reply #1 on: September 04, 2013, 10:55:17 am »
Hi alexgr,

I get the following but it might be because I'm on 3.2.1???

oc_t_item_car_make_attr
#1062 - Duplicate entry '32' for key 'PRIMARY'


and
oc_t_item_car_model_attr
#1062 - Duplicate entry '1' for key 'PRIMARY'

This is using phpMyAdmin sql, using my Admin page Tools/import I get There was a problem importing data to the database.

cheers
Dave

Gilden

  • Sr. Member
  • ****
  • Posts: 464
  • Availability: 30%
Re: Complete database with ALL Car Makes & Models for car attributes plugin
« Reply #2 on: September 04, 2013, 11:57:23 am »
It's because you already have data on your tables. You could either empty those tables first or replace the existing ids.

dev101

  • Osclass Hero
  • Hero Member
  • *
  • Posts: 2155
  • osclass.work
Re: Complete database with ALL Car Makes & Models for car attributes plugin
« Reply #3 on: September 04, 2013, 02:58:50 pm »
First to say thanks to alexgr for this list!

Problems:

[1] In makes db, manufacturers 32-53 are duplicates, and this creates trouble when importing. If I delete the entire makes table, I can import newer without a problem, but then it is not complete, about first 31 manufacturers from original installation are missing, since the newer db start from 32. And if I try to delete rows 32-53, I get the following error:


Code: [Select]
Error
SQL query:  Edit

DELETE FROM `osclass320`.`oc_t_item_car_make_attr` WHERE `oc_t_item_car_make_attr`.`pk_i_id` =32 LIMIT 1 ;


MySQL said:

#1451 - Cannot delete or update a parent row: a foreign key constraint fails (`osclass320`.`oc_t_item_car_model_attr`, CONSTRAINT `oc_t_item_car_model_attr_ibfk_1` FOREIGN KEY (`fk_i_make_id`) REFERENCES `oc_t_item_car_make_attr` (`pk_i_id`))

[2] And when I tried to delete entire models table, I could not do it because of a foreign key:

Code: [Select]
Error
SQL query:  Edit

DELETE FROM `osclass320`.`oc_t_item_car_make_attr` WHERE `oc_t_item_car_make_attr`.`pk_i_id` =1 LIMIT 1 ;

MySQL said:

#1451 - Cannot delete or update a parent row: a foreign key constraint fails (`osclass320`.`oc_t_item_car_model_attr`, CONSTRAINT `oc_t_item_car_model_attr_ibfk_1` FOREIGN KEY (`fk_i_make_id`) REFERENCES `oc_t_item_car_make_attr` (`pk_i_id`))

If I untick foreign key check, it gets deleted allright, but when I import newer models database I get a new error about the foreign key:

Code: [Select]
Error
SQL query:

--
-- Constraints for dumped tables
--
--
-- Constraints for table `oc_t_item_car_model_attr`
--
ALTER TABLE  `oc_t_item_car_model_attr` ADD CONSTRAINT  `oc_t_item_car_model_attr_ibfk_1` FOREIGN KEY (  `fk_i_make_id` ) REFERENCES  `oc_t_item_car_make_attr` (  `pk_i_id` ) ;


MySQL said:

#1452 - Cannot add or update a child row: a foreign key constraint fails (`osclass320`.`#sql-b8_121`, CONSTRAINT `oc_t_item_car_model_attr_ibfk_1` FOREIGN KEY (`fk_i_make_id`) REFERENCES `oc_t_item_car_make_attr` (`pk_i_id`))

How to properly import this into db?

Question: can we manually edit db in text editor, since the list looks very simple to me, and just rearange the data? Or is it not that simple/not recommended?
« Last Edit: September 04, 2013, 03:00:56 pm by dev101 »

lexosc

  • Sr. Member
  • ****
  • Posts: 344
Re: Complete database with ALL Car Makes & Models for car attributes plugin
« Reply #4 on: September 04, 2013, 03:44:30 pm »
Sorry in my database it works without problem but i can't understand why it shows duplicate key error i am looking into this if i find solution i will post it

lexosc

  • Sr. Member
  • ****
  • Posts: 344
Re: Complete database with ALL Car Makes & Models for car attributes plugin
« Reply #5 on: September 04, 2013, 04:25:02 pm »
I fixed the dublicate error and managed to import makes and models database now  i just get an error when importing models :
Code: [Select]
#1005 - Can't create table 'osclass.#sql-1414_10a' (errno: 121)
But i think you can just ignore this error because it works without problem for me right now after importing this

if someone know about this error and why i get this please tell us!
maybe i get this error because i didn't export the right way.
the only thing i know is that it has to do with this code at the end of oc_t_item_car_model_attr.sql
Code: [Select]
ALTER TABLE `oc_t_item_car_model_attr`
  ADD CONSTRAINT `oc_t_item_car_model_attr_ibfk_1` FOREIGN KEY (`fk_i_make_id`) REFERENCES `oc_t_item_car_make_attr` (`pk_i_id`);

just delete all rows from oc_t_item_car_make_attr and oc_t_item_car_model_attr
then go and import make and then model i also removed some foreign keywords i had added

i attached the fixed sql files here
« Last Edit: September 07, 2013, 06:07:01 pm by alexgr »

classifyme

  • Newbie
  • *
  • Posts: 43
Re: Complete database with ALL Car Makes & Models for car attributes plugin
« Reply #6 on: September 05, 2013, 11:13:56 am »
That fix works great thanks alexgr, great work and very much appreciated.

cheers
Dave

serjuc11111

  • Hero Member
  • *****
  • Posts: 814
Re: Complete database with ALL Car Makes & Models for car attributes plugin
« Reply #7 on: September 24, 2013, 01:04:43 pm »
maybe someone help with this!
when i edit a item cars attribute fileds are reseted and are not saved!
thx!

Robert Patricksson

  • Newbie
  • *
  • Posts: 1
The main problem with all these plugins on the choice of models is the quick obsolescence of the data. Therefore, the correct way is to select the data provider with an API instead of writing your code.
Usually these data providers already have code examples and widgets.

I had a experience with a data provider with car makes models from https://car2db.com, everything was ready to use: SQL-dump, code examples. So it takes me much less time.

milko

  • Newbie
  • *
  • Posts: 1
The easiest vehicle database for your web project. Actually, databases.one has every car make(240+) & model(2700+) from 1906 - 2017 now. Car Year Make Model Trim Database API KEY for auto updates. A list of Vehicle Makes, Models and Trims all sortable by year.

Sample Car Database Download