Osclass Support Forums

Osclass theme support => Alpha Osclass Theme => Topic started by: siken on September 25, 2019, 12:07:49 AM

Title: missing many phones to update your themes
Post by: siken on September 25, 2019, 12:07:49 AM
Each theme use own table to store information that cannot be stored in osclass itself.

The idea is to combine the data from the "oc_t_item_veronika" table with the "oc_t_item_alpha" table and with the "oc_t_item_beta table".

I need the consultation, thanks.
Title: Re: missing many phones to update your themes
Post by: MB Themes on September 26, 2019, 02:16:14 PM
@alexandromt
Try this set of queries

Code: [Select]
REPLACE INTO oc_t_item_beta (fk_i_item_id, s_phone, i_condition, i_transaction)
SELECT fk_i_item_id, s_phone, i_condition, i_transaction FROM oc_t_item_beta where s_phone <> '';

REPLACE INTO oc_t_item_beta (fk_i_item_id, s_phone, i_condition, i_transaction)
SELECT fk_i_item_id, s_phone, i_condition, i_transaction FROM oc_t_item_alpha where s_phone <> '';

REPLACE INTO oc_t_item_beta (fk_i_item_id, s_phone, i_condition, i_transaction)
SELECT fk_i_item_id, s_phone, i_condition, i_transaction FROM oc_t_item_veronika where s_phone <> '';
Title: Re: missing many phones to update your themes
Post by: siken on September 26, 2019, 02:37:35 PM
@alexandromt
Try this set of queries

Code: [Select]
REPLACE INTO oc_t_item_beta (fk_i_item_id, s_phone, i_condition, i_transaction)
SELECT fk_i_item_id, s_phone, i_condition, i_transaction FROM oc_t_item_beta where s_phone <> '';

REPLACE INTO oc_t_item_beta (fk_i_item_id, s_phone, i_condition, i_transaction)
SELECT fk_i_item_id, s_phone, i_condition, i_transaction FROM oc_t_item_alpha where s_phone <> '';

REPLACE INTO oc_t_item_beta (fk_i_item_id, s_phone, i_condition, i_transaction)
SELECT fk_i_item_id, s_phone, i_condition, i_transaction FROM oc_t_item_veronika where s_phone <> '';


The first query and the third one accept it. The second query gives this error:

1452 - cannot add or update a child row: a foreign key constraint fails
Title: Re: missing many phones to update your themes
Post by: siken on September 26, 2019, 04:48:07 PM
@alexandromt
Try this set of queries

Code: [Select]
REPLACE INTO oc_t_item_beta (fk_i_item_id, s_phone, i_condition, i_transaction)
SELECT fk_i_item_id, s_phone, i_condition, i_transaction FROM oc_t_item_beta where s_phone <> '';

REPLACE INTO oc_t_item_beta (fk_i_item_id, s_phone, i_condition, i_transaction)
SELECT fk_i_item_id, s_phone, i_condition, i_transaction FROM oc_t_item_alpha where s_phone <> '';

REPLACE INTO oc_t_item_beta (fk_i_item_id, s_phone, i_condition, i_transaction)
SELECT fk_i_item_id, s_phone, i_condition, i_transaction FROM oc_t_item_veronika where s_phone <> '';


First I have put the web in maintenance mode.

Then I changed the table name oc_t_item_beta to oc_t_item_beta2

Then I have been adding these sequences in the database:


Code: [Select]
REPLACE INTO oc_t_item_beta_2 (fk_i_item_id, s_phone, i_condition, i_transaction, i_sold)
SELECT fk_i_item_id, s_phone, i_condition, i_transaction, i_sold FROM oc_t_item_beta_leales where s_phone <> '';

REPLACE INTO oc_t_item_beta_2 (fk_i_item_id, s_phone, i_condition, i_transaction, i_sold)
SELECT fk_i_item_id, s_phone, i_condition, i_transaction, i_sold FROM oc_t_item_beta_leales where i_condition <> '';

REPLACE INTO oc_t_item_beta_2 (fk_i_item_id, s_phone, i_condition, i_transaction, i_sold)
SELECT fk_i_item_id, s_phone, i_condition, i_transaction, i_sold FROM oc_t_item_beta_leales where i_transaction <> '';

REPLACE INTO oc_t_item_beta_2 (fk_i_item_id, s_phone, i_condition, i_transaction, i_sold)
SELECT fk_i_item_id, s_phone, i_condition, i_transaction, i_sold FROM oc_t_item_beta_leales where i_sold <> '';

REPLACE INTO oc_t_item_beta_2 (fk_i_item_id, s_phone, i_condition, i_transaction, i_sold)
SELECT fk_i_item_id, s_phone, i_condition, i_transaction, i_sold FROM oc_t_item_veronika where s_phone <> '';

REPLACE INTO oc_t_item_beta_2 (fk_i_item_id, s_phone, i_condition, i_transaction, i_sold)
SELECT fk_i_item_id, s_phone, i_condition, i_transaction, i_sold FROM oc_t_item_veronika where i_condition <> '';

REPLACE INTO oc_t_item_beta_2 (fk_i_item_id, s_phone, i_condition, i_transaction, i_sold)
SELECT fk_i_item_id, s_phone, i_condition, i_transaction, i_sold FROM oc_t_item_veronika where i_transaction <> '';

REPLACE INTO oc_t_item_beta_2 (fk_i_item_id, s_phone, i_condition, i_transaction, i_sold)
SELECT fk_i_item_id, s_phone, i_condition, i_transaction, i_sold FROM oc_t_item_veronika where i_sold <> '';

REPLACE INTO oc_t_item_beta_2 (fk_i_item_id, s_phone, i_condition, i_transaction, i_sold)
SELECT fk_i_item_id, s_phone, i_condition, i_transaction, i_sold FROM oc_t_item_alpha where s_phone <> '';

REPLACE INTO oc_t_item_beta_2 (fk_i_item_id, s_phone, i_condition, i_transaction, i_sold)
SELECT fk_i_item_id, s_phone, i_condition, i_transaction, i_sold FROM oc_t_item_alpha where i_condition <> '';

REPLACE INTO oc_t_item_beta_2 (fk_i_item_id, s_phone, i_condition, i_transaction, i_sold)
SELECT fk_i_item_id, s_phone, i_condition, i_transaction, i_sold FROM oc_t_item_alpha where i_transaction <> '';

REPLACE INTO oc_t_item_beta_2 (fk_i_item_id, s_phone, i_condition, i_transaction, i_sold)
SELECT fk_i_item_id, s_phone, i_condition, i_transaction, i_sold FROM oc_t_item_alpha where i_sold <> '';

I added the i_sold field to the query ...

And finally I renamed the table, from oc_t_item_beta_2 to oc_t_item_beta

And now old ads created with veronika or alpha have their phones with the new beta theme.

When changing the theme, you have to copy the data from the table of the previous theme, so the phones and the states of the ads will be.


Regards