Champ 'price' manquant

  • Posts: 82
  • Thank you received: 15
  • Hikashop Business
1 year 9 months ago #347180

-- url of the page with the problem -- : bases-netsources.com/boutique
-- HikaShop version -- : 4.6.2

Hello,
Depuis quelques temps je reçois de Google l'avertissement "Champ 'price' manquant" pour les sites avec HikaShop déclarés dans la Search Console.
Et maintenant le message "Champ 'image' manquant"
Evidement les fiches produits ont un prix affiché et une image.
Y a-t-il moyen de corriger cela ?
Merci

Attachments:
Last edit: 7 months 3 weeks ago by Marti.

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

  • Posts: 82426
  • Thank you received: 13274
  • MODERATOR
1 year 9 months ago #347184

Bonjour,

Le souci vient des overrides de vue de la page produit.
Ils sont basés sur de vieilles versions d'HikaShop ou les meta tags en question n'étaient pas renseignés, car pas nécessaire à l'époque.
Par exemple, pour l'image, il y a ce code dans product / show_block_img:

<?php	
	if(empty($this->variant_name) && !empty($img->origin_url)) {
		if(strpos($img->origin_url, 'http://') === false && strpos($img->origin_url, 'https://') === false) {
			$url = HIKASHOP_LIVE;
			$pieces = parse_url(HIKASHOP_LIVE);
			if(!empty($pieces['path']))
				$url = substr(HIKASHOP_LIVE,0,strrpos(HIKASHOP_LIVE,$pieces['path']));
			$img->origin_url = $url.$img->origin_url;
		}
?>
		<meta itemprop="image" content="<?php echo $img->origin_url; ?>"/>
<?php
	}
}
?>
Ce code est vraissemblablement manquant dans l'override.

Pareil dans product / show_default qui contient du code pour les meta tags liés au prix:
<!-- PRICE -->
<?php
	$itemprop_offer = '';
	if (!empty($this->element->prices))
		$itemprop_offer = 'itemprop="offers" itemscope itemtype="https://schema.org/Offer"';
?>
		<span id="hikashop_product_price_main" class="hikashop_product_price_main" <?php echo $itemprop_offer; ?>>
<?php
	$main =& $this->element;
	if(!empty($this->element->main))
		$main =& $this->element->main;
	if(!empty($main->product_condition) && !empty($this->element->prices)) {
?>
			<meta itemprop="itemCondition" itemtype="https://schema.org/OfferItemCondition" content="https://schema.org/<?php echo $main->product_condition; ?>" />
<?php
	}
	if($this->params->get('show_price') && (empty($this->displayVariants['prices']) || $this->params->get('characteristic_display') != 'list')) {
		$this->row =& $this->element;
		$this->setLayout('listing_price');
		echo $this->loadTemplate();
		if (!empty($this->element->prices)) {
?>
			<meta itemprop="price" content="<?php echo $this->itemprop_price; ?>" />
			<meta itemprop="availability" content="https://schema.org/<?php echo ($this->row->product_quantity != 0) ? 'InStock' : 'OutOfstock' ;?>" />
			<meta itemprop="priceCurrency" content="<?php echo $this->currency->currency_code; ?>" />                                               
<?php	}
	}
?>		</span>
<!-- EO PRICE -->

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

  • Posts: 82
  • Thank you received: 15
  • Hikashop Business
1 year 9 months ago #347200

Hello Nicolas,
Super merci, ai corrigé :)

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

Time to create page: 0.058 seconds
Powered by Kunena Forum