Ejemplo n.º 1
0
 public function afterUninstall()
 {
     Yii::app()->settings->clear('shop');
     Yii::app()->unintallComponent('currency');
     $db = Yii::app()->db;
     $tablesArray = array(ShopTypeAttribute::model()->tableName(), ShopAttribute::model()->tableName(), ShopAttributeOption::model()->tableName(), ShopAttributeOptionTranslate::model()->tableName(), ShopAttributeTranslate::model()->tableName(), ShopCategory::model()->tableName(), ShopCategoryTranslate::model()->tableName(), ShopCurrency::model()->tableName(), ShopManufacturer::model()->tableName(), ShopManufacturerTranslate::model()->tableName(), ShopProduct::model()->tableName(), ShopProductCategoryRef::model()->tableName(), ShopProductImage::model()->tableName(), ShopProductTranslate::model()->tableName(), ShopProductType::model()->tableName(), ShopProductVariant::model()->tableName(), ShopRelatedProduct::model()->tableName(), ShopSuppliers::model()->tableName(), $db->tablePrefix . 'shop_product_attribute_eav', $db->tablePrefix . 'shop_product_configurable_attributes', $db->tablePrefix . 'shop_product_configurations');
     foreach ($tablesArray as $table) {
         $db->createCommand()->dropTable($table);
     }
     CFileHelper::removeDirectory(Yii::getPathOfAlias('webroot.uploads.product'), array('traverseSymlinks' => true));
     CFileHelper::removeDirectory(Yii::getPathOfAlias('webroot.uploads.categories'), array('traverseSymlinks' => true));
     CFileHelper::removeDirectory(Yii::getPathOfAlias('webroot.uploads.manufacturer'), array('traverseSymlinks' => true));
     return parent::afterUninstall();
 }
Ejemplo n.º 2
0
 public function afterDelete()
 {
     // Clear type attribute relations
     ShopTypeAttribute::model()->deleteAllByAttributes(array('type_id' => $this->id));
     return parent::afterDelete();
 }
Ejemplo n.º 3
0
 public function afterDelete()
 {
     // Delete options
     foreach ($this->options as $o) {
         $o->delete();
     }
     // Delete relations used in product type.
     ShopTypeAttribute::model()->deleteAllByAttributes(array('attribute_id' => $this->id));
     // Delete attributes assigned to products
     $conn = $this->getDbConnection();
     $command = $conn->createCommand("DELETE FROM `{{shop_product_attribute_eav}}` WHERE `attribute`='{$this->name}'");
     $command->execute();
     return parent::afterDelete();
 }