Hi,
I have a new product type for photos. Almost everything is working apart from a description field in the admin area when adding or editing a product.
The new field is image_sizes_name and is one of 4 fields in a new table "product_photo_extra". 3 fields are lookups, the 4th is free-form text to be edited in an instance of the FCKeditor.
If I pre-populate the table field the editor correctly retrieves the value (function zen_get_image_sizes is working). However after preview --> update the value for the text field is lost (it shows as 0); the values of the other three fields are stored.
The fact that the other three values are updated suggest the update is working correctly. For this one field either the value isn't being read from the editor or the value isn't being passed when it comes to the update.
The code surrounding the editor in collect_info.php is:
The relevant bit of code in update_product.php is:<!-- image_sizes new code start -->
<?php
for ($i=0, $n=sizeof($languages); $i<$n; $i++) {
?>
<tr>
<td class="main" valign="top"><?php if ($i == 0) echo TEXT_PRODUCTS_IMAGE_SIZES; ?></td>
<td colspan="2">
<table border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="main" width="25" valign="top"><?php echo zen_image(DIR_WS_CATALOG_LANGUAGES . $languages[$i]['directory'] . '/images/' . $languages[$i]['image'], $languages[$i]['name']); ?> </td>
<td class="main" width="100%">
<?php if ($_SESSION['html_editor_preference_status']=="FCKEDITOR") {
$oFCKeditor = new FCKeditor('image_sizes_name[' . $languages[$i]['id'] . ']') ;
$oFCKeditor->Value = (isset($image_sizes_name[$languages[$i]['id']])) ? stripslashes($image_sizes_name[$languages[$i]['id']]) : zen_get_image_sizes($pInfo->products_id, $languages[$i]['id']);
$oFCKeditor->Width = '99%' ;
$oFCKeditor->Height = '350' ;
// $oFCKeditor->Config['ToolbarLocation'] = 'Out:xToolbar' ;
// $oFCKeditor->Create() ;
$output = $oFCKeditor->CreateHtml() ; echo $output;
} else { // using HTMLAREA or just raw "source"
echo zen_draw_textarea_field('image_sizes_name[' . $languages[$i]['id'] . ']', 'soft', '100%', '30', (isset($image_sizes_name[$languages[$i]['id']])) ? htmlspecialchars(stripslashes($image_sizes_name[$languages[$i]['id']]), ENT_COMPAT, CHARSET, TRUE) : htmlspecialchars(zen_get_image_sizes($pInfo->products_id, $languages[$i]['id']), ENT_COMPAT, CHARSET, TRUE)); //,'id="'.'image_sizes_name' . $languages[$i]['id'] . '"');
} ?>
</td>
</tr>
</table>
</td>
</tr>
<?php
}
?>
<!-- image_sizes new code end -->
Any and all suggestions greatly appreciated.$tmp_value = zen_db_prepare_input($_POST['photographers_id']);
$photographers_id = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['model_release_id']);
$model_release_id = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['property_release_id']);
$property_release_id = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
$tmp_value = zen_db_prepare_input($_POST['image_sizes_name']);
$image_sizes_name = (!zen_not_null($tmp_value) || $tmp_value=='' || $tmp_value == 0) ? 0 : $tmp_value;
$sql_data_array = array('photographers_id' => $photographers_id,
'model_release_id' => $model_release_id,
'property_release_id' => $property_release_id,
'image_sizes_name' => $image_sizes_name );
zen_db_perform(TABLE_PRODUCT_PHOTO_EXTRA, $sql_data_array, 'update', "products_id = '" . (int)$products_id . "'");
Ric


Reply With Quote
