1

I am fairly new with Magento and not sure if answer to this is very trivial, but looking at available help through search. I was not able to figure out the right way.

For a solution, I am building with Magento I want to add a address for a new entity, which i have created (say Store entity - Multistore setup). My initial thought was to user existing address entity created by Magento base but then realized that it's more specific to customer entity (table name: customer_address_entity). So I decided to create a new entity with name store_address_entity.

However, the store_address_entity attributes are very similar to customer_address_entity and there is no point of repeating the attributes and was wondering, If there is any better way to do this. I mean

  • Can I create store_address_entity with customer_address_entity type?

  • Or Use same attribute set for shop_address_entity as for customer_address_entity?

1
  1. You can create a store_address_entity, including all the other tables _varchar, _int, etc. And then copy (create) all the attributes as for customer_address_entity

  2. you can't use the same attributeset for the entity, because attribute sets are nailed to one entity_type.

But if you know the attributes and they don't change, you should think about a flat table.

| improve this answer | |
  • If we need to create a separate entity then i see a redundancy here. I thought there will be a better way to do this. Do you also think same? – Lalit Jun 2 '14 at 5:13
  • Yes it is somehow a redundency, but that's the way to do it in magento :) – Fabian Blechschmidt Jun 2 '14 at 5:14
  • Also, I can see one column in customer_address_entity table, which says 'attribute_set_id'. Can't we create similar table for store_address_entity and specify this as 2? which is attribute set id for customer_address_entity attributes. To avoid duplication of attributes. – Lalit Jun 2 '14 at 5:17
  • Ok let me be clear here: YES you can. You can do everything we are talking about a turing-complete programming language. But you get a whole world of work, because there are dependencies no one of us is aware of. And you don't want to hack foreign key dependencies in a database :-). Clone all the attributes. – Fabian Blechschmidt Jun 2 '14 at 5:22
  • Or don't do it, go down the dark path. I'm sure we can both learn a lot, please report about it :-) – Fabian Blechschmidt Jun 2 '14 at 5:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.