ajout d'onglet

  • Posts: 53
  • Thank you received: 0
8 years 3 months ago #241944

-- HikaShop version -- : 2.6.3
-- Joomla version -- : 4.5.1

Bonjour

J'ai cherché dans le forum jusque plus de 2 mois en arrière, mais je n'ai rien trouvé sur ce sujet.

Je voudrais ajouter un onglet dans l'affichage du produit, en plus de description, spécifications, commentaires etc... Est-ce possible et comment s'il vous plait ?

En vous remerciant bcp


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: 26121
  • Thank you received: 4023
  • MODERATOR
8 years 3 months ago #241948

Bonjour,

Moins de 2 mois : www.hikashop.com/forum/product-category-...ew-product-page.html
En Français (via une recherche sur "onglet") : www.hikashop.com/forum/product-category-.../876690-onglets.html

Cordialement,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 53
  • Thank you received: 0
8 years 3 months ago #242047

Merci Jérôme, je consulte le lien en français, car en anglais, je ne comprends pas tout ; résultats : souvent des bugs après, donc...

Encore merci


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: 53
  • Thank you received: 0
8 years 3 months ago #242060

Bonjour

J'ai créé un onglet selon vos indications et je l'ai placé où je voulais entre les tabs "spécifications" et "commentaires".
En lisant les posts pour trouver comment publier des données dans ce nouvel onglet, j'ai compris qu'il fallait utiliser les champs personnalisés. J'ai donc créé un champs "carte utile", car je veux faire apparaitre une carte,hélas sans succès après avoir testé les modes texte, zone de texte, champs personnalisé... . Pour tester, j'ai laissé du texte simple. Sauf que ce texte s'affiche dans toutes les tabs, ce qu'évidemment je ne veux pas. Le champ "carte utile" apparait également dans les spécifications, ce que je ne veux pas non plus.
[url=http://http://aventures-culturelles.com/circuits-uniques/product/au-bonheur-des-cavaliers]Voir le problème[/url]

Dans le show-tabs, voici ce que j'ai mis après la ligne "specification_li"

<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>

puis vers la fin du show_tabs
<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>

J'ai masqué cet onglet via la catégorie comme suggéré par Nicolas dans l'un des posts, pour que l'onglet ne s'affiche que sur les produits concernés.

Pour la carte à afficher, il s'agit de Zhgooglemap. Elle peut être appelée depuis la page descriptif, j'imagine donc qu'il est possible de l'appeler dans un autre onglet.

Un grand merci pour votre aide


Joomla 3.6.4
Hikashop Business 2.6.4
PHP 5.7
Navigateur Chrome 50 ou Mozilla 5
Website : www.aventures-culturelles.com
Last edit: 8 years 3 months ago by Nathy78.

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

  • Posts: 13201
  • Thank you received: 2322
8 years 3 months ago #243586

Bonjour,

Vous semblez utiliser une ancienne version de la vue, merci d'utiliser ce code (il inclut la partie souhaitée):

<?php

//shitty fix to avoid the faebook js to conflict with the tab JS with the SEF activated...
/*
if(strpos(hikashop_currentURL(),'?fb_action_ids=')){
	$app = Jfactory::getApplication();
	$parts = explode('?',hikashop_currentURL());
	$app->redirect($parts[0]);
}
*/
hikashop_loadJslib('jquery');
$js = '';
$params = null;
$this->params->set('vote_type','product');
if(isset($this->element->main)){
	$product_id = $this->element->main->product_id;
}else{
	$product_id = $this->element->product_id;
}
$this->params->set('vote_ref_id',$product_id);
$this->params->set('productlayout','show_tabular');
$layout_vote_mini = hikashop_getLayout('vote', 'mini', $this->params, $js);
$layout_vote_listing = hikashop_getLayout('vote', 'listing', $this->params, $js);
$layout_vote_form = hikashop_getLayout('vote', 'form', $this->params, $js);
$config =& hikashop_config();
$status_vote = $config->get('enable_status_vote');
// Hide or display the specifications of the product
$hide_specs = 1;
if($this->element->product_manufacturer_id != 0 || $this->element->product_weight != 0 || $this->element->product_width != 0 || $this->element->product_height != 0 || $this->element->product_length != 0 || @$this->element->main->product_weight != 0 || @$this->element->main->product_width != 0 || @$this->element->main->product_height != 0 || @$this->element->main->product_length != 0)
	$hide_specs = 0;
foreach ($this->fields as $fieldName => $oneExtraField) {
	$value = '';
	if(empty($this->element->$fieldName) && !empty($this->element->main->$fieldName))$this->element->$fieldName = $this->element->main->$fieldName;
	if(isset($this->element->$fieldName))
		$value = trim($this->element->$fieldName);
	if(!empty($value)){
		$hide_specs = 0;
		break;
	}
}

// EO Hide or Display the specifications of the product
?>
<div id="hikashop_product_top_part" class="hikashop_product_top_part">
<?php if(!empty($this->element->extraData->topBegin)) { echo implode("\r\n",$this->element->extraData->topBegin); } ?>
	<h1>
		<span id="hikashop_product_name_main" class="hikashop_product_name_main" itemprop="name">
			<?php
			if (hikashop_getCID('product_id')!=$this->element->product_id && isset ($this->element->main->product_name))
				echo $this->element->main->product_name;
			else
				echo $this->element->product_name;
			?>
		</span>
		<?php if ($this->config->get('show_code')) { ?>
		<span id="hikashop_product_code_main" class="hikashop_product_code_main" itemprop="sku">
			<span id="hikashop_product_code_main" class="hikashop_product_code_main">
				<?php
				echo $this->element->product_code;
				?>
			</span>
		</span>
		<?php } ?>
	</h1>
<?php if(!empty($this->element->extraData->topEnd)) { echo implode("\r\n",$this->element->extraData->topEnd); } ?>
	<?php
	$this->setLayout('show_block_social');
	echo $this->loadTemplate();
		?>
</div>
<?php if(HIKASHOP_RESPONSIVE){ ?>
	<div class="<?php echo HK_GRID_ROW; ?>">
<?php } ?>
<div id="hikashop_product_left_part" class="hikashop_product_left_part <?php echo HK_GRID_COL_6; ?>">
	<?php
	if(!empty($this->element->extraData->leftBegin)) { echo implode("\r\n",$this->element->extraData->leftBegin); }

	//LAYOUT show_block_img
	$this->row = & $this->element;
	$this->setLayout('show_block_img');
	echo $this->loadTemplate();
	?>
	<div id="hikashop_product_description_main_mini" class="hikashop_product_description_main_mini">
		<?php
		//DISPLAY the product description
		if(!empty($this->element->product_description)){
			$resume = substr(strip_tags(preg_replace('#<hr *id="system-readmore" */>.*#is','',$this->element->product_description)),0,300);
			if (!empty($this->element->product_description) && strlen($this->element->product_description)>300)
				$resume .= " ...<a href='#hikashop_show_tabular_description'>".JText::_('READ_MORE')."</a>";
			echo JHTML::_('content.prepare',$resume);
		}
		?>
	</div>
	<?php if(!empty($this->element->extraData->leftEnd)) { echo implode("\r\n",$this->element->extraData->leftEnd); } ?>
</div>
<div id="hikashop_product_right_part" class="hikashop_product_right_part <?php echo HK_GRID_COL_6; ?>">
	<?php
	if(!empty($this->element->extraData->rightBegin))
		echo implode("\r\n",$this->element->extraData->rightBegin);
	?>
	<span id="hikashop_product_price_main" class="hikashop_product_price_main" itemprop="offers" itemscope itemtype="http://schema.org/Offer">
		<?php
		//LAYOUT listing_price
		if ($this->params->get('show_price')) {
			$this->row = & $this->element;
			$this->setLayout('listing_price');
			echo $this->loadTemplate();

			//Currency code for Micro Data/request SQL  :
			$CurrId = hikashop_getCurrency();
			$null = null;
			$currency = $this->currencyHelper->getCurrencies($CurrId, $null);
			$CurrCode = $currency[$CurrId]->currency_code;

		?>
			<meta itemprop="priceCurrency" content="<?php echo $CurrCode; ?>" />
		<?php
		}
		?>
	</span><br />
	<div id="hikashop_product_vote_mini" class="hikashop_product_vote_mini">
		<?php
		//LAYOUT show the rating stars
		if($this->params->get('show_vote_product') == '-1'){
			$this->params->set('show_vote_product',$config->get('show_vote_product'));
		}
		if($this->params->get('show_vote_product')){
			echo $layout_vote_mini;
		}
		?>
	</div>
	<?php
	if($this->params->get('characteristic_display')!='list'){
		//LAYOUT show_block_charasteristic
		$this->setLayout('show_block_characteristic');
		echo $this->loadTemplate();
		?>
		<br />
		<?php
	}
	$form = ',0';
	if (!$this->config->get('ajax_add_to_cart', 1)) {
		$form = ',\'hikashop_product_form\'';
	}
	if (hikashop_level(1) && !empty ($this->element->options)) {
	?>
		<div id="hikashop_product_options" class="hikashop_product_options">
			<?php
			//LAYOUT option
			$this->setLayout('option');
			echo $this->loadTemplate();
			?>
		</div>
		<br />
		<?php
		$form = ',\'hikashop_product_form\'';
		if ($this->config->get('redirect_url_after_add_cart', 'stay_if_cart') == 'ask_user') {
		?>
			<input type="hidden" name="popup" value="1"/>
		<?php
		}
	}
	if (!$this->params->get('catalogue') && ($this->config->get('display_add_to_cart_for_free_products') ||  ($this->config->get('display_add_to_wishlist_for_free_products', 1) && hikashop_level(1) && $this->params->get('add_to_wishlist') && $config->get('enable_wishlist', 1)) || !empty ($this->element->prices))) {
		if (!empty ($this->itemFields)) {
			$form = ',\'hikashop_product_form\'';
			if ($this->config->get('redirect_url_after_add_cart', 'stay_if_cart') == 'ask_user') {
			?>
				<input type="hidden" name="popup" value="1"/>
			<?php
			}
			//LAYOUT show_block_custom_item
			$this->setLayout('show_block_custom_item');
			echo $this->loadTemplate();
		}
	}
	$this->formName = $form;
	if($this->params->get('show_price')){ ?>
		<span id="hikashop_product_price_with_options_main" class="hikashop_product_price_with_options_main"></span>
	<?php } ?>
	<?php $contact = $this->config->get('product_contact',0); ?>
	<div id="hikashop_product_contact_main" class="hikashop_product_contact_main">
		<?php
		if (hikashop_level(1) && ($contact == 2 || ($contact == 1 && !empty ($this->element->product_contact)))) {
			$empty = '';
			$params = new HikaParameter($empty);
			global $Itemid;
			$url_itemid='';
			if(!empty($Itemid)){
				$url_itemid='&Itemid='.$Itemid;
			}
			echo $this->cart->displayButton(JText :: _('CONTACT_US_FOR_INFO'), 'contact_us', $params, hikashop_completeLink('product&task=contact&cid=' . $this->element->product_id.$url_itemid), 'window.location=\'' . hikashop_completeLink('product&task=contact&cid=' . $this->element->product_id.$url_itemid) . '\';return false;');
		}
		?>
	</div>
	<?php
	if(!empty($this->element->extraData->rightMiddle))
		echo implode("\r\n",$this->element->extraData->rightMiddle);
	?>
	<span id="hikashop_product_id_main" class="hikashop_product_id_main">
		<input type="hidden" name="product_id" value="<?php echo $this->element->product_id; ?>" />
	</span>
	<br />
<?php if(empty ($this->element->characteristics) || $this->params->get('characteristic_display')!='list'){ ?>
		<div id="hikashop_product_quantity_main" class="hikashop_product_quantity_main"><?php
			//LAYOUT quantity
			$this->row = & $this->element;
			$this->ajax = 'if(hikashopCheckChangeForm(\'item\',\'hikashop_product_form\')){ return hikashopModifyQuantity(\'' . $this->row->product_id . '\',field,1' . $form . ',\'cart\'); } else { return false; }';
			$this->setLayout('quantity');
			echo $this->loadTemplate();
		?></div>
<?php
	}
	//LAYOUT show_product_product_files
	$this->setLayout('show_block_product_files');
	echo $this->loadTemplate();

	if(HIKASHOP_J30) {
		$this->setLayout('show_block_tags');
		echo $this->loadTemplate();
	}

	if(!empty($this->element->extraData->rightEnd))
		echo implode("\r\n",$this->element->extraData->rightEnd);
?>
</div>
<?php if(HIKASHOP_RESPONSIVE){ ?>
	</div>
<?php } ?>
	<input type="hidden" name="cart_type" id="type" value="cart"/>
	<input type="hidden" name="add" value="1"/>
	<input type="hidden" name="ctrl" value="product"/>
	<input type="hidden" name="task" value="updatecart"/>
	<input type="hidden" name="return_url" value="<?php echo urlencode(base64_encode(urldecode($this->redirect_url)));?>"/>
</form>
<div id="hikashop_product_bottom_part" class="hikashop_product_bottom_part show_tabular">
	<div id="hikashop_tabs_div">
		<ul class="hikashop_tabs_ul">
			<li id="hikashop_show_tabular_description_li" class="hikashop_tabs_li ui-corner-top"><?php echo JText::_('PRODUCT_DESCRIPTION');?></li>
			<?php if($hide_specs == 0){ ?>
			<li id="hikashop_show_tabular_specification_li" class="hikashop_tabs_li ui-corner-top"><?php echo JText::_('SPECIFICATIONS');?></li>
			<?php }?>
			<li id="hikashop_show_tabular_attractivite_li" class="hikashop_tabs_li ui-corner-top"><?php echo JText::_('Attractivités');?></li>
			<?php
			if($status_vote == "comment" || $status_vote == "two" || $status_vote == "both" ){
			?>
			<li id="hikashop_show_tabular_comment_li" class="hikashop_tabs_li ui-corner-top"><?php echo JText::_('PRODUCT_COMMENT');?></li>
			<li id="hikashop_show_tabular_new_comment_li" class="hikashop_tabs_li ui-corner-top"><?php echo JText::_('PRODUCT_NEW_COMMENT');?></li>
			<?php } ?>
		</ul>
		<?php
		if(!empty($this->element->extraData->bottomBegin))
			echo implode("\r\n",$this->element->extraData->bottomBegin);
		?>
		<div class="hikashop_tabs_content" id="hikashop_show_tabular_attractivite">
			<?php echo JHTML::_('content.prepare',$this->element->carte); ?>
		</div>
		<div class="hikashop_tabs_content" id="hikashop_show_tabular_description">
			<div id="hikashop_product_description_main" class="hikashop_product_description_main" itemprop="description">
				<?php
				echo JHTML::_('content.prepare',preg_replace('#<hr *id="system-readmore" */>#i','',$this->element->product_description));
				?>
			</div>
			<span id="hikashop_product_url_main" class="hikashop_product_url_main">
				<?php
				if (!empty ($this->element->product_url)) {
					//DISPLAY the manufacturer
					echo JText :: sprintf('MANUFACTURER_URL', '<a href="' . $this->element->product_url . '" target="_blank">' . $this->element->product_url . '</a>');
				}
				?>
			</span>
		</div>
		<?php if($hide_specs == 0){ ?>
		<div class="hikashop_tabs_content" id="hikashop_show_tabular_specification">
		<?php
			//LAYOUT show_block_dimensions
			$this->setLayout('show_block_dimensions');
			echo $this->loadTemplate();
			if(!empty($this->fields)){
				//LAYOUT show_block_custom_main
				$this->setLayout('show_block_custom_main');
				echo $this->loadTemplate();
			}
		?>
		</div>
		<?php }
if($status_vote == "comment" || $status_vote == "two" || $status_vote == "both" ){ ?>
		<form action="<?php echo hikashop_currentURL() ?>" method="post" name="adminForm_hikashop_comment_form" id="hikashop_comment_form">
			<?php
			if(!empty($this->element->extraData->bottomMiddle))
				echo implode("\r\n",$this->element->extraData->bottomMiddle);
			?>
			<div class="hikashop_tabs_content" id="hikashop_show_tabular_comment">
				<div id="hikashop_vote_listing" data-votetype="product" class="hikashop_product_vote_listing">
					<?php
						//Layout show the comment listing
						echo $layout_vote_listing;
					?>
				</div>
			</div>
			<div class="hikashop_tabs_content" id="hikashop_show_tabular_new_comment">
				<div id="hikashop_vote_form" data-votetype="product" class="hikashop_product_vote_form">
					<?php
						//Layout show the comment form
						echo $layout_vote_form;
					?>
				</div>
			</div>
		</form>
<?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>
<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>

Pour ne pas l'avoir dans la partie "spécification" il faut éditer la vue "product / show_block_custom_main" et ajouter une condition "if" tel que:
if($fieldName == "carte") continue;

Comment fonctionne "Zhgooglemap" ? Il faut mettre un tag qui va être interprété par le plugin ?
Que mettez vous comme valeur dans le champ personnalisé ?

ps: un champ texte devrait être suffisant.

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

Time to create page: 0.072 seconds
Powered by Kunena Forum