Closed hasanzade-hasan closed 1 year ago
Just used this code snippet to store Better Payment transaction ID as property of order transaction. No need to allow shop owner to manage this data and property. So CustomFieldsInstaller class not anymore required to be implemented.
In order to store Better Payment transaction ID we need
better_payment_transaction_id
property onorder_transaction
table. We can achieve this in one of the following waysorder_transaction
table This method uses basic idea to add additional column to core table. Then CRUD & search operations must be implemented using raw sql. Currently could not find a way to use any core APIs to manage new column data.order_transaction
entity This is what is missing from previous approach. But instead of adding column to entity table itself, this approach creates another table and adds oneToOne relation to entity table. https://developer.shopware.com/docs/guides/plugins/plugins/framework/data-handling/add-complex-data-to-existing-entities NOTE SW6 version support needs to be considered Required work to do:order_transaction
Just needs to upsert custom fields data. We can add custom field during plugin install, in case we want shop owner to manage our custom field. We can achieve it byCustomFieldInstaller.php
class. NOTE SW6 version support needs to be consideredBelow resource shows quick differences between last two approaches:
https://www.brocksi.net/blog/customfields-properties-entity-extensions-shopware-6/
We chose to implement the last approach, which needs to install custom fields during plugin install in case we need this custom field to be managed by shop owner: https://developer.shopware.com/docs/guides/plugins/plugins/framework/custom-field/add-custom-field#adding-an-actual-custom-field Actually we don't need that!!!