Jump to content

Getter in Product class


Unnits

Recommended Posts

Hi,

I have a problem with magic method __get() in Product class.

I will try to describe the problem:

 

I overriding class Product and give it to a folder:

/override/classes/Products.php - it´s work

 

In the file:

class Product extends ProductCore
{

	public function __get($name)
	{
		if ($name == "name") {
			return $this->manufacturer_name . " - " . $this->name;
		}
		return $this->$name;
	}

}

It´s working too but not everywhere.

 

In product detail prints variables through __get() only variable specificPrice, but not name and others.

 

I want simple thing. If I calling $product->name, printing "manufacturer_name - product_name".

 

Thx for helping and sorry for my bad english.

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...