Jump to content

How to access customizedField values in Product.php -> getPrice()


lumik

Recommended Posts

Hi everyone,

 

 

I am developing a custom module that returns price of the product based on what user fills in the customized field. The expected flow is:

  1. User enters something (it is not important now what) into a text field on Product page, and saves the value
  2. The Product page reloads, while the price gets re-calculated based on what is entered in the custom field

 

I have already created override for the getPrice() method in Product, but I have problem getting the custom field values, I have tried:

// Product.php override

public function getPrice(...){
   ...
   $this->getAllCustomizedDatas($this->id_cart));
   ...
   // logic that calculates and returns price based on above custom valeu
   ...
}

The only thing I need to know is how to GET THE CUSTOM data while returing the price. Is this even possible from Product.php (before adding it to cart)?

 

I have dumped the whole Product instance (var_dump), but did not find the values in any variables...

 

Thanks for any advice!

 

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