Exemple #1
0
<?php

$type_model = new shopTypeModel();
$type_model->recount();
 /**
  * Change type of all products from $from_type_id to $to_type_id
  * @param int $from_type_id
  * @param int $to_type_id
  * @return boolean
  */
 public function changeType($from_type_id, $to_type_id)
 {
     $sql = "UPDATE `{$this->table}` SET type_id = " . (int) $to_type_id . " WHERE type_id = " . (int) $from_type_id;
     if (!$this->exec($sql)) {
         return false;
     }
     $type_model = new shopTypeModel();
     $type_model->recount(array($from_type_id, $to_type_id));
     return true;
 }