Jump to content
thirty bees forum

Module compatability issue with v1.4 since no class attribute anymore


x97wehner

Recommended Posts

Hello,

I have a amazon sync module for PS 1.6 that the developer told me they will not support with TB 1.4 since there is no class = attribute anymore. I'm sure @datakick has a solution for this with the latest version. If there is one, can you outline how to fix it please? I can share more info if needed. This is a big problem for us.

Thanks

Link to comment
Share on other sites

In PHP8 Attribute is a reserved name. Every PHP codebase that used the same name must stop using it if they want to be compatible with PHP8. Thirtybees definitely want to run on PHP8, so we renamed this class to ProductAttribute.

You will have to adjust your module and replace usage of Attribute class with this one. 

For example, if your module contains 

$attr = new Attribute();
$attributes = Attribute::getAttributes();

You have to change it to look like this

$attr = new ProductAttribute();
$attributes = ProductAttribute::getAttributes();

There is also more easier solution - add this line at the beginning of every PHP file in the module (that is using this class). And you can keep the rest of the code intact

use ProductAttribute as Attribute;

 

 

  • Like 1
Link to comment
Share on other sites

7 hours ago, datakick said:

In PHP8 Attribute is a reserved name. Every PHP codebase that used the same name must stop using it if they want to be compatible with PHP8. Thirtybees definitely want to run on PHP8, so we renamed this class to ProductAttribute.

You will have to adjust your module and replace usage of Attribute class with this one. 

For example, if your module contains 

$attr = new Attribute();
$attributes = Attribute::getAttributes();

You have to change it to look like this

$attr = new ProductAttribute();
$attributes = ProductAttribute::getAttributes();

There is also more easier solution - add this line at the beginning of every PHP file in the module (that is using this class). And you can keep the rest of the code intact

use ProductAttribute as Attribute;

 

 

Thank you for the help on that. I will give it try.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...