当前位置: 首页>>代码示例>>PHP>>正文


PHP Category::getRootNode方法代码示例

本文整理汇总了PHP中Category::getRootNode方法的典型用法代码示例。如果您正苦于以下问题:PHP Category::getRootNode方法的具体用法?PHP Category::getRootNode怎么用?PHP Category::getRootNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Category的用法示例。


在下文中一共展示了Category::getRootNode方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: getFilterUrlTemplate

 private function getFilterUrlTemplate()
 {
     include_once ClassLoader::getRealPath('application.helper.smarty') . '/function.categoryUrl.php';
     $params = array('filters' => array(new ManufacturerFilter(999, '___')), 'data' => Category::getRootNode()->toArray());
     $templateUrl = createCategoryUrl($params, $this->application);
     return strtr($templateUrl, array(999 => '#', '___' => '|'));
 }
开发者ID:saiber,项目名称:www,代码行数:7,代码来源:ManufacturersController.php

示例2: testDelete

 public function testDelete()
 {
     $type = ProductRatingType::getNewInstance(Category::getRootNode());
     $type->save();
     $type2 = ProductRatingType::getNewInstance(Category::getRootNode());
     $type2->save();
     for ($k = 0; $k <= 1; $k++) {
         $review = ProductReview::getNewInstance($this->product, $this->user);
         $review->save();
         $rating = ProductRating::getNewInstance($this->product, $type);
         $rating->rating->set(6 + $k);
         $rating->review->set($review);
         $rating->save();
         $rating = ProductRating::getNewInstance($this->product, $type2);
         $rating->rating->set(4 + $k);
         $rating->review->set($review);
         $rating->save();
     }
     $this->product->reload();
     $this->assertEqual($this->product->ratingCount->get(), 4);
     $this->assertEqual($this->product->ratingSum->get(), 22);
     $this->assertEqual($this->product->rating->get(), 5.5);
     // delete last review
     $review->delete();
     $this->product->reload();
     $this->assertEqual($this->product->ratingCount->get(), 2);
     $this->assertEqual($this->product->ratingSum->get(), 10);
     $this->assertEqual($this->product->rating->get(), 5);
     // check rating summaries
     $summary = ProductRatingSummary::getInstance($this->product, $type2);
     $this->assertEqual($summary->rating->get(), 4);
 }
开发者ID:saiber,项目名称:livecart,代码行数:32,代码来源:ProductReviewTest.php

示例3: smarty_function_manufacturerUrl

/**
 * Generates manufacturer page URL
 *
 * @param array $params
 * @param Smarty $smarty
 * @return string
 *
 * @package application.helper.smarty
 * @author Integry Systems
 */
function smarty_function_manufacturerUrl($params, LiveCartSmarty $smarty)
{
    $manufacturer = $params['data'];
    $params['data'] =& Category::getRootNode()->toArray();
    $params['addFilter'] = new ManufacturerFilter($manufacturer['ID'], $manufacturer['name']);
    return createCategoryUrl($params, $smarty->getApplication());
}
开发者ID:saiber,项目名称:www,代码行数:17,代码来源:function.manufacturerUrl.php

示例4: products

 public function products()
 {
     $this->setLayout('empty');
     set_time_limit(0);
     $response = new XMLResponse();
     $filter = new ARSelectFilter();
     $filter->setOrder(f('Product.dateCreated'), ARSelectFilter::ORDER_DESC);
     $categoryId = $this->getRequest()->get('id');
     if (preg_match('/^\\d+$/', $categoryId)) {
         $this->shouldBeEnabledFeed('CATEGORY_PRODUCTS');
         $category = Category::getInstanceById($categoryId, Category::LOAD_DATA);
         $filter = new ProductFilter($category, $filter);
     } else {
         $this->shouldBeEnabledFeed('ALL_PRODUCTS');
         $category = Category::getRootNode(true);
         $filter = new ProductFilter($category, $filter);
         $filter->includeSubCategories();
     }
     $feed = new ProductFeed($filter);
     $feed->setFlush();
     $feed->setLimit($this->config->get('NUMBER_OF_PRODUCTS_TO_INCLUDE'));
     $response->set('feed', $feed);
     $response->set('category', $category->toArray());
     return $response;
 }
开发者ID:saiber,项目名称:livecart,代码行数:25,代码来源:RssController.php

示例5: testRatingTypes

 public function testRatingTypes()
 {
     $type = ProductRatingType::getNewInstance(Category::getRootNode());
     $type->save();
     $rating = ProductRating::getNewInstance($this->product, $type);
     $rating->rating->set(6);
     $rating->save();
     $this->product->reload();
     $this->assertEqual($this->product->ratingCount->get(), 1);
     $this->assertEqual($this->product->ratingSum->get(), 6);
     $this->assertEqual($this->product->rating->get(), 6);
     ActiveRecord::clearPool();
     $summary = ProductRatingSummary::getInstance($this->product, $type);
     $summary->reload();
     $this->assertEqual($summary->ratingCount->get(), 1);
     $this->assertEqual($summary->ratingSum->get(), 6);
     $this->assertEqual($summary->rating->get(), 6);
     $type2 = ProductRatingType::getNewInstance(Category::getRootNode());
     $type2->save();
     $rating = ProductRating::getNewInstance($this->product, $type2);
     $rating->rating->set(4);
     $rating->save();
     $this->product->reload();
     $this->assertEqual($this->product->ratingCount->get(), 2);
     $this->assertEqual($this->product->ratingSum->get(), 10);
     $this->assertEqual($this->product->rating->get(), 5);
     ActiveRecord::clearPool();
     $summary = ProductRatingSummary::getInstance($this->product, $type2);
     $summary->reload();
     $this->assertEqual($summary->ratingCount->get(), 1);
     $this->assertEqual($summary->ratingSum->get(), 4);
     $this->assertEqual($summary->rating->get(), 4);
 }
开发者ID:saiber,项目名称:livecart,代码行数:33,代码来源:ProductRatingTest.php

示例6: selectProduct

 /**
  * Products popup
  *
  * @role update
  */
 public function selectProduct()
 {
     $response = new ActionResponse();
     $categoryList = Category::getRootNode()->getDirectChildNodes();
     $categoryList->unshift(Category::getRootNode());
     $response->set("categoryList", $categoryList->toArray());
     return $response;
 }
开发者ID:saiber,项目名称:www,代码行数:13,代码来源:ProductRelationshipController.php

示例7: setUp

 public function setUp()
 {
     parent::setUp();
     $this->root = Category::getRootNode();
     $this->container = Product::getNewInstance($this->root);
     $this->container->type->set(Product::TYPE_BUNDLE);
     $this->container->save();
 }
开发者ID:saiber,项目名称:livecart,代码行数:8,代码来源:ProductBundleTest.php

示例8: testPositions

 public function testPositions()
 {
     $type1 = ProductRatingType::getNewInstance(Category::getRootNode());
     $type1->save();
     $type2 = ProductRatingType::getNewInstance(Category::getRootNode());
     $type2->save();
     $this->assertEqual($type1->position->get(), 1);
     $this->assertEqual($type2->position->get(), 2);
 }
开发者ID:saiber,项目名称:livecart,代码行数:9,代码来源:ProductRatingTypeTest.php

示例9: testContaining

 public function testContaining()
 {
     $root = Category::getRootNode();
     $list = ProductList::getNewInstance($root);
     $list->save();
     $product = Product::getNewInstance($root);
     $product->save();
     $list->addProduct($product);
     $another = Product::getNewInstance($root);
     $another->save();
     $this->assertTrue($list->contains($product));
     $this->assertFalse($list->contains($another));
 }
开发者ID:saiber,项目名称:livecart,代码行数:13,代码来源:ProductListTest.php

示例10: setUp

 public function setUp()
 {
     parent::setUp();
     $this->product = Product::getNewInstance(Category::getRootNode(), 'test');
     $this->product->save();
     $this->option = ProductOption::getNewInstance($this->product);
     $this->option->type->set(ProductOption::TYPE_SELECT);
     $this->option->save();
     for ($k = 0; $k <= 1; $k++) {
         $choice = ProductOptionChoice::getNewInstance($this->option);
         $choice->priceDiff->set(10 + $k);
         $choice->save();
         $this->choices[] = $choice;
     }
 }
开发者ID:saiber,项目名称:livecart,代码行数:15,代码来源:ProductOptionTest.php

示例11: setUp

 public function setUp()
 {
     parent::setUp();
     Category::recalculateProductsCount();
     $this->root = Category::getNewInstance(Category::getRootNode());
     $this->root->save();
     for ($k = 1; $k <= 2; $k++) {
         $cat = Category::getNewInstance($this->root);
         $cat->save();
         $this->categories[$k] = $cat;
     }
     $this->product = Product::getNewInstance($this->categories[1]);
     $this->product->save();
     $this->secondCategory = ProductCategory::getNewInstance($this->product, $this->categories[2]);
     $this->secondCategory->save();
 }
开发者ID:saiber,项目名称:livecart,代码行数:16,代码来源:ProductCategoryTest.php

示例12: testDelete

 public function testDelete()
 {
     $category = Category::getNewInstance(Category::getRootNode());
     $category->save();
     $field = SpecField::getNewInstance($category, SpecField::DATATYPE_TEXT, SpecField::TYPE_TEXT_SIMPLE);
     $field->handle->set('randomhandle');
     $field->save();
     $this->request->set('id', $field->getID());
     $response = $this->controller->delete();
     $this->assertIsA($response, 'JSONResponse');
     $value = $response->getValue();
     $this->assertEqual($value['status'], 'success');
     // already deleted
     $response = $this->controller->delete();
     $value = $response->getValue();
     $this->assertEqual($value['status'], 'failure');
 }
开发者ID:saiber,项目名称:livecart,代码行数:17,代码来源:SpecFieldControllerTest.php

示例13: createOrder

 private function createOrder()
 {
     $user = User::getNewInstance('google@checkout.test');
     $user->save();
     $currency = Currency::getInstanceByID('USD');
     $product = Product::getNewInstance(Category::getRootNode());
     $product->isEnabled->set(true);
     $product->stockCount->set(100);
     $product->setPrice($currency, 100);
     $product->setValueByLang('name', null, 'Test name');
     $product->setValueByLang('shortDescription', null, 'Really short description');
     $product->save();
     $order = CustomerOrder::getNewInstance($user);
     $order->addProduct($product, 1);
     $order->save();
     return $order;
 }
开发者ID:saiber,项目名称:www,代码行数:17,代码来源:GoogleCheckoutTest.php

示例14: testRatingTypes

 public function testRatingTypes()
 {
     $types = array();
     for ($k = 1; $k <= 3; $k++) {
         $type = ProductRatingType::getNewInstance(Category::getRootNode());
         $type->save();
         $types[$k] = $type;
         $this->request->set('rating_' . $type->getID(), $k);
     }
     $this->controller->rate();
     $this->product->reload();
     $response = $this->controller->index();
     $ratings = $response->get('rating');
     $this->assertEqual(count($ratings), 3);
     foreach ($ratings as $key => $rating) {
         $this->assertEqual($key + 1, $rating['rating']);
     }
 }
开发者ID:saiber,项目名称:livecart,代码行数:18,代码来源:ProductControllerTest.php

示例15: export

 public function export()
 {
     $module = $this->request->get('module');
     $enabledFeeds = $this->config->get('ENABLED_FEEDS');
     if (!isset($enabledFeeds[$module]) || $this->request->get('key') != $this->config->get('FEED_KEY')) {
         return;
     }
     $this->setLayout('empty');
     set_time_limit(0);
     $cat = Category::getRootNode(true);
     $filter = new ProductFilter($cat, new ARSelectFilter());
     $filter->includeSubCategories();
     $feed = new ProductFeed($filter);
     $feed->setFlush();
     $response = new XMLResponse();
     $response->set('feed', $feed);
     $response->set('tpl', 'xml/feed/' . $module . '.tpl');
     return $response;
 }
开发者ID:saiber,项目名称:livecart,代码行数:19,代码来源:XmlController.php


注:本文中的Category::getRootNode方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。