[solved]Products Module - Add Gallery and Google Maps to Detail PageForEachItem

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
kkreitz
Forum Members
Forum Members
Posts: 48
Joined: Fri Jun 25, 2010 3:06 am

[solved]Products Module - Add Gallery and Google Maps to Detail PageForEachItem

Post by kkreitz »

I am using the Products module for a rental listing site. I have it styled and laid out how I would like and thought I was home free! In looking at the module I thought I could create two custom fields, one for the photo gallery and one for CGGoogleMaps. I thought that when adding an item I could go to each specific custom field's input box and place tags such as:

{Gallery dir='unit1'}

and

{cggm_add_dynpoint map="1" name="anything" lat="34.440584" long="-119.73527" icon="house"}
{CGGoogleMaps map='1'}

and I would have exactly what I wanted. Unfortunately it seems this does not work that way.

Am I missing something simple? Or is there an entirely different way to do this? And if so how complicated?

Thank You.
Last edited by kkreitz on Sat Aug 28, 2010 10:45 am, edited 1 time in total.
maranc
Forum Members
Forum Members
Posts: 249
Joined: Tue May 04, 2010 5:04 pm

Re: Products Module - Add Gallery and Google Maps to Detail Page for each item

Post by maranc »

If you want include gallery photos in product template plase make it as bellow:

1. Create custom field in products (type textbox ex. name 'foto_dir')
2. In gallery module create your subgallery, named ex. 'product1' and put hier your photos
2. Return to products module, edit product and in field foto_dir write value 'product1' (this is a path to dir in gallery).
3. In product template call gallery like this:

{if $field->name == 'foto_dir'}
    {if $field->value != ""}
               
                    {Gallery dir=$field->value}
               
  {else}No photos for this products  <-- optional when there isn't any photo
    {/if}
{/if}

More... The same method you can use for making pagelimit for photos (definied field in products module, not in gallery template)


Best regrads
Marek A.
uniqu3

Re: Products Module - Add Gallery and Google Maps to Detail Page for each item

Post by uniqu3 »

I didn't do this in Products module but had the same task and i used news module.

First i created a custom field named googlemap, this is where i simply enter address with postal code.
{capture assign='addressFull'}
{$entry->fieldsbyname.googlemap->value}
{/capture}
{cggm_add_dynpoint map="1" name=$entry->title|cms_escape:htmlall address=$addressFull}
{CGGoogleMaps map="1"}
map= is the id of the map you want to use for these entries
name= you should change this to work with products module
address= is the captured value of my extra field googlemap
kkreitz
Forum Members
Forum Members
Posts: 48
Joined: Fri Jun 25, 2010 3:06 am

Re: Products Module - Add Gallery and Google Maps to Detail Page for each item

Post by kkreitz »

Marek,

Thank you for your response and help, it is very much appreciated. Unfortunately I cannot seem to get it to work. I have followed the steps you suggested and put the additional code into the detail page of the products module. The div class "galleryArea" does not show up in the html source code at all. I checked and rechecked everything many times and nothing. ...here is the complete code for the detail page with your piece in it:


{assign var='products' value=$mod}


{$entry->product_name}


{if $field->name == 'foto_dir'}
    {if $field->value != ""}
               
                    {Gallery dir=$field->value}
               
  {else}No photos for this products 
    {/if}
{/if}

{if isset($foo.promo_id)}
Discount:  {$currency_symbol}{$foo.discount|number_format:2} ({$foo.percentage|number_format:2}%)
{if $entry->price ne ''}
Rent {$currency_symbol}: {$entry->price * $foo.decimal|number_format:2}

{/if}
{elseif $entry->price ne ''}
Rent: {$currency_symbol}{$entry->price}

{/if}

{if $entry->details ne ''}
{$entry->details}
{/if}

{* accessing all of the fields in a list *}
{if count($entry->fields)}
  {foreach from=$entry->fields key='name' item='field'}
   
      {$name}:
      {$field->value}
 
   
  {/foreach}
{/if}

{* print out attributes *}
{if isset($entry->attributes)}
  Attributes
  {foreach from=$entry->attributes key='name' item='attribset'}
    {$name}
   
      {foreach from=$attribset key='label' item='adjustment'}
        {$label}: {$adjustment}
      {/foreach}
   
  {/foreach}
{/if}

{* print out the categories *}
{if isset($entry->categories)}
  Categories
  {foreach from=$entry->categories item='category'}
   
      {$mod->Lang('id')}: {$category->id}
      {$mod->Lang('name')}: {$category->name}
      {* if there are data fields associated with this category, display them too *}
      {if isset($category->data) && count($category->data)}
       
        {$mod->Lang('data')}
        {foreach from=$category->data item='onedataitem'}
         
          {if $onedataitem.field_type == 'image'}
            file_location}/{$onedataitem.field_value}">file_location}/thumb_{$onedataitem.field_value}" alt="thumb" />
          {elseif $onedataitem.field_type == 'file'}
            file_location}/{$onedataitem.field_value}">{$onedataitem.field_value}
          {else}
            {$onedataitem.field_prompt}: {$onedataitem.field_value}
          {/if}
         
        {/foreach}
       
      {/if}
   
  {/foreach}
{/if}


{* create a link back to the top of the page *}
{anchor anchor='product_name' text=$products->Lang('return_to_top') title=$products->Lang('return_to_top')}

maranc
Forum Members
Forum Members
Posts: 249
Joined: Tue May 04, 2010 5:04 pm

Re: Products Module - Add Gallery and Google Maps to Detail Page for each item

Post by maranc »

This fragment must be above code, witch call Gallery module:

{if count($entry->fields)}
  {foreach from=$entry->fields key='name' item='field'}
  {/foreach}
{/if}


I'm not expert in smarty, but I thing it will be working when you call this above.

Marek A.
kkreitz
Forum Members
Forum Members
Posts: 48
Joined: Fri Jun 25, 2010 3:06 am

Re: Products Module - Add Gallery and Google Maps to Detail Page for each item

Post by kkreitz »

This worked with one small change!

Instead of:
2. Return to products module, edit product and in field foto_dir write value 'product1' (this is a path to dir in gallery)

I removed the quotes in entering the value
2. Return to products module, edit product and in field foto_dir write value product1 (this is a path to dir in gallery)

Thank You!
kkreitz
Forum Members
Forum Members
Posts: 48
Joined: Fri Jun 25, 2010 3:06 am

Re: Products Module - Add Gallery and Google Maps to Detail Page for each item

Post by kkreitz »

Here is the code for the Gallery Module:


{if count($entry->fields)}
  {foreach from=$entry->fields key='name' item='field'}
   
      {if $field->name == 'foto_dir'}
      {if $field->value != ""}
               
                    {Gallery dir=$field->value}
               
  {else}No photos for this products 
  {/foreach}
{/if}

kkreitz
Forum Members
Forum Members
Posts: 48
Joined: Fri Jun 25, 2010 3:06 am

Re: Products Module - Add Gallery and Google Maps to Detail Page for each item

Post by kkreitz »

uniqu3,

Thank you for your help on this item. I have followed your steps and put the code into the detail page just below the custom fields code. The Google map that I want to use shows up, however the details of the dynapoint map do not  :-[

Here is the code I put into the detail page:

{* accessing all of the fields in a list *}
{if count($entry->fields)}
 {foreach from=$entry->fields key='name' item='field'}
   
      {$name}:
      {$field->value}  
   
 {/foreach}
{/if}

{capture assign='addressFull'}
{$entry->fieldsbyname.googlemap->value}
{/capture}
{cggm_add_dynpoint map="1" name=$entry->product_name address=$addressFull}
{CGGoogleMaps map="1"}

In the html is the following error message from Google Maps:

Last edited by kkreitz on Fri Aug 27, 2010 9:15 pm, edited 1 time in total.
uniqu3

Re: Products Module - Add Gallery and Google Maps to Detail Page for each item

Post by uniqu3 »

Hi kkreitz,

this is the code i tested with products module and is working:
{cggm_add_dynpoint name=$entry->product_name map="1" address=$entry->fields.googlemap->value}
{CGGoogleMaps map="1"}
See: http://demo.i-arts.eu/Products/1/121/Test
kkreitz
Forum Members
Forum Members
Posts: 48
Joined: Fri Jun 25, 2010 3:06 am

Re: Products Module - Add Gallery and Google Maps to Detail Page for each item

Post by kkreitz »

Yes it is working! Thank you!!
Post Reply

Return to “Modules/Add-Ons”