Jump to content

Prestashop Product Update Hook Is Not Updating Product Attributes In The Hook Function


Recommended Posts

I am using hookActionProductUpdate I am getting all data updated but not attribtues, 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?

I am trying in prestashop 1.6


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 :(");



here is stackoverflow link

Edited by anil1590 (see edit history)
Link to comment
Share on other sites

  • 8 months later...

Hi, did You resolve this issue , I have the same issue. I have my function like this.

public function hookActionProductAttributeUpdate($params)
		echo "test1";
		if ($params['id_product_attribute']) {
            $idp = $params['id_product'];
            $ida = $params['id_product_attribute'];
            $api = new LinioApi();
            $pr = new LinioProduct($idp, false, Context::getContext()->language->id);
            $sku = $pr->getSku($ida);
            $xml = simplexml_load_string($api->getProductBySku(array($sku)));
        $content = ob_get_contents();
        file_put_contents('update-pr.txt', $content, FILE_APPEND);

this my function for xml

 public function getXmlDesc($attribute = null)
        $sku = (!$attribute || !$this->attributes) ? $this->reference : $this->attributes[$attribute]['SellerSku'];
        //$qty = StockAvailable::getQuantityAvailableByProduct($this->id, $attribute);
        $xml = '<?xml version="1.0" encoding="UTF-8" ?><Request><Product>';
        $xml .= $this->getXmlProperty('SellerSku', $sku);
        $xml .= $this->getXmlProperty('Description', $this->description);
        $xml .= '</Product></Request>';
        return $xml;

I use the hook quantity and it works perfectly , but this one I cannot print echo test

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