I am using hookActionProductUpdate
. I am getting all data updated but not attributes.
This is the code inside hook function:
public function hookActionProductUpdate($params) {
$prestaObject = new ProductCore($params['id_product'], false, Context::getContext()->language->id);
$arrrs = $prestaObject->getFrontFeatures(1);
}
Everything else is updated but the front features I am getting are the older one. Any IDEA?
EDIT: I tried this too, here is my new function:
public function hookActionProductUpdate($params) {
$product = $params['product'];
$arrrs = $product->getFrontFeatures(1);
pr($arrrs);die("No updating :(");
}
Yeah I got it why, Its a bug in prestashop, It calls the hook AdminProductsController
from an update method which is called first then it executes the feature update code.
INSIDE processupdate function
I found this code
You don't need to instantiate a new Object. The product Object should already be contained in
$params['product']
.Here is the
update()
method of Product Class where this Hook is called:You should then use this code instead: