Product Manager: image display in product editor
Posted: Fri Apr 10, 2009 6:03 am
I noticed that the request for displaying images (thumbnails) in the product editor came up several times,
also I wanted to have it there, so it would be easier to see what is linked to it.
So, I did a bit of "hacking", I'm sure that I did not do it the proper way and used the right techniques,
but with my limited knowledge how certain thing come together in CMCMS, this is my temporary solution:
Anybody who can improve it feel free to post amendments
Also, this is designed for the default image that is in the product structure, if there are additional images, this is not
working, because then only the last image that is detected in the "customfields" loop will be put in the variable.
in the "editproduct.tpl": add the red code....
{foreach from=$customfields item=customfield}
{if isset($customfield->prompt)}{$customfield->prompt}{else}{$customfield->name}{/if}:
{if $customfield->prompt =='image'}{/if}
{if isset($customfield->value)}{$mod->Lang('current_value')}: {$customfield->value}
{if isset($customfield->delete)}{$mod->Lang('delete')} {$customfield->delete}{/if}
{/if}
{if isset($customfield->hidden)}{$customfield->hidden}{/if}{$customfield->input_box}
{if isset($customfield->attribute)}{$customfield->attribute}{/if}
{/foreach}
and in "action.editproduct.php": add the red code.... case'image' is to be found around line 419
case 'image':
if( $this->GetPreference('autowatermark') == 'adjustable' )
{
$field->attribute = $this->Lang('watermark_location').' '.
$this->CreateInputDropdown($id,'customfield_attr[field-'.$fielddef->id.']',$wmopts,-1,'default');
}
$field->delete = $this->CreateInputCheckbox($id,'customfield[deletefield-'.$fielddef->id.']',
1,0);
$field->input_box = $this->CreateFileUploadInput($id,'customfield[field-'.$fielddef->id.']','',50);
$field->hidden = $this->CreateInputHidden($id,'customfield[field-'.$fielddef->id.']',$value);
$destdir = cms_join_path($gCms->config['uploads_url'],$this->GetName(),'product_'.$compid);
$desttn = cms_join_path($destdir,'thumb_'.$value);
$this->smarty->assign('bild',$desttn);
break;
sm...
also I wanted to have it there, so it would be easier to see what is linked to it.
So, I did a bit of "hacking", I'm sure that I did not do it the proper way and used the right techniques,
but with my limited knowledge how certain thing come together in CMCMS, this is my temporary solution:
Anybody who can improve it feel free to post amendments
Also, this is designed for the default image that is in the product structure, if there are additional images, this is not
working, because then only the last image that is detected in the "customfields" loop will be put in the variable.
in the "editproduct.tpl": add the red code....
{foreach from=$customfields item=customfield}
{if isset($customfield->prompt)}{$customfield->prompt}{else}{$customfield->name}{/if}:
{if $customfield->prompt =='image'}{/if}
{if isset($customfield->value)}{$mod->Lang('current_value')}: {$customfield->value}
{if isset($customfield->delete)}{$mod->Lang('delete')} {$customfield->delete}{/if}
{/if}
{if isset($customfield->hidden)}{$customfield->hidden}{/if}{$customfield->input_box}
{if isset($customfield->attribute)}{$customfield->attribute}{/if}
{/foreach}
and in "action.editproduct.php": add the red code.... case'image' is to be found around line 419
case 'image':
if( $this->GetPreference('autowatermark') == 'adjustable' )
{
$field->attribute = $this->Lang('watermark_location').' '.
$this->CreateInputDropdown($id,'customfield_attr[field-'.$fielddef->id.']',$wmopts,-1,'default');
}
$field->delete = $this->CreateInputCheckbox($id,'customfield[deletefield-'.$fielddef->id.']',
1,0);
$field->input_box = $this->CreateFileUploadInput($id,'customfield[field-'.$fielddef->id.']','',50);
$field->hidden = $this->CreateInputHidden($id,'customfield[field-'.$fielddef->id.']',$value);
$destdir = cms_join_path($gCms->config['uploads_url'],$this->GetName(),'product_'.$compid);
$desttn = cms_join_path($destdir,'thumb_'.$value);
$this->smarty->assign('bild',$desttn);
break;
sm...