本文整理汇总了PHP中ProductCategory::populate方法的典型用法代码示例。如果您正苦于以下问题:PHP ProductCategory::populate方法的具体用法?PHP ProductCategory::populate怎么用?PHP ProductCategory::populate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ProductCategory
的用法示例。
在下文中一共展示了ProductCategory::populate方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: has_categories
/**
* Checks if the storefront has any categories
*
* @api `shopp('storefront.has-categories')`
* @since 1.1
*
* @param string $result The output
* @param array $options The options
* - **showsmart**: (before,after) Include smart collections before or after the categories
* @param ShoppStorefront $O The working object
* @return bool True if categories exist, false otherwise
**/
public static function has_categories($result, $options, $O)
{
$defaults = array('showsmart' => false);
$options = array_merge($defaults, $options);
extract($options, EXTR_SKIP);
if (empty($O->categories)) {
$O->load_categories($options, $showsmart);
} else {
// Make sure each entry is a valid ProductCollection to prevent fatal errors @bug #2017
foreach ($O->categories as $id => $term) {
if ($Category instanceof ProductCollection) {
continue;
}
$ProductCategory = new ProductCategory();
$ProductCategory->populate($term);
$O->categories[$id] = $ProductCategory;
}
reset($O->categories);
return true;
}
reset($O->categories);
return count($O->categories) > 0;
}
示例2: load_category
public function load_category($term, $taxonomy)
{
$Category = new ProductCategory();
$Category->populate($term);
return $Category;
}