Esempio n. 1
0
 /**
  * Save categories history when creating new version of a product
  * @param string $strTable
  * @param int    $intId
  */
 public function createVersion($strTable, $intId)
 {
     if ($strTable != Product::getTable()) {
         return;
     }
     $objCategories = ProductCategory::findBy('pid', $intId);
     $arrCategories = null === $objCategories ? array() : $objCategories->fetchAll();
     SubtableVersion::create($strTable, $intId, ProductCategory::getTable(), $arrCategories);
 }
Esempio n. 2
0
 /**
  * Save prices history when creating a new version of a product
  * @param   string
  * @param   int
  * @param   \DataContainer
  */
 public function createVersion($strTable, $intId, $dc)
 {
     if ($strTable != Product::getTable()) {
         return;
     }
     $arrData = array('prices' => array(), 'tiers' => array());
     $objPrices = ProductPrice::findBy('pid', $intId);
     if (null !== $objPrices) {
         $objTiers = \Database::getInstance()->query("SELECT * FROM tl_iso_product_pricetier WHERE pid IN (" . implode(',', $objPrices->fetchEach('id')) . ")");
         $arrData['prices'] = $objPrices->fetchAll();
         $arrData['tiers'] = $objTiers->fetchAllAssoc();
     }
     SubtableVersion::create($strTable, $intId, ProductPrice::getTable(), $arrData);
 }