Product Module - Gallery

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Locked
przemo
Forum Members
Forum Members
Posts: 23
Joined: Mon Dec 30, 2013 12:58 pm

Product Module - Gallery

Post by przemo »

Hi,
I would like the product page to post a photo gallery. Has anyone used this module and has the solution?
Now I have only one image per page:

Code: Select all

  {foreach from=$entry->fields key='name' item='field'}
   {if $field->name == 'picture' && $field->value!=''}
    <img src="{CGSmartImage src=$entry->file_location|cat:'/'|cat:$field->value filter_resize="c,240,150"  noembed=1 notag=1}"  alt="{$entry->title|escape:htmlall}" />
{/if}
Does anyone have an idea how to add more photos whithout creating several custom fields in template?
Is there a way to connect with {Gallery} module?

I'm working on:
CMSMS (1.11.9)
CGSmartImage (1.16)
Products (2.20.2)
JQueryTools (1.2.6)
CGExtensions (.1.38.5)
zaidcrowe
Forum Members
Forum Members
Posts: 109
Joined: Wed Jun 10, 2009 3:43 pm

Re: Product Module - Gallery

Post by zaidcrowe »

I think this is the only way to achieve this - at least as far as I know, would love to hear if its doable.

If you dont need ecommerce functionality then Id use ListIt2 - but if you do, you might be stuck :(
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: Product Module - Gallery

Post by applejack »

If you are using SKU codes which are unique then create a Gallery directory based on that and call the Gallery from within Products.

Alternatively add another field to Products and enter the Gallery directory name.

For an example see

https://yanksair.com/Products/69/106/Gr ... cat-F6F-5/

You don't even need to upload the photos in the Gallery module you can just FTP them.
Last edited by applejack on Thu Mar 27, 2014 10:33 am, edited 1 time in total.
zaidcrowe
Forum Members
Forum Members
Posts: 109
Joined: Wed Jun 10, 2009 3:43 pm

Re: Product Module - Gallery

Post by zaidcrowe »

@applejack - smart!
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: Product Module - Gallery

Post by applejack »

If you use a naming convention for things such as folders based upon say the page aliases then there is a lot of things you can automate.

This is how all the galleries, virtual tours amongst other things work on this site by following a specific directory structure so you can use one line of Smarty code throughout rather than specifically for each page.
http://www.c-h-w.com/large-rooms/lecture-hall/
uniqu3

Re: Product Module - Gallery

Post by uniqu3 »

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')}:&nbsp;{$customfield->value}<br/>
                {/if}
            {/if}
            {if isset($customfield->delete)}{$mod->Lang('delete')}&nbsp;{$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.
applejack
Power Poster
Power Poster
Posts: 1014
Joined: Fri Mar 30, 2007 2:28 am

Re: Product Module - Gallery

Post by applejack »

Or you can use the Gallery plugin for TinyMCE which then become available as drop down.
zaidcrowe
Forum Members
Forum Members
Posts: 109
Joined: Wed Jun 10, 2009 3:43 pm

Re: Product Module - Gallery

Post by zaidcrowe »

i have a man crush on uniqu3 - awesome solution with great focus on the customers ease of use and scalability!
Locked

Return to “Modules/Add-Ons”