Nik Grey Posted December 14, 2013 Share Posted December 14, 2013 I have searched and cant find the answer, one of my 'Lighter' questions Having just set up my test site (for testing) I realised that I have filled my 'Live' CC with product but haven't set the 'Manufacturer' - the products look a bit better with the manufacturer field populated. So, before I go through each product (will fill my Saturday Night) is there a way of setting the manufacturer as 'Default' ? Quote Link to comment Share on other sites More sharing options...
bsmither Posted December 14, 2013 Share Posted December 14, 2013 Unfortunately, no. The manufacturers table uses a 'id' key which makes the association between this table and the manufacturer column of the inventory table. The manufacturer column in the inventory table has null as a default. This can be changed (maybe using phpMyAdmin) to make the default value for this column a 1 (for example). You would be ALTERing the inventory table. The key to the manufacturer table cannot be zero (or null). So, you will need to pick a manufacturer as the default, learn the value in the 'id' column for that record, then use that number as the default value when you ALTER the inventory table. The above will get you your "default" manufacturer for all newly added items. You will need to run a query against the inventory table to UPDATE all existing records that have a null value to set the manufacturer column to have the default manufacturer 'id' value. I'm not able to give you step-by-step instructions on how to use phpMyAdmin to do the above, but if you need to know the query that will update the inventory table, let me know. Quote Link to comment Share on other sites More sharing options...
Nik Grey Posted December 14, 2013 Author Share Posted December 14, 2013 I'm ok with phpmyadmin, the query to update the table would be great though Quote Link to comment Share on other sites More sharing options...
bsmither Posted December 14, 2013 Share Posted December 14, 2013 UPDATE CubeCart_inventory SET manufacturer = 1 WHERE manufacturer IS NULL; If there is a table prefix, be sure to prepend it to CubeCart. The value 1 is actually the value of the manufacturer you determined by looking in the CubeCart_manufacturer table. Quote Link to comment Share on other sites More sharing options...
Nik Grey Posted December 14, 2013 Author Share Posted December 14, 2013 I must be doing something wrong: Select the Inventory table, SQL Tab, enter: UPDATE CubeCart_inventory SET `manufacturer` = 1 WHERE `manufacturer` IS NULL; Go (0 Rows affected) Tried selecting the 'Inventory' from the Fields on the right and still the same. It would be faster for me to set everything in the manufacturer column to 1 than do these One by One from the store front if this isnt going to work. Quote Link to comment Share on other sites More sharing options...
bsmither Posted December 15, 2013 Share Posted December 15, 2013 Editing the table row by row is certainly faster than CubeCart editing product by product. You can try the command without the backticks on manufacturer. (I made that update to my post very shortly after posting, so you must have read my post from some source other than these forums, or almost immediately after I posted it.) From looking at the inventory table, can you determine if there are any rows that, in fact, have null in the manufacturer column? Quote Link to comment Share on other sites More sharing options...
Nik Grey Posted December 15, 2013 Author Share Posted December 15, 2013 I usually come straight back here once I see an email of an update, so I probably didnt see your update without the backticks as I wouldn't notice such small detail I just tried it without the backticks and still no joy - here's an image with what's in the Manufacturer column: I changed the first two manually. Quote Link to comment Share on other sites More sharing options...
Dirty Butter Posted December 15, 2013 Share Posted December 15, 2013 So they have zeroes, not NULL in the Manufacturers? Are ALL your products going to be just one manufacturer? Quote Link to comment Share on other sites More sharing options...
Nik Grey Posted December 15, 2013 Author Share Posted December 15, 2013 Yes, all same manufacturer (personalised items by me). So, do I just change the NULL in that Query to 0 ? Quote Link to comment Share on other sites More sharing options...
bsmither Posted December 15, 2013 Share Posted December 15, 2013 UPDATE CubeCart_inventory SET manufacturer = 1 WHERE manufacturer = 0; Quote Link to comment Share on other sites More sharing options...
Nik Grey Posted December 15, 2013 Author Share Posted December 15, 2013 That's it - Splendid. That certainly saved me a lot of work. Thanks very much everyone Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.