Дополнительное поле
Здравствуйте. Добавил новое поле в форме заявки, теперь при отправке выводится ошибка "Exception: The property 'text2' does not exist in the model 'comment' ". Где нужно добавить описание переменной, чтобы убрать ошибку? Заранее благодарен.
Не совсем ясно о какой форме заявки идет речь. Можно подробнее?
Вы только что начали читать предложение, чтение которого вы уже заканчиваете.
Вот xsl шаблон, из которого на страницу выводится форма обратной связи
Обработчик данных в Информационные системы/Интернет-магазин/Интернет-магазин
<?xml version = "1.0" encoding = "utf-8" ?>
<!DOCTYPE xsl:stylesheet>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:hostcms="http://www.hostcms.ru/"
exclude-result-prefixes="hostcms">
<xsl:output xmlns="http://www.w3.org/TR/xhtml1/strict" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" encoding="utf-8" indent="yes" method="html" omit-xml-declaration="no" version="1.0" media-type="text/xml"/>
<!-- МагазинТовар -->
<xsl:decimal-format name="my" decimal-separator="," grouping-separator=" "/>
<xsl:template match="/shop">
<xsl:apply-templates select="shop_item"/>
</xsl:template>
<xsl:template match="shop_item">
<h1 hostcms:id="{@id}" hostcms:field="name" hostcms:entity="shop_item" class="h1editable"><xsl:value-of disable-output-escaping="yes" select="name" /></h1>
<!-- Получаем ID родительской группы и записываем в переменную $group -->
<xsl:variable name="group" select="/shop/group"/>
<div>
<!-- Изображение для товара, если есть -->
<xsl:if test="image_small != ''">
<div id="gallery2" class="shop_img">
<img src="{dir}{image_large}" />
</div>
</xsl:if>
<xsl:if test="marking != ''">
<div class="shop_property h1editable">REF: <span hostcms:id="{@id}" hostcms:field="marking" hostcms:entity="shop_item"><xsl:value-of disable-output-escaping="yes" select="marking"/></span></div>
</xsl:if>
<xsl:if test="count(property_value)">
<xsl:apply-templates select="property_value" />
</xsl:if>
<!-- Цена товара -->
<div class="shop-property">
<xsl:if test="price != 0">Цена продажи: <span class="text-price-size"><xsl:value-of select="format-number(price, '### ##0', 'my')"/><xsl:text> </xsl:text><xsl:value-of disable-output-escaping="yes" select="currency"/><xsl:text> </xsl:text></span></xsl:if><xsl:if test="price = 0"><b>По запросу</b></xsl:if>
</div>
<xsl:if test="/shop/message/node()">
<xsl:value-of disable-output-escaping="yes" select="/shop/message"/>
</xsl:if>
<div style="clear: both;"></div>
<div class="description">
<div class="comment-form-style">
<!-- Выводим сообщение -->
<p>Связаться с нами</p>
<form action="." method="post">
<input type="text" placeholder="Имя" name="name"/>
<input type="text" placeholder="Телефон" name="phone"/>
<input type="text" placeholder="E-mail" name="email"/>
<textarea placeholder="Ваш комментарий" name="text2" />
<input type="submit" name="add_comment" class="button" />
</form>
</div>
<!-- Описание товара -->
<xsl:if test="description != ''">
<div hostcms:id="{@id}" hostcms:field="description" hostcms:entity="shop_item" hostcms:type="wysiwyg" class="content-width"><xsl:value-of disable-output-escaping="yes" select="description" /></div>
</xsl:if>
<!-- Текст товара -->
<xsl:if test="text != ''">
<div hostcms:id="{@id}" hostcms:field="text" hostcms:entity="shop_item" hostcms:type="wysiwyg" class="content-width"><xsl:value-of disable-output-escaping="yes" select="text"/></div>
</xsl:if>
</div>
</div>
<xsl:if test="/shop/show_comments/node() and /shop/show_comments = 1">
</xsl:if>
<div style="clear: both;"></div>
<xsl:if test="count(property_value[tag_name='gallery']/informationsystem_group) >0">
<div id="gallery" data-id="photos">
<div class="like_h3">Фотографии</div>
<xsl:apply-templates select="property_value[tag_name='gallery']" mode="groups"/>
</div>
</xsl:if>
<xsl:if test="property_value/informationsystem_item/property_value[property_id=75]/value">
<script type="text/javascript">
$(document).ready(function(){
var map;
var coords = '<xsl:value-of disable-output-escaping="yes" select="property_value/informationsystem_item/property_value[property_id=75]/value"/>';
coords = coords.split(',');
var point=new google.maps.LatLng(coords[0],coords[1]);
function init() {
var mapDiv = document.getElementById('map-canvas');
var map = new google.maps.Map(mapDiv, {
center: point,
zoom: 6,
scrollwheel: false,
mapTypeId: google.maps.MapTypeId.ROADMAP,
disableDoubleClickZoom: true
});
var marker=new google.maps.Marker({
position:point,
});
marker.setMap(map);
}
init();
});
</script>
<div class="clearing"></div>
<div id="map-canvas"></div>
</xsl:if>
</xsl:template>
<xsl:template match="property_value" mode="groups">
<xsl:apply-templates select="informationsystem_group" mode="items"/>
</xsl:template>
<xsl:template match="informationsystem_group" mode="items">
<xsl:apply-templates select="informationsystem_item" mode="items"/>
</xsl:template>
<xsl:template match="informationsystem_item" mode="items">
<a href="{dir}{image_large}" target="_blank"><img src="{dir}{image_small}"/></a>
</xsl:template>
<!-- Вывод строки со значением свойства -->
<xsl:template match="property_value">
<xsl:if test="value/node() and value != '' or file/node() and file != '' or informationsystem_item/node()">
<div class="shop_property h1editable">
<xsl:variable name="property_id" select="property_id" />
<xsl:variable name="property" select="/shop/shop_item_properties//property[@id=$property_id]" />
<xsl:value-of disable-output-escaping="yes" select="$property/name"/><xsl:text>: </xsl:text>
<span><xsl:choose>
<xsl:when test="$property/type = 2">
<a href="{../dir}{file}" target="_blank"><xsl:value-of disable-output-escaping="yes" select="file_name"/></a>
</xsl:when>
<xsl:when test="$property/type = 7">
<xsl:choose>
<xsl:when test="value = 1">
Да
</xsl:when>
<xsl:otherwise>
Нет
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$property/type = 5">
<xsl:value-of disable-output-escaping="yes" select="informationsystem_item/name"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of disable-output-escaping="yes" select="value"/>
<!-- Единица измерения свойства -->
<xsl:if test="$property/shop_measure/node()">
<xsl:text> </xsl:text><xsl:if test="$property/shop_measure/name = 'м2'">м<sup>2</sup></xsl:if>
</xsl:if>
</xsl:otherwise>
</xsl:choose></span>
</div>
</xsl:if>
</xsl:template>
<!-- Шаблон для вывода звездочек (оценки) -->
<xsl:template name="for">
<xsl:param name="i" select="0"/>
<xsl:param name="n"/>
<input type="radio" name="shop_grade" value="{$i}" id="id_shop_grade_{$i}">
<xsl:if test="/shop/shop_grade = $i">
<xsl:attribute name="checked"></xsl:attribute>
</xsl:if>
</input><xsl:text> </xsl:text>
<label for="id_shop_grade_{$i}">
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="$i"/>
<xsl:with-param name="const_grade" select="5"/>
</xsl:call-template>
</label>
<br/>
<xsl:if test="$n > $i and $n > 1">
<xsl:call-template name="for">
<xsl:with-param name="i" select="$i + 1"/>
<xsl:with-param name="n" select="$n"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="AddCommentForm">
<xsl:param name="id" select="0"/>
<!-- Заполняем форму -->
<xsl:variable name="subject">
<xsl:if test="/shop/comment/parent_id/node() and /shop/comment/parent_id/node() and /shop/comment/parent_id= $id">
<xsl:value-of select="/shop/comment/subject"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="email">
<xsl:if test="/shop/comment/email/node() and /shop/comment/parent_id/node() and /shop/comment/parent_id= $id">
<xsl:value-of select="/shop/comment/email"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="phone">
<xsl:if test="/shop/comment/phone/node() and /shop/comment/parent_id/node() and /shop/comment/parent_id= $id">
<xsl:value-of select="/shop/comment/phone"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="text2">
<xsl:if test="/shop/comment/text2/node() and /shop/comment/parent_id/node() and /shop/comment/parent_id= $id">
<xsl:value-of select="/shop/comment/text2"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="text">
<xsl:if test="/shop/comment/text/node() and /shop/comment/parent_id/node() and /shop/comment/parent_id= $id">
<xsl:value-of select="/shop/comment/text"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="name">
<xsl:if test="/shop/comment/author/node() and /shop/comment/parent_id/node() and /shop/comment/parent_id= $id">
<xsl:value-of select="/shop/comment/author"/>
</xsl:if>
</xsl:variable>
<div class="comment">
<!--Отображение формы добавления комментария-->
<form action="{/shop/shop_item/url}" name="comment_form_0{$id}" method="post">
<!-- Авторизированным не показываем -->
<!--<xsl:if test="/shop/siteuser_id = 0">-->
<div class="row">
<div class="caption">Имя</div>
<div class="field">
<input type="text" size="70" name="author" value="{$name}"/>
</div>
</div>
<div class="row">
<div class="caption">E-mail</div>
<div class="field">
<input id="email{$id}" type="text" size="70" name="email" value="{$email}" />
<div id="error_email{$id}"></div>
</div>
</div>
<div class="row">
<div class="caption">Комментарий</div>
<div class="field">
<input type="text" size="70" name="phone" value="{$bingo}"/>
</div>
</div>
<div class="row">
<div class="caption">Телефон</div>
<div class="field">
<input type="text" size="70" name="phone" value="{$phone}"/>
</div>
</div>
<xsl:if test="$id != 0">
<input type="hidden" name="parent_id" value="{$id}"/>
</xsl:if>
<div class="row">
<div class="caption"></div>
<div class="field">
<input id="submit_email{$id}" type="submit" name="add_comment" value="Оставить заявку" class="button" />
</div>
</div>
</form>
</div>
</xsl:template>
<!-- Склонение после числительных -->
<xsl:template name="declension">
<xsl:param name="number" select="number"/>
<!-- Именительный падеж -->
<xsl:variable name="nominative"><xsl:text>просмотр</xsl:text></xsl:variable>
<!-- Родительный падеж, единственное число -->
<xsl:variable name="genitive_singular"><xsl:text>просмотра</xsl:text></xsl:variable>
<xsl:variable name="genitive_plural"><xsl:text>просмотров</xsl:text></xsl:variable>
<xsl:variable name="last_digit"><xsl:value-of select="$number mod 10"/></xsl:variable>
<xsl:variable name="last_two_digits"><xsl:value-of select="$number mod 100"/></xsl:variable>
<xsl:choose>
<xsl:when test="$last_digit = 1 and $last_two_digits != 11">
<xsl:value-of select="$nominative"/>
</xsl:when>
<xsl:when test="$last_digit = 2 and $last_two_digits != 12
or $last_digit = 3 and $last_two_digits != 13
or $last_digit = 4 and $last_two_digits != 14">
<xsl:value-of select="$genitive_singular"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$genitive_plural"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
<!DOCTYPE xsl:stylesheet>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:hostcms="http://www.hostcms.ru/"
exclude-result-prefixes="hostcms">
<xsl:output xmlns="http://www.w3.org/TR/xhtml1/strict" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN" encoding="utf-8" indent="yes" method="html" omit-xml-declaration="no" version="1.0" media-type="text/xml"/>
<!-- МагазинТовар -->
<xsl:decimal-format name="my" decimal-separator="," grouping-separator=" "/>
<xsl:template match="/shop">
<xsl:apply-templates select="shop_item"/>
</xsl:template>
<xsl:template match="shop_item">
<h1 hostcms:id="{@id}" hostcms:field="name" hostcms:entity="shop_item" class="h1editable"><xsl:value-of disable-output-escaping="yes" select="name" /></h1>
<!-- Получаем ID родительской группы и записываем в переменную $group -->
<xsl:variable name="group" select="/shop/group"/>
<div>
<!-- Изображение для товара, если есть -->
<xsl:if test="image_small != ''">
<div id="gallery2" class="shop_img">
<img src="{dir}{image_large}" />
</div>
</xsl:if>
<xsl:if test="marking != ''">
<div class="shop_property h1editable">REF: <span hostcms:id="{@id}" hostcms:field="marking" hostcms:entity="shop_item"><xsl:value-of disable-output-escaping="yes" select="marking"/></span></div>
</xsl:if>
<xsl:if test="count(property_value)">
<xsl:apply-templates select="property_value" />
</xsl:if>
<!-- Цена товара -->
<div class="shop-property">
<xsl:if test="price != 0">Цена продажи: <span class="text-price-size"><xsl:value-of select="format-number(price, '### ##0', 'my')"/><xsl:text> </xsl:text><xsl:value-of disable-output-escaping="yes" select="currency"/><xsl:text> </xsl:text></span></xsl:if><xsl:if test="price = 0"><b>По запросу</b></xsl:if>
</div>
<xsl:if test="/shop/message/node()">
<xsl:value-of disable-output-escaping="yes" select="/shop/message"/>
</xsl:if>
<div style="clear: both;"></div>
<div class="description">
<div class="comment-form-style">
<!-- Выводим сообщение -->
<p>Связаться с нами</p>
<form action="." method="post">
<input type="text" placeholder="Имя" name="name"/>
<input type="text" placeholder="Телефон" name="phone"/>
<input type="text" placeholder="E-mail" name="email"/>
<textarea placeholder="Ваш комментарий" name="text2" />
<input type="submit" name="add_comment" class="button" />
</form>
</div>
<!-- Описание товара -->
<xsl:if test="description != ''">
<div hostcms:id="{@id}" hostcms:field="description" hostcms:entity="shop_item" hostcms:type="wysiwyg" class="content-width"><xsl:value-of disable-output-escaping="yes" select="description" /></div>
</xsl:if>
<!-- Текст товара -->
<xsl:if test="text != ''">
<div hostcms:id="{@id}" hostcms:field="text" hostcms:entity="shop_item" hostcms:type="wysiwyg" class="content-width"><xsl:value-of disable-output-escaping="yes" select="text"/></div>
</xsl:if>
</div>
</div>
<xsl:if test="/shop/show_comments/node() and /shop/show_comments = 1">
</xsl:if>
<div style="clear: both;"></div>
<xsl:if test="count(property_value[tag_name='gallery']/informationsystem_group) >0">
<div id="gallery" data-id="photos">
<div class="like_h3">Фотографии</div>
<xsl:apply-templates select="property_value[tag_name='gallery']" mode="groups"/>
</div>
</xsl:if>
<xsl:if test="property_value/informationsystem_item/property_value[property_id=75]/value">
<script type="text/javascript">
$(document).ready(function(){
var map;
var coords = '<xsl:value-of disable-output-escaping="yes" select="property_value/informationsystem_item/property_value[property_id=75]/value"/>';
coords = coords.split(',');
var point=new google.maps.LatLng(coords[0],coords[1]);
function init() {
var mapDiv = document.getElementById('map-canvas');
var map = new google.maps.Map(mapDiv, {
center: point,
zoom: 6,
scrollwheel: false,
mapTypeId: google.maps.MapTypeId.ROADMAP,
disableDoubleClickZoom: true
});
var marker=new google.maps.Marker({
position:point,
});
marker.setMap(map);
}
init();
});
</script>
<div class="clearing"></div>
<div id="map-canvas"></div>
</xsl:if>
</xsl:template>
<xsl:template match="property_value" mode="groups">
<xsl:apply-templates select="informationsystem_group" mode="items"/>
</xsl:template>
<xsl:template match="informationsystem_group" mode="items">
<xsl:apply-templates select="informationsystem_item" mode="items"/>
</xsl:template>
<xsl:template match="informationsystem_item" mode="items">
<a href="{dir}{image_large}" target="_blank"><img src="{dir}{image_small}"/></a>
</xsl:template>
<!-- Вывод строки со значением свойства -->
<xsl:template match="property_value">
<xsl:if test="value/node() and value != '' or file/node() and file != '' or informationsystem_item/node()">
<div class="shop_property h1editable">
<xsl:variable name="property_id" select="property_id" />
<xsl:variable name="property" select="/shop/shop_item_properties//property[@id=$property_id]" />
<xsl:value-of disable-output-escaping="yes" select="$property/name"/><xsl:text>: </xsl:text>
<span><xsl:choose>
<xsl:when test="$property/type = 2">
<a href="{../dir}{file}" target="_blank"><xsl:value-of disable-output-escaping="yes" select="file_name"/></a>
</xsl:when>
<xsl:when test="$property/type = 7">
<xsl:choose>
<xsl:when test="value = 1">
Да
</xsl:when>
<xsl:otherwise>
Нет
</xsl:otherwise>
</xsl:choose>
</xsl:when>
<xsl:when test="$property/type = 5">
<xsl:value-of disable-output-escaping="yes" select="informationsystem_item/name"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of disable-output-escaping="yes" select="value"/>
<!-- Единица измерения свойства -->
<xsl:if test="$property/shop_measure/node()">
<xsl:text> </xsl:text><xsl:if test="$property/shop_measure/name = 'м2'">м<sup>2</sup></xsl:if>
</xsl:if>
</xsl:otherwise>
</xsl:choose></span>
</div>
</xsl:if>
</xsl:template>
<!-- Шаблон для вывода звездочек (оценки) -->
<xsl:template name="for">
<xsl:param name="i" select="0"/>
<xsl:param name="n"/>
<input type="radio" name="shop_grade" value="{$i}" id="id_shop_grade_{$i}">
<xsl:if test="/shop/shop_grade = $i">
<xsl:attribute name="checked"></xsl:attribute>
</xsl:if>
</input><xsl:text> </xsl:text>
<label for="id_shop_grade_{$i}">
<xsl:call-template name="show_average_grade">
<xsl:with-param name="grade" select="$i"/>
<xsl:with-param name="const_grade" select="5"/>
</xsl:call-template>
</label>
<br/>
<xsl:if test="$n > $i and $n > 1">
<xsl:call-template name="for">
<xsl:with-param name="i" select="$i + 1"/>
<xsl:with-param name="n" select="$n"/>
</xsl:call-template>
</xsl:if>
</xsl:template>
<xsl:template name="AddCommentForm">
<xsl:param name="id" select="0"/>
<!-- Заполняем форму -->
<xsl:variable name="subject">
<xsl:if test="/shop/comment/parent_id/node() and /shop/comment/parent_id/node() and /shop/comment/parent_id= $id">
<xsl:value-of select="/shop/comment/subject"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="email">
<xsl:if test="/shop/comment/email/node() and /shop/comment/parent_id/node() and /shop/comment/parent_id= $id">
<xsl:value-of select="/shop/comment/email"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="phone">
<xsl:if test="/shop/comment/phone/node() and /shop/comment/parent_id/node() and /shop/comment/parent_id= $id">
<xsl:value-of select="/shop/comment/phone"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="text2">
<xsl:if test="/shop/comment/text2/node() and /shop/comment/parent_id/node() and /shop/comment/parent_id= $id">
<xsl:value-of select="/shop/comment/text2"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="text">
<xsl:if test="/shop/comment/text/node() and /shop/comment/parent_id/node() and /shop/comment/parent_id= $id">
<xsl:value-of select="/shop/comment/text"/>
</xsl:if>
</xsl:variable>
<xsl:variable name="name">
<xsl:if test="/shop/comment/author/node() and /shop/comment/parent_id/node() and /shop/comment/parent_id= $id">
<xsl:value-of select="/shop/comment/author"/>
</xsl:if>
</xsl:variable>
<div class="comment">
<!--Отображение формы добавления комментария-->
<form action="{/shop/shop_item/url}" name="comment_form_0{$id}" method="post">
<!-- Авторизированным не показываем -->
<!--<xsl:if test="/shop/siteuser_id = 0">-->
<div class="row">
<div class="caption">Имя</div>
<div class="field">
<input type="text" size="70" name="author" value="{$name}"/>
</div>
</div>
<div class="row">
<div class="caption">E-mail</div>
<div class="field">
<input id="email{$id}" type="text" size="70" name="email" value="{$email}" />
<div id="error_email{$id}"></div>
</div>
</div>
<div class="row">
<div class="caption">Комментарий</div>
<div class="field">
<input type="text" size="70" name="phone" value="{$bingo}"/>
</div>
</div>
<div class="row">
<div class="caption">Телефон</div>
<div class="field">
<input type="text" size="70" name="phone" value="{$phone}"/>
</div>
</div>
<xsl:if test="$id != 0">
<input type="hidden" name="parent_id" value="{$id}"/>
</xsl:if>
<div class="row">
<div class="caption"></div>
<div class="field">
<input id="submit_email{$id}" type="submit" name="add_comment" value="Оставить заявку" class="button" />
</div>
</div>
</form>
</div>
</xsl:template>
<!-- Склонение после числительных -->
<xsl:template name="declension">
<xsl:param name="number" select="number"/>
<!-- Именительный падеж -->
<xsl:variable name="nominative"><xsl:text>просмотр</xsl:text></xsl:variable>
<!-- Родительный падеж, единственное число -->
<xsl:variable name="genitive_singular"><xsl:text>просмотра</xsl:text></xsl:variable>
<xsl:variable name="genitive_plural"><xsl:text>просмотров</xsl:text></xsl:variable>
<xsl:variable name="last_digit"><xsl:value-of select="$number mod 10"/></xsl:variable>
<xsl:variable name="last_two_digits"><xsl:value-of select="$number mod 100"/></xsl:variable>
<xsl:choose>
<xsl:when test="$last_digit = 1 and $last_two_digits != 11">
<xsl:value-of select="$nominative"/>
</xsl:when>
<xsl:when test="$last_digit = 2 and $last_two_digits != 12
or $last_digit = 3 and $last_two_digits != 13
or $last_digit = 4 and $last_two_digits != 14">
<xsl:value-of select="$genitive_singular"/>
</xsl:when>
<xsl:otherwise>
<xsl:value-of select="$genitive_plural"/>
</xsl:otherwise>
</xsl:choose>
</xsl:template>
</xsl:stylesheet>
Обработчик данных в Информационные системы/Интернет-магазин/Интернет-магазин
А в базу text2 ваш добавили? В таблицу комментариев comments?
Вы только что начали читать предложение, чтение которого вы уже заканчиваете.
Авторизация