There is also that nice little feature called "module_custom" see:
http://docs.cmsmadesimple.org/customizi ... -templates so one can simply change appearance of a module backend template.
Usually my clients have hard time to remember "alias" of some page or do not want to bother about that so simply want a "clickety click" solution.
A nice thing is that
Gallery Module provides a API to create a dropdown so all we need is a quick UDT which will return a dropdown and small change in
Products editproduct.tpl template file.
The UDT (name it get_gallery_dropdown or whatever you want):
Code: Select all
/**
* @param value | sets a selected value for rendered <select> tag
* @param actionid | actionid of current module
* @param name | name attribute for <select> tag
* @param assign | assign this output to a variable
*/
// Get Gallery module
$Gallery = cms_utils::get_module('Gallery');
// set params
$selected = isset($params['value']) ? $params['value'] : -1;
$actionid = $params['actionid'];
$name = $params['name'];
// create a dropdown using GalleryDropdown() function from Gallery_utils class
$dropdown = Gallery_utils::GalleryDropdown($actionid, $selected, $name);
if (isset($params['assign'])){
$smarty->assign($params['assign'],$dropdown);
}else{
return $dropdown;
}
Create a extra field of type textfield in
Products module.
Now all you need is small change in
Products template, so create a following folder structure (as described in CMSMS Documentation)
"
/module_custom/Products/templates" and copy
editproduct.tpl file from "
/modules/Products/templates".
Somewhere around line 121 there is "custom fields" section, starting like {if $customfieldscount gt 0} where code in foreach loop should be changed as following (supposed your field is named
gallery):
Code: Select all
{if $customfieldscount gt 0}
{$tab_fields}
{foreach from=$customfields item=customfield}
<div class="pageoverflow">
<p class="pagetext">{if isset($customfield->prompt)}{$customfield->prompt}{else}{$customfield->name}{/if}:</p>
<p class="pageinput">
{if $customfield->name == 'gallery'} {* change this to whatever you entered in "Name" input field when creating extra field *}
{if isset($customfield->value)}
{$value = $customfield->value} {* assign saved value to a variable *}
{/if}
{* call the UDT *}
{get_gallery_dropdown actionid=$actionid value=$value|default:'' name="customfield[field-`$customfield->id`]"}
{else}
{if isset($customfield->value)}
{if $customfield->type == 'image' && isset($customfield->image) && isset($customfield->thumbnail)}
<a href="{$customfield->image}" class="fancybox"><img src="{$customfield->thumbnail}" alt="{$customfield->value}"/></a>
{elseif $customfield->type != 'textarea' && $customfield->type != 'dimensions'}
{$mod->Lang('current_value')}: {$customfield->value}<br/>
{/if}
{/if}
{if isset($customfield->delete)}{$mod->Lang('delete')} {$customfield->delete}<br/>{/if}
{if isset($customfield->hidden)}{$customfield->hidden}{/if}
{$customfield->input_box}
{if isset($customfield->attribute)}
<br/>{$customfield->attribute}
{/if}
{/if}
</p>
</div>
{/foreach}
{$endtab}
{/if}
Thats it, now you will have a dropdown listing available galleries in
Gallery module.