module-shipper icon indicating copy to clipboard operation
module-shipper copied to clipboard

shipperhq_shipping_group attribute issue on save

Open yuriyrudyuk opened this issue 9 years ago • 6 comments

Hello,

We've noticed an issue with shipperhq_shipping_group product's attribute. When trying to re-save it (in our case new options were added) from admin (Stores -> Attributes -> Product) it changes its configuration From: backend_type -> text attribute_model -> null source_model -> null To: backend_type -> varchar attribute_model -> Magento\Catalog\Model\ResourceModel\Eav\Attribute source_model -> Magento\Eav\Model\Entity\Attribute\Source\Table

As the result, shipperhq group can't be updated for existing products (which uses "text" backend type).

Magento version - EE 2.1.4

Thanks

yuriyrudyuk avatar Aug 14 '17 11:08 yuriyrudyuk

You shouldnt be manipulating this field in the magento admin, its synchronised automatically with ShipperHQ via the extension and is connected to the data from the ShipperHQ server. If you are re-saving it we couldnt be certain at all how Magento would handle it.

If you look at https://github.com/shipperhq/module-shipper/blob/master/src/Setup/InstallData.php it shows how this attribute should be setup.

source_model -> Magento\Eav\Model\Entity\Attribute\Source\Table backend_type -> text attribute_model -> Magento\Catalog\Model\ResourceModel\Eav\Attribute

This is what you need to get it back to. If you are struggling to do this let us know and we can assist over email. Closing issue.

birchestx avatar Aug 22 '17 01:08 birchestx

Hi @wsakaren!

Is there some way for you guys to prevent shop owners from saving these special product attributes? We have a client who keeps trying to save them causing to change the type of the attribute and this then breaks stuff. We already told them twice to keep away from those attributes, but they aren't really listening ... 😛

In our case, it's these attributes:

  • ship_length, changes from decimal to varchar
  • ship_width, changes from decimal to varchar
  • ship_height, changes from decimal to varchar
  • shipperhq_poss_boxes, changes from text to varchar

If it wouldn't be possible to save those attributes from the Magento backend, it would prevent this from happening and that would be a nice addition to your extension.

Thanks!

hostep avatar Oct 28 '19 14:10 hostep

Hey @hostep

Unfortunately that's outside the control of our module. They're just regular Magento attributes.

If you do find a way, it would be great if you can submit a PR and we will merge it into the main code base.

wsajosh avatar Oct 29 '19 09:10 wsajosh

Thanks @wsajosh

Hmm, I'm wondering though why the backend_type of these attributes change the moment you save them in the backend of Magento (even without changing anything), that's a bit weird no? That's not normal behavior of regular Magento attributes I believe? Unfortunately I haven't found time to dig into this yet, and not sure if I will find time in the near future.

hostep avatar Oct 29 '19 19:10 hostep

Hey @hostep

It's a very weird scenario and not one that we're able to reproduce on our own local installs, but have seen it on a handful of customer sites. It usually affects a lot of attributes rather than just our ones also which is another reason we've not dug into this deeply. It appears to be a Magento issue, there's various articles on stack overflow or similar sites with the same issue.

wsajosh avatar Nov 01 '19 09:11 wsajosh

Thanks for the comment @wsajosh. Ah, I wasn't aware of the fact that it is not easily reproducible. It might be a Magento bug indeed, this particular shop is running on Magento 2.1.16 which is a bit outdated, so it might be a bug in that old version.

hostep avatar Nov 01 '19 10:11 hostep