/** * Finds and returns list of available attributes. * * @return array List of available product attributes */ public function findAllAttributes() { if ($this->attributes === null) { $this->attributes = $this->service->findAllAttributes(); } return $this->attributes; }
/** * Displays the form for the wordpress admin. * * @param array $instance Instance data. * * @return string|void */ public function form($instance) { $title = isset($instance['title']) ? esc_attr($instance['title']) : null; $attribute = isset($instance['attribute']) ? esc_attr($instance['attribute']) : null; $attributes = self::$productService->findAllAttributes(); Render::output('widget/layered_nav/form', array('title_id' => $this->get_field_id('title'), 'title_name' => $this->get_field_name('title'), 'title' => $title, 'attribute_id' => $this->get_field_id('attribute'), 'attribute_name' => $this->get_field_name('attribute'), 'attribute' => $attribute, 'attributes' => $attributes)); }
/** * Displays the product data box, tabbed, with several panels covering price, stock etc * * @since 1.0 */ public function box() { $post = $this->wp->getGlobalPost(); /** @var \Jigoshop\Entity\Product $product */ $product = $this->productService->findForPost($post); $types = array(); foreach ($this->type->getEnabledTypes() as $type) { /** @var $type Types\Product\Type */ $types[$type->getId()] = $type->getName(); } $taxClasses = array(); foreach ($this->options->get('tax.classes') as $class) { $taxClasses[$class['class']] = $class['label']; } $attributes = array('' => array('label' => ''), '-1' => array('label' => __('Custom attribute', 'jigoshop'))); foreach ($this->productService->findAllAttributes() as $attribute) { /** @var $attribute Attribute */ $attributes[$attribute->getId()] = array('label' => $attribute->getLabel(), 'disabled' => $product->hasAttribute($attribute->getId())); } $tabs = $this->wp->applyFilters('jigoshop\\admin\\product\\tabs', array('general' => array('product' => $product), 'advanced' => array('product' => $product, 'taxClasses' => $taxClasses), 'attributes' => array('product' => $product, 'availableAttributes' => $attributes, 'attributes' => $product->getAttributes()), 'stock' => array('product' => $product), 'sales' => array('product' => $product)), $product); Render::output('admin/product/box', array('product' => $product, 'types' => $types, 'menu' => $this->menu, 'tabs' => $tabs, 'current_tab' => 'general')); }
/** * Displays the page. */ public function display() { Render::output('admin/product_attributes', array('messages' => $this->messages, 'attributes' => $this->productService->findAllAttributes(), 'types' => Attribute::getTypes())); }