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(); }
/** * Update status * @param bool $new * @throws CHttpException */ public function actionUpdate($new = false) { if ($new === true) { $model = new ShopSuppliers(); $model->unsetAttributes(); } else { $model = ShopSuppliers::model()->findByPk($_GET['id']); } if (!$model) { throw new CHttpException(404, Yii::t('ShopModule.admin', 'NO_FOUND_CURRENCY')); } $this->pageName = $model->isNewRecord ? $model->t('PAGE_NAME', 0) : $model->t('PAGE_NAME', 1); $this->breadcrumbs = array(Yii::t('ShopModule.default', 'MODULE_NAME') => array('/admin/shop'), Yii::t('ShopModule.admin', 'SUPPLIERS') => $this->createUrl('index'), $this->pageName); if (Yii::app()->request->isPostRequest) { $model->attributes = $_POST['ShopSuppliers']; if ($model->validate()) { $model->save(); $this->redirect(array('index')); } } $this->render('update', array('model' => $model)); }
echo Html::endForm(); ?> <div class="clear"></div></div> <?php if (isset($_GET['OrderProduct'])) { $supplier_id = $_GET['OrderProduct']['supplier_id']; } else { $supplier_id = null; } $this->widget('ext.fancybox.Fancybox', array('target' => 'td.image a')); $this->widget('ext.adminList.GridView', array('ajaxUpdate' => false, 'dataProvider' => $model->search(array('history' => true)), 'filter' => $model, 'filterCssClass' => 'tfilter', 'enableCustomActions' => false, 'selectableRows' => false, 'columns' => array(array('class' => 'SGridIdColumn', 'type' => 'html', 'htmlOptions' => array('class' => 'image'), 'value' => '(!empty($data->prd->mainImage))?CHtml::link(CHtml::image($data->prd->mainImage->getUrl("50x50"),""),$data->prd->mainImage->getUrl("500x500")):"no image"'), array('name' => 'name', 'value' => '$data->name', 'htmlOptions' => array('class' => 'textL')), array('name' => 'order_id', 'value' => '$data->order_id', 'filter' => false), array('name' => 'categories', 'type' => 'raw', 'htmlOptions' => array('style' => 'width:100px'), 'value' => '$data->getCategories()', 'filter' => false), array('name' => 'supplier_id', 'value' => '$data->supplier_id ? Html::encode($data->supplier->name) : Yii::t("core", "NO")', 'filter' => Html::dropDownList('OrderProduct[supplier_id]', $supplier_id, Html::listData(ShopSuppliers::model()->findAll(), "id", "name"), array('empty' => 'Все'))), array('header' => 'Ящиков', 'value' => '$data->quantity', 'htmlOptions' => array('class' => 'quantity'), 'filter' => false), array('header' => 'Пар в ящ.', 'value' => '$data->prd->pcs', 'htmlOptions' => array('class' => 'pcs'), 'filter' => false), array('header' => 'Цена закупки', 'value' => '$data->prd->price_purchase', 'htmlOptions' => array('class' => 'price_purchase')), array('header' => 'Цена продажи', 'value' => '$data->price', 'htmlOptions' => array('class' => 'price'), 'filter' => false), array('header' => 'Общ. сумма', 'type' => 'raw', 'value' => '$data->prd->price_purchase * $data->prd->pcs * $data->quantity', 'htmlOptions' => array('class' => 'total_price'), 'filter' => false)))); ?> <div class="clear"></div> <?php if ($model->search(array('scope' => 'ordersMade'))->totalItemCount) { ?> <div class="body" style="width:400px;float:right"> <ul class="wInvoice"> <li> <h4 class="blue" id="total_quantity"></h4> <span>Ящиков</span> </li> <li> <h4 class="red" id="total_price"></h4>
public function getForm() { Yii::import('zii.widgets.jui.CJuiDatePicker'); Yii::app()->controller->widget('ext.tinymce.TinymceWidget'); return array('showErrorSummary' => true, 'attributes' => array('enctype' => 'multipart/form-data', 'class' => 'form-horizontal', 'id' => __CLASS__), 'elements' => array('content' => array('type' => 'form', 'title' => $this->t('TAB_GENERAL'), 'elements' => array('name' => array('type' => 'text', 'id' => 'title', 'visible' => Yii::app()->settings->get('shop', 'auto_gen_url') ? false : true), 'seo_alias' => array('type' => 'text', 'id' => 'alias', 'visible' => Yii::app()->settings->get('shop', 'auto_gen_url') || Yii::app()->settings->get('core', 'translate_object_url') ? false : true), 'sku' => array('type' => 'text', 'afterField' => '<span class="fieldIcon icon-barcode "></span>'), 'price' => array('type' => $this->use_configurations ? 'hidden' : 'text', 'afterField' => '<span class="fieldIcon icon-coin"></span>'), 'price_purchase' => array('type' => 'text', 'afterField' => '<span class="fieldIcon icon-coin"></span>'), 'pcs' => array('type' => 'text', 'visible' => Yii::app()->settings->get('shop', 'wholesale') ? true : false), 'label' => array('type' => 'dropdownlist', 'items' => self::getProductLabels(), 'empty' => Yii::t('core', 'EMPTY_DROPDOWNLIST', 1)), 'currency_id' => array('type' => 'dropdownlist', 'items' => Html::listData(ShopCurrency::model()->findAll(array('condition' => '`t`.`default`=:int', 'params' => array(':int' => 0))), 'id', 'name'), 'empty' => '— Не привязывать —', 'visible' => Yii::app()->controller->module->accept_currency), 'main_category_id' => array('type' => 'dropdownlist', 'items' => ShopCategory::flatTree(), 'empty' => '---'), 'switch' => array('type' => 'dropdownlist', 'items' => array(1 => Yii::t('app', 'YES'), 0 => Yii::t('app', 'NO')), 'hint' => $this->t('HINT_SWITCH')), 'date_create' => array('type' => 'CJuiDatePicker', 'options' => array('dateFormat' => 'yy-mm-dd ' . date('H:i:s')), 'afterField' => '<span class="fieldIcon icon-calendar-2"></span>'), 'manufacturer_id' => array('type' => 'dropdownlist', 'items' => Html::listData(ShopManufacturer::model()->findAll(), 'id', 'name'), 'empty' => $this->t('EMPTY_MANUFACTURER')), 'supplier_id' => array('type' => 'dropdownlist', 'items' => Html::listData(ShopSuppliers::model()->findAll(), 'id', 'name'), 'empty' => $this->t('EMPTY_SUPPLIERS'), 'visible' => Yii::app()->controller->module->supplier), 'short_description' => array('type' => 'textarea', 'class' => 'editor', 'hint' => Yii::app()->settings->get('shop', 'auto_fill_short_desc') ? Yii::t('ShopModule.admin', 'MODE_ENABLE', array('{mode}' => Yii::t('ShopModule.SettingsShopForm', 'AUTO_FILL_SHORT_DESC'))) : null), 'full_description' => array('type' => 'textarea', 'class' => 'editor'))), 'warehouse' => array('type' => 'form', 'title' => $this->t('TAB_WAREHOUSE'), 'elements' => array('quantity' => array('type' => 'text'), 'discount' => array('type' => 'text', 'hint' => $this->t('HINT_DISCOUNT')), 'auto_decrease_quantity' => array('type' => 'dropdownlist', 'items' => array(0 => Yii::t('app', 'NO'), 1 => Yii::t('app', 'YES')), 'hint' => $this->t('HINT_AUTO_DECREASE_QUANTITY')), 'availability' => array('type' => 'dropdownlist', 'items' => $this->getAvailabilityList()))), 'seo' => array('type' => 'form', 'title' => $this->t('TAB_SEO'), 'elements' => array('seo_title' => array('type' => 'text'), 'seo_keywords' => array('type' => 'textarea'), 'seo_description' => array('type' => 'textarea')))), 'buttons' => array('submit' => array('type' => 'submit', 'class' => 'btn btn-success', 'label' => $this->isNewRecord ? Yii::t('app', 'CREATE', 0) : Yii::t('app', 'SAVE')))); }
<?php if ($this->isAjax) { $this->renderPartial('mod.admin.views.layouts._content-top'); echo Html::openTag('div', array('class' => 'wrapper')); } ?> <div class="widget"> <div class="whead"> <h6><?php echo $this->pageName; ?> </h6> <a class="buttonH bBlue" title="" href="/admin/shop/notify/deliverySend"><?php echo Yii::t('CartModule.admin', 'Отправить'); ?> </a> <div class="clear"></div> </div> <?php $this->widget('ext.fancybox.Fancybox', array('target' => 'td.image a')); $this->widget('ext.adminList.GridView', array('dataProvider' => $dataProvider, 'selectableRows' => false, 'autoColumns' => false, 'enableHeader' => false, 'columns' => array(array('class' => 'SGridIdColumn', 'type' => 'html', 'htmlOptions' => array('class' => 'image'), 'value' => '(!empty($data->mainImage))?Html::link(Html::image($data->mainImage->getUrl("50x50"),""),$data->mainImage->getUrl("500x500")):"no image"'), array('name' => 'name', 'type' => 'raw', 'value' => 'Html::link(Html::encode($data->name), array("/shop/admin/products/update", "id"=>$data->id))'), 'price', array('name' => 'manufacturer_id', 'type' => 'raw', 'value' => '$data->manufacturer ? Html::encode($data->manufacturer->name) : ""', 'filter' => Html::listData(ShopManufacturer::model()->orderByName()->findAll(), 'id', 'name')), array('name' => 'supplier_id', 'type' => 'raw', 'value' => '$data->supplier_id ? Html::encode($data->supplier->name) : ""', 'filter' => Html::listData(ShopSuppliers::model()->findAll(), 'id', 'name')), array('type' => 'raw', 'header' => 'Категория/и', 'htmlOptions' => array('style' => 'width:100px'), 'value' => '$data->getCategories()', 'filter' => false)))); ?> <div class="clear"></div> </div> <?php if ($this->isAjax) { echo Html::closeTag('div'); }