diff options
| -rw-r--r-- | views/produktseite/produkt.phtml | 17 |
1 files changed, 11 insertions, 6 deletions
diff --git a/views/produktseite/produkt.phtml b/views/produktseite/produkt.phtml index 507f07e..4ce57be 100644 --- a/views/produktseite/produkt.phtml +++ b/views/produktseite/produkt.phtml @@ -19,15 +19,20 @@ $oProduct = $this->view['oProduct']; if (($this->view['data']['product_key']??'') !== '') $oProduct->setProductKey($this->view['data']['product_key']); - // Ähnliche Produkte usw. stehen im Hauptprodukt; nur das Hauptprodukt bekommt die Brotkrumen + // Nur das Hauptprodukt bekommt Brotkrumen und H1; ähnliche und eingebettete Produkte H2 (K67) $bMainProduct = \wpsg\ProductPage::isMain(\wpsg\ProductPage::enter(), (bool)$this->noReleatedProducts); + // titleDisplayed: Die Seite zeigt den Titel. Für ähnliche Produkte gilt er nicht, sie stehen nach dem Hauptprodukt. + $bRelated = (!$bMainProduct && $this->noReleatedProducts && ($_REQUEST['action']??'') !== 'wpsg_productvariants_switch'); + $bTitleByPage = ($this->titleDisplayed && !$bRelated && !($bMainProduct && \wpsg\ProductPage::templateWithoutTitle())); + $nTitleLevel = \wpsg\ProductPage::titleLevel($bMainProduct, (bool)$bTitleByPage); + $nSectionLevel = (($bMainProduct)?2:3); ?> <div class="wpsg_produkt_wrapper wpsg-product"> <input type="hidden" name="wpsg_post_id" value="<?php echo get_the_ID(); ?>" /> - <input type="hidden" name="titleDisplayed" value="<?php echo $this->titleDisplayed; ?>" /> + <input type="hidden" name="titleDisplayed" value="<?php echo (($bTitleByPage)?'1':''); ?>" /> <?php if (!$bMainProduct) { ?><input type="hidden" name="wpsg_sub_product" value="1" /><?php } ?> @@ -97,10 +102,10 @@ <div class="wpsg_produkt wpsg_product_name"> - <?php if (!$this->titleDisplayed) { ?> - <h1 class="wpsg_producttitle"><?php echo $oProduct->getProductName(); ?></h1> + <?php if ($nTitleLevel > 0) { ?> + <h<?php echo $nTitleLevel; ?> class="wpsg_producttitle"><?php echo $oProduct->getProductName(); ?></h<?php echo $nTitleLevel; ?>> <?php if (($this->view['data']['detailname']??'') !== '' && $oProduct->getProductName() !== $this->view['data']['detailname']) { ?> - <h2 class="wpsg_productdetailtitle"><?php echo wp_kses_post($this->view['data']['detailname']); ?></h2> + <p class="wpsg_productdetailtitle"><?php echo wp_kses_post($this->view['data']['detailname']); ?></p> <?php } ?> <?php } ?> @@ -384,7 +389,7 @@ <?php foreach (['longdescription' => __('Beschreibung', 'wpsg'), 'moreinfos' => __('Zusätzliche Informationen', 'wpsg'), 'moreinfos2' => __('Lieferumfang', 'wpsg')] as $field => $title) { ?> <?php if (trim((string)($this->view['data'][$field]??'')) === '') continue; $section_id = 'wpsg-product-'.$field.'-'.$this->getTemplateIndex(); ?> <section class="wpsg-product__section wpsg_produkt_<?php echo esc_attr($field); ?>" aria-labelledby="<?php echo esc_attr($section_id); ?>"> - <h2 id="<?php echo esc_attr($section_id); ?>" class="wpsg-product__section-title"><?php echo esc_html($title); ?></h2> + <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> </section> <?php } ?> |
