本文整理汇总了PHP中Family::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Family::model方法的具体用法?PHP Family::model怎么用?PHP Family::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Family
的用法示例。
在下文中一共展示了Family::model方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ConvertSEO
public static function ConvertSEO()
{
$arrFamilies = Family::model()->findAll();
foreach ($arrFamilies as $objFamily) {
$objFamily->request_url = _xls_seo_url($objFamily->family);
$objFamily->save();
}
}
示例2: loadModel
private function loadModel($id)
{
$model = Family::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
示例3: actionBrowse
/**
* Used for general category browsing (which is really a search by category or family)
* The URL manager passes the category request_url which we look up here
*/
public function actionBrowse()
{
$strC = Yii::app()->getRequest()->getQuery('cat');
$strB = Yii::app()->getRequest()->getQuery('brand');
$strS = Yii::app()->getRequest()->getQuery('class_name');
$strInv = '';
//If we haven't passed any criteria, we just query the database
$criteria = new CDbCriteria();
$criteria->alias = 'Product';
if (!empty($strC)) {
$objCategory = Category::LoadByRequestUrl($strC);
if ($objCategory) {
$criteria->join = 'LEFT JOIN xlsws_product_category_assn as ProductAssn ON ProductAssn.product_id=Product.id';
$intIdArray = array($objCategory->id);
$intIdArray = array_merge($intIdArray, $objCategory->GetBranchPath());
$criteria->addInCondition('category_id', $intIdArray);
$this->pageTitle = $objCategory->PageTitle;
$this->pageDescription = $objCategory->PageDescription;
$this->pageImageUrl = $objCategory->CategoryImage;
$this->breadcrumbs = $objCategory->Breadcrumbs;
$this->pageHeader = Yii::t('category', $objCategory->label);
$this->subcategories = $objCategory->getSubcategoryTree($this->MenuTree);
if ($objCategory->custom_page) {
$this->custom_page_content = $objCategory->customPage->page;
}
$this->canonicalUrl = $objCategory->getCanonicalUrl();
}
}
if (!empty($strB)) {
$objFamily = Family::LoadByRequestUrl($strB);
if ($objFamily) {
$criteria->addCondition('family_id = :id');
$criteria->params = array(':id' => $objFamily->id);
$this->pageTitle = $objFamily->PageTitle;
$this->pageHeader = $objFamily->family;
$this->canonicalUrl = $objFamily->getCanonicalUrl();
}
}
if (!empty($strS)) {
$objClasses = Classes::LoadByRequestUrl($strS);
if ($objClasses) {
$criteria->addCondition('class_id = :id');
$criteria->params = array(':id' => $objClasses->id);
$this->pageHeader = $objClasses->class_name;
$this->canonicalUrl = $objClasses->getCanonicalUrl();
}
}
if (_xls_get_conf('INVENTORY_OUT_ALLOW_ADD') == Product::InventoryMakeDisappear) {
$criteria->addCondition('(inventory_avail>0 OR inventoried=0)');
}
if (!_xls_get_conf('CHILD_SEARCH') || empty($strQ)) {
$criteria->addCondition('Product.parent IS NULL');
}
if (Product::HasFeatured() && empty($strS) && empty($strB) && empty($strC)) {
$criteria->addCondition('featured=1');
$this->pageHeader = 'Featured Products';
}
$criteria->addCondition('web=1');
$criteria->addCondition('current=1');
$criteria->order = 'Product.' . _xls_get_sort_order();
$productsGrid = new ProductGrid($criteria);
$this->returnUrl = $this->canonicalUrl;
$this->pageImageUrl = "";
if ($strB == '*') {
$familiesCriteria = new CDbCriteria();
$familiesCriteria->order = 'family';
if (CPropertyValue::ensureBoolean(Yii::app()->params['DISPLAY_EMPTY_CATEGORY']) === false) {
$familiesCriteria->addCondition('child_count > 0');
}
$families = Family::model()->findAll($familiesCriteria);
$this->render('brands', array('model' => $families));
} else {
$this->render('grid', array('model' => $productsGrid->getProductGrid(), 'item_count' => $productsGrid->getNumberOfRecords(), 'page_size' => Yii::app()->params['PRODUCTS_PER_PAGE'], 'items_count' => $productsGrid->getNumberOfRecords(), 'pages' => $productsGrid->getPages()));
}
}
示例4: array
echo $form->listBox($model, 'categories', CHtml::listData(Category::model()->findAllByAttributes(array('parent' => null), array('order' => 'label')), 'label', 'label'), array('multiple' => 'multiple', 'class' => 'tall wider', 'onChange' => 'js:FillListValues(this)', 'onMouseDown' => 'js:GetCurrentListValues(this)'));
?>
<div class="clearfix"></div><?php
echo CHtml::link(Yii::t('admin', 'Clear All'), '#', array('class' => 'listboxReset', 'onclick' => 'js:jQuery($("#' . CHtml::activeId($model, 'categories') . '").find("option").prop("selected", false))'));
?>
<?php
echo $form->error($model, 'categories');
?>
</div>
<div class="span3">
<?php
echo $form->labelEx($model, 'families');
?>
<?php
echo $form->listBox($model, 'families', CHtml::listData(Family::model()->findAll(array('order' => 'family')), 'family', 'family'), array('multiple' => 'multiple', 'class' => 'tall wider', 'onChange' => 'js:FillListValues(this)', 'onMouseDown' => 'js:GetCurrentListValues(this)'));
?>
<div class="clearfix"></div><?php
echo CHtml::link(Yii::t('admin', 'Clear All'), '#', array('class' => 'listboxReset', 'onclick' => 'js:jQuery($("#' . CHtml::activeId($model, 'families') . '").find("option").prop("selected", false))'));
?>
<?php
echo $form->error($model, 'families');
?>
</div>
<div class="span2">
<?php
echo $form->labelEx($model, 'classes');
?>
<?php
echo $form->listBox($model, 'classes', CHtml::listData(Classes::model()->findAll(array('order' => 'class_name')), 'class_name', 'class_name'), array('multiple' => 'multiple', 'class' => 'tall', 'onChange' => 'js:FillListValues(this)', 'onMouseDown' => 'js:GetCurrentListValues(this)'));
?>
示例5: array
<?php
echo $form->labelEx($model, 'l_name');
?>
<?php
echo $form->textField($model, 'l_name', array('class' => 'form-control', 'maxlength' => 255));
?>
<?php
echo $form->error($model, 'l_name');
?>
<?php
echo $form->labelEx($model, 'family_id');
?>
<?php
echo $form->dropDownList($model, 'family_id', CHtml::listData(Family::model()->findAll(), 'id', 'name'), array('empty' => 'Без семьи'));
?>
<?php
echo $form->error($model, 'family_id');
?>
<div class="clearfix"></div>
<?php
echo $form->labelEx($model, 'parent1_id');
?>
<?php
echo $form->dropDownList($model, 'parent1_id', CHtml::listData(People::model()->findAll(), 'id', function ($data) {
return $data['f_name'] . ' ' . $data['l_name'];
}), array('empty' => 'Нет родителя'));
?>
示例6: save_product
/**
* Save a product in the database (Create if need be)
*
* @param string $passkey
* @param int $intRowid
* @param string $strCode
* @param string $strName
* @param string $blbImage
* @param string $strClassName
* @param int $blnCurrent
* @param string $strDescription
* @param string $strDescriptionShort
* @param string $strFamily
* @param int $blnGiftCard
* @param int $blnInventoried
* @param double $fltInventory
* @param double $fltInventoryTotal
* @param int $blnMasterModel
* @param int $intMasterId
* @param string $strProductColor
* @param string $strProductSize
* @param double $fltProductHeight
* @param double $fltProductLength
* @param double $fltProductWidth
* @param double $fltProductWeight
* @param int $intTaxStatusId
* @param double $fltSell
* @param double $fltSellTaxInclusive
* @param double $fltSellWeb
* @param string $strUpc
* @param int $blnOnWeb
* @param string $strWebKeyword1
* @param string $strWebKeyword2
* @param string $strWebKeyword3
* @param int $blnFeatured
* @param string $strCategoryPath
* @return string
*/
public function save_product($passkey, $intRowid, $strCode, $strName, $blbImage, $strClassName, $blnCurrent, $strDescription, $strDescriptionShort, $strFamily, $blnGiftCard, $blnInventoried, $fltInventory, $fltInventoryTotal, $blnMasterModel, $intMasterId, $strProductColor, $strProductSize, $fltProductHeight, $fltProductLength, $fltProductWidth, $fltProductWeight, $intTaxStatusId, $fltSell, $fltSellTaxInclusive, $fltSellWeb, $strUpc, $blnOnWeb, $strWebKeyword1, $strWebKeyword2, $strWebKeyword3, $blnFeatured, $strCategoryPath)
{
if (!$this->check_passkey($passkey)) {
return self::FAIL_AUTH;
}
// We must preservice the Rowid of Products within the Web Store
// database and must therefore see if it already exists
$objProduct = Product::model()->findByPk($intRowid);
if (!$objProduct) {
$objProduct = new Product();
$objProduct->id = $intRowid;
}
$strName = trim($strName);
$strName = trim($strName, '-');
$strName = substr($strName, 0, 255);
$strCode = trim($strCode);
$strCode = str_replace('"', '', $strCode);
$strCode = str_replace("'", '', $strCode);
if (empty($strName)) {
$strName = 'missing-name';
}
if (empty($strDescription)) {
$strDescription = '';
}
$objProduct->code = $strCode;
$objProduct->title = $strName;
//$objProduct->class_name = $strClassName;
$objProduct->current = $blnCurrent;
$objProduct->description_long = $strDescription;
$objProduct->description_short = $strDescriptionShort;
//$objProduct->family = $strFamily;
$objProduct->gift_card = $blnGiftCard;
$objProduct->inventoried = $blnInventoried;
$objProduct->inventory = $fltInventory;
$objProduct->inventory_total = $fltInventoryTotal;
$objProduct->master_model = $blnMasterModel;
if ($intMasterId > 0) {
$objProduct->parent = $intMasterId;
} else {
$objProduct->parent = null;
}
$objProduct->product_color = $strProductColor;
$objProduct->product_size = $strProductSize;
$objProduct->product_height = $fltProductHeight;
$objProduct->product_length = $fltProductLength;
$objProduct->product_width = $fltProductWidth;
$objProduct->product_weight = $fltProductWeight;
$objProduct->tax_status_id = $intTaxStatusId;
$objProduct->sell = $fltSell;
$objProduct->sell_tax_inclusive = $fltSellTaxInclusive;
//If we're in TaxIn Mode, then SellWeb has tax and we reverse it.
if (_xls_get_conf('TAX_INCLUSIVE_PRICING', 0) == 1) {
if ($fltSellWeb != 0) {
//Tax in with a sell on web price
$objProduct->sell_web_tax_inclusive = $fltSellWeb;
//LS sends tax in web already
$objProduct->sell_web = Tax::StripTaxesFromPrice($fltSellWeb, $intTaxStatusId);
} else {
//We use our regular prices and copy them price
$objProduct->sell_web_tax_inclusive = $fltSellTaxInclusive;
$objProduct->sell_web = $fltSell;
}
//.........这里部分代码省略.........
示例7: getFamilies
/**
* For current category, return families within the category
* ToDo: This really needs to use a Search class instead, and
* this will not pick up families in subcategories
* Consider this "version 1"
* @return array
*/
public function getFamilies()
{
$objCommand = Yii::app()->db->createCommand();
$objCommand->select('t4.*,t4.family as label');
$objCommand->leftJoin('xlsws_product_category_assn t2', 't1.id=t2.product_id');
$objCommand->leftJoin('xlsws_category t3', 't2.category_id=t3.id');
$objCommand->leftJoin('xlsws_family t4', 't1.family_id=t4.id');
$objCommand->where('t2.category_id=:categoryid and family is not null');
$objCommand->from('xlsws_product t1');
$objCommand->group('t4.id');
$objCommand->order('t4.family');
$objCommand->bindValue('categoryid', $this->id, PDO::PARAM_STR);
return Family::model()->populateRecords($objCommand->QueryAll(), false);
}
示例8: actionConvertFamilies
/**
* 25: Convert families into Ids and attach
* @return string
*/
protected function actionConvertFamilies()
{
//families
$sql = "insert ignore into xlsws_family (family) select distinct family from xlsws_product where coalesce(family,'')<>'' order by family";
Yii::app()->db->createCommand($sql)->execute();
_dbx("update xlsws_product as a set family_id=(select id from xlsws_family as b where b.family=a.family)");
Family::ConvertSEO();
$objFamilies = Family::model()->findAll();
foreach ($objFamilies as $obj) {
$obj->UpdateChildCount();
}
return array('result' => "success", 'makeline' => 16, 'total' => 50);
}
示例9: array
<fieldset id='<?php
echo $this->id;
?>
'>
<legend>Выбор модели *</legend>
<?php
echo $form->error($model, 'model_id');
?>
<div class='row' id='<?php
echo $this->id;
?>
_brand'>
<label for='brand_id'><?php
echo Family::model()->getAttributeLabel('brand_id');
?>
</label>
<?php
echo CHtml::dropDownList('brand_id', '', array());
?>
<img src='/images/loader.gif' class='loader' style='display: none;'>
</div>
<div class='row' id='<?php
echo $this->id;
?>
_model' style='display: none;'>
<label for='model_id'><?php
echo Modification::model()->getAttributeLabel('model_id');
?>
</label>
<?php
示例10: actionIndex
public function actionIndex()
{
$data = Family::model()->findAll();
$this->render('index', array('fam_list' => $data));
}