mp_category_dropdown Dropdown Bug

using the shortcode: [mp_category_dropdown] produces the following html:

<select name='cat' id='mp_category_dropdown' class='postform' >
<option class="level-0" value="6">Ford</option>
<option class="level-0" value="8">Badges</option>
<option class="level-0" value="9">Holden</option>
<option class="level-0" value="12">Interior Accessories</option>
<option class="level-0" value="13">Windows</option>
<option class="level-0" value="14">Wheels</option>
<option class="level-0" value="15">Lights</option>
<option class="level-0" value="16">Exterior Accessories</option>
<option class="level-0" value="17">Clips</option>
<option class="level-0" value="18">Rubbers</option>
<option class="level-0" value="19">Toyota</option>
<option class="level-0" value="20">Rubbers</option>
<option class="level-0" value="21">Rubbers</option>
<script type="text/javascript">
/* <![CDATA[ */
var dropdown = document.getElementById("mp_category_dropdown");
function onCatChange() {
if ( dropdown.options[dropdown.selectedIndex].value > 0 ) {
location.href = "<?php echo home_url(); ?>/?product_category="+dropdown.options[dropdown.selectedIndex].value;
dropdown.onchange = onCatChange;
/* ]]> */

This then produces a drop down list of categories that link through to invalid URLs such as:


As you can see from the above, the PHP is not executing but simply being echoed as part of the URL string.

Could this be that the previously quoted code is invalid? The javascript uses a PHP command to determine the URL but I’m not sure how that can work since the javascript only gets executed at the client side AFTER the PHP has finished being executed.

Whatever the answer, there’s definitely seems to be a problem with this code.

Please advise.

  • DavidM
    • DEV MAN’s Mascot

    Hi brandicoot,

    There was just an update to MarketPress that has a bunch of changes. It’s meant for use strictly with WP 3.3. Any chance you could give that a try?

    If that’s not feasible currently, we can have a look at the version you’re using. Could you let us know which versions of WP and MarketPress you’re using in that case?



  • Mason
    • DEV MAN’s Sidekick


    As we haven’t heard back from you we’re going to assume the problem was sorted out and mark this ticket as resolved.

    If it wasn’t resolved, or you have any more questions related to this thread please feel free to post them below and tick the ‘Mark as Not Resolved (re-open)’ box below the post area (or else we’ll miss it!)

    Otherwise, thanks for using the forums, and for being a member of WPMU DEV, it’s a pleasure to help you out and we look forward to being of assistance in the future.


Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.