HtmlArea in product description

islander

Avatar: islander

2005-07-06 00:42

Is it possible to add the wysiwyg editor into the product discriptions?
I found a simular thread "http://opensolution.org/forum/index.php?p=readTopic&nr=33"
but everyone seems to have the same questions without any working answers.

I have tried, but doesnt seem to want to work, I either get an error with no editor or nothing at all.

Any info would be much appreciated.

islander

Avatar: islander

2005-07-06 20:22

All credit for this mod go to Roger Barrett from wizzud.com, thanks Roger.

Assumption: we're talking about QCv0.3.0 here (if we're not then the code below can be found in admin.php instead of actions_admin/products.php).

In actions_admin/products.php there is a section of code that curently looks something like:

else{
if( isset( $iProduct ) && is_numeric( $iProduct ) )
$aProduct = throwProduct( $iProduct );
if( !isset( $iCategory ) )
$iCategory = null;

if( isset( $aProduct ) && is_array( $aProduct ) ){
$aFiles = listFiles( $iProduct, 'products_form.tpl', 1 );

$aProduct['shortDescription'] = changeTxt( $aProduct['shortDescription'], 'nl' );
$aProduct['fullDescription'] = changeTxt( $aProduct['fullDescription'], 'nl' );
}
else{
$aProduct['category'] = $iCategory;
$aProduct['status'] = 1;
$aProduct['position'] = 50;
}
$sSelectCategory = listCategories( 'categories_select.tpl', 1, null, $aProduct['category'] );
$sSelectStatus = throwYesNoSelect( $aProduct['status'] );

Change it to:

else{
if( isset( $iProduct ) && is_numeric( $iProduct ) )
$aProduct = throwProduct( $iProduct );
if( !isset( $iCategory ) )
$iCategory = null;

if( isset( $aProduct ) && is_array( $aProduct ) ){
$aFiles = listFiles( $iProduct, 'products_form.tpl', 1 );

// comment out these lines ...
// $aProduct['shortDescription'] = changeTxt( $aProduct['shortDescription'], 'nl' );
// $aProduct['fullDescription'] = changeTxt( $aProduct['fullDescription'], 'nl' );
}
else{
$aProduct['category'] = $iCategory;
$aProduct['status'] = 1;
$aProduct['position'] = 50;
// insert this line ...
$aProduct['shortDescription'] = $aProduct['fullDescription'] = '';
}
// insert these lines ...
$sHtmlEditor1 = htmlEditor( 'sShortDescription', '', '300', '650', $aProduct['shortDescription'] );
$sHtmlEditor2 = htmlEditor( 'sFullDescription', '', '300', '650', $aProduct['fullDescription'] );
$sSelectCategory = listCategories( 'categories_select.tpl', 1, null, $aProduct['category'] );
$sSelectStatus = throwYesNoSelect( $aProduct['status'] );

Then, in templates/admin/products_form.tpl find this section of code:

<tr>
<td style='text-align: right; padding: 5px;'>
$lang[Short_description]:&nbsp;
</td>
<td>
<textarea name='sShortDescription' cols='70' rows='5' class='input'>$aProduct[shortDescription]</textarea>
</td>
</tr>
<tr>
<td style='text-align: right; padding: 5px;'>
$lang[Full_description]:&nbsp;
</td>
<td>
<textarea name='sFullDescription' cols='70' rows='15' class='input'>$aProduct[fullDescription]</textarea>
</td>
</tr>

and change it to (modifications in red):

<tr>
<td style='text-align: right; padding: 5px;' colspan='2'>
$lang[Short_description]:<br />
$sHtmlEditor1
</td>
</tr>
<tr>
<td style='text-align: right; padding: 5px;' colspan='2'>
$lang[Full_description]:<br />
$sHtmlEditor2
</td>
</tr>

Tested and all works fine error free.

Mark

No avatar

2005-09-13 10:42

HELP!

After adding the HTML editor to the products the LINK FUNCTION DID NOT WORK!!

The link will collapce after you are saving the product, like this:

<A href="" ?? folder yoursite.com http:>http://yoursite.com/folder/</A>

ANY HELP WHY THIS HAPPEND???

Mark

No avatar

2005-09-14 17:51

??? please

marcopolo

No avatar

2005-11-11 21:01

that works very fine ! respect

Back to top
about us | contact