data = &$args; add_action($this->get_taxonomy() . '_add_form_fields', array($this, 'add_form_fields'), 12); add_action($this->get_taxonomy() . '_edit_form_fields', array($this, 'edit_form_fields'), 12); add_action('edited_' . $this->get_taxonomy(), array($this, 'save_update_taxonomy'), 12); add_action('create_' . $this->get_taxonomy(), array($this, 'save_update_taxonomy'), 12); } public function save_update_taxonomy($term_id) { foreach ($this->get_panels() as $optionIndex => $option) : $option_value = isset($_POST[$option['id']]) ? mage_array_strip($_POST[$option['id']]) : ''; if (is_array($option_value)) { $option_value = serialize($option_value); } update_term_meta($term_id, $option['id'], $option_value); endforeach; } public function edit_form_fields($term) { $term_id = $term->term_id; foreach ($this->get_panels() as $optionIndex => $option) : ?>
$details
"; } private function get_taxonomy() { if (isset($this->data['taxonomy'])) return $this->data['taxonomy']; else return "category"; } private function get_panels() { if (isset($this->data['options'])) return $this->data['options']; else return array(); } } }