WPIntell

Source evidence

stock_check && get_swatch_html

Smart Variation Swatches and Attribute Filters for WooCommerce · support · 2020-06-26T20:52:00+00:00

mixedsentiment
mediumseverity
0.79relevance
1replies
Evidence linked to opportunitycommercial context

Proof Health

Open evidence

Commercial opportunities need traceable source links before they are treated as build-worthy.

4 / 11 rows with source links

36.4% of this page's analysis has direct source links.

0 build-decision rows missing links

0 rows here require auditable proof before promotion.

7 rows with no attached evidence

0 rows have source counts but still need direct links.

Conversation

support
drahnier resolved
We use your plugin version: 1.2.1 and have found a programming error. Please check your code in the file “class-frontend.php” in line 246. The way you write it can’t work! You cannot have multiple of the same key in an associative array! 1.) I changed that to: $array[] = $variation['attributes']; 2.) Then the lines in lines 154 to 184 must also be adjusted as follows: foreach ( $terms as $term ) { if ( in_array( $term->slug, $options ) ) { $meta_key = md5( $term->slug ); if ( isset( $swatch_type_options[$key] ) && $swatch_type_options[$key]['type'] == 'product_color' ) { $meta_options['value'] = ( isset ( $swatch_type_options[ $key ][ $meta_key ]['color'] ) && $swatch_type_options[ $key ][ $meta_key ]['color'] != "" ) ? $swatch_type_options[ $key ][ $meta_key ]['color'] :''; $meta_options['type'] = 'color'; } if ( isset( $swatch_type_options[$key] ) && $swatch_type_options[$key]['type'] == 'product_image' ) { $meta_options['value'] = ( isset ( $swatch_type_options[ $key ][ $meta_key ]['image'] ) && $swatch_type_options[ $key ][ $meta_key ]['image'] != "" ) ? $swatch_type_options[ $key ][ $meta_key ]['image'] :''; $meta_options['type'] = 'image'; } if ( isset( $swatch_type_options[$key] ) && $swatch_type_options[$key]['type'] == 'product_label' ) { $meta_options['value'] = ''; $meta_options['type'] = 'label'; } //$stock['attribute_'.$attribute] $meta_options['stock_checker'] = ''; /* if( isset( $stock['attribute_'.$attribute] ) && $stock['attribute_'.$attribute] == $term->slug ){ $meta_options['stock_checker'] = 'out_of_stock'; } */ for($x = 0; $x < count($stock);$x++){ if(isset($stock[$x]['attribute_'.$attribute]) && in_array($term->slug, $stock[$x])){ $meta_options['stock_checker'] = 'out_of_stock'; break; } } $swatches .= apply_filters( 'atawc_swatch_html', '', $term, $attr, $args, $meta_options ); } } That’s working fine! Can you please program this in a next update? Thanks. Hi @drahnier Thanks for help! we have added your code with a new version of the Smart Variation Swatches plugins, would you check once. Thanks

Comments

1 shown
aThemeArt 2020-07-25T09:24:00+00:00

Hi @drahnier Thanks for help! we have added your code with a new version of the Smart Variation Swatches plugins, would you check once. Thanks