本文整理汇总了PHP中ProductCategory::getAll方法的典型用法代码示例。如果您正苦于以下问题:PHP ProductCategory::getAll方法的具体用法?PHP ProductCategory::getAll怎么用?PHP ProductCategory::getAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProductCategory
的用法示例。
在下文中一共展示了ProductCategory::getAll方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: _getEndJs
/**
* (non-PHPdoc)
* @see CRUDPageAbstract::_getEndJs()
*/
protected function _getEndJs()
{
$manufactureArray = $supplierArray = $statuses = $productCategoryArray = array();
foreach (Manufacturer::getAll() as $os) {
$manufactureArray[] = $os->getJson();
}
foreach (Supplier::getAll() as $os) {
$supplierArray[] = $os->getJson();
}
foreach (ProductStatus::getAll() as $os) {
$statuses[] = $os->getJson();
}
foreach (ProductCategory::getAll() as $os) {
$productCategoryArray[] = $os->getJson();
}
$js = parent::_getEndJs();
if (($product = Product::get($this->Request['id'])) instanceof Product) {
$js .= "\$('searchPanel').hide();";
$js .= "pageJs._singleProduct = true;";
}
$js .= 'pageJs._loadManufactures(' . json_encode($manufactureArray) . ')';
$js .= '._loadSuppliers(' . json_encode($supplierArray) . ')';
$js .= '._loadCategories(' . json_encode($productCategoryArray) . ')';
$js .= '._loadProductStatuses(' . json_encode($statuses) . ')';
$js .= "._loadChosen()";
$js .= "._bindSearchKey()";
$js .= ".setCallbackId('priceMatching', '" . $this->priceMatchingBtn->getUniqueID() . "')";
$js .= ".setCallbackId('toggleActive', '" . $this->toggleActiveBtn->getUniqueID() . "')";
$js .= ".getResults(true, " . $this->pageSize . ");";
return $js;
}
示例2: populateModelData
/**
* Populate Product Template Model with data
* @param Product Template object $model
* @param int $counter
*/
public function populateModelData(&$model, $counter)
{
assert('$model instanceof ProductTemplate');
parent::populateModel($model);
$productTemplateRandomData = self::getProductTemplatesRandomData();
$name = $productTemplateRandomData['names'][$counter];
$productCategoryName = self::getProductCategoryForTemplate($name);
$allCats = ProductCategory::getAll();
foreach ($allCats as $category) {
if ($category->name == $productCategoryName) {
$categoryId = $category->id;
}
}
$productCategory = ProductCategory::getById($categoryId);
$model->name = $name;
$model->productCategories->add($productCategory);
$model->priceFrequency = 2;
$model->cost->value = 200;
$model->listPrice->value = 200;
$model->sellPrice->value = 200;
$model->status = ProductTemplate::STATUS_ACTIVE;
$model->type = ProductTemplate::TYPE_PRODUCT;
$sellPriceFormula = new SellPriceFormula();
$sellPriceFormula->type = SellPriceFormula::TYPE_EDITABLE;
$model->sellPriceFormula = $sellPriceFormula;
}
示例3: _getEndJs
/**
* (non-PHPdoc)
* @see CRUDPageAbstract::_getEndJs()
*/
protected function _getEndJs()
{
$manufactureArray = $supplierArray = $statuses = $productCategoryArray = array();
foreach (Manufacturer::getAll() as $os) {
$manufactureArray[] = $os->getJson();
}
foreach (Supplier::getAll() as $os) {
$supplierArray[] = $os->getJson();
}
foreach (ProductStatus::getAll() as $os) {
$statuses[] = $os->getJson();
}
foreach (ProductCategory::getAll() as $os) {
$productCategoryArray[] = $os->getJson();
}
$js = parent::_getEndJs();
if (($product = Product::get($this->Request['id'])) instanceof Product) {
$js .= "\$('searchPanel').hide();";
$js .= "pageJs._singleProduct = true;";
}
$js .= 'pageJs.totalValueId = "total-found-value";';
$js .= 'pageJs.totalQtyId = "total-found-qty";';
$js .= 'pageJs._loadManufactures(' . json_encode($manufactureArray) . ')';
$js .= '._loadSuppliers(' . json_encode($supplierArray) . ')';
$js .= '._loadCategories(' . json_encode($productCategoryArray) . ')';
$js .= '._loadProductStatuses(' . json_encode($statuses) . ')';
$js .= "._loadChosen()";
$js .= "._bindSearchKey()";
$js .= "._bindNewRuleBtn()";
$js .= ".setCallbackId('priceMatching', '" . $this->priceMatchingBtn->getUniqueID() . "')";
$js .= ".setCallbackId('toggleActive', '" . $this->toggleActiveBtn->getUniqueID() . "')";
$js .= ".setCallbackId('toggleSellOnWeb', '" . $this->toggleSellOnWebBtn->getUniqueID() . "')";
$js .= ".setCallbackId('updatePrice', '" . $this->updatePriceBtn->getUniqueID() . "')";
$js .= ".setCallbackId('updateStockLevel', '" . $this->updateStockLevelBtn->getUniqueID() . "')";
$js .= ".setCallbackId('toggleIsKit', '" . $this->toggleIsKitBtn->getUniqueID() . "')";
$js .= ".setCallbackId('toggleManualFeed', '" . $this->toggleManualFeedBtn->getUniqueID() . "')";
$js .= ".setCallbackId('newRule', '" . $this->newRuleBtn->getUniqueID() . "')";
$js .= ".getResults(true, " . $this->pageSize . ");";
return $js;
}
示例4: testGetAllWhenThereAreNone
public function testGetAllWhenThereAreNone()
{
Yii::app()->user->userModel = User::getByUsername('super');
$productCategories = ProductCategory::getAll();
$this->assertEquals(0, count($productCategories));
}
示例5: testSuperUserDeleteAction
public function testSuperUserDeleteAction()
{
$super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
Yii::app()->user->userModel = $super;
$productCategory = ProductCategoryTestHelper::createProductCategoryByName("My New Category");
//Delete a product template
$this->setGetArray(array('id' => $productCategory->id));
$this->resetPostArray();
$productCategories = ProductCategory::getAll();
$this->assertEquals(14, count($productCategories));
$this->runControllerWithRedirectExceptionAndGetContent('productTemplates/category/delete');
$productCategories = ProductCategory::getAll();
$this->assertEquals(13, count($productCategories));
try {
ProductCategory::getById($productCategory->id);
$this->fail();
} catch (NotFoundException $e) {
//success
}
}
示例6: renderModalList
protected function renderModalList($modalViewName, $pageTitle)
{
$rolesModalTreeView = new $modalViewName($this->getId(), $this->getModule()->getId(), $_GET['modalTransferInformation']['sourceModelId'], ProductCategory::getAll('name'), $_GET['modalTransferInformation']['sourceIdFieldId'], $_GET['modalTransferInformation']['sourceNameFieldId'], $_GET['modalTransferInformation']['modalId']);
Yii::app()->getClientScript()->setToAjaxMode();
$view = new ModalView($this, $rolesModalTreeView);
return $view->render();
}
示例7: syncAllProductCategory
public function syncAllProductCategory()
{
$pcArray = ProductCategory::getAll(true, null, DaoQuery::DEFAUTL_PAGE_SIZE, array('position' => 'ASC'));
if (is_array($pcArray) && count($pcArray) > 0) {
$soapClient = $this->_mySoapClient;
foreach ($pcArray as $productCategory) {
$categoryData = $this->_generateCategoryData($productCategory);
if (($pcMageId = trim($productCategory->mageId)) === '' || $pcMageId === '0') {
$parentId = 1;
if (($pcParent = $productCategory->getParent()) instanceof ProductCategory) {
$parentId = (int) $pcParent->getMageId();
}
$newMageId = $soapClient->catalogCategoryCreate($this->_session, $parentId, $categoryData);
$productCategory->setMageId($newMageId)->save();
} else {
$updated = $soapClient->catalogCategoryUpdate($this->_session, $pcMageId, $categoryData);
}
}
}
return $this;
}