[solved]company directory and cggooglemaps, on category

Have a question or a suggestion about a 3rd party addon module or plugin?
Let us know here.
Post Reply
janvl
Power Poster
Power Poster
Posts: 980
Joined: Wed Aug 13, 2008 10:57 am

[solved]company directory and cggooglemaps, on category

Post by janvl »

Hi,

I have the combination between these modules with the following code in the page:

Code: Select all

{foreach from=$items item='entry'}

{assign var='name' value=$entry->company_name}
{assign var='lat' value=$entry->latitude}   
{assign var='long' value=$entry->longitude}   
{capture assign='description'}
<img src="{$entry->logo_path}" />
<h3>{$entry->company_name}</h3><br />
<a href="{$entry->detail_url}">Weitere Informationen</a><br /><br />
{/capture}
{cggm_add_dynpoint map='1' name="$name" lat="$lat" long="$long" description="$description" lang="de_DE"}

{/foreach}
this works perfectly but I would want to present only one category of companies.

I tried with {if $categorytext='the name of the category'}
but that does not present the category.
How do I check on category?

Thanks,
Jan
Last edited by janvl on Thu Dec 01, 2011 2:49 pm, edited 3 times in total.
uniqu3

Re: company directory and cggooglemaps, on category

Post by uniqu3 »

$categorytext does exist as variable in summary template?
Use <pre>{$entry|print_r}</pre> to see what is available. Probably something like {$entry->category} or so.
janvl
Power Poster
Power Poster
Posts: 980
Joined: Wed Aug 13, 2008 10:57 am

Re: company directory and cggooglemaps, on category

Post by janvl »

Thanks Uniq3,

Code: Select all

stdClass Object
(
    [id] => 1
    [company_name] => Fliesen Preininger GmbH
    [detail_url] => http://www.stajl.biz/cms-demo/index.php?mact=CompanyDirectory,cntnt01,details,0&cntnt01assign=&cntnt01lang=de_DE&cntnt01cd_origpage=82&cntnt01companyid=1&cntnt01returnid=82
    [address] => Makovskystraße 3, 4240 Freistadt
    [latitude] => 48.5012614
    [longitude] => 14.5001726
    [telephone] => 0043-(0)7942-73968
    [fax] => 
    [contact_email] => info@fliesen-preininger.at
    [website] => http://www.fliesen-preininger.at
    [details] => 
    [picture_location] => 
    [picture_path] => http://www.stajl.biz/cms-demo/uploads/companydirectory/id1/
    [logo_location] => stajl-logo.png
    [logo_path] => http://www.stajl.biz/cms-demo/uploads/companydirectory/id1/stajl-logo.png
    [fielddefs] => Array
        (
        )

    [customfieldscount] => 0
    [customfieldsbyname] => Array
        (
        )

    [categories] => Array
        (
            [Verlässliche Kunden] => stdClass Object
                (
                    [id] => 2
                    [name] => Verlässliche Kunden
                    [extra1] => 
                    [extra2] => 
                    [extra3] => 
                    [create_date] => 2011-09-07 05:23:45
                    [modified_date] => 2011-09-07 05:23:45
                    [value] => 1
                    [url] => http://www.stajl.biz/cms-demo/index.php?mact=CompanyDirectory,cntnt01,default,0&cntnt01assign=&cntnt01lang=de_DE&cntnt01cd_origpage=82&cntnt01companyid=1&cntnt01categoryid=2&cntnt01returnid=82
                )

        )

)
1
is what I get.
How do I extract the categories.id or categories.name ?
I want to test on the category and present a map with only that category.

Kind regards,
Jan
janvl
Power Poster
Power Poster
Posts: 980
Joined: Wed Aug 13, 2008 10:57 am

Re: company directory and cggooglemaps, on category

Post by janvl »

Hi,

I found the following and I managed to get the categorytext in the summary template thanks to Connie.

http://forum.cmsmadesimple.org/viewtopi ... es#p149674

But if I want to present it in cggooglemaps the category does not show up in the following code that is in the pagecontent..

Code: Select all

{JQueryTools action=incjs lang="de_DE"}
{CompanyDirectory assign="" lang="de_DE"}


{foreach from=$items item='entry'}

{assign var='name' value=$entry->company_name}
{assign var='lat' value=$entry->latitude}   
{assign var='long' value=$entry->longitude}   
{capture assign='description'}
<img src="{$entry->logo_path}" />
<h3>{$entry->company_name}</h3><br />
{$entry->categorytext} - Wert<br />
<a href="{$entry->detail_url}">Weitere Informationen</a><br /><br />
{/capture}
{cggm_add_dynpoint map='1' name="$name" lat="$lat" long="$long" description="$description" lang="de_DE"}

{/foreach}

<br />
{CGGoogleMaps map='1' lang="de_DE"}

The demosite is here:
http://www.stajl.biz/cms-demo/index.php ... rmengoogle

Do I need to add the PHP-Code Connie wrote in another file?

Kind regards,
Jan
uniqu3

Re: company directory and cggooglemaps, on category

Post by uniqu3 »

I am not a fan of hacking module, core or whatever code especially if i have no idea what am i doing with it, so you could try this:

Sample Summary Template:

Code: Select all

{if isset($catformstart)}
{$catformstart}
{$catdropdown}{$catbutton}
{$catformend}
{/if}

{if isset($messages)}
<div class="CompanyDirectoryMessage">
 <ul>
   {foreach from=$messages item='one'}
     <li>{$one}</li>
   {/foreach}
 </ul>
</div>
{/if}

{if isset($errors)}
<div class="CompanyDirectoryError">
 <ul>
   {foreach from=$errors item='one'}
     <li>{$one}</li>
   {/foreach}
 </ul>
</div>
{/if}

{if isset($items)}
  <div>
  {$firstlink} {$prevlink}  {$pagetext} {$curpage} {$oftext} {$pagecount}  {$nextlink} {$lastlink}
  </div>

  {foreach from=$items item=entry}
<pre>{$entry|print_r}</pre>
  <div class="CompanyDirectoryItem">
  Name: <a href="{$entry->detail_url}">{$entry->company_name}</a><br />

  {if $entry->address ne ''}
  Address: {$entry->address}<br />
  {/if}

  {if $entry->website ne ''}
  Website: <a href="http://{$entry->website}">{$entry->website}</a>
  {/if}

  </div>
{* THIS IS OUR CATEGORY STUFF *}
{if !empty($entry->categories)} {* categories has value *}
  {assign var='get_cat' value=$entry->categories|@array_keys}
  {capture assign='cat'}{', '|implode:$get_cat}{/capture}{* get category value *}
  {foreach from=$get_cat item='one'}
  {if $one == 'test'}
     {cggm_add_dynpoint map=1 name=$entry->company_name address=$entry->address}{* if $get_cat value equals categoryname "test" use CGGM add_dynpoint function *}
  {/if}
{/foreach}
{/if}
{* END CATEGORY STUFF *}
  {/foreach}
{/if}
{CGGoogleMaps map='1'}
janvl
Power Poster
Power Poster
Posts: 980
Joined: Wed Aug 13, 2008 10:57 am

Re: company directory and cggooglemaps, on category

Post by janvl »

Thanks!

it was clear to me that the code added, was only making a declaration for the variable {entry->categorytext} and I alway document what I change.

But, your solution is far better, it saves the trouble to watch every update and it brings a possibility to also show the list for this one category, I will experiment a little further.

But the problem is solved, many thanks.

Kind regards,
Jan
janvl
Power Poster
Power Poster
Posts: 980
Joined: Wed Aug 13, 2008 10:57 am

Re: company directory and cggooglemaps, on category

Post by janvl »

Hi,

after an upgrade for some modules, the dynpoints do not appear anymore.


I wrote it here:
http://forum.cmsmadesimple.org/viewtopi ... =7&t=58270

thanks for any help.

Jan

Solved by downgrading CGGooglemaps to 2.1.1
Post Reply

Return to “Modules/Add-Ons”