File tree Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Expand file tree Collapse file tree 1 file changed +7
-7
lines changed Original file line number Diff line number Diff line change @@ -87,21 +87,21 @@ require('./header.inc.phtml');
87
87
<table>
88
88
<thead></thead><tbody>
89
89
<?php function add_product_checkbox ( $ id , $ name , $ checked ) { ?>
90
- <td><input type="checkbox" id="<?php echo $ id ; ?> " name="used_by[]" value="<?php echo $ id ; ?> "<?php if ( $ checked ) { ?> checked="checked"<?php } ?> /><label for="<?php echo $ id ; ?> "><?php echo $ name ; ?> </label></td>
90
+ <td><input type="checkbox" id="used_by_ <?php echo $ id ; ?> " name="used_by[]" value="<?php echo $ id ; ?> "<?php if ( $ checked ) { ?> checked="checked"<?php } ?> /><label for="used_by_ <?php echo $ id ; ?> "><?php echo $ name ; ?> </label></td>
91
91
<?php }
92
92
$ product_ubound = count ( $ this ->getContext ()->products );
93
- for ( $ product_i = 0 ; $ product_i < $ product_ubound ; ++$ product_i ) {
94
- $ p = $ this ->getContext ()->products [ $ product_i ];
95
- ?>
93
+ for ( $ product_i = 0 ; $ product_i < $ product_ubound ; ++$ product_i ) { ?>
96
94
<tr>
97
95
<?php
98
- $ checked = isset ( $ this ->getContext ()->used_by [ $ p ->getBnetProductId () ]);
96
+ $ p = $ this ->getContext ()->products [ $ product_i ];
97
+ $ checked = in_array ( $ p , $ this ->getContext ()->used_by );
99
98
add_product_checkbox ( $ p ->getBnetProductId (), $ p ->getLabel (), $ checked );
100
99
if ( $ product_i + 1 < $ product_ubound ) {
101
100
$ p = $ this ->getContext ()->products [ ++$ product_i ];
102
- $ checked = isset ( $ this ->getContext ()->used_by [ $ p -> getBnetProductId () ] );
101
+ $ checked = in_array ( $ p , $ this ->getContext ()->used_by );
103
102
add_product_checkbox ( $ p ->getBnetProductId (), $ p ->getLabel (), $ checked );
104
- } ?>
103
+ }
104
+ ?>
105
105
</tr>
106
106
<?php } ?>
107
107
</tbody>
You can’t perform that action at this time.
0 commit comments