本文整理匯總了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;
}