Jump to content

[SOLVED] - Disappearing Colours


prestatent

Recommended Posts

Prestashop 1.5.4.1

 

Has anyone noticed that when you import a combinations file, it deletes the colours already in the database.

 

Is this a bug or deliberate. See file below:

 

68|Color:color:1|Atlantic:1||REF1||||||0|1||1|1||0|

68|Color:color:2|Treetops:2||REF2||||||0|1||0|2||0|

 

What I think it's doing is using the number in the 2nd field (Color:color:1) as a database id and deleting the current one that is there.Unfortunately it seems to leave the colour image behind and uses that as the image to use.

Edited by prestatent (see edit history)
Link to comment
Share on other sites

Thanks Pascal. It would be good to know how the format of the file relates to attributes within the database. For instance, if I have 10 colours within the database, and only 5 of these colours are in my file, do I have to lookup the database table of colours matching the ones in the file in order to get the id to place against the position in the file? Eg.

 

- Colour in file is blue

- Lookup database table for id of colour blue - value is 4 for example

- Output id in second field - second field value is "Color:color:4"

- Output third field - value is "Blue:1"

 

I guess I'll have to look at the code to see what's going on here.

 

It would of course be very welcome to have the documentation explain this in detail as there seems to be very little explaining the differences between importing in 1.4 & 1.5.

 

Cheers

Link to comment
Share on other sites

Resolved issue as follows:

 

1. Create all required colours via Attributes.

 

2. Comment out lines in AdminImportController.php relating to truncating tables as follows;

 

// Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'attribute`');

// Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'attribute_impact');

// Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'attribute_lang`');

// Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'attribute_group`');

// Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'attribute_group_lang`');

// Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'attribute_group_shop`');

// Db::getInstance()->execute('TRUNCATE TABLE `'._DB_PREFIX_.'attribute_shop`');

 

3. Run import. All colours should be assigned to products correctly. Obviously if there are any new colours on the import file they will be created, but importantly will not overwrite anything else.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...