display a map in a tab

  • Posts: 53
  • Thank you received: 0
8 years 5 months ago #242756

-- url of the page with the problem -- : aventures-culturelles.com/circuits-uniqu...onheur-des-cavaliers
-- HikaShop version -- : 2.6.3
-- Joomla version -- : 4.5.1
-- PHP version -- : 5.5

Hi

I used tabs to display my products and I would like to make a map display in one of them. For the map, I use Zhgooglemap plugin.

I tested the plugin Zhgooglemap in description product, it's allright. I used the following code :

{tab Localisation}
{zhgooglemap-marker: 15; placemark}

So I created a new tab and put it between "specifications" and "comments". To display a map in it, I read that I had to use the custom fields. So I created a new field.

My problems are following :

- in specifications tab, I see the code "{zhgooglemap-marker: 15; placemark}" ; but I don't want to see this information in specifications tab.
- in the new tab, the map doesn't display. I only see the code.

In the view "show-tabs", after "specification_li", I added this one :
<li id="hikashop_show_tabular_custom_li" class="hikashop_tabs_li ui-corner-top">
              <a onclick="displayTab('hikashop_show_tabular_custom');" href="javascript:void(0);"><?php echo JText::_('Attractivités');?></a></li>

Then :
<input type="hidden" name="selected_tab" id="selected_tab" value="hikashop_show_tabular_description"/>
		<?php
		if(!empty($this->element->extraData->bottomEnd))
			echo implode("\r\n",$this->element->extraData->bottomEnd);
		?>
	</div>
	<div class="hikashop_tabs_content" id="hikashop_show_tabular_custom"><?php echo $this->element->carte; ?></div>

I need help to display my map please

Then, I would like that in case the field "map" is empty, the tab doesn't appear. Could you help me with this problem too ?

Thanks a lot


Joomla 3.6.4
Hikashop Business 2.6.4
PHP 5.7
Navigateur Chrome 50 ou Mozilla 5
Website : www.aventures-culturelles.com

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
8 years 5 months ago #242779

Hi,

1. You should turn off the display of the custom field on the product page.

2. Instead of:
<?php echo $this->element->carte; ?>
You should have:
<?php echo JHTML::_('content.prepare',$this->element->carte); ?>
so that Joomla can replace content tags in your "carte" custom field.

Please Log in or Create an account to join the conversation.

  • Posts: 53
  • Thank you received: 0
8 years 5 months ago #242882

Hi
But if I turn off the custom field display, my page will not present the product as I want on the front page.

I suppose it must be possible to add something in a new tab. In your extension, I saw that it was possible to add a map. Cannot we choose where to display it (for exemple in a tab) ?

Thanks a lot


Joomla 3.6.4
Hikashop Business 2.6.4
PHP 5.7
Navigateur Chrome 50 ou Mozilla 5
Website : www.aventures-culturelles.com

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
8 years 5 months ago #242897

Hi,

I'm sorry but I think there are some misunderstandings here.
If you want to display a custom product field on the product page, you have two choices:
1. You turn on the display option of the custom field settings page, and it will display in the specifications area/tab.
That mode doesn't handle the content tags.
2. You can add where you want on your product page the code I gave you in my previous message. It will handle the content tags, and allow you to display the custom field value wherever you want on the product page, even in a tab.

So what I replied previously seems to answer your question as far as I can see. But maybe I'm missing something ?

Please Log in or Create an account to join the conversation.

  • Posts: 53
  • Thank you received: 0
8 years 5 months ago #243115

Hi,

I tried different things but nothing works. Perhaps I wasn't clear enough and there is a misunderstanding. So I am going to explain what I mean in another way.

I use the plugin Zhgooglemap in Hikashop product through two ways :

1/ My product display with default custom. In product description, I manually add tabs. In one of them, I display the map I want (Let's see picture 1 for backend - picture 2 for frontend)

2/ My product display with show-tab custom. In the product, I have added personnalized fields (one for the map). In the view "show-tabular", I have added the code described hereunder to add a tab in between description and specifications.

In the view, if I replace

<?php echo $this->element->carte; ?>
with your code
<?php } ?>
      <input type="hidden" name="selected_tab" id="selected_tab" value="hikashop_show_tabular_description"/>
		<?php
		if(!empty($this->element->extraData->bottomEnd))
			echo implode("\r\n",$this->element->extraData->bottomEnd);
		?>
	</div>
	<div class="hikashop_tabs_content" id="hikashop_show_tabular_custom">[color=#bb0000]< ? Php echo JHTML :: _ ( 'content.prepare', $ this-> element-> carte);? ?>[/color]</div>
  	<?php if(!empty($this->element->carte)){ ?> <?php } ?>
  </div>
<script type="text/javascript">
	if(typeof(hkjQuery) == "undefined") window.hkjQuery = window.jQuery;
	window.hikashop.ready( function(){
		var selectedTab = hkjQuery( "#selected_tab" ).val();
		hkjQuery("#hikashop_tabs_div").children("div").css("display","none");
		hkjQuery("#"+selectedTab+"_li").addClass("hikashop_tabs_li_selected");
		hkjQuery("#"+selectedTab).css("display","inherit");
		hkjQuery("#hikashop_tabs_div .hikashop_tabs_ul li").click(function(){
			var currentLi = hkjQuery(this).attr("id");
			var currentDiv = currentLi.replace("_li","");
			hkjQuery("#hikashop_tabs_div").children("div").css("display","none");
			hkjQuery("#hikashop_tabs_div").children("form").children("div").css("display","none");
			hkjQuery("#"+currentDiv).css("display","inherit");
			hkjQuery(".hikashop_tabs_li_selected" ).removeClass("hikashop_tabs_li_selected");
			hkjQuery("#"+currentLi).addClass("hikashop_tabs_li_selected");
		});
	});
</script>
,

it doesn't work. (See backend in picture 3 - frontend in picture 4). Did I do something wrong ?

What I need ?... To display a specific map in each product page, in the third tab, and if none, to hide the tab.

Thanks a lot for your help


Joomla 3.6.4
Hikashop Business 2.6.4
PHP 5.7
Navigateur Chrome 50 ou Mozilla 5
Website : www.aventures-culturelles.com
Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
8 years 5 months ago #243138

Hi,

In your message, you say that you've added the code:

< ? Php echo JHTML :: _ ( 'content.prepare', $ this-> element-> carte);? ?>
while I told you to add the code:
<?php echo JHTML::_('content.prepare',$this->element->carte); ?>
That's why it doesn't work.

Please Log in or Create an account to join the conversation.

  • Posts: 53
  • Thank you received: 0
8 years 5 months ago #243358

Ooops ! One "?" was too much. You have the good eye ! Thanks.

I noticed that if I click on the third tab, and then go on another tab, the map display at the bottom of each tab. Is it possible to restrict her display on third tab only ?

And what about the possibility to hide third tab if personnalized map field is empty ?

I'm most gratefull for your help. Thanks in advance


Joomla 3.6.4
Hikashop Business 2.6.4
PHP 5.7
Navigateur Chrome 50 ou Mozilla 5
Website : www.aventures-culturelles.com

Please Log in or Create an account to join the conversation.

  • Posts: 82863
  • Thank you received: 13372
  • MODERATOR
8 years 5 months ago #243366

1.
Then it means that you have a problem in the code somewhere.
Please provide the whole code you have on that file so that we can look at it.
2.
Suppose that you use this code to display the tab title:

<li id="hikashop_show_tabular_custom_li" class="hikashop_tabs_li ui-corner-top">
              <a onclick="displayTab('hikashop_show_tabular_custom');" href="javascript:void(0);"><?php echo JText::_('Attractivités');?></a></li>
you can use instead this code and it will display it only when the carte custom field is not empty:
<?php if(!empty($this->element->carte)){ ?><li id="hikashop_show_tabular_custom_li" class="hikashop_tabs_li ui-corner-top">
              <a onclick="displayTab('hikashop_show_tabular_custom');" href="javascript:void(0);"><?php echo JText::_('Attractivités');?></a></li><?php } ?>

Please Log in or Create an account to join the conversation.

Time to create page: 0.069 seconds
Powered by Kunena Forum