Jump to content

Recommended Posts

Posted

I am using the fieldtype-map-marker module to show a map of all the users that have logins for my site (shop owners) but the icon links to /processwire/access/users/ etc. I wantde to stop that and href it to a section in a list but my js is not good. My second option is to create a page for that url link but how?

Also now after 2 weeks of working the address doesn't geocode when entered through the api to the map field, I must also fix that.

Any help would be appreciated.

Posted
4 hours ago, gar1606 said:

Also now after 2 weeks of working the address doesn't geocode when entered through the api to the map field, I must also fix that.

For this, please ask in the Map Marker forums.

As for  user URL:

4 hours ago, gar1606 said:

I wantde to stop that and href it to a section in a list

What and where is this list? How is it generated?

4 hours ago, gar1606 said:

My second option is to create a page for that url link but how?

I am not suggesting that this is how you should do it, but the following thread is probably worth a read.

 

Posted (edited)

Hello Kongondo,

I have asked on the map maker forum about the geocoding, a few others have too but no one has shined any light on that problem as of yet. I have even tried $user->trackChange('map'); or other variants to no avail.

 

my code for generating the page with the list and map of shopowners:

<?php namespace ProcessWire;

$items = $users->find("roles=fachhandler");
foreach($items as $item){
    $fachhandlerList .= "<div class='row wrap' id='$item->id'>
                            <div class='col-sm-3'>
                                <label for='Firmenname' >Firma:</label><br>$item->name2
                            </div><!-- /col-sm-3 -->
                            <div class='col-sm-3'>
                                <label for='Fachhändler' >Fachhändler:</label><br>$item->vorname $item->familienname
                            </div><!-- /col-sm-3 -->
                            <div class='col-sm-3'>
                                <label for='Adresse' >Adresse:</label><br> $item->strasse <br> $item->plz  $item->ort <br> $item->land
                            </div><!-- /col-sm-3 -->
                            <div class='col-sm-3'>
                                <label for='Kontakt' >Kontakt:</label><br>$item->tel<br>$item->email<br>$item->web
                            </div><!-- /col-sm-3 -->
                        </div><!-- /row wrap -->";
}

$map = $modules->get('MarkupGoogleMap');
$options = array('height' => '500px');
$pageMap = $map->render($items, 'map', $options);

$content = "<div class='container'>
                <div class='row'>
                    <div class='col-sm-12 text-center'>
                        <div class = 'jumbotron'>
                            <h2 class = 'whiteHeader'>$title</h2>
                            
                            <div class='heart-rate'>
                                <svg version='1.0' xmlns='http://www.w3.org/2000/svg' xmlns:xlink='http://www.w3.org/1999/xlink' x='0px' y='0px' width='150px' height='73px' viewBox='0 0 150 73' enable-background='new 0 0 150 73' xml:space='preserve'>
                                    <polyline fill='none' stroke='#fff' stroke-width='3' stroke-miterlimit='10' points='0,45.486 38.514,45.486 44.595,33.324 50.676,45.486 57.771,45.486 62.838,55.622 71.959,9 80.067,63.729 84.122,45.486 97.297,45.486 103.379,40.419 110.473,45.486 150,45.486'/>
                                </svg>
                            </div>
                            
                            <h3 class = 'whiteHeader'>$summary</h3>
                        </div>
                    </div>
                </div>
                <div class='row'>
                    <div class='col-sm-8 col-sm-offset-2 cont padBot'>
                        $pageMap        
                    </div><!-- /col-sm-8 col-sm-offset-2 -->
                </div>
                <div class='row'>
                    <div class='col-sm-12 '>
                        $fachhandlerList
                    </div><!-- /col-sm-12 -->
                </div><!-- /row -->
            </div> <!-- /container -->";

 

I want to href to the id='item->id' instead of /processwire/access/users/ etc. I would rather that than making a page for each user that really doesn't have very much info on it. I have looked through the code in the module file MarkupGoogleMap.js but like I said, my javascript is not so good.

 

Thank you for your help/input.

Edited by kongondo
code block
Posted

You could try another approach but it depends on how you manage shopowners in the backend. If they can register themselves it will be a little more problematic, but if an admin creates shopowners you could try:

  1. Create a page /shopowners/ (with its own template) and create pages as children for each shopowner with a title field(default) and a page reference field which points to the users page.
  2. On the page /shopowners/ you then don't query the users, but the pages unter /shopowners/ with the page reference ID. With this ID you then get the content and your url would be /shopowners/shop-owner-name/
  3. Same goes for /shopowners/shop-owner-name/
    Get the page field ID and retrieve the content for the user.

Another approach would be:

  1. Just like the above with the page reference field
  2. But keep the user page data to a minimum just with username, language and password
  3. Store all the public viewable data in the pages under/shopowners/shop-owner-name/

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...