Files
VITEC-website/packages/vitec/Classes/Domain/Model/Product.php
Oliver Rasche 7bd1161abf Product text import from agency XLSX workbooks
VITEC Import module: Products tab is now a searchable/sortable product
overview. "Edit Product" opens an XLSX upload with per-field source
mapping (component + cell), old/new preview and checkbox apply via
DataHandler; the mapping and manual matches are persisted and preselect
the next workbook. Category workbooks are detected and rejected.

- new: ProductXlsxReader (PhpSpreadsheet), ProductTextImportController,
  Products/ProductTexts templates, 4 module routes
- related products: per-pair card text in new side table
  tx_vitec_product_related_text (survives MM rewrites), emitted as
  `cardtext` in the product JSON; missing MM relations added add-only
- card copy read from Body Copy (D) with fallback to CTA/Card Copy (E) -
  the workbooks fill either depending on row type
- product detail page <title> now uses seotitle with title fallback
  (provider made singleton and fed from the JSON renderer)
- per-user recent-search badges; last loaded workbook stored per product
  (tx_vitec_product_workbook), Edit Product reopens on it
- composer: add phpoffice/phpspreadsheet ^5.9
- diagnostics: migrations/check_workbook.php
2026-08-21 11:00:45 +02:00

1076 lines
20 KiB
PHP
Executable File

<?php
declare(strict_types=1);
namespace Evomedien\Vitec\Domain\Model;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
use TYPO3\CMS\Extbase\Domain\Model\Category;
use TYPO3\CMS\Extbase\Domain\Model\FileReference;
/**
* This file is part of the "VITEC" Extension for TYPO3 CMS.
*
* For the full copyright and license information, please read the
* LICENSE.txt file that was distributed with this source code.
*
* (c) 2025
*/
/**
* Product
*/
class Product extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* title
*
* @var string
* @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty")
*/
protected $title;
/**
* slug
*
* @var string
*/
protected $slug;
/**
* urltitle
*
* @var string
*/
protected $urltitle = '';
/**
* seotitle
*
* @var string
*/
protected $seotitle = '';
/**
* seometa
*
* @var string
*/
protected $seometa = '';
/**
* keywords
*
* @var string
*/
protected $keywords = '';
/**
* structureddata
*
* @var string
*/
protected $structureddata = '';
/**
* teaser
*
* @var string
*/
protected $teaser = '';
/**
* subtitle
*
* @var string
*/
protected $subtitle = '';
/**
* video
*
* @var string
*/
protected $video = '';
/**
* hideonapp
*
* @var bool
*/
protected $hideonapp = false;
/**
* hideonwebsite
*
* @var bool
*/
protected $hideonwebsite = false;
/**
* hideondatasheets
*
* @var bool
*/
protected $hideondatasheets = false;
/**
* hideonproducts
*
* @var bool
*/
protected $hideonproducts = false;
/**
* applications
*
* @var string
*/
protected $applications = '';
/**
* description
*
* @var string
*/
protected $description = '';
/**
* highlights
*
* @var string
*/
protected $highlights = '';
/**
* shortcut
*
* @var bool
*/
protected $shortcut = false;
/**
* shortcutpid
*
* @var string
*/
protected $shortcutpid = '';
/**
* legacy
*
* @var bool
*/
protected $legacy = false;
/**
* supportproduct
*
* @var bool
*/
protected $supportproduct = false;
/**
* subproduct
*
* @var bool
*/
protected $subproduct = false;
/**
* @var ObjectStorage<Category>
*/
protected $categories;
/**
* Product images
*
* @var ObjectStorage<FileReference>
* @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove")
*/
protected $productimage;
/**
* Downloads
*
* @var ObjectStorage<\Evomedien\Vitec\Domain\Model\Download>
* @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove")
*/
protected $downloads;
/**
* Open Graph Image
*
* @var FileReference
*/
protected $ogimage;
/**
* Content element link - Key Features
*
* @var string
*/
/**
* Uploaded / locally selected video file (FAL)
*
* @var \TYPO3\CMS\Extbase\Domain\Model\FileReference|null
*/
protected $videofile;
/**
* Show the "Datapath is now Vitec" graphic in the frontend
*
* @var bool
*/
protected $showdatapath = false;
protected $contentelement;
/**
* Content element link - CTA Features
*
* @var string
*/
protected $contentelementcta;
/**
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Evomedien\Vitec\Domain\Model\Product>
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
* @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove")
*/
protected $relatedprodukt;
/* --------------------------------------------------------------------- */
/**
* Returns the title
*
* @return string
*/
public function getTitle()
{
return $this->title;
}
/**
* Sets the title
*
* @param string $title
* @return void
*/
public function setTitle(string $title)
{
$this->title = $title;
}
/**
* Returns the video
*
* @return string
*/
public function getVideo()
{
return $this->video;
}
/**
* Sets the video
*
* @param string $video
* @return void
*/
public function setVideo(string $video)
{
$this->video = $video;
}
/**
* Returns the slug
*
* @return string
*/
public function getSlug()
{
return $this->slug;
}
/**
* Sets the slug
*
* @param string $slug
* @return void
*/
public function setSlug(string $slug)
{
$this->slug = $slug;
}
/**
* Returns the urltitle
*
* @return string
*/
public function getUrltitle()
{
return $this->urltitle;
}
/**
* Sets the urltitle
*
* @param string $urltitle
* @return void
*/
public function setUrltitle(string $urltitle)
{
$this->urltitle = $urltitle;
}
/**
* Returns the seotitle
*
* @return string
*/
public function getSeotitle()
{
return $this->seotitle;
}
/**
* Sets the seotitle
*
* @param string $seotitle
* @return void
*/
public function setSeotitle(string $seotitle)
{
$this->seotitle = $seotitle;
}
/**
* Returns the seometa
*
* @return string $seometa
*/
public function getSeometa()
{
return $this->seometa;
}
/**
* Sets the seometa
*
* @param string $seometa
* @return void
*/
public function setSeometa($seometa)
{
$this->seometa = $seometa;
}
/**
* Returns the keywords
*
* @return string $keywords
*/
public function getKeywords()
{
return $this->keywords;
}
/**
* Sets the keywords
*
* @param string $keywords
* @return void
*/
public function setKeywords($keywords)
{
$this->keywords = $keywords;
}
/**
* Returns the teaser
*
* @return string $kteasereywords
*/
public function getTeaser()
{
return $this->teaser;
}
/**
* Sets the teaser
*
* @param string $teaser
* @return void
*/
public function setTeaser($teaser)
{
$this->teaser = $teaser;
}
/**
* Returns the subtitle
*
* @return string $subtitle
*/
public function getSubtitle()
{
return $this->subtitle;
}
/**
* Sets the subtitle
*
* @param string $subtitle
* @return void
*/
public function setSubtitle($subtitle)
{
$this->subtitle = $subtitle;
}
/**
* Returns the hideonapp
*
* @return bool $hideonapp
*/
public function getHideonapp()
{
return $this->hideonapp;
}
/**
* Sets the hideonapp
*
* @param bool $hideonapp
* @return void
*/
public function setHideonapp($hideonapp)
{
$this->hideonapp = $hideonapp;
}
/**
* Returns the description
*
* @return bool $description
*/
public function getDescription()
{
return $this->description;
}
/**
* Sets the description
*
* @param bool $description
* @return void
*/
public function setDescriptionp($description)
{
$this->description = $description;
}
/**
* Returns the hideonwebsite
*
* @return bool $hideonwebsite
*/
public function getHideonwebsite()
{
return $this->hideonwebsite;
}
/**
* Sets the hideonwebsite
*
* @param bool $hideonwebsite
* @return void
*/
public function setHideonwebsite($hideonwebsite)
{
$this->hideonwebsite = $hideonwebsite;
}
/**
* Returns the hideondatasheets
*
* @return bool $hideondatasheets
*/
public function getHideondatasheets()
{
return $this->hideondatasheets;
}
/**
* Sets the hideondatasheets
*
* @param bool $hideondatasheets
* @return void
*/
public function setHideondatasheets($hideondatasheets)
{
$this->hideondatasheets = $hideondatasheets;
}
/**
* Returns the hideonproducts
*
* @return bool $hideonproducts
*/
public function getHideonproducts()
{
return $this->hideonproducts;
}
/**
* Sets the hideonproducts
*
* @param bool $hideonproducts
* @return void
*/
public function setHideonproducts($hideonproducts)
{
$this->hideonproducts = $hideonproducts;
}
/**
* Returns the structureddata
*
* @return string $structureddata
*/
public function getStructureddata()
{
return $this->structureddata;
}
/**
* Sets the structureddata
*
* @param string $structureddata
* @return void
*/
public function setStructureddata($structureddata)
{
$this->structureddata = $structureddata;
}
/**
* Returns the applications
*
* @return string $applications
*/
public function getApplications()
{
return $this->applications;
}
/**
* Sets the applications
*
* @param string $applications
* @return void
*/
public function setApplications($applications)
{
$this->applications = $applications;
}
/**
* Returns the highlights
*
* @return string $highlights
*/
public function getHighlights()
{
return $this->highlights;
}
/**
* Sets the highlights
*
* @param string $highlights
* @return void
*/
public function setHighlights($highlights)
{
$this->highlights = $highlights;
}
/**
* Returns the shortcutpid
*
* @return string
*/
public function getShortcutpid()
{
return $this->shortcutpid;
}
/**
* Sets the shortcutpid
*
* @param string $shortcutpid
* @return void
*/
public function setShortcutpid ($shortcutpid)
{
$this->shortcutpid = $shortcutpid;
}
/**
* Returns the shortcut
*
* @return bool $shortcut
*/
public function getShortcut()
{
return $this->shortcut;
}
/**
* Sets the shortcut
*
* @param bool $shortcut
* @return void
*/
public function setShortcut($shortcut)
{
$this->shortcut = $shortcut;
}
/**
* Returns the legacy
*
* @return bool $legacy
*/
public function getLegacy()
{
return $this->legacy;
}
/**
* Sets the legacy
*
* @param bool $legacy
* @return void
*/
public function setLegacy($legacy)
{
$this->legacy = $legacy;
}
/**
* Returns the supportproduct
*
* @return bool $supportproduct
*/
public function getSupportproduct()
{
return $this->supportproduct;
}
/**
* Sets the supportproduct
*
* @param bool $supportproduct
* @return void
*/
public function setSupportproduct($supportproduct)
{
$this->supportproduct = $supportproduct;
}
/**
* Returns the subproduct
*
* @return bool $subproduct
*/
public function getSubproduct()
{
return $this->subproduct;
}
/**
* Sets the subproduct
*
* @param bool $subproduct
* @return void
*/
public function setSubproduct($subproduct)
{
$this->subproduct = $subproduct;
}
/**
* Initializes the ObjectStorage for categories
*/
public function __construct()
{
$this->categories = new ObjectStorage();
$this->productimage = new ObjectStorage();
$this->heroimage = new ObjectStorage();
$this->downloads = new ObjectStorage();
}
/**
* Adds a category
*
* @param Category $category
* @return void
*/
public function addCategory(Category $category)
{
$this->categories->attach($category);
}
/**
* Removes a category
*
* @param Category $categoryToRemove
* @return void
*/
public function removeCategory(Category $categoryToRemove)
{
$this->categories->detach($categoryToRemove);
}
/**
* Returns the categories
*
* @return ObjectStorage<Category>
*/
public function getCategories()
{
return $this->categories;
}
/**
* Sets the categories
*
* @param ObjectStorage<Category> $categories
* @return void
*/
public function setCategories(ObjectStorage $categories)
{
$this->categories = $categories;
}
/**
* Adds a product image
*
* @param FileReference $productimage
* @return void
*/
public function addProductimage(FileReference $productimage)
{
$this->productimage->attach($productimage);
}
/**
* Removes a product image
*
* @param FileReference $productimageToRemove
* @return void
*/
public function removeProductimage(FileReference $productimageToRemove)
{
$this->productimage->detach($productimageToRemove);
}
/**
* Returns the product images
*
* @return ObjectStorage<FileReference>
*/
public function getProductimage()
{
return $this->productimage;
}
/**
* Sets the product images
*
* @param ObjectStorage<FileReference> $productimage
* @return void
*/
public function setProductimage(ObjectStorage $productimage)
{
$this->productimage = $productimage;
}
/**
* Adds a download
*
* @param \Evomedien\Vitec\Domain\Model\Download $download
* @return void
*/
public function addDownload(\Evomedien\Vitec\Domain\Model\Download $download): void
{
$this->downloads->attach($download);
}
/**
* Removes a download
*
* @param \Evomedien\Vitec\Domain\Model\Download $downloadToRemove
* @return void
*/
public function removeDownload(\Evomedien\Vitec\Domain\Model\Download $downloadToRemove): void
{
$this->downloads->detach($downloadToRemove);
}
/**
* Returns the downloads
*
* @return ObjectStorage<\Evomedien\Vitec\Domain\Model\Download>
*/
public function getDownloads(): ObjectStorage
{
return $this->downloads;
}
/**
* Sets the downloads
*
* @param ObjectStorage<\Evomedien\Vitec\Domain\Model\Download> $downloads
* @return void
*/
public function setDownloads(ObjectStorage $downloads): void
{
$this->downloads = $downloads;
}
/**
* Returns the Open Graph Image
*
* @return FileReference|null
*/
public function getOgimage(): ?FileReference
{
return $this->ogimage;
}
/**
* Sets the Open Graph Image
*
* @param FileReference $ogimage
* @return void
*/
public function setOgimage(FileReference $ogimage): void
{
$this->ogimage = $ogimage;
}
/**
* Returns the content element link
*
* @return string
*/
/**
* Returns the uploaded video file
*
* @return \TYPO3\CMS\Extbase\Domain\Model\FileReference|null
*/
public function getVideofile(): ?\TYPO3\CMS\Extbase\Domain\Model\FileReference
{
return $this->videofile;
}
/**
* Sets the uploaded video file
*
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference|null $videofile
* @return void
*/
public function setVideofile(?\TYPO3\CMS\Extbase\Domain\Model\FileReference $videofile): void
{
$this->videofile = $videofile;
}
/**
* Returns the showdatapath flag
*
* @return bool
*/
public function getShowdatapath(): bool
{
return (bool)$this->showdatapath;
}
/**
* Sets the showdatapath flag
*
* @param bool $showdatapath
* @return void
*/
public function setShowdatapath(bool $showdatapath): void
{
$this->showdatapath = $showdatapath;
}
public function getContentelement(): string
{
return $this->contentelement;
}
/**
* Sets the content element link
*
* @param string $contentelement
* @return void
*/
public function setContentelement(string $contentelement): void
{
$this->contentelement = $contentelement;
}
/**
* Returns the content element cta link
*
* @return string
*/
public function getContentelementcta(): string
{
return $this->contentelementcta;
}
/**
* Sets the content element link cta
*
* @param string $contentelementcta
* @return void
*/
public function setContentelementcta(string $contentelementcta): void
{
$this->contentelementcta = $contentelementcta;
}
/**
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Vendor\Extension\Domain\Model\Product>
*/
public function getRelatedprodukt(): \TYPO3\CMS\Extbase\Persistence\ObjectStorage
{
return $this->relatedprodukt;
}
/**
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\Vendor\Extension\Domain\Model\Product> $relatedprodukt
*/
public function setRelatedprodukt(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $relatedprodukt): void
{
$this->relatedprodukt = $relatedprodukt;
}
/**
* Hero images
*
* @var ObjectStorage<FileReference>
* @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove")
*/
protected $heroimage;
/**
* Second description
*
* @var string
*/
protected $description2 = '';
/**
* Capabilities
*
* @var string
*/
protected $capabilities = '';
/**
* Portfolio link (typolink parameter)
*
* @var string
*/
protected $portfolio = '';
/**
* @return ObjectStorage<FileReference>
*/
public function getHeroimage(): ObjectStorage
{
return $this->heroimage;
}
/**
* @param ObjectStorage<FileReference> $heroimage
*/
public function setHeroimage(ObjectStorage $heroimage): void
{
$this->heroimage = $heroimage;
}
public function getDescription2(): string
{
return $this->description2;
}
public function setDescription2(string $description2): void
{
$this->description2 = $description2;
}
public function getCapabilities(): string
{
return $this->capabilities;
}
public function setCapabilities(string $capabilities): void
{
$this->capabilities = $capabilities;
}
public function getPortfolio(): string
{
return $this->portfolio;
}
public function setPortfolio(string $portfolio): void
{
$this->portfolio = $portfolio;
}
/**
* Intro text above the related products
*
* @var string
*/
protected $textrelatedproducts = '';
public function getTextrelatedproducts(): string
{
return $this->textrelatedproducts;
}
public function setTextrelatedproducts(string $textrelatedproducts): void
{
$this->textrelatedproducts = $textrelatedproducts;
}
/* --------------------------------------------------------------------- */
}