Results 1 to 1 of 1

Thread: Share Coupon Multiple Categories problem

  1. #1
    Thread Starter
    pipis's Avatar
    Join Date
    Mar 2014
    Location
    Slovakia
    Posts
    15
    Thanks
    0
    Thanked 1 Time in 1 Post

    Share Coupon Multiple Categories problem

    Im using WP 4.1, latest clipper and flatter.

    I want to add a coupon in more than 2 coupon categories.

    You have by default the wp_dropdown_categories( $args ); function implementation and it doesnt work well.

    I changed some code to reveal a mulpiple select list but I can not add the coupon in 2 categories for example.

    Code: ( /flatter/includes/theme-actions.php )
    Code:
    			<li>
    				<label><?php _e( 'Coupon Category:', APP_TD ); ?> </label>
    				<?php
    					$args = array( 'taxonomy' => APP_TAX_CAT, 'selected' => $field['cat'], 'hierarchical' => 1, 'class' => 'text required', 'show_option_none' => __( '-- Select One --', APP_TD ), 'hide_empty' => 0, 'echo' => 0 );
    					$select = wp_dropdown_categories( $args );
    					$select = str_replace('id=', 'multiple="multiple" id=', $select);
    					if (is_array($taxonomy_default)) {    
    						foreach ($taxonomy_default as $key => $post_term) {
    							$select = str_replace(' value="' . $post_term . '"', ' value="' . $post_term . '" selected="selected"', $select);
    						}
    					} else {
    						$select = str_replace(' value="' . $taxonomy_default . '"', ' value="' . $taxonomy_default . '" selected="selected"', $select);
    					}
    					$select = preg_replace('"-1"', "", $select); // remove the -1 for the "select one" option so jquery validation works
    					echo $select;
    				?>
    			</li>
    I tried to debug that code and the value $posted['cat'] in /clipper/includes/forms/submit-coupon/submit-coupon-process.php returns me the last pick from the dropdown list.



    I replaced more thing, here is my new code and the $posted['cat'] returns me ' ' or NULL.
    Code:
    			<li>
    				<label><?php _e( 'Coupon Category:', APP_TD ); ?> </label>
    				<?php
    					$args = array( 'taxonomy' => APP_TAX_CAT, 'selected' => $field['cat'], 'hierarchical' => 1, 'class' => 'text required', 'show_option_none' => __( '-- Select One --', APP_TD ), 'hide_empty' => 0, 'echo' => 0 );
    					$select = wp_dropdown_categories( $args );
    					$select = str_replace('name=\'cat\' id=\'cat\'', 'name=\'cat[]\ multiple="multiple" id=\'cat\'', $select);
    					if (is_array($taxonomy_default)) {    
    						foreach ($taxonomy_default as $key => $post_term) {
    							$select = str_replace(' value="' . $post_term . '"', ' value="' . $post_term . '" selected="selected"', $select);
    						}
    					} else {
    						$select = str_replace(' value="' . $taxonomy_default . '"', ' value="' . $taxonomy_default . '" selected="selected"', $select);
    					}
    					$select = preg_replace('"-1"', "", $select); // remove the -1 for the "select one" option so jquery validation works
    					echo $select;
    				?>
    			</li>

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Replies: 1
    Last Post: June 28th, 2012, 07:53 AM
  2. Replies: 1
    Last Post: June 28th, 2012, 07:53 AM
  3. multiple categories for coupon via importer
    By mefindcoupon in forum Report Clipper Bugs
    Replies: 2
    Last Post: January 9th, 2012, 03:35 AM
  4. Replies: 4
    Last Post: November 13th, 2011, 05:01 AM
  5. [SOLVED] Problem with captcha position in «Share a coupon» form
    By frozen in forum Report Clipper Bugs
    Replies: 3
    Last Post: September 28th, 2011, 10:30 AM