Go Back   Mosets Community > Mosets Tree 3.x > Discussions, Troubleshooting & Problems

Reply
 
Thread Tools Search this Thread Display Modes
  #1  
Old 08-11-2015, 09:59 PM
boioskam boioskam is offline
Mosets'd
 
Join Date: Apr 2014
Posts: 21
Default Add a new button

Hi all,

Is it possible to add a button in Mosets?

Thanks in advance!
Reply With Quote
  #2  
Old 08-14-2015, 08:10 PM
peterwalker peterwalker is offline
Mosets'd
 
Join Date: Nov 2013
Posts: 53
Default

So much specifics missing in the question.
- Is it for front or backend?
- Do you want a form button or a standard hyperlink?
- What exactly must happen when the button is used?
Reply With Quote
  #3  
Old 08-14-2015, 08:32 PM
boioskam boioskam is offline
Mosets'd
 
Join Date: Apr 2014
Posts: 21
Default

Hi Peter,
In the front and I would like a form button to link a photogalery (made with Ignite Gallery) and other expressive links.
Thanks,
Reply With Quote
  #4  
Old 08-16-2015, 02:12 AM
peterwalker peterwalker is offline
Mosets'd
 
Join Date: Nov 2013
Posts: 53
Default

That seems like a standard Joomla menu item and not related to Mosets Tree. I have not used the ignite extension but if it is a component, create a menu item and select an appropriate type from the ignite elements
Reply With Quote
  #5  
Old 08-18-2015, 07:11 PM
boioskam boioskam is offline
Mosets'd
 
Join Date: Apr 2014
Posts: 21
Default

That's a way, but I would like to direct them from the mosets tree lay-out directly.
So, is it possible to add a optional button (with a deep link) or is that not possible in Mosets tree?

(see example)
Reply With Quote
  #6  
Old 08-18-2015, 08:15 PM
peterwalker peterwalker is offline
Mosets'd
 
Join Date: Nov 2013
Posts: 53
Default

The image certainly clarifies your inquiry.

There is no immediate setting to add such a button but it can be done with a template override.

Step 1
While in Mosets tree admin
- click templates in the left column
- select the default template by checking the radio button
- click copy template at the top
- fill in the fields, specifically the first 2 fields
- click save

Step 2
- click the name of the template you created
- if using version 3.6.x, in the right column click sub_listingDetailsActions.tpl.php if using a lower version, click sub_listingDetails.tpl.php and scroll to the bottom to see the actions code block.
- add the following to the list
Code:
$this->plugin( 'ahref','ADD-URL-TO-GALLERY-HERE', 'Gallery', 'class="btn"' );
So the whole thing should look like this

Code:
<?php
if( $this->show_actions_rating_fav ) {
?>
<div class="row-fluid">
<div class="span12 actions-rating-fav">
<?php if( $this->show_actions ) { ?>
<div class="actions">
<?php
$this->plugin( 'ahrefreview', $this->link, array("class"=>"btn", "rel"=>"nofollow") );
$this->plugin( 'ahrefrecommend', $this->link, array("class"=>"btn", "rel"=>"nofollow") );
$this->plugin( 'ahrefprint', $this->link, array("class"=>"btn", "rel"=>"nofollow") );
$this->plugin( 'ahrefcontact', $this->link, array("class"=>"btn", "rel"=>"nofollow") );
$this->plugin( 'ahrefvisit', $this->link, '', 1, array("class"=>"btn", "rel"=>"nofollow") );
$this->plugin( 'ahrefreport', $this->link, array("class"=>"btn", "rel"=>"nofollow") );
$this->plugin( 'ahrefclaim', $this->link, array("class"=>"btn", "rel"=>"nofollow") );
$this->plugin( 'ahrefownerlisting', $this->link, array("class"=>"btn") );
$this->plugin( 'ahrefmap', $this->link, array("class"=>"btn", "rel"=>"nofollow") );
$this->plugin( 'ahref','ADD-URL-TO-GALLERY-HERE', 'Gallery', 'class="btn"' );
?>
</div>
</div>
</div><?php
}
}
- save the file
- set the new template as default

I have setup a demo of the gallery button. See http://directory.websitedons.net/blo...dr-harvey-karp

Last edited by peterwalker; 08-18-2015 at 08:23 PM.
Reply With Quote
  #7  
Old 08-18-2015, 08:31 PM
boioskam boioskam is offline
Mosets'd
 
Join Date: Apr 2014
Posts: 21
Default

Thanks a million!! That will do I hope. I'll let you know/show you the result.

Thanks again!!
Reply With Quote
  #8  
Old 08-18-2015, 09:16 PM
boioskam boioskam is offline
Mosets'd
 
Join Date: Apr 2014
Posts: 21
Default



WORKS!!

Only, the gallery button is now used in all listings. I can't change the gallery per listing so to speak.
Listing 1 has an specific gallery
Listing 2 has an other gallery
and so on...

Is this also possible in coding?

Last edited by boioskam; 08-18-2015 at 09:23 PM.
Reply With Quote
  #9  
Old 08-19-2015, 12:14 PM
peterwalker peterwalker is offline
Mosets'd
 
Join Date: Nov 2013
Posts: 53
Default

Yes you can configure the code to show the gallery button on selected listings.

- create a custom field type as radio button.
- give it an appropriate caption such as 'show gallery button'
- enter the choices such as yes|no
- assign the field to the categories desired
- set show in details view to 'yes'
- Note the field ID as it will be used later
- edit the same file as before sub_listingDetailsActions.tpl.php as the following

Code:
if( $this->fields->getFieldById(49)->value == 'yes' ) $this->plugin( 'ahref','ADD-URL-TO-GALLERY-HERE', 'Gallery', 'class="btn"' );
be sure to replace the ID (49) with that of the field you created. Now there will be the option to enable the button per listing.

The caveat
because show in details view is set to yes, the field value will display in your listing's field items, so additional file edit must be done.

While in view of the override template settings
- click the file sub_listingDetailsFields.tpl.php
- find the line
Code:
!in_array($field->getId(),array(5,6,7,8))
- add the new custom field ID to the array

-------[ UPDATE ]-----
After re-reading the quest, I realized the solution given is not what you asked, but usable anyway, so I'll leave it.

To have a different gallery URL per listing
- create a custom field type as text
- add caption, set to show in detail view, assign to categories, note ID
- no need to change any parameters in the right column
- edit the same file sub_listingDetailsActions.tpl.php
Code:
$gallery='';
if( $this->fields->getFieldById(49)->hasValue() ) {
$gallery = $this->fields->getFieldById(49)->value;
$this->plugin( 'ahref', $gallery, 'Gallery', 'class="btn"' );
}
Follow the same steps to disable the field view by adding the ID to the array as shown above.

You can see it working at http://directory.websitedons.net/blogs . The first 2 listings have different destinations for the gallery button and the third listing has no button because the custom field was left empty.

Last edited by peterwalker; 08-19-2015 at 01:09 PM.
Reply With Quote
  #10  
Old 08-28-2015, 05:14 PM
boioskam boioskam is offline
Mosets'd
 
Join Date: Apr 2014
Posts: 21
Default

Hi Peter, sorry for the late response, but I cant find the 'ub_listingDetailsActions.tpl.php' So I must be using an older version. Is that an older version Mosets Tree or older version kinabalu?

And I can't figure out where to put the last code ($gallery='';...) in the php file.

Thanks again!
Reply With Quote
  #11  
Old 08-30-2015, 06:43 AM
peterwalker peterwalker is offline
Mosets'd
 
Join Date: Nov 2013
Posts: 53
Default

The new file to edit is sub_listingDetailsFields.tpl.php

sub_listingDetailsActions.tpl.php is the file you edited before to add the button.

The $gallery=''; variable along with the conditional coding goes in place of the original edit you did to add the button.

So the file will now look like this
Code:
<?php
if( $this->show_actions_rating_fav ) {
?>
<div class="row-fluid">
<div class="span12 actions-rating-fav">
<?php if( $this->show_actions ) { ?>
<div class="actions">
<?php
$this->plugin( 'ahrefreview', $this->link, array("class"=>"btn", "rel"=>"nofollow") );
$this->plugin( 'ahrefrecommend', $this->link, array("class"=>"btn", "rel"=>"nofollow") );
$this->plugin( 'ahrefprint', $this->link, array("class"=>"btn", "rel"=>"nofollow") );
$this->plugin( 'ahrefcontact', $this->link, array("class"=>"btn", "rel"=>"nofollow") );
$this->plugin( 'ahrefvisit', $this->link, '', 1, array("class"=>"btn", "rel"=>"nofollow") );
$this->plugin( 'ahrefreport', $this->link, array("class"=>"btn", "rel"=>"nofollow") );
$this->plugin( 'ahrefclaim', $this->link, array("class"=>"btn", "rel"=>"nofollow") );
$this->plugin( 'ahrefownerlisting', $this->link, array("class"=>"btn") );
$this->plugin( 'ahrefmap', $this->link, array("class"=>"btn", "rel"=>"nofollow") );
// MODIFICATION TO INSERT GALLERY BUTTON
$gallery='';
if( $this->fields->getFieldById(49)->hasValue() ) {
$gallery = $this->fields->getFieldById(49)->value;
$this->plugin( 'ahref', $gallery, 'Gallery', 'class="btn"' );
}
?>
</div>
</div>
</div><?php
}
}
Reply With Quote
  #12  
Old 08-31-2015, 02:43 AM
boioskam boioskam is offline
Mosets'd
 
Join Date: Apr 2014
Posts: 21
Default

Thanks, works like charm!!

Can I pull this trick more times, to create more buttons, or is it just a once edditing of the php file?
Reply With Quote
  #13  
Old 08-31-2015, 03:26 AM
peterwalker peterwalker is offline
Mosets'd
 
Join Date: Nov 2013
Posts: 53
Default

yes you can apply the method to add as many action links as needed.
It is possible to add a function that would simplify the process if you expect to add many buttons. It would use a markdown method and a foreach loop.

To give an idea without the actual coding 'cos it is a bit complex

You would change the custom field to a multi-line text area
Then when adding a listing and need to add buttons you would enter them in the following format
Gallery|site/gallery
---
Booking|site/booking
---
Videos|site/videos


The first part in each line separated by a vertical bar is the button label and the second is the URL. Then to add another button, you separate with 3 hyphens and repeat.
Reply With Quote
  #14  
Old 09-30-2015, 09:19 PM
boioskam boioskam is offline
Mosets'd
 
Join Date: Apr 2014
Posts: 21
Default

Hi, Peter
Other issue, when I switch to another 'listing style' the button disappears (see screenshots)




How's that possible?

I would like to use style 6, that's the last one, but than with button...

Sorry again for asking..
Reply With Quote
  #15  
Old 10-06-2015, 08:33 PM
boioskam boioskam is offline
Mosets'd
 
Join Date: Apr 2014
Posts: 21
Default

Nobody?

Probably due to the upgrade, the button I created are now gone.
How do I get them back again? When I look at the code, it has ben simplified extreem, so I don't know what to do now...
Please help!

Last edited by boioskam; 04-11-2016 at 06:35 PM.
Reply With Quote
  #16  
Old 04-11-2016, 07:10 PM
boioskam boioskam is offline
Mosets'd
 
Join Date: Apr 2014
Posts: 21
Default Out of Listing detail

I figured out how to activate the button again, but I want to not show the link in the Listing Details



When I simply switch of 'Detail View' the whole page get scrambled and an php error is visible.



Please help?!
Reply With Quote
  #17  
Old 04-12-2016, 03:28 PM
boioskam boioskam is offline
Mosets'd
 
Join Date: Apr 2014
Posts: 21
Unhappy What the hell is goeing on?

Why don't I get support???

That's not the Mosets way
Reply With Quote
  #18  
Old 04-12-2016, 03:36 PM
dknight dknight is offline
Mosets Team - Lead Developer
 
Join Date: Dec 2004
Posts: 27,205
Default

Hi!

If you're using 3.6 and above, edit the following template file:

/components/com_mtree/templates/kinabalu/sub_listingDetailsFields.tpl.php

In line 4, you'll see:
PHP Code:
$skipped_field_ids = array(1,2); 
Enter your 'Gallery' custom field ID to the array and it will prevent it from being shown under 'Listing Details'.
__________________
Lee
Lead Developer
Mosets.com - Quality Joomla! Solutions
Reply With Quote
  #19  
Old 04-13-2016, 03:45 PM
boioskam boioskam is offline
Mosets'd
 
Join Date: Apr 2014
Posts: 21
Default

Thanks!!
Sorry for my bold reaction...

Now we are on 'speaking terms' again, is there a way I can share buttons (like LinkedIn and Google+) from the listing overview site?

Thanks!!
Reply With Quote
  #20  
Old 04-13-2016, 04:54 PM
dknight dknight is offline
Mosets Team - Lead Developer
 
Join Date: Dec 2004
Posts: 27,205
Default

No problem. By 'listing overview' I suppose you mean listing summary?
__________________
Lee
Lead Developer
Mosets.com - Quality Joomla! Solutions
Reply With Quote
  #21  
Old 04-13-2016, 05:58 PM
boioskam boioskam is offline
Mosets'd
 
Join Date: Apr 2014
Posts: 21
Default

Ah back again

I found the share section in the new template, thanks. New template, new possibilities, sorry for not looking properly...
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Add download button at top of details page. angelaroberts Discussions, Troubleshooting & Problems 5 02-24-2011 06:23 AM
Backend 'Add Photo' button for Add Property does not work randy Discussions, Troubleshooting and Problems 8 03-12-2010 12:56 AM


All times are GMT +8. The time now is 05:12 AM.

Copyright © 2005-2010 Mosets Consulting

Powered by vBulletin® Version 3.8.6
Copyright ©2000 - 2023, Jelsoft Enterprises Ltd.