The ezmultiprice datatype (Multi-price)
Class eZMultiPriceType in kernel/classes/datatypes/ezmultiprice/ezmultipricetype.php; identifier ezmultiprice, listed in settings/content.ini [DataTypeSettings] AvailableDataTypes[].
What it stores
The columns of the attribute tables its class reads or writes: data_float1, data_int1, data_text, data_text1 (data_text, data_int, data_float and sort_key_* are the object attribute's; data_text1 ... data_int4 the class attribute's settings). Found by reading the class: a heuristic.
In templates
my_attribute stands for the identifier of an attribute of this type in your class:
def $attribute = $node.data_map.my_attribute
if $attribute.has_content
attribute_view_gui attribute=$attribute
/if
{* the value as the datatype returns it (objectAttributeContent()) *}
$attribute.content|attribute( show, 1 )The shipped template that shows it (attribute_view_gui), design/standard/templates/content/datatype/view/ezmultiprice.tpl (first 25 lines):
{* DO NOT EDIT THIS FILE! Use an override template instead. *}
{def $multiprice = $attribute.content
$price_list = $multiprice.inc_vat_price_list
$currency_list = $multiprice.currency_list
$currency = false()}
if $multiprice.has_discount
{def $discount_price_list = $multiprice.discount_inc_vat_price_list
$price = false()}
<table cellspacing="10">
<tr>
<th>'Currency'|i18n( 'design/standard/content/datatype' )</th>
<th>'Price'|i18n( 'design/standard/content/datatype' )</th>
<th>'Your price'|i18n( 'design/standard/content/datatype' )</th>
<th>'You save'|i18n( 'design/standard/content/datatype' )</th>
</tr>
foreach $discount_price_list as $pos => $discount_price
{set price = $price_list[$pos]
currency = $currency_list[$price.currency_code]}
<tr>
<td>$price.currency_code|wash</td>
<td><strike>$price.value|l10n( 'currency', $currency.locale, '' )</strike></td>
<td>$discount_price.value|l10n( 'currency', $currency.locale, '' )</td>
<td>sub($price.value, $discount_price.value)|l10n( 'currency', $currency.locale, '' ) ( $multiprice.discount_percent % )</td>The shipped template that edits it (attribute_edit_gui), design/standard/templates/content/datatype/edit/ezmultiprice.tpl (first 25 lines):
{* DO NOT EDIT THIS FILE! Use an override template instead. *}
default attribute_base=ContentObjectAttribute
<div class="block">
{*<fieldset>*}
{def $multi_price = $attribute.content
$custom_price_list = $multi_price.custom_price_list
$auto_price_list = $multi_price.auto_price_list
$currency_list = $multi_price.auto_currency_list}
if or( count( $custom_price_list ), count( $auto_price_list ) )
<table class="list" cellspacing="0">
<tr>
<th class="tight"> </th>
<th>'Currency'|i18n( 'design/standard/content/datatype' )</th>
<th>'Value'|i18n( 'design/standard/content/datatype' )</th>
</tr>
foreach $auto_price_list as $index => $price
<tr>
{* Remove. *}
<td><input id="ezcoa-if ne( $attribute_base, 'ContentObjectAttribute' )$attribute_base-/if$attribute.contentclassattribute_id_$attribute.contentclass_attribute_identifier_remove_$index" class="ezcc-$attribute.object.content_class.identifier ezcca-$attribute.object.content_class.identifier_$attribute.contentclass_attribute_identifier" type="checkbox" name="$attribute_base_remove_price_array_$attribute.id[$price.currency_code]" title="'Select price for removal.'|i18n( 'design/standard/content/datatype' )" disabled="disabled" /></td>
{* Currency *}
<td>$price.currency_code|wash</td>
{* Value *}Override them for one class attribute in an override.ini.append.php with Source=content/datatype/view/ezmultiprice.tpl and a match on attribute_identifier (see A template override).
Related
Generated by ./console exp:help:examples from kernel/classes/datatypes/ezmultiprice/ezmultipricetype.php, settings/content.ini, design/standard/templates/content/datatype/view/ezmultiprice.tpl, design/standard/templates/content/datatype/edit/ezmultiprice.tpl. Do not edit this page: change the source and generate again (how). Free documentation: GFDL 1.3 or later.