Transaction history, how is it implemented?

1

I need to make a history of the last purchase (s) of the user (these infos will be shown in table ).

Could you give me tips on how this history is usually saved? (need not do for me)

Normally a column is created and within it an array with id pendents' numbers of the products is saved, or does it save all% com_defaults separated by commas? could you give me tips on implementing this part?

will be shown id , quantidade , id_produto

    
asked by anonymous 20.01.2016 / 18:01

1 answer

0

The basic idea of creating a history is to have a 'controlled denormalization' in your database. In other words, you need a new table where the fields are the descriptions of the manipulated 'objects', some ids may be important too.

Example:

A history table with the id , id_venda , endereco_entrega fields. The customer makes a purchase and during processing changes the delivery address of your account, now imagine what would happen if the history table had the address id instead of its description? Store could dispatch the product to a wrong address as the customer can change this information at any time.

The right thing is to record your 'descriptive values' to record that exact purchase at that moment, something like taking a photo to compare with another.

    
20.01.2016 / 18:38