Home › Forums › WoodMart support forum › Size guide bulk assignments
Size guide bulk assignments
- This topic has 5 replies, 2 voices, and was last updated 5 years, 10 months ago by
Elise Noromit.
-
AuthorPosts
-
April 29, 2019 at 11:11 am #121409
kuhconParticipantHi, i created 5 size guides, i attached them to categories but theyvare not showing up at the products in those categories. If i go in the product and assign it there, yes it works. But i have 1000+ products, i need 2 days to go in every product and assign the size guides. Is there any tweak to assign them in all products all at once or I’m doing something wrong?
April 29, 2019 at 11:53 am #121420
Elise NoromitMemberHello,
We shall fix this in our nearest update. Meanwhile please add this code to the functions.php of the child theme
` function woodmart_sguide_display( $post_id = false ){
$post_id = ( $post_id ) ? $post_id : get_the_ID();$sguide_post_id = get_post_meta( $post_id, ‘woodmart_sguide_select’ );
if ( isset( $sguide_post_id[0] ) && $sguide_post_id[0] == ‘disable’ ) return;
if ( isset( $sguide_post_id[0] ) && !empty( $sguide_post_id[0] ) ){
$sguide_post_id = $sguide_post_id[0];
}else{
$terms = wp_get_post_terms( $post_id, ‘product_cat’ );
if ( $terms ) {
foreach( $terms as $term ){
$sguide_post_meta = get_term_meta( $term->term_id, ‘woodmart_chosen_sguide’ );
if ( $sguide_post_meta[0] ) {
$sguide_post_id = $sguide_post_meta[0];
}else{
$sguide_post_id = false;
}
}
}
}
if ( $sguide_post_id ) {
$sguide_post = get_post( $sguide_post_id );
$size_tables = get_post_meta( $sguide_post_id, ‘woodmart_sguide’ );woodmart_sguide_display_table_template( $sguide_post, $size_tables );
}
}`Best Regards
April 29, 2019 at 12:24 pm #121421
kuhconParticipantHi, it does not work this code. Still they can’t be assigned
April 29, 2019 at 1:45 pm #121432
Elise NoromitMemberHello,
Sorry, please try once more with this one:
function woodmart_sguide_display( $post_id = false ){ $post_id = ( $post_id ) ? $post_id : get_the_ID(); $sguide_post_id = get_post_meta( $post_id, 'woodmart_sguide_select' ); if ( isset( $sguide_post_id[0] ) && $sguide_post_id[0] == 'disable' ) return; if ( isset( $sguide_post_id[0] ) && !empty( $sguide_post_id[0] ) ){ $sguide_post_id = $sguide_post_id[0]; }else{ $terms = wp_get_post_terms( $post_id, 'product_cat' ); if ( $terms ) { foreach( $terms as $term ){ $sguide_post_meta = get_term_meta( $term->term_id, 'woodmart_chosen_sguide' ); if ( $sguide_post_meta[0] ) { $sguide_post_id = $sguide_post_meta[0]; }else{ $sguide_post_id = false; } } } } if ( $sguide_post_id ) { $sguide_post = get_post( $sguide_post_id ); $size_tables = get_post_meta( $sguide_post_id, 'woodmart_sguide' ); woodmart_sguide_display_table_template( $sguide_post, $size_tables ); } }
Best Regards
April 29, 2019 at 1:52 pm #121433
kuhconParticipantPERFECT!!!! I hope in future this will be fixed with the parent theme.
Thanks, you are great.
April 29, 2019 at 2:55 pm #121445
Elise NoromitMemberYou are welcome! If you have any questions please feel free to contact us.
Best Regards
-
AuthorPosts
The topic ‘Size guide bulk assignments’ is closed to new replies.
- You must be logged in to create new topics. Login / Register