Home Forums WC Vendors Pro Support Urgent Issue with new attribute tab

NOTICE: We've Moved to a Ticket System for Support

As of August 31, 2017 (12am EST) our support forums will be retired (read-only), and we will be moving to a support ticket system.  This will allow us to better organize and answer support requests, and provide a more personalized experience as we assist our customers.

For the time being, we will leave our forums open for reading and learning while we work on creating a more robust Knowledge Base for everyone to use.

If you are a WC Vendors Pro customer please open a support ticket here. 

If you are a WC Vendors user please open a support ticket on the Wordpress.org forums.

The information on this forum is outdated and in most instances no longer relevant. Please be sure to check our documentation for the most up to date information.

https://docs.wcvendors.com/

Thank you to all of our customers!

 

Viewing 17 posts - 1 through 17 (of 17 total)
  • Author
    Posts
  • #29589
    Omar
    Participant

    Hi Ben,

    I have just updated to the new version of Pro 1.2.5 along with the new wordpress update and it seems that the new attribute tab is not working!

    When you select an attribute from the drop down and click add, nothing happens.

    I have set up a new test site with only woocommerce, wcv + pro are active and and running twenty sixteen theme but, I am still having the same issue.

    Could you please look into this?

    Thanks

    #29591
    WC Vendors Support
    Participant

    TwentySixteen theme? Seriously? 🙂 Test with Storefront, and see if you can replicate the issue on dev.wcvendors.com.

    #29601
    Omar
    Participant

    Hi Ben,

    I have tried it with Storefront and it didn’t work. however, I have tried it on a different PC and it worked fine! This is really strange. So you can ignore it.

    Now that is sorted, I have reverted back to 1.2.4 as it was easier to have all of the attributes open so that the vendors can select them rather than add one by one.

    Is it possible to control this in the new update? It would be much easier this way for vendors and to avoid them being lazy and stop adding them one by one.

    Thank you for your help.

    Regards,
    Omar

    #29602
    WC Vendors Support
    Participant

    Stay with v1.2.5 — Jamie will be on in a sec soon as he’s done cooking my wife lunch. (He’s a great guy to have stay with you a few weeks!). He has a line of code that will make the old version work, but allow you to still run v1.2.5. After all, we dont want you on old versions of Pro, WooCommerce OR WordPress! 🙂

    #29606
    Jamie
    Keymaster

    Hello,

    Here is a template override that will give you the old attributes back but keep all the new features we’ve added.

    https://gist.github.com/digitalchild/024b4e81b6fc95c0239bfe64f4f041e6

    cheers,

    Jamie.

    #29607
    WC Vendors Support
    Participant

    PS — That file goes in /themes/yourtheme-child/wc-vendors/dashboard/product-edit.php 🙂 If the directory doesnt exist, create it, and upload the file there.

    #29914
    Omar
    Participant

    Thank you guys, but I am getting the following error at the bottom of the product edit page:

    Warning: Missing argument 2 for WCVendors_Pro_Product_Form::form_data(), called in /wp-content/themes/onesocial-child/wc-vendors/dashboard/product-edit.php on line 177 and defined in wp-content/plugins/wc-vendors-pro/public/forms/class-wcvendors-pro-product-form.php on line 226

    Also, It seems that the guys at Buddyboss did not update their theme files (They are overriding the wv vendors templates)

    #30117
    WC Vendors Support
    Participant

    Yup, BuddyBoss will need to update their templates. If the error says the error is in the theme folder, or their marketplace plugin, then it’s their error. Otherwise, it’s ours. 🙂

    #31021
    Omar
    Participant

    Hi Jamie and Ben,

    Your template worked a treat but now the attribute tab is still there (and not clickable)

    I tried to hide it with CSS but the only one I can find was last element css which hides other tabs from other pages.

    Could you please let me know how I can hide the Attributes tab?

    thank you.
    Omar

    #31694
    WC Vendors Support
    Participant

    If you want to hide attributes, go to wp-admin > woo > wc vendors > product form and uncheck attributes. 😉

    #31804
    Omar
    Participant

    Hi Ben,

    This template no longer works with the new update, do you have another solution please?

    I see that the main line in question is the below but when I add it to the new template, it comes up with an error when submitting the product:

    <?php WCVendors_Pro_Product_Form::attributes( $object_id, true ); ?>

    #31805
    WC Vendors Support
    Participant

    We’re not able to support old versions of how WC Vendors works. If you get it to work, congrats! If not, we support the current version and the current templates only.

    #31806
    Omar
    Participant

    This is the rror message I get when submitting the product:

    Warning: explode() expects parameter 2 to be string, array given in /home/fineart2/public_html/fas/wp-content/plugins/wc-vendors-pro/public/class-wcvendors-pro-product-controller.php on line 623

    Warning: array_map(): Argument #2 should be an array in /home/fineart2/public_html/fas/wp-content/plugins/wc-vendors-pro/public/class-wcvendors-pro-product-controller.php on line 623

    #31807
    Omar
    Participant

    okay sorry I just saw your message!

    I am using the new version but I want the attributes to display in full rather than select and add etc

    #31811
    Omar
    Participant

    I fixed it, thanks!

    #35406
    Omar
    Participant

    Hi guys,

    Last time I managed to work around this attribute thing so that I can use the old layout/function rather than the new one by adding <?php WCVendors_Pro_Product_Form::attributes( $object_id, true ); ?> to the product-edit.php and replacing the “Save Attribute” code in the class-wcvendors-pro-product-controller.php with the code below and it worked perfectly.

    Now that I have updated to the new pro version, I did the same thing with the codes but now when a vendor tries to select an attribute and save. the product comes through to Admin as it should but for some reason, the attribute value is a number rather than the text value that was selected. and when you go and edit that on the front end and select another value (i.e. Door) it generates another number instead. So it seems to be creating random numbers instead of the value selected.

    Hope this makes sense. My question is, did you guys change something on this file or any other files that controlls the attributes since the last update that I need to look at and perhaps amend etc?

    Here is the code that I mentioned above which I have inserted into the product-controller file:

    // Save Attributes

    $attributes = array();

    if ( isset( $_POST[‘attribute_names’] ) && isset( $_POST[‘attribute_values’] ) ) {

    $attribute_names = $_POST[‘attribute_names’];

    $attribute_values = $_POST[‘attribute_values’];

    $attribute_names_count = sizeof( $attribute_names );

    if ( isset( $_POST[‘attribute_variation’] ) ) {

    $attribute_variation = $_POST[‘attribute_variation’];

    }

    $pos = 0;

    for ( $i = 0; $i < $attribute_names_count; $i++ ) {

    if ( ! $attribute_names[ $i ] ) {

    continue;

    }

    $is_variation = isset( $attribute_variation[ $i ] ) ? 1 : 0;

    if ( isset( $attribute_values[ $i ] ) ) {

    // Select based attributes – Format values (posted values are slugs)

    $values = array_map( ‘sanitize_title’, $attribute_values[ $i ] );

    // Remove empty items in the array

    $values = array_filter( $values, ‘strlen’ );

    } else {

    $values = array();

    }

    // Update post terms

    if ( taxonomy_exists( $attribute_names[ $i ] ) ) {

    wp_set_object_terms( $post_id, $values, $attribute_names[ $i ] );

    }

    if ( $values ) {

    // Add attribute to array, but don’t set values

    // TODO: add filters for position, visible

    $attributes[ sanitize_title( $attribute_names[ $i ] ) ] = array(

    ‘name’ => wc_clean( $attribute_names[ $i ] ),

    ‘value’ => ”,

    ‘position’ => $pos,

    ‘is_visible’ => 1,

    ‘is_variation’ => $is_variation,

    ‘is_taxonomy’ => 1

    );

    }

    $pos++;

    }

    }

    if ( ! function_exists( ‘attributes_cmp’ ) ) {

    function attributes_cmp( $a, $b ) {

    if ( $a[‘position’] == $b[‘position’] ) {

    return 0;

    }

    return ( $a[‘position’] < $b[‘position’] ) ? -1 : 1;

    }

    }

    uasort( $attributes, ‘attributes_cmp’ );

    update_post_meta( $post_id, ‘_product_attributes’, $attributes );

    #35408
    WC Vendors Support
    Participant

    It’s all up to you man, we dont really support old versions of Pro and old functions no longer used. If you wish to continue using ways in which we dont support, supporting them is all up to you. 🙁

Viewing 17 posts - 1 through 17 (of 17 total)
  • The forum ‘WC Vendors Pro Support’ is closed to new topics and replies.