public function load() { if ($this->request('new')) { $Category = new ProductCategory(); } else { $Category = new ProductCategory($this->request('id')); } $meta = array('specs', 'priceranges', 'options', 'prices'); foreach ($meta as $prop) { if (!isset($Category->{$prop})) { $Category->{$prop} = array(); } } // $Category = ShoppCollection(); // if ( empty($Category) ) $Category = new ProductCategory(); $Category->load_meta(); $Category->load_images(); return $Category; }
public function load_options_template() { check_admin_referer('wp_ajax_shopp_options_template'); $Category = new ProductCategory((int) $_GET['category']); $Category->load_meta(); $result = new stdClass(); $result->options = $Category->options; $result->prices = $Category->prices; echo json_encode($result); exit; }
/** * Interface processor for the category editor * * @author Jonathan Davis * @since 1.0 * @return void **/ public function editor() { global $CategoryImages; $Shopp = Shopp::object(); if (!current_user_can('shopp_categories')) { wp_die(__('You do not have sufficient permissions to access this page.')); } $Category = ShoppCollection(); if (empty($Category)) { $Category = new ProductCategory(); } $Category->load_meta(); $Category->load_images(); $Price = new ShoppPrice(); $priceTypes = ShoppPrice::types(); $billPeriods = ShoppPrice::periods(); // Build permalink for slug editor $permalink = trailingslashit(Shopp::url()) . "category/"; $Category->slug = apply_filters('editable_slug', $Category->slug); $pricerange_menu = array("disabled" => __('Price ranges disabled', 'Shopp'), "auto" => __('Build price ranges automatically', 'Shopp'), "custom" => __('Use custom price ranges', 'Shopp')); $uploader = shopp_setting('uploader_pref'); if (!$uploader) { $uploader = 'flash'; } $workflows = array("continue" => __('Continue Editing', 'Shopp'), "close" => __('Categories Manager', 'Shopp'), "new" => __('New Category', 'Shopp'), "next" => __('Edit Next', 'Shopp'), "previous" => __('Edit Previous', 'Shopp')); do_action('add_meta_boxes', ProductCategory::$taxon, $Category); do_action('add_meta_boxes_' . ProductCategory::$taxon, $Category); do_action('do_meta_boxes', ProductCategory::$taxon, 'normal', $Category); do_action('do_meta_boxes', ProductCategory::$taxon, 'advanced', $Category); do_action('do_meta_boxes', ProductCategory::$taxon, 'side', $Category); include $this->ui('category.php'); }