diff options
Diffstat (limited to 'views')
| -rw-r--r-- | views/produktseite/produkt.phtml | 27 | ||||
| -rw-r--r-- | views/produkttemplates/standard.phtml | 3 | ||||
| -rw-r--r-- | views/produkttemplates/standard2.phtml | 13 | ||||
| -rw-r--r-- | views/produkttemplates/standard3.phtml | 9 |
4 files changed, 23 insertions, 29 deletions
diff --git a/views/produktseite/produkt.phtml b/views/produktseite/produkt.phtml index 962c359..22d14e0 100644 --- a/views/produktseite/produkt.phtml +++ b/views/produktseite/produkt.phtml @@ -41,16 +41,8 @@ <?php if ($bMainProduct) echo \wpsg\ProductPage::breadcrumbs($oProduct); ?> - <div itemscope itemtype="http://schema.org/Product" class="wpsg_produkt wpsg_produkt_<?php echo $this->view['data']['id']; ?>"> - - <meta itemprop="name" content="<?php echo wpsg_hspc($oProduct->getProductName()); ?>" /> - <meta itemprop="detailname" content="<?php echo wpsg_hspc($this->view['data']['detailname']); ?>" /> - - <?php foreach ($oProduct->getAllProductCodes() as $product_code) { ?> - <?php if ($product_code['itemprop'] !== null) { ?> - <meta itemprop="<?php echo $product_code['itemprop']; ?>" content="<?php echo $product_code['code']; ?>" /> - <?php } ?> - <?php } ?> + <?php /* Strukturierte Daten stehen als JSON-LD im Kopf der Seite (ProductSchema), daher hier keine Microdata */ ?> + <div class="wpsg_produkt wpsg_produkt_<?php echo $this->view['data']['id']; ?>"> <?php /* Zweispaltig: Bilder links, Angaben rechts; schmal untereinander (Punkt 8.1) */ ?> <div class="wpsg-product__main"> @@ -77,8 +69,6 @@ <?php /* URL für die Lightbox */ ?> <?php $att = wp_get_attachment_image_src($attachment_id, 'large', false); ?> - <meta itemprop="image" content="<?php echo esc_url((string)($att[0]??'')); ?>" /> - <a class="wpsg-product__image" <?php if ($attachment_id != $arAttachmentID) echo 'style="display:none;"'; ?> rel="gallery-wpsg-<?php echo $this->getTemplateIndex(); ?>" title="<?php echo esc_attr($oProduct->getProductName()); ?>" href="<?php echo esc_url((string)($att[0]??'')); ?>" data-fslightbox="<?php echo $this->getTemplateIndex(); ?>" data-wpsg-image="<?php echo intval($i); ?>"> <?php /* Sichtbares Bild des Hauptprodukts sofort und zuerst laden, verborgene erst beim Zeigen (W6) */ $bShown = ($attachment_id == $arAttachmentID); ?> <?php echo wp_get_attachment_image($attachment_id, 'large', false, ['sizes' => '(min-width: 800px) 50vw, 100vw', 'loading' => (($bShown && $bMainProduct)?false:'lazy'), 'fetchpriority' => (($bShown && $bMainProduct)?'high':'auto')]); ?> @@ -124,10 +114,7 @@ <?php if ($oProduct->canDisplayPrice()) { $price = $oProduct->getPrice($this->view['data']['product_key']); $oldPrice = $oProduct->getOldPrice(); $hint_id = \wpsg\Blocks::kleinunternehmerHintID('product-'.$oProduct->getId()); ?> - <div itemprop="offers" itemscope itemtype="http://schema.org/Offer" class="wpsg_produkt_preis wpsg-product__price"> - - <meta itemprop="priceCurrency" content="<?php echo esc_attr($this->get_option('wpsg_currency')); ?>" /> - <meta itemprop="price" content="<?php echo esc_attr((string)$price); ?>" /> + <div class="wpsg_produkt_preis wpsg-product__price"> <?php if ($oldPrice !== false && $oldPrice != $price) { ?> <span class="wpsg_mod_productview_price wpsg_mod_productview_current"><?php echo wpsg_price_html($price, 'product'); ?></span> @@ -196,7 +183,7 @@ <?php /* Kurzbeschreibung; der Kurztext weiter unten nur, wenn er etwas anderes sagt (W2) */ $shortdesc_text = trim(wp_strip_all_tags((string)($this->view['data']['shortdesc']??''))); ?> <?php if ($shortdesc_text !== '') { ?> - <div itemprop="description" class="wpsg_produkt_shortdescription"> + <div class="wpsg_produkt_shortdescription"> <span><?php echo $this->view['data']['shortdesc']; ?></span> @@ -268,7 +255,7 @@ <?php $kurztext = trim(wp_strip_all_tags((string)($this->view['data']['beschreibung']??''))); if ($kurztext !== '' && $kurztext !== $shortdesc_text) { ?> <div class="wpsg_product_information_short"> <div class="wpsg_produkt_additional_information"> - <div itemprop="description" class="wpsg_produkt_shortdescription"> + <div class="wpsg_produkt_shortdescription"> <span><?php echo $this->view['data']['beschreibung']; ?></span> </div> </div> @@ -379,7 +366,7 @@ <li class="wpsg_artikelnummer"><?php echo esc_html__('Artikelnummer', 'wpsg'); ?>: <span class="wpsg_anr"><?php echo esc_html((string)$oProduct->getNr()); ?></span></li> <?php } ?> <?php if ($manufacturer !== '') { ?> - <li class="wpsg-product__manufacturer"><?php echo esc_html__('Hersteller', 'wpsg'); ?>: <span itemprop="manufacturer"><?php echo esc_html($manufacturer); ?></span></li> + <li class="wpsg-product__manufacturer"><?php echo esc_html__('Hersteller', 'wpsg'); ?>: <?php echo esc_html($manufacturer); ?></li> <?php } ?> <?php foreach ($arProductCodes as $product_code) { ?> <li class="product_code <?php echo esc_attr($product_code['code_key']); ?>"><span class="label"><?php echo esc_html($product_code['label']); ?></span>: <span class="code"><?php echo esc_html($product_code['code']); ?></span></li> @@ -398,7 +385,7 @@ <?php /* Benannte Landmarke nur beim Hauptprodukt; nachgeordnete Produkte hätten sonst gleichnamige (axe landmark-unique) */ $section_tag = (($bMainProduct)?'section':'div'); ?> <<?php echo $section_tag; ?> class="wpsg-product__section wpsg_produkt_<?php echo esc_attr($field); ?>"<?php if ($bMainProduct) { ?> aria-labelledby="<?php echo esc_attr($section_id); ?>"<?php } ?>> <h<?php echo $nSectionLevel; ?> id="<?php echo esc_attr($section_id); ?>" class="wpsg-product__section-title"><?php echo esc_html($title); ?></h<?php echo $nSectionLevel; ?>> - <div<?php echo (($field === 'longdescription')?' itemprop="description"':''); ?>><?php echo $this->view['data'][$field]; ?></div> + <div><?php echo $this->view['data'][$field]; ?></div> </<?php echo $section_tag; ?>> <?php } ?> <?php /* Abschnitte ENDE */ ?> diff --git a/views/produkttemplates/standard.phtml b/views/produkttemplates/standard.phtml index c908dea..82cc85d 100644 --- a/views/produkttemplates/standard.phtml +++ b/views/produkttemplates/standard.phtml @@ -40,7 +40,6 @@ <div itemscope itemtype="http://schema.org/Product" class="wpsg_produkt wpsg_produkt_<?php echo $this->view['data']['id']; ?>">
<meta itemprop="name" content="<?php echo wpsg_hspc($oProduct->getProductName()); ?>" />
- <meta itemprop="detailname" content="<?php echo wpsg_hspc($this->view['data']['detailname']); ?>" />
<?php foreach ($oProduct->getAllProductCodes() as $product_code) { ?>
<?php if ($product_code['itemprop'] !== null) { ?>
@@ -111,7 +110,7 @@ <div itemprop="offers" itemscope itemtype="http://schema.org/Offer" class="wpsg_produkt_preis">
- <meta itemprop="priceCurrency" content="<?php echo $this->get_option('wpsg_currency'); ?>" />
+ <?php /* Nur ein gültiger ISO-Code, das Feld „Währung“ ist frei */ $schema_currency = \wpsg\ProductSchema::currency((string)$this->get_option('wpsg_currency')); if ($schema_currency !== null) { ?><meta itemprop="priceCurrency" content="<?php echo esc_attr($schema_currency); ?>" /><?php } ?>
<meta itemprop="price" content="<?php echo $this->view['oProduct']->getPrice($this->view['data']['product_key']); ?>" />
<?php echo __('Stückpreis:', 'wpsg'); ?>
diff --git a/views/produkttemplates/standard2.phtml b/views/produkttemplates/standard2.phtml index d2c072e..6308039 100644 --- a/views/produkttemplates/standard2.phtml +++ b/views/produkttemplates/standard2.phtml @@ -46,10 +46,14 @@ <div itemscope itemtype="http://schema.org/Product" class="wpsg_produkt wpsg_produkt_<?php echo $this->view['data']['id']; ?>">
- <meta itemprop="url" content="<?php echo $oProduct->getProductURL().'?test'; ?>" />
+ <meta itemprop="url" content="<?php echo esc_url($oProduct->getProductURL()); ?>" />
<meta itemprop="name" content="<?php echo wpsg_hspc($this->getProductName($this->view['data']['id'])); ?>" />
- <meta itemprop="detailname" content="<?php echo wpsg_hspc($this->getProductName($this->view['data']['id']).' / '.rtrim(($var_info['key']??''), ' /')); ?>" />
- <meta itemprop="sku" content="<?php echo wpsg_hspc($oProduct->getEAN()); ?>" />
+
+ <?php foreach ($oProduct->getAllProductCodes() as $product_code) { ?>
+ <?php if ($product_code['itemprop'] !== null) { ?>
+ <meta itemprop="<?php echo esc_attr($product_code['itemprop']); ?>" content="<?php echo esc_attr($product_code['code']); ?>" />
+ <?php } ?>
+ <?php } ?>
<?php /* Block für die Produktbilder START */ ?>
<?php
@@ -111,7 +115,8 @@ <div itemprop="offers" itemscope itemtype="http://schema.org/Offer" class="wpsg_produkt_preis">
- <meta itemprop="priceCurrency" content="<?php echo $this->get_option('wpsg_currency'); ?>" />
+ <?php /* Nur ein gültiger ISO-Code, das Feld „Währung“ ist frei */ $schema_currency = \wpsg\ProductSchema::currency((string)$this->get_option('wpsg_currency')); if ($schema_currency !== null) { ?><meta itemprop="priceCurrency" content="<?php echo esc_attr($schema_currency); ?>" /><?php } ?>
+ <meta itemprop="price" content="<?php echo esc_attr((string)$this->view['oProduct']->getPrice($this->view['data']['product_key'])); ?>" />
<?php echo __('Stückpreis:', 'wpsg'); ?>
diff --git a/views/produkttemplates/standard3.phtml b/views/produkttemplates/standard3.phtml index 567a308..c305178 100644 --- a/views/produkttemplates/standard3.phtml +++ b/views/produkttemplates/standard3.phtml @@ -62,9 +62,9 @@ <div>
<?php if (!$this->titleDisplayed) { ?>
- <h1 itemprop="name" class="wpsg_producttitle"><?php echo $this->getProductName($this->view['data']['id']); ?></h1>
+ <h1 class="wpsg_producttitle"><?php echo $this->getProductName($this->view['data']['id']); ?></h1>
<?php if (($this->view['data']['detailname']??'') !== '' && $this->getProductName($this->view['data']['id']) !== $this->view['data']['detailname']) { ?>
- <h2 itemprop="detailname" class="wpsg_productdetailtitle"><?php echo wp_kses_post($this->view['data']['detailname']); ?></h2>
+ <h2 class="wpsg_productdetailtitle"><?php echo wp_kses_post($this->view['data']['detailname']); ?></h2>
<?php } ?>
<?php } ?>
@@ -74,6 +74,8 @@ <div itemscope itemtype="http://schema.org/Product" class="wpsg_produkt wpsg_produkt_<?php echo $this->view['data']['id']; ?>">
+ <meta itemprop="name" content="<?php echo wpsg_hspc($this->getProductName($this->view['data']['id'])); ?>" />
+
<?php if ($this->get_option('wpsg_showArticelnumber') == '1') { ?>
<div class="wpsg_artikelnummer">
<?php echo __('Artikelnummer', 'wpsg'); ?>: <span class="wpsg_anr"><?php echo wpsg_hspc($oProduct->getNr()); ?></span><br />
@@ -100,7 +102,8 @@ <div itemprop="offers" itemscope itemtype="http://schema.org/Offer" class="wpsg_produkt_preis">
- <meta itemprop="priceCurrency" content="<?php echo $this->get_option('wpsg_currency'); ?>" />
+ <?php /* Nur ein gültiger ISO-Code, das Feld „Währung“ ist frei */ $schema_currency = \wpsg\ProductSchema::currency((string)$this->get_option('wpsg_currency')); if ($schema_currency !== null) { ?><meta itemprop="priceCurrency" content="<?php echo esc_attr($schema_currency); ?>" /><?php } ?>
+ <meta itemprop="price" content="<?php echo esc_attr((string)$this->view['oProduct']->getPrice($this->view['data']['product_key'])); ?>" />
<?php echo __('Stückpreis:', 'wpsg'); ?>
|
