New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When editing a variation it allows you to select another variation as the parent #1893

Closed
benhuson opened this Issue May 28, 2015 · 4 comments

Comments

Projects
None yet
2 participants
@benhuson
Member

benhuson commented May 28, 2015

When creating a new variation in the admin, the drop down menu only lets you choose a Variation Set to which to assign it (i.e. a variation term with parent = 0).

However, when you click in to edit a variation that is already created it lets you change the parent to another variation (where term parent > 0) rather than just a variation set which is unexpected behaviour and could cause problems.

This drop down menu should only list variation sets.
See attached images which show the drop down menu listing everything.

edit-var

edit-var-menu

@benhuson

This comment has been minimized.

Show comment
Hide comment
@benhuson

benhuson Jun 2, 2015

Member

Loosely related to #257

Member

benhuson commented Jun 2, 2015

Loosely related to #257

@JustinSainton

This comment has been minimized.

Show comment
Hide comment
@JustinSainton

JustinSainton Jun 3, 2015

Member

@benhuson Something like this?

add_filter( 'taxonomy_parent_dropdown_args', function( $args, $taxonomy, $context ) {

    if ( 'wpsc-variation' == $taxonomy && 'edit' == $context ) {
        $args['depth'] = 1;
    }

    return $args;
}, 10, 3 );
Member

JustinSainton commented Jun 3, 2015

@benhuson Something like this?

add_filter( 'taxonomy_parent_dropdown_args', function( $args, $taxonomy, $context ) {

    if ( 'wpsc-variation' == $taxonomy && 'edit' == $context ) {
        $args['depth'] = 1;
    }

    return $args;
}, 10, 3 );
@benhuson

This comment has been minimized.

Show comment
Hide comment
@benhuson

benhuson Jun 3, 2015

Member

Yep, that's what I was thinking.
Was thinking about how to just target that admin page and had forgotten there was a $context parameter ;)

Member

benhuson commented Jun 3, 2015

Yep, that's what I was thinking.
Was thinking about how to just target that admin page and had forgotten there was a $context parameter ;)

@JustinSainton JustinSainton added this to the 4.0 milestone Jun 3, 2015

@JustinSainton

This comment has been minimized.

Show comment
Hide comment
@JustinSainton

JustinSainton Jun 3, 2015

Member

@benhuson Sweet! Happy to merge a PR, otherwise, I'll get to it as soon as I can 👍

Member

JustinSainton commented Jun 3, 2015

@benhuson Sweet! Happy to merge a PR, otherwise, I'll get to it as soon as I can 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment