Skip to main content

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

PropertyValue
ClassPriceField
NamespaceJ2Commerce\Component\J2commerce\Administrator\Field
Fileadministrator/components/com_j2commerce/src/Field/PriceField.php
ExtendsJoomla\CMS\Form\FormField
Field type stringPrice
Since6.0.7

Behavior

The field renders a <div class="alert ..."> containing:

  • An <h3 class="alert-heading"> translated from the label attribute via Text::_().
  • An optional <p> paragraph translated from the description attribute.
  • 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

AttributeRequiredDescription
nameYesField name. Required by the Joomla form system; not stored or submitted.
typeYesMust be Price.
labelYesLanguage key translated and rendered as the <h3> alert heading.
descriptionNoLanguage key translated and rendered as a <p> below the heading. When absent, mb-0 is added to the heading to remove bottom margin.
classNoBootstrap alert modifier appended to alert. Common values: alert-success, alert-info, alert-warning.
layoutNoIf 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

  • PriceField and AlertField produce identical HTML. The two types exist so form XML can express intent — use Alert for general notices and Price for 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.