Changeset 1204608
- Timestamp:
- 07/23/2015 08:05:55 AM (11 years ago)
- Location:
- wooheat
- Files:
-
- 4 edited
-
assets/screenshot-5.jpg (modified) (previous)
-
trunk/admin/admin-wooheat.php (modified) (3 diffs)
-
trunk/readme.txt (modified) (1 diff)
-
trunk/wooheat.php (modified) (7 diffs)
Legend:
- Unmodified
- Added
- Removed
-
wooheat/trunk/admin/admin-wooheat.php
r1203784 r1204608 17 17 18 18 <table class="form-table"> 19 <tr> 20 <th scope="row">Display 'Heat Rating' Label?</th> 21 <td> 22 <label for="woo_heat_enable_label"><input name="woo_heat_enable_label" id="woo_heat_enable_label" type="checkbox" value="1" <?php checked( '1', get_option( 'woo_heat_enable_label', true) ); ?> /> Enable</label> 23 </td> 24 </tr> 25 <tr> 26 <th scope="row">Display rating chart?</th> 27 <td> 28 <label for="woo_heat_enable_scale"><input name="woo_heat_enable_scale" id="woo_heat_enable_scale" type="checkbox" value="1" <?php checked( '1', get_option( 'woo_heat_enable_scale', true) ); ?> /> Enable</label> 29 </td> 30 </tr> 19 31 <tr> 20 32 <th scope="row">Cold Colour</th> 21 33 <td> 22 <input type="text" name="woo_heat_cold_temperature_colour" placeholder="<?php echo get_option('woo_heat_cold_temperature_colour', '#7DB558') ?>" value="<?php echo esc_attr( get_option('woo_heat_cold_temperature_colour' ) ); ?>" />34 <input type="text" name="woo_heat_cold_temperature_colour" placeholder="<?php echo get_option('woo_heat_cold_temperature_colour', '#7DB558') ?>" value="<?php echo esc_attr( get_option('woo_heat_cold_temperature_colour', '#7DB558' ) ); ?>" /> 23 35 <p>You must enter valid HEX colour code, eg. #7DB558</p> 24 36 </td> … … 27 39 <th scope="row">Hot Colour</th> 28 40 <td> 29 <input type="text" name="woo_heat_hot_temperature_colour" placeholder="<?php echo get_option('woo_heat_hot_temperature_colour', '#FF1616') ?>" value="<?php echo esc_attr( get_option('woo_heat_hot_temperature_colour' ) ); ?>" />41 <input type="text" name="woo_heat_hot_temperature_colour" placeholder="<?php echo get_option('woo_heat_hot_temperature_colour', '#FF1616') ?>" value="<?php echo esc_attr( get_option('woo_heat_hot_temperature_colour', '#FF1616') ); ?>" /> 30 42 <p>You must enter valid HEX colour code, eg. #FF1616</p> 31 43 </td> … … 40 52 </td> 41 53 </tr> 42 43 54 <tr> 55 <th scope="row">Display Scoville rating?</th> 56 <td> 57 <label for="woo_heat_enable_scoville"><input name="woo_heat_enable_scoville" id="woo_heat_enable_scoville" type="checkbox" value="1" <?php checked( '1', get_option( 'woo_heat_enable_scoville', true ) ); ?> /> Enable</label> 58 </td> 59 </tr> 44 60 45 61 </table> -
wooheat/trunk/readme.txt
r1203787 r1204608 28 28 3. How the heat ratings are displayed on a product page 29 29 4. The heat ratings location when editing a product 30 5. Changing the colour of the heat rating chart30 5. The plugin admin screen 31 31 32 32 == Changelog == 33 33 34 = 1.2 = 35 * Can use plugin only to provide for sorting options 36 * Added ability to enable display of heat rating label, scoville units and heat chart 37 * Added in Scoville heat unit ratings to products 38 34 39 = 1.1 = 35 * Added ability to use custom images to represent each rating over 1036 * Added ability to choose between and orage and white flame40 * Added ability to use custom images to represent each rating over 10 41 * Added ability to choose between and orage and white flame 37 42 38 43 = 1.0 = 39 * Initial Release44 * Initial Release -
wooheat/trunk/wooheat.php
r1203787 r1204608 5 5 Plugin URI: http://uiux.me 6 6 Description: Woocommerce Plugin for adding Heat Ratings to products allowing items to be sorted by their heat value. 7 Version: 1. 17 Version: 1.2 8 8 Author: Ben Parry 9 9 Author URI: http://uiux.me … … 58 58 ) 59 59 ); 60 61 woocommerce_wp_text_input( 62 array( 63 'id' => 'woo_heat_scoville', 64 'label' => __( 'Scoville Rating', 'woocommerce'), 65 'description' => __('Scoville Heat Units, eg 1000000', 'woocommerce') 66 ) 67 ); 60 68 } 61 69 … … 65 73 if ( defined( 'DOING_AUTOSAVE' ) && DOING_AUTOSAVE ) 66 74 return; 75 67 76 if ( isset( $_POST['woo_heat'] ) ) { 68 77 if ( is_numeric( $_POST['woo_heat'] ) ) 69 78 update_post_meta( $product_id, 'woo_heat', $_POST['woo_heat'] ); 70 79 } else delete_post_meta( $product_id, 'woo_heat' ); 80 81 if ( isset( $_POST['woo_heat_scoville'] ) ) { 82 if ( is_numeric( $_POST['woo_heat_scoville'] ) ) 83 update_post_meta( $product_id, 'woo_heat_scoville', $_POST['woo_heat_scoville'] ); 84 } else delete_post_meta( $product_id, 'woo_heat_scoville' ); 71 85 } 72 86 … … 78 92 $woo_heat_display = get_post_meta( $product->id, 'woo_heat', true ); 79 93 94 $heat_label = get_option('woo_heat_enable_label', 1); 95 $heat_scale = get_option('woo_heat_enable_scale', 1); 96 $woo_heat_scoville = ''; 97 $scoville = false; 98 99 if(get_option('woo_heat_enable_scoville', false)) { 100 $scoville = true; 101 $woo_heat_scoville = get_post_meta( $product->id, 'woo_heat_scoville', true ); 102 if($woo_heat_scoville) { 103 $woo_heat_scoville = number_format($woo_heat_scoville); 104 } 105 } 106 80 107 if($woo_heat_display > 10) { 81 108 //only show a maximum of 10 heat points on chart … … 88 115 89 116 if($woo_heat_display > 10) { 90 echo '<p class="wooheat-rating">Heat Rating</p>'; 117 118 if($heat_label) { 119 echo '<p class="wooheat-rating">Heat Rating</p>'; 120 } 121 122 if($scoville) { 123 echo '<p class="wooheat-scoville">'.$woo_heat_scoville.'</span></p>'; 124 } 125 91 126 echo get_heat_rating_image($woo_heat_display); 92 echo '<div class="wooheat-scale"><span class="wooheat-fire" style="left:'.$heat_rating.'%;"></span></div>'; 127 128 if($heat_scale) { 129 echo '<div class="wooheat-scale"><span class="wooheat-fire" style="left:'.$heat_rating.'%;"></span></div>'; 130 } 131 93 132 } else { 94 echo '<p class="wooheat-rating">Heat Rating</p>'; 95 echo '<div class="wooheat-scale"><span class="wooheat-fire" style="left:'.$heat_rating.'%;"></span></div>'; 133 134 if($heat_label) { 135 echo '<p class="wooheat-rating">Heat Rating</p>'; 136 } 137 138 if($scoville) { 139 echo '<p class="wooheat-scoville">'.$woo_heat_scoville.'</span></p>'; 140 } 141 142 if($heat_scale) { 143 echo '<div class="wooheat-scale"><span class="wooheat-fire" style="left:'.$heat_rating.'%;"></span></div>'; 144 } 96 145 } 97 146 … … 183 232 184 233 function woo_heat_settings() { 234 register_setting( 'woo-heat-settings-group', 'woo_heat_enable_label'); 235 register_setting( 'woo-heat-settings-group', 'woo_heat_enable_scale' ); 236 register_setting( 'woo-heat-settings-group', 'woo_heat_enable_scoville' ); 185 237 register_setting( 'woo-heat-settings-group', 'woo_heat_scale_limit' ); 186 238 register_setting( 'woo-heat-settings-group', 'woo_heat_cold_temperature_colour' ); … … 215 267 .wooheat-rating {padding: 0;margin: 0;} 216 268 .wooheat-image {width:250px;height:50px;margin:2px!important;} 269 .wooheat-scoville {color:#FF1616;} 217 270 .wooheat-scale{ 218 271 -webkit-border-radius: 6px;-moz-border-radius: 6px;-ms-border-radius: 6px;-o-border-radius: 6px;border-radius: 6px;
Note: See TracChangeset
for help on using the changeset viewer.