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


PHP ProductCategory::sortoptions方法代码示例

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


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

示例1: screen

 public function screen()
 {
     $status = 'available';
     if (!is_dir($this->theme_path)) {
         $status = 'directory';
     } else {
         if (!is_writable($this->theme_path)) {
             $status = 'permissions';
         } else {
             $builtin = array_filter(scandir($this->template_path), 'filter_dotfiles');
             $theme = array_filter(scandir($this->theme_path), 'filter_dotfiles');
             if (empty($theme)) {
                 $status = 'ready';
             } elseif (array_diff($builtin, $theme)) {
                 $status = 'incomplete';
             }
         }
     }
     $category_views = array('grid' => Shopp::__('Grid'), 'list' => Shopp::__('List'));
     $row_products = array(2, 3, 4, 5, 6, 7);
     $productOrderOptions = ProductCategory::sortoptions();
     $productOrderOptions['custom'] = Shopp::__('Custom');
     $orderOptions = array('ASC' => Shopp::__('Order'), 'DESC' => Shopp::__('Reverse Order'), 'RAND' => Shopp::__('Shuffle'));
     $orderBy = array('sortorder' => Shopp::__('Custom arrangement'), 'created' => Shopp::__('Upload date'));
     include $this->ui('presentation.php');
 }
开发者ID:forthrobot,项目名称:inuvik,代码行数:26,代码来源:Presentation.php

示例2: presentation

 public function presentation()
 {
     if (!current_user_can('shopp_settings_presentation')) {
         wp_die(__('You do not have sufficient permissions to access this page.'));
     }
     $builtin_path = SHOPP_PATH . '/templates';
     $theme_path = sanitize_path(STYLESHEETPATH . '/shopp');
     $term_recount = false;
     if (!empty($_POST['save'])) {
         check_admin_referer('shopp-settings-presentation');
         $updated = __('Shopp presentation settings saved.', 'Shopp');
         if (isset($_POST['settings']['theme_templates']) && $_POST['settings']['theme_templates'] == 'on' && !is_dir($theme_path)) {
             $_POST['settings']['theme_templates'] = 'off';
             $updated = __('Shopp theme templates can\'t be used because they don\'t exist.', 'Shopp');
         }
         if (empty($_POST['settings']['catalog_pagination'])) {
             $_POST['settings']['catalog_pagination'] = 0;
         }
         // Recount terms when this setting changes
         if (isset($_POST['settings']['outofstock_catalog']) && $_POST['settings']['outofstock_catalog'] != shopp_setting('outofstock_catalog')) {
             $term_recount = true;
         }
         shopp_set_formsettings();
         $this->notice(Shopp::__('Presentation settings saved.'), 'notice', 20);
     }
     if ($term_recount) {
         $taxonomy = ProductCategory::$taxon;
         $terms = get_terms($taxonomy, array('hide_empty' => 0, 'fields' => 'ids'));
         if (!empty($terms)) {
             wp_update_term_count_now($terms, $taxonomy);
         }
     }
     // Copy templates to the current WordPress theme
     if (!empty($_POST['install'])) {
         check_admin_referer('shopp-settings-presentation');
         copy_shopp_templates($builtin_path, $theme_path);
     }
     $status = 'available';
     if (!is_dir($theme_path)) {
         $status = 'directory';
     } else {
         if (!is_writable($theme_path)) {
             $status = 'permissions';
         } else {
             $builtin = array_filter(scandir($builtin_path), 'filter_dotfiles');
             $theme = array_filter(scandir($theme_path), 'filter_dotfiles');
             if (empty($theme)) {
                 $status = 'ready';
             } else {
                 if (array_diff($builtin, $theme)) {
                     $status = 'incomplete';
                 }
             }
         }
     }
     $category_views = array('grid' => __('Grid', 'Shopp'), 'list' => __('List', 'Shopp'));
     $row_products = array(2, 3, 4, 5, 6, 7);
     $productOrderOptions = ProductCategory::sortoptions();
     $productOrderOptions['custom'] = __('Custom', 'Shopp');
     $orderOptions = array('ASC' => __('Order', 'Shopp'), 'DESC' => __('Reverse Order', 'Shopp'), 'RAND' => __('Shuffle', 'Shopp'));
     $orderBy = array('sortorder' => __('Custom arrangement', 'Shopp'), 'created' => __('Upload date', 'Shopp'));
     include $this->ui('presentation.php');
 }
开发者ID:BlessySoftwares,项目名称:anvelocom,代码行数:63,代码来源:Setup.php

示例3: orderby_list

 /**
  * Provides markup for a category sort order selection widget
  *
  * The widget can be a drop-down menu or an unordered list of links
  *
  * @api `shopp('storefront.orderby-list')`
  * @since 1.0
  *
  * @param string          $result  The output
  * @param array           $options The options
  * @param ShoppStorefront $O       The working object
  * @return string The order-by markup
  **/
 public static function orderby_list($result, $options, $O)
 {
     $Collection = ShoppCollection();
     $Storefront = ShoppStorefront();
     // Some internals can suppress this control
     if (isset($Collection->controls)) {
         return false;
     }
     if (isset($Collection->loading['order']) || isset($Collection->loading['sortorder'])) {
         return false;
     }
     $defaultsort = array('title', shopp_setting('default_product_order'), isset($Storefront->browsing['sortorder']) ? $Storefront->browsing['sortorder'] : false);
     foreach ($defaultsort as $setting) {
         if (!empty($setting)) {
             $default = $setting;
         }
     }
     // Setup defaults
     $options = wp_parse_args($options, array('dropdown' => false, 'default' => $default, 'title' => '', 'class' => ''));
     extract($options, EXTR_SKIP);
     // Get the sort option labels
     $menuoptions = ProductCategory::sortoptions();
     // Don't show custom product order for smart categories
     if ($Collection->smart) {
         unset($menuoptions['custom']);
     }
     $_ = array();
     $request = $_SERVER['REQUEST_URI'];
     if (Shopp::str_true($dropdown)) {
         $_[] = $title;
         $_[] = '<form action="' . esc_url($request) . '" method="get" id="shopp-' . $Collection->slug . '-orderby-menu">';
         if ('' == get_option('permalink_structure')) {
             foreach ($_GET as $key => $value) {
                 if ('sort' != $key) {
                     $_[] = '<input type="hidden" name="' . $key . '" value="' . $value . '" />';
                 }
             }
         }
         $_[] = '<select name="sort" class="shopp-orderby-menu ' . esc_attr($class) . '">';
         $_[] = menuoptions($menuoptions, $default, true);
         $_[] = '</select>';
         $_[] = '</form>';
     } else {
         foreach ($menuoptions as $value => $label) {
             $href = esc_url(add_query_arg(array('sort' => $value), $request));
             $class = $default == $value ? ' class="current"' : '';
             $_[] = '<li><a href="' . $href . '"' . $class . '>' . $label . '</a></li>';
         }
     }
     return join('', $_);
 }
开发者ID:jonathandavis,项目名称:shopp,代码行数:64,代码来源:storefront.php


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