From b62f1c9a01518678d1dcd911898af771694714d7 Mon Sep 17 00:00:00 2001 From: Mohammed Saimon Date: Wed, 16 May 2018 01:51:41 +0600 Subject: [PATCH] fix(earning-suggestion): multiple category selection mess up with earning suggesting is fixed (#252) * fix(earning-suggestion): multiple category selection mess up with earning suggesting is fixed * refactor(taxonomy-walker): remove remove unwanted code and make var to public * refector(earning-suggestion): remove empty string from constructor --- lib/class.taxonomy-walker.php | 22 +++++++++++++++++----- templates/products/new-product-single.php | 4 ++-- 2 files changed, 19 insertions(+), 7 deletions(-) diff --git a/lib/class.taxonomy-walker.php b/lib/class.taxonomy-walker.php index b14c57b02d..e1b753ff39 100644 --- a/lib/class.taxonomy-walker.php +++ b/lib/class.taxonomy-walker.php @@ -10,20 +10,32 @@ class DokanTaxonomyWalker extends Walker{ * @see Walker::$tree_type * @var string */ - var $tree_type = 'category'; + public $tree_type = 'category'; /** * @see Walker::$db_fields * @var array */ - var $db_fields = array('parent' => 'parent', 'id' => 'term_id'); + public $db_fields = array('parent' => 'parent', 'id' => 'term_id'); + + private $post_id = ''; + + public function __construct( $post_id = '' ) { + // fetch the list of term ids for the given post + $this->post_id = $post_id; + } function start_el( &$output, $category, $depth = 0, $args = array(), $id = 0 ) { - $pad = str_repeat( ' ', $depth * 3 ); + $commission_val = dokan_get_seller_percentage( dokan_get_current_user_id(), $this->post_id, $category->term_id ); + $commission_type = dokan_get_commission_type( dokan_get_current_user_id(), $this->post_id, $category->term_id ); + + $pad = str_repeat( ' ', $depth * 3 ); $cat_name = apply_filters( 'list_cats', $category->name, $category ); - $output .= "\t\n"; } -} \ No newline at end of file +} diff --git a/templates/products/new-product-single.php b/templates/products/new-product-single.php index 4e312641eb..ea4d178d97 100755 --- a/templates/products/new-product-single.php +++ b/templates/products/new-product-single.php @@ -308,7 +308,7 @@ 'exclude' => '', 'selected' => $term, 'echo' => 0, - 'walker' => new DokanTaxonomyWalker() + 'walker' => new DokanTaxonomyWalker( $post_id ) ) ) ); echo str_replace( ' '', 'selected' => $selected, 'echo' => 0, - 'walker' => new DokanTaxonomyWalker() + 'walker' => new DokanTaxonomyWalker( $post_id ) ) ); echo str_replace( '