PriceField
PriceField renders a Bootstrap alert box for presenting pricing-related information inside a Joomla admin form. It is structurally identical to AlertField but is registered under the type string Price, providing a semantically distinct field type for pricing contexts such as the variant pricing panel or advanced price rule forms.
The field is display-only — it stores no data and submits nothing.
Class Details
| Property | Value |
|---|---|
| Class | PriceField |
| Namespace | J2Commerce\Component\J2commerce\Administrator\Field |
| File | administrator/components/com_j2commerce/src/Field/PriceField.php |
| Extends | Joomla\CMS\Form\FormField |
| Field type string | Price |
| Since | 6.0.7 |
Behavior
The field renders a <div class="alert ..."> containing:
- An
<h3 class="alert-heading">translated from thelabelattribute viaText::_(). - An optional
<p>paragraph translated from thedescriptionattribute. - The Joomla field description tooltip is hidden via an inline CSS rule injected through the Web Asset Manager.
When a custom layout attribute is specified, the field delegates to parent::getInput().
XML Usage
<form addfieldprefix="J2Commerce\Component\J2commerce\Administrator\Field">
<fieldset name="pricing">
<field
name="price_note"
type="Price"
label="COM_J2COMMERCE_VARIANT_PRICE_HEADING"
description="COM_J2COMMERCE_VARIANT_PRICE_HEADING_DESC"
class="alert-success"
/>
</fieldset>
</form>
XML Attributes
| Attribute | Required | Description |
|---|---|---|
name | Yes | Field name. Required by the Joomla form system; not stored or submitted. |
type | Yes | Must be Price. |
label | Yes | Language key translated and rendered as the <h3> alert heading. |
description | No | Language key translated and rendered as a <p> below the heading. When absent, mb-0 is added to the heading to remove bottom margin. |
class | No | Bootstrap alert modifier appended to alert. Common values: alert-success, alert-info, alert-warning. |
layout | No | If set, delegates to the named layout file instead of the built-in HTML generation. |
Output Structure
<div id="{field-id}" class="alert alert-success">
<h3 class="alert-heading h3">Translated Price Heading</h3>
<p>Translated description text.</p>
</div>
Usage Notes
PriceFieldandAlertFieldproduce identical HTML. The two types exist so form XML can express intent — useAlertfor general notices andPricefor pricing-specific headings.- No
<input>is rendered. The field never appears in POST data. - The description tooltip (
id-desc) is suppressed via injected CSS to avoid duplicate text on screen.
Related
- AlertField — General-purpose Bootstrap alert display field
- VariantPriceField — Variant pricing input grid