title: Update overrided model for product in prestashop
body: <p>I have a loop problem with my override of product model. I tried to implement this solution <a href="https://stackoverflow.com/questions/30602713/update-product-from-a-module-in-prestashop">Update product from a module in prestashop</a>. Here is the model (with an extra function for testing purpose) : </p>
  
  <pre><code>&lt;?php
  Class Product extends ProductCore
  {
      // new field in product table
      public $design;
      public $fabric_front;
      public $fabric_back;
      public $fabric_front_border;
      public $fabric_back_border;
  
      public function __construct($id_product = null, $full = false, $id_lang = null, $id_shop = null, Context $context = null)
      {
          // adding new fields in product's model definition
          self::$definition['fields']['design'] = array(
              'type' =&gt; self::TYPE_HTML, 
              'validate' =&gt; 'isCleanHtml',
          );
          self::$definition['fields']['fabric_front'] = array(
              'type' =&gt; self::TYPE_INT,
              'validate' =&gt; 'isUnsignedInt',
          );
          self::$definition['fields']['fabric_back'] = array(
              'type' =&gt; self::TYPE_INT,
              'validate' =&gt; 'isUnsignedInt',
          );
          self::$definition['fields']['fabric_front_border'] = array(
              'type' =&gt; self::TYPE_INT,
              'validate' =&gt; 'isUnsignedInt',
          );
          self::$definition['fields']['fabric_back_border'] = array(
              'type' =&gt; self::TYPE_INT,
              'validate' =&gt; 'isUnsignedInt',
          );
  
          // resume normal process
          parent::__construct($id_product, $full, $id_lang, $id_shop, $context);
      }
  
      public function setDesign()
      {
          $sql = 'UPDATE '._DB_PREFIX_.'product SET design="'.$this-&gt;design.'" WHERE id_product='.$this-&gt;id.';';
          if (!($update = Db::getInstance()-&gt;execute($sql)))
              return false;
  
          return true;
      }
  
  }
  </code></pre>
  
  <p>And this is how I called the model in Hooks : </p>
  
  <pre><code>public function hookDisplayAdminProductsExtra($params)
  {
      $id_product = (int)Tools::getValue('id_product');
      if (Validate::isLoadedObject($product = new Product($id_product))) {
  
          if (!empty($product) &amp;&amp; isset($product-&gt;id)) 
              $this-&gt;context-&gt;smarty-&gt;assign(array(
                  'design_svg_img' =&gt; $product-&gt;design,
              ));
  
          return $this-&gt;display(__FILE__,'views/templates/admin/build_design.tpl');
  
      } else 
          return $this-&gt;displayWarning($this-&gt;l('You must save this product before adding a design.'));
  }
  
  public function hookActionProductUpdate($params)
  {
      // get params from template
      $id_product = (int)Tools::getValue('id_product');
      $svg_content = Tools::getValue('design_svg_upload');
  
      if (Validate::isLoadedObject($product = new Product($id_product))) {
  
          // attribute values to model members
          $product-&gt;design = $svg_content;
  
          if (!$product-&gt;save())
          // if (!$product-&gt;setDesign())
              return $this-&gt;displayWarning($this-&gt;l('Impossible to update product'));
  
      } else
          return $this-&gt;displayWarning($this-&gt;l('Product not found'));
  }
  </code></pre>
  
  <p>The mechanics work, when I used the method $product->save() the data is inserted and retrieved from database but it also creates a infinite loop on the <code>hookActionProductUpdate()</code>. </p>
  
  <p>But if I use my own function $product->setDesign() instead, everything is fine. 
  So there is obviously something I missed. But I'm on it for 2 days without seeing it. </p>