本文整理汇总了PHP中Family::UpdateChildCount方法的典型用法代码示例。如果您正苦于以下问题:PHP Family::UpdateChildCount方法的具体用法?PHP Family::UpdateChildCount怎么用?PHP Family::UpdateChildCount使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Family
的用法示例。
在下文中一共展示了Family::UpdateChildCount方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: save_product
//.........这里部分代码省略.........
$objProduct->inventory_avail = $fltInventory - $fltReserved;
}
//Because Lightspeed may send us products out of sequence (child before parent), we have to turn this off
Yii::app()->db->createCommand('SET FOREIGN_KEY_CHECKS=0;')->execute();
if (!$objProduct->save()) {
Yii::log("SOAP ERROR : Error saving product {$intRowid} {$strCode} " . print_r($objProduct->getErrors(), true), 'error', 'application.' . __CLASS__ . "." . __FUNCTION__);
return self::UNKNOWN_ERROR . " Error saving product {$intRowid} {$strCode} " . print_r($objProduct->getErrors(), true);
}
$strFeatured = _xls_get_conf('FEATURED_KEYWORD', 'XnotsetX');
if (empty($strFeatured)) {
$strFeatured = 'XnotsetX';
}
//Save keywords
$strTags = trim($strWebKeyword1) . "," . trim($strWebKeyword2) . "," . trim($strWebKeyword3);
$strTags = str_replace(",,", ",", $strTags);
$arrTags = explode(",", $strTags);
ProductTags::DeleteProductTags($objProduct->id);
foreach ($arrTags as $indivTag) {
if (!empty($indivTag)) {
$tag = Tags::model()->findByAttributes(array('tag' => $indivTag));
if (!$tag instanceof Tags) {
$tag = new Tags();
$tag->tag = $indivTag;
$tag->save();
}
$objProductTag = new ProductTags();
$objProductTag->product_id = $objProduct->id;
$objProductTag->tag_id = $tag->id;
$objProductTag->save();
if ($strFeatured != 'XnotsetX' && $objProduct->web && $indivTag == $strFeatured) {
$objProduct->featured = 1;
$objProduct->save();
}
}
}
if (!empty($strFamily)) {
$objFamily = Family::model()->findByAttributes(array('family' => $strFamily));
if ($objFamily instanceof Family) {
$objProduct->family_id = $objFamily->id;
$objProduct->save();
} else {
$objFamily = new Family();
$objFamily->family = $strFamily;
$objFamily->child_count = 0;
$objFamily->request_url = _xls_seo_url($strFamily);
$objFamily->save();
$objProduct->family_id = $objFamily->id;
$objProduct->save();
}
$objFamily->UpdateChildCount();
} else {
if ($objProduct->family_id) {
$objFamily = Family::model()->findByAttributes(array('id' => $objProduct->family_id));
$objProduct->family_id = null;
$objProduct->save();
$objFamily->UpdateChildCount();
}
}
if (!empty($strClassName)) {
$objClass = Classes::model()->findByAttributes(array('class_name' => $strClassName));
if ($objClass instanceof Classes) {
$objProduct->class_id = $objClass->id;
$objProduct->save();
} else {
$objClass = new Classes();
$objClass->class_name = $strClassName;
$objClass->child_count = 0;
$objClass->request_url = _xls_seo_url($strClassName);
$objClass->save();
$objProduct->class_id = $objClass->id;
$objProduct->save();
}
$objClass->UpdateChildCount();
}
// Save category
$strCategoryPath = trim($strCategoryPath);
if ($strCategoryPath && $strCategoryPath != "Default") {
$arrCategories = explode("\t", $strCategoryPath);
$intCategory = Category::GetIdByTrail($arrCategories);
if (!is_null($intCategory)) {
$objCategory = Category::model()->findByPk($intCategory);
//Delete any prior categories from the table
ProductCategoryAssn::model()->deleteAllByAttributes(array('product_id' => $objProduct->id));
$objAssn = new ProductCategoryAssn();
$objAssn->product_id = $objProduct->id;
$objAssn->category_id = $intCategory;
$objAssn->save();
$objCategory->UpdateChildCount();
}
} else {
ProductCategoryAssn::model()->deleteAllByAttributes(array('product_id' => $objProduct->id));
}
Product::convertSEO($intRowid);
//Build request_url
Yii::app()->db->createCommand('SET FOREIGN_KEY_CHECKS=1;')->execute();
$objEvent = new CEventProduct('LegacysoapController', 'onSaveProduct', $objProduct);
_xls_raise_events('CEventProduct', $objEvent);
//
return self::OK;
}