Skip to content

Commit

Permalink
Add notifier hooks for collect_info.php to include fields in prices area
Browse files Browse the repository at this point in the history
  • Loading branch information
drbyte committed Sep 17, 2024
1 parent 8ce4084 commit d4aeaad
Showing 1 changed file with 93 additions and 3 deletions.
96 changes: 93 additions & 3 deletions admin/includes/modules/collect_info.php
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,74 @@
</div>
</div>
<div class="well product-tax-prices">
<?php
// -----
// If a plugin has additional fields to add to the form, it supplies that information here.
// Additional fields are specified as a simple array of arrays,
// with each array element identifying a new input element:
//
// $additional_fields = [
// [
// 'label' => 'The text to include for the field label' (leave blank for radio buttons)
// 'fieldname' => 'label "for" attribute, must match id of input field' (leave blank for radio buttons)
// 'input' => 'The form-related portion of the field' (for radio buttons, embed label with input fields, all in this one element)
// ],
// ...
// ];
//
$additional_fields = [];
$zco_notifier->notify('NOTIFY_ADMIN_PRODUCT_PRICE_EDIT_SECTION_TOP', $pInfo, $additional_fields);
if (!empty($additional_fields)) {
foreach ($additional_fields as $current_field) {
?>
<div class="form-group">
<?php if (!empty($current_field['label'])) { ?>
<?= zen_draw_label($current_field['label'], $current_field['fieldname'], 'class="col-sm-3 control-label"') ?>
<?php } ?>
<?php if (!empty($current_field['fieldname'])) { ?>
<div class="col-sm-9 col-md-6"><?= $current_field['input'] ?></div>
<?php } else { ?>
<?= $current_field['input'] ?>
<?php } ?>
</div>
<?php
}
}
?>
<div class="form-group">
<?php echo zen_draw_label(TEXT_PRODUCTS_TAX_CLASS, 'products_tax_class_id', 'class="col-sm-3 control-label"'); ?>
<div class="col-sm-9 col-md-6">
<?php echo zen_draw_pull_down_menu('products_tax_class_id', $tax_class_array, $pInfo->products_tax_class_id, 'onchange="updateTaxIncl()" class="form-control" id="products_tax_class_id"'); ?>
</div>
<div class="col-sm-9 col-md-6">
<?php echo zen_draw_pull_down_menu('products_tax_class_id', $tax_class_array, $pInfo->products_tax_class_id, 'onchange="updateTaxIncl()" class="form-control" id="products_tax_class_id"'); ?>
</div>
</div>
<?php
// -----
// If a plugin has additional fields to add to the form, it supplies that information here.
// Additional fields are specified as a simple array of arrays,
// with each array element identifying a new input element:
//
// $additional_fields = [
// [
// 'label' => 'The text to include for the field label' (leave blank for radio buttons)
// 'fieldname' => 'label "for" attribute, must match id of input field' (leave blank for radio buttons)
// 'input' => 'The form-related portion of the field' (for radio buttons, embed label with input fields, all in this one element)
// ],
// ...
// ];
//
$additional_fields = [];
$zco_notifier->notify('NOTIFY_ADMIN_PRODUCT_PRICE_EDIT_ABOVE', $pInfo, $additional_fields);
if (!empty($additional_fields)) {
foreach ($additional_fields as $current_field) {
?>
<div class="form-group">
<?php echo zen_draw_label($current_field['label'], $current_field['fieldname'], 'class="col-sm-3 control-label"'); ?>
<div class="col-sm-9 col-md-6"><?php echo $current_field['input']; ?></div>
</div>
<?php
}
}
?>
<div class="form-group">
<?php echo zen_draw_label(TEXT_PRODUCTS_PRICE_EXCL, 'products_price', 'class="col-sm-3 control-label"'); ?>
<div class="col-sm-9 col-md-6">
Expand All @@ -290,6 +352,34 @@
}
?>
</div>
<?php
// -----
// If a plugin has additional fields to add to the form, it supplies that information here.
// Additional fields are specified as a simple array of arrays,
// with each array element identifying a new input element:
//
// $additional_fields = [
// [
// 'label' => 'The text to include for the field label',
// 'fieldname' => 'label "for" attribute, must match id of input field'
// 'input' => 'The form-related portion of the field',
// ],
// ...
// ];
//
$additional_fields = [];
$zco_notifier->notify('NOTIFY_ADMIN_PRODUCT_PRICE_EDIT_BELOW', $pInfo, $additional_fields);
if (!empty($additional_fields)) {
foreach ($additional_fields as $current_field) {
?>
<div class="form-group">
<?php echo zen_draw_label($current_field['label'], $current_field['fieldname'], 'class="col-sm-3 control-label"'); ?>
<div class="col-sm-9 col-md-6"><?php echo $current_field['input']; ?></div>
</div>
<?php
}
}
?>
<script>
updateTaxIncl();
</script>
Expand Down

0 comments on commit d4aeaad

Please sign in to comment.