Parameter value
-
You recently helped me a lot and solved my question.
If the parameter has the form 35-40 (For example, shoe size is from 35 to 40 sizes), then you need to use the following function:function my_output_range( $numbers ) { $range = explode( '-', $numbers ); $return = array(); for ( $i = $range[0]; $i <= $range[1]; $i++ ) { $return[] = $i; } return implode( '|', $return ); }
But there was a problem – in some products a different format of 110x115x65 cm is indicated in the value of this parameter (for example, the size of a backpack).
If I use the previous code, an error appears – Notice: Undefined offset: 1 in /var/www/***/data/www/site.com.ru/wp-content/uploads/wpallimport/functions.php on line 12 Notice: Undefined offset: 1 in /var/www/***/data/www/…
How can I solve this problem? So that this formula is activated only if the parameter is written in the form from and to.
- The topic ‘Parameter value’ is closed to new replies.