本文整理汇总了PHP中Product::unsetAttributes方法的典型用法代码示例。如果您正苦于以下问题:PHP Product::unsetAttributes方法的具体用法?PHP Product::unsetAttributes怎么用?PHP Product::unsetAttributes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Product
的用法示例。
在下文中一共展示了Product::unsetAttributes方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionIndex
public function actionIndex()
{
$model = new Product('search');
$model->unsetAttributes();
if (isset($_GET['Product'])) {
$model->attributes = $_GET['Product'];
}
$this->render('index', array('model' => $model));
}
示例2: actionAdmin
public function actionAdmin()
{
$model = new Product('search');
$model->unsetAttributes();
if (isset($_GET['Product'])) {
$model->setAttributes($_GET['Product']);
}
$this->render('admin', array('model' => $model));
}
示例3: actionIndex
/**
* Manage and list all models.
*/
public function actionIndex()
{
$model = new Product('search');
$model->unsetAttributes();
// clear any default values
if (isset($_GET['Product'])) {
$model->attributes = $_GET['Product'];
}
$this->render('admin', array('model' => $model));
}
示例4: actionIndex
/**
* Lists all models.
*/
public function actionIndex()
{
parent::actionIndex();
$deliveryadvicedetail = new Deliveryadvicedetail('search');
$deliveryadvicedetail->unsetAttributes();
// clear any default values
if (isset($_GET['Deliveryadvicedetail'])) {
$deliveryadvicedetail->attributes = $_GET['Deliveryadvicedetail'];
}
$product = new Product('search');
$product->unsetAttributes();
// clear any default values
if (isset($_GET['Product'])) {
$product->attributes = $_GET['Product'];
}
$unitofmeasure = new Unitofmeasure('search');
$unitofmeasure->unsetAttributes();
// clear any default values
if (isset($_GET['Unitofmeasure'])) {
$unitofmeasure->attributes = $_GET['Unitofmeasure'];
}
$sloc = new Sloc('search');
$sloc->unsetAttributes();
// clear any default values
if (isset($_GET['Sloc'])) {
$sloc->attributes = $_GET['Sloc'];
}
$requestedby = new Requestedby('search');
$requestedby->unsetAttributes();
// clear any default values
if (isset($_GET['Requestedby'])) {
$requestedby->attributes = $_GET['Requestedby'];
}
$model = new Deliveryadvice('search');
$model->unsetAttributes();
// clear any default values
if (isset($_GET['Deliveryadvice'])) {
$model->attributes = $_GET['Deliveryadvice'];
}
if (isset($_GET['pageSize'])) {
Yii::app()->user->setState('pageSize', (int) $_GET['pageSize']);
unset($_GET['pageSize']);
// would interfere with pager and repetitive page size change
}
$this->render('index', array('model' => $model, 'deliveryadvicedetail' => $deliveryadvicedetail, 'product' => $product, 'unitofmeasure' => $unitofmeasure, 'sloc' => $sloc, 'requestedby' => $requestedby));
}
示例5: actionIndex
public function actionIndex($alias = '')
{
Yii::app()->getModule('catalog')->getSettings(true);
$alias = trim($alias);
//$filter = array();
// Список категорий
$categoryList = Category::model()->published()->with(array('slides' => array('scopes' => 'published', 'order' => 'slides.sort ASC'), 'eavSet' => array('with' => array('attrs' => array('scopes' => 'active', 'with' => array('activeVariants'))))))->findAll(array('order' => 't.sort ASC'));
// Определяем, выбрана или нет категория
if (!empty($alias)) {
// Если выбран вид камня
$category = Category::model()->published()->with(array('slides' => array('scopes' => 'published', 'order' => 'slides.sort ASC'), 'eavSet' => array('with' => array('attrs' => array('scopes' => 'active', 'with' => array('activeVariants'))))))->find('t.alias = :alias', array(':alias' => $alias));
if (!$category) {
throw new CHttpException(404);
}
} else {
if (!empty($categoryList)) {
$category = $categoryList[0];
} else {
throw new CHttpException(404);
}
}
// Список товаров
$model = new Product();
$model->unsetAttributes();
$model->attachEavSet($category->eav_set_id);
$model->category_id = $category->id;
$model->setOrder(Yii::app()->getRequest()->getParam('sort'));
if (isset($_GET['Product'])) {
$model->attributes = $_GET['Product'];
$model->isSearch = true;
}
$dataProvider = $model->user_search();
Yii::app()->user->setState('activeProductsList', CJSON::encode($model->getProductsTotalList(true)));
// Сохраняем ссылку для возврата
Yii::app()->user->setState('productsCatalogReturnUrl', $this->_constructReturnUrl('catalog/catalog/index'));
// Сохраняем данные фильтра в сессии
//Yii::app()->user->setState('productCatalogFilter', $filter);
if (Yii::app()->request->isAjaxRequest) {
$this->renderPartial('_catalog', array('category' => $category, 'model' => $model, 'dataProvider' => $dataProvider, 'sizerVariants' => $sizerVariants), false, true);
Yii::app()->end();
} else {
// Вывод каталога
$this->render('index', array('category' => $category, 'model' => $model, 'dataProvider' => $dataProvider, 'categoryList' => $categoryList, 'sizerVariants' => $sizerVariants));
}
}
示例6: actionIndex
/**
* This is the default 'index' action that is invoked
* when an action is not explicitly requested by users.
*/
public function actionIndex()
{
$weeklySalesReport = new WeeklySalesReport();
$thisWeeksSale = $weeklySalesReport->getCurrentWeekSales();
$monthlySalesReport = new MonthlySalesReport();
$wholeMonthSale = $monthlySalesReport->getThisMonthsReport();
$annualReportObj = new AnnualReport();
$annualMonthlyReport = $annualReportObj->getAnnualMonthlyReport();
$productModel = new Product('search');
$productModel->unsetAttributes();
if (isset($_GET['Product'])) {
$productModel->attributes = $_GET['Product'];
}
$materialModel = new Materials('search');
$materialModel->unsetAttributes();
if (isset($_GET['Materials'])) {
$materialModel->attributes = $_GET['Materials'];
}
$this->render('index', compact('productModel', 'materialModel', 'thisWeeksSale', 'wholeWeekReport', 'wholeMonthSale', 'annualMonthlyReport'));
}
开发者ID:kevindaus,项目名称:Order-Billing-Inventory-System-Marcials-Furniture,代码行数:24,代码来源:SiteController.php
示例7: array
echo $form->hiddenField($model, 'deliveryadvicedetailid');
echo $form->hiddenField($model, 'deliveryadviceid');
?>
<table>
<tr>
<td>
<div class="row">
<?php
echo $form->labelEx($model, 'productid');
echo $form->hiddenField($model, 'productid');
?>
<input type="text" name="product_name" id="productname" title="Account name" style="width: 200px" readonly>
<?php
$this->beginWidget('zii.widgets.jui.CJuiDialog', array('id' => 'product_dialog', 'options' => array('title' => Yii::t('app', 'Material Master'), 'width' => 'auto', 'autoOpen' => false, 'modal' => true)));
$product = new Product('searchwfstatus');
$product->unsetAttributes();
// clear any default values
if (isset($_GET['Product'])) {
$product->attributes = $_GET['Product'];
}
$this->widget('zii.widgets.grid.CGridView', array('id' => 'product-grid', 'dataProvider' => $product->Searchwstatus(), 'filter' => $product, 'template' => '{summary}{pager}<br>{items}{pager}{summary}', 'columns' => array(array('header' => '', 'type' => 'raw', 'value' => 'CHtml::Button("+",
array("name" => "send_absschedule",
"id" => "send_absschedule",
"onClick" => "$(\\"#product_dialog\\").dialog(\\"close\\"); $(\\"#productname\\").val(\\"$data->productname\\"); $(\\"#Deliveryadvicedetail_productid\\").val(\\"$data->productid\\");
"))'), array('name' => 'productid', 'visible' => false, 'value' => '$data->productid', 'htmlOptions' => array('width' => '1%')), 'productname')));
$this->endWidget('zii.widgets.jui.CJuiDialog');
echo CHtml::Button('...', array('onclick' => '$.fn.yiiGridView.update("product-grid");$("#product_dialog").dialog("open"); return false;'));
?>
<?php
echo $form->error($model, 'productid');
?>
示例8: array
?>
</div>
</td>
</tr>
<tr>
<td>
<div class="row">
<?php
echo $form->labelEx($model, 'materialpackage');
echo $form->hiddenField($model, 'materialpackage');
?>
<input type="text" name="materialpackagecode" id="materialpackagecode" readonly >
<?php
$this->beginWidget('zii.widgets.jui.CJuiDialog', array('id' => 'materialpackage_dialog', 'options' => array('title' => Yii::t('app', 'Material Package'), 'width' => 'auto', 'autoOpen' => false, 'modal' => true)));
$materialpackage = new Product('searchwstatus');
$materialpackage->unsetAttributes();
// clear any default values
if (isset($_GET['Product'])) {
$materialpackage->attributes = $_GET['Product'];
}
$this->widget('zii.widgets.grid.CGridView', array('id' => 'materialpackage-grid', 'dataProvider' => $materialpackage->Searchwstatus(), 'filter' => $materialpackage, 'template' => '{summary}{pager}<br>{items}{pager}{summary}', 'columns' => array(array('header' => '', 'type' => 'raw', 'value' => 'CHtml::Button("V",
array("name" => "send_kelurahan",
"id" => "send_kelurahan",
"onClick" => "$(\\"#materialpackage_dialog\\").dialog(\\"close\\"); $(\\"#materialpackagecode\\").val(\\"$data->productname\\");
$(\\"#Productbasic_productid\\").val(\\"$data->productid\\");"))'), array('name' => 'productid', 'visible' => false, 'value' => '$data->productid', 'htmlOptions' => array('width' => '1%')), 'productname')));
$this->endWidget('zii.widgets.jui.CJuiDialog');
echo CHtml::Button('...', array('onclick' => '$("#materialpackage_dialog").dialog("open"); return false;'));
?>
<?php
echo $form->error($model, 'productid');
?>
示例9: actionList
/**
* Displays a particular model's products as a long list.
* @param str $slug the 'slug' identifier of the model to be displayed
*/
public function actionList($slug)
{
// Retrieve the model via it's slug
$model_localization = $this->loadLocalizationModelSlug($slug);
$model = $model_localization->category;
if (!$model->visible) {
throw new CHttpException(404, Yii::t('app', 'La page demandée n\'existe pas.'));
}
$this->pageTitle = $model_localization->name . " - " . Yii::app()->name;
$alternatives = array();
foreach ($model->categoryLocalizations as $localization) {
$alternatives[$localization->locale_id] = $this->createAbsoluteUrl("view", array("slug" => $localization->slug, "language" => $localization->locale_id));
}
$this->alternatives = $alternatives;
// Generate the subcategories to display in the sidebar.
// Generate the subcategories to display in the sidebar.
$children_cache_id = Yii::app()->request->hostInfo . " CategoryController:[children_cats_for_cat] " . $model->id;
$cache_duration = 300;
$menu_array = Yii::app()->cache->get($children_cache_id);
if (!$menu_array) {
$menu_array = array();
$children = new Category();
$children->unsetAttributes();
$children->visible = 1;
$children->id = $model->id;
$category_data_provider = $children->searchChildren();
foreach ($category_data_provider->getData() as $child) {
if ($this->isB2b()) {
// In a B2B store, we show a list of products so users can select many products at once
$menu_array[] = array('label' => $child->categoryLocalization->name, 'url' => array('category/list', "slug" => $child->categoryLocalization->slug));
} else {
$menu_array[] = array('label' => $child->categoryLocalization->name, 'url' => array('category/view', "slug" => $child->categoryLocalization->slug));
}
}
Yii::app()->cache->set($children_cache_id, $menu_array, $cache_duration);
}
$this->menu = $menu_array;
if ($model->parent_category) {
// This is a subcategory
// Subcategories must display their products. They must also add their parents categories to the page's breadcrumbs
// Display breadcrumbs in the right order (home >> root category >> subcategory 1 >> subcatory 2, etc.)
$this->breadcrumbs = array();
function appendMotherCatToBreadcrumbs($cat, &$breadarray, $locale)
{
$locale_category = CategoryLocalization::model()->find("category_id = :category AND locale_id = :locale", array(":category" => $cat->id, ":locale" => $locale));
$breadarray[$locale_category->name] = array("category/view", "slug" => $locale_category->slug);
if ($cat->parent_category) {
appendMotherCatToBreadcrumbs($cat->parentCategory, $breadarray, $locale);
}
}
if ($model->parent_category) {
appendMotherCatToBreadcrumbs($model->parentCategory, $this->breadcrumbs, Yii::app()->language);
// The array returned is reversed (top category at the end) we need to reverse it.
$this->breadcrumbs = array_reverse($this->breadcrumbs);
}
// We're at the end of the run, just append our name
$this->breadcrumbs[] = $model_localization->name;
// Retrieve the order's products (with the correct localization)
$products_data_provider = null;
$product = new Product();
$product->unsetAttributes();
$product->visible = 1;
$product->discontinued = 0;
$product->categoryId = $model->id;
$product->restrictScopeToCurrentLocale = false;
if ($model->is_brand) {
$products_data_provider = $product->searchForBrand($model);
} else {
$products_data_provider = $product->search();
}
$products_data_provider->setPagination(array('pageSize' => 100));
$this->render('list', array('model' => $model, 'localization' => $model_localization, 'products' => $products_data_provider));
} else {
throw new CHttpException(404, Yii::t('app', 'La page demandée n\'existe pas.'));
}
}
示例10: actionIndex
/**
* Lists all models.
*/
public function actionIndex()
{
parent::actionIndex();
$supplier = new Supplier('searchwstatus');
$supplier->unsetAttributes();
// clear any default values
if (isset($_GET['Supplier'])) {
$supplier->attributes = $_GET['Supplier'];
}
$product = new Product('searchwstatus');
$product->unsetAttributes();
// clear any default values
if (isset($_GET['Product'])) {
$product->attributes = $_GET['Product'];
}
$purchasinggroup = new Purchasinggroup('searchwstatus');
$purchasinggroup->unsetAttributes();
// clear any default values
if (isset($_GET['Purchasinggroup'])) {
$purchasinggroup->attributes = $_GET['Purchasinggroup'];
}
$currency = new Currency('searchwstatus');
$currency->unsetAttributes();
// clear any default values
if (isset($_GET['Currency'])) {
$currency->attributes = $_GET['Currency'];
}
$model = new Purchinforec('search');
$model->unsetAttributes();
// clear any default values
if (isset($_GET['Purchinforec'])) {
$model->attributes = $_GET['Purchinforec'];
}
if (isset($_GET['pageSize'])) {
Yii::app()->user->setState('pageSize', (int) $_GET['pageSize']);
unset($_GET['pageSize']);
// would interfere with pager and repetitive page size change
}
$this->render('index', array('model' => $model, 'supplier' => $supplier, 'product' => $product, 'purchasinggroup' => $purchasinggroup, 'currency' => $currency));
}
示例11: actionCatalog
public function actionCatalog($id = null)
{
$model = new Product('search');
$model->unsetAttributes();
$model->category_id = Yii::app()->request->getParam('id');
if (isset($_GET['Product'])) {
$model->attributes = $_GET['Product'];
}
$this->render('catalog', array('model' => $model));
}
示例12: actionIndex
/**
* Lists all models.
*/
public function actionIndex()
{
parent::actionIndex();
$this->lookupdata();
$model = new Product('search');
$model->unsetAttributes();
// clear any default values
if (isset($_GET['Product'])) {
$model->attributes = $_GET['Product'];
}
if (isset($_GET['pageSize'])) {
Yii::app()->user->setState('pageSize', (int) $_GET['pageSize']);
unset($_GET['pageSize']);
// would interfere with pager and repetitive page size change
}
$this->render('index', array('model' => $model, 'productacc' => $this->productacc, 'productbasic' => $this->productbasic, 'productconversion' => $this->productconversion, 'productplant' => $this->productplant, 'productpurchase' => $this->productpurchase));
}
示例13: actionAdmin
/**
* Manages all models.
*/
public function actionAdmin()
{
$model = new Product('search');
$model->unsetAttributes();
// clear any default values
if (isset($_GET['Product'])) {
$model->attributes = $_GET['Product'];
}
$this->render('admin', array_merge($this->getNeededDataLists(), array('model' => $model)));
}
示例14: actionLocation
public function actionLocation()
{
$cat = Yii::app()->getRequest()->getQuery('cat');
$bname = Yii::app()->getRequest()->getQuery('keyword');
$catname = Category::model()->getCategoryName($cat);
if ($cat == 'all' || empty($catname)) {
$query = "SELECT * \n\t\t\t\t\t\tFROM `mm_product` \n\t\t\t\t\t\tWHERE `product_name` LIKE '" . $bname . "%' \n\t\t\t\t\t\tORDER BY `product_name` LIMIT 10";
} else {
$query = "SELECT * \n\t\t\t\t\tFROM `mm_product` \n\t\t\t\t\tWHERE `product_name` LIKE '%" . $bname . "%'\n\t\t\t\t\tAND\t`product_category_id` IN (SELECT entity_id FROM category WHERE category_name LIKE '" . $catname . "')";
}
$command = Yii::app()->db->createCommand($query);
$result = $command->queryAll();
$model = new Product('search');
$model->unsetAttributes();
// clear any
$model->product_name = $bname;
$model->product_category = $catname;
//send model object for search
$this->render('index', array('dataProvider' => $model->search(), 'model' => $model));
/*
$dataProvider=new CArrayDataProvider($result, array(
'sort'=>false,
'keyField'=>'id', //this is what will be considered your key field
'pagination'=>array(
'pageSize'=>30, //eureka! you can configure your pagination from here
),
));
//echo '<pre>'; var_dump($pp); die();
$this->render('index',array(
'dataProvider'=>$dataProvider,
));*/
//throw new CHttpException(404,'The requested page does not exist.');
}
示例15: actionAdmin
/**
* Manages all models.
*/
public function actionAdmin()
{
$model = new Product( 'search' );
$model->unsetAttributes(); // clear any default values
$this->pageTitle = get_class( Product::model() );
$productprice = new Productprice();
if ( isset( $_GET['Product'] ) )
$model->attributes = $_GET['Product'];
$this->render( 'admin', array(
'model' => $model,'productprice'=>$productprice
) );
}