inital commit

This commit is contained in:
Raphael Martin
2023-12-05 10:40:47 +01:00
commit d950880d65
150 changed files with 10942 additions and 0 deletions

View File

@@ -0,0 +1,114 @@
<?php
declare(strict_types=1);
namespace A2G\A2gProducts\Controller;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Utility\MathUtility;
use A2G\A2gProducts\Services\FeuserSessionService;
use A2G\A2gProducts\Domain\Model\Ingredients;
use A2G\A2gProducts\Domain\Traits\{
InjectIngredientsRepositoryTrait,
InjectImageServiceTrait
};
use A2G\A2gProducts\PageTitle\A2gPageTitleProvider;
use TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
/**
* This file is part of the "Products" 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) 2021 Raphael Martin <raphy.martin@gmail.com>, none
*/
/**
* IngredientsController
*/
class IngredientsController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
use InjectIngredientsRepositoryTrait;
use InjectImageServiceTrait;
/**
* action list
*
* @return string|object|null|void
*/
public function listAction() {
$ingredients = $this->ingredientsRepository->findAll();
$this->view->assign('contentObjectUid', $this->configurationManager->getContentObject()->data['uid']);
$this->view->assign('ingredients', $ingredients);
}
/**
* action ajaxListAction
*
* @return string|object|null|void
*/
public function ajaxListAction() {
}
/**
* action show
*
* @param Ingredients $ingredient
* @return string|object|null|void
*/
public function showAction(Ingredients $ingredient) {
$titleProvider = GeneralUtility::makeInstance(A2gPageTitleProvider::class);
if(array_key_exists('pageTitleSuffix', $this->settings) && $this->settings['pageTitleSuffix'] !== null && $this->settings['pageTitleSuffix'] !== '' && (strlen($ingredient->getTitle()) + strlen($this->settings['pageTitleSuffix'])) < 66 ){
$pageTitle = $ingredient->getTitle(). ' ' . $this->settings['pageTitleSuffix'];
} else {
$pageTitle = $ingredient->getTitle();
}
$titleProvider->setTitle($pageTitle);
$contentObject = GeneralUtility::makeInstance(ContentObjectRenderer::class);
$description = $contentObject->crop($ingredient->getDescription(), 125 . '|...|' . true);
$uri = $this->uriBuilder->reset()->setCreateAbsoluteUri(true)->setTargetPageUid(
$GLOBALS['TSFE']->id)->uriFor('show', ['ingredient' => $ingredient], 'Ingredients', 'a2gProducts', 'ingredientsdetail');
$this->view->assign('contentObjectUid', $this->configurationManager->getContentObject()->data['uid']);
$metaTagManager = GeneralUtility::makeInstance(MetaTagManagerRegistry::class);
/* TODO change
$metaTagManager->getManagerForProperty('robots')->addProperty('robots', 'index, folow');
$metaTagManager->getManagerForProperty('og:type')->addProperty('og:type', 'website');
$metaTagManager->getManagerForProperty('twitter:card')->addProperty('twitter:card', 'summary_large_image');
if ($ingredient->getTitle() !== '') {
$metaTagManager->getManagerForProperty('title')->addProperty('title', $pageTitle);
$metaTagManager->getManagerForProperty('og:title')->addProperty('og:title', $pageTitle);
$metaTagManager->getManagerForProperty('twitter:title')->addProperty('twitter:title', $pageTitle);
}
if ($ingredient->getDescription() !== '') {
$metaTagManager->getManagerForProperty('description')->addProperty('description', $description);
$metaTagManager->getManagerForProperty('og:description')->addProperty('og:description', $description);
$metaTagManager->getManagerForProperty('twitter:description')->addProperty('twitter:description', $description);
}
$metaTagManager->getManagerForProperty('og:url')->addProperty('og:url', $uri);
$metaTagManager->getManagerForProperty('twitter:url')->addProperty('twitter:url', $uri);
if ($ingredient->getImage() !== null) {
$processedImage = $this->imageService->applyProcessingInstructions(
$this->imageService->getImage('', $ingredient->getImage(), false),
['width' => '
1200', 'height' => '630c']
);
$metaTagManager->getManagerForProperty('twitter:image')->addProperty('twitter:image', $this->imageService->getImageUri($processedImage, true));
$metaTagManager->getManagerForProperty('og:image')->addProperty('og:image', $this->imageService->getImageUri($processedImage, true));
}
*/
$this->view->assign('ingredient', $ingredient);
}
}

View File

@@ -0,0 +1,222 @@
<?php
declare(strict_types=1);
namespace A2G\A2gProducts\Controller;
use TYPO3\CMS\Core\Utility\MathUtility;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use A2G\A2gProducts\Services\FeuserSessionService;
use A2G\A2gProducts\Domain\Traits\{
InjectCategoriesRepositoryTrait,
InjectProductsRepositoryTrait,
InjectFiltersRepositoryTrait,
InjectImageServiceTrait
};
use A2G\A2gProducts\PageTitle\A2gPageTitleProvider;
use TYPO3\CMS\Core\MetaTag\MetaTagManagerRegistry;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
use A2G\A2gToolkit\Domain\Traits\SetMetaTagsTrait;
/**
* This file is part of the "Products" 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) 2021 Raphael Martin <raphy.martin@gmail.com>, none
*/
/**
* ProductsController
*/
class ProductsController extends \TYPO3\CMS\Extbase\Mvc\Controller\ActionController {
use InjectProductsRepositoryTrait;
use InjectFiltersRepositoryTrait;
use InjectCategoriesRepositoryTrait;
use InjectImageServiceTrait;
use SetMetaTagsTrait;
/**
* @var FeuserSessionService
*/
protected $feuserSessionService = null;
/**
* @param FeuserSessionService $feuserSessionService
*/
public function injectFeuserSessionService(FeuserSessionService $feuserSessionService) {
$this->feuserSessionService = $feuserSessionService;
}
/**
* mapInt
*
* @param string $int
* @return int|null
*/
static function mapInt(string $int): ?int {
if (MathUtility::canBeInterpretedAsInteger($int)) {
return (int) $int;
}
return null;
}
/**
*
* @param \TYPO3\CMS\Extbase\DomainObject\AbstractEntity $obj
* @return int|null
*/
static function mapGetUid(\TYPO3\CMS\Extbase\DomainObject\AbstractEntity $obj): ?int {
return $obj->getUid();
}
/**
* action list
*
* @return string|object|null|void
*/
public function listAction() {
$uniqid = $GLOBALS['TSFE']->id . '_' . $this->configurationManager->getContentObject()->data['uid'];
$this->injectFeuserSessionService(new FeuserSessionService('a2gProducts_' . $uniqid . '_'));
$activFilter = $this->feuserSessionService->get('filter');
$searchField = $this->feuserSessionService->get('searchField');
$catUids = array_filter(array_map('self::mapInt', explode(',', $this->settings['showCategories'])));
$categories = $this->categoriesRepository->findByUids($catUids);
$filters = $this->filtersRepository->getFromCategories($catUids);
if (!empty($activFilter)) {
if ((int) $this->settings['ajaxListLimit'] === 0) {
$products = $this->productsRepository->filter($catUids, $activFilter, $searchField, 0, 0, $filters);
} else {
$products = $this->productsRepository->filter($catUids, $activFilter, $searchField, $this->settings['ajaxListLimit'] + 2, 0, $filters);
}
} else {
if ((int) $this->settings['ajaxListLimit'] === 0) {
$products = $this->productsRepository->getFromCategories($catUids);
} else {
$products = $this->productsRepository->getFromCategories($catUids, (int) $this->settings['ajaxListLimit'] + 2);
}
}
$this->view->assign('contentObjectUid', $this->configurationManager->getContentObject()->data['uid']);
$this->view->assign('categories', $categories);
$this->view->assign('filters', $filters);
$this->view->assign('activeFilter', $activFilter);
$this->view->assign('searchField', $searchField);
$this->view->assign('products', $products);
$this->view->assign('uniqid', $uniqid);
}
/**
* action ajaxListAction
*
* @return string|object|null|void
*/
public function ajaxListAction() {
$this->injectFeuserSessionService(new FeuserSessionService('a2gProducts_' . (string) $_POST['tx_a2gproducts_a2gproductlist']['uniqid'] . '_'));
$uniqid = $GLOBALS['TSFE']->id . '_' . $this->configurationManager->getContentObject()->data['uid'];
$settings = [
'detailPage' => $_POST['tx_a2gproducts_a2gproductlist']['dp'],
'showCategories' => $_POST['tx_a2gproducts_a2gproductlist']['sc'],
'style' => $_POST['tx_a2gproducts_a2gproductlist']['style'],
'ajaxListLimit' => (int) $_POST['tx_a2gproducts_a2gproductlist']['limit']
];
$catUids = array_filter(array_map('self::mapInt', explode(',', $_POST['tx_a2gproducts_a2gproductlist']['sc'])));
$filters = $this->filtersRepository->getFromCategories($catUids);
if (array_key_exists('filter',$_POST['tx_a2gproducts_a2gproductlist']) && $_POST['tx_a2gproducts_a2gproductlist']['filter'] === null) {
$filter = [];
} else {
$filter = $_POST['tx_a2gproducts_a2gproductlist']['filter'];
}
$this->feuserSessionService->set($filter, 'filter');
$this->feuserSessionService->set($_POST['tx_a2gproducts_a2gproductlist']['searchField'], 'searchField');
// duplicate from listAction make a new function !!
if (!empty($filter) || $_POST['tx_a2gproducts_a2gproductlist']['searchField'] !== '') {
if ((int) $settings['ajaxListLimit'] === 0) {
$products = $this->productsRepository->filter($catUids, $filter, $_POST['tx_a2gproducts_a2gproductlist']['searchField'], 0, 0, $filters);
} else {
$products = $this->productsRepository->filter($catUids, $filter, $_POST['tx_a2gproducts_a2gproductlist']['searchField'], $settings['ajaxListLimit'] + 2, (int) $_POST['tx_a2gproducts_a2gproductlist']['loads'] * $settings['ajaxListLimit'], $filters);
}
} else {
if ((int) $settings['ajaxListLimit'] === 0) {
$products = $this->productsRepository->getFromCategories($catUids);
} else {
$products = $this->productsRepository->getFromCategories($catUids, $settings['ajaxListLimit'] + 2, (int) $_POST['tx_a2gproducts_a2gproductlist']['loads'] * $settings['ajaxListLimit']);
}
}
$this->view->assign('products', $products);
$this->view->assign('filters', $filters);
$this->view->assign('settings', $settings);
}
static protected function isAllowedCategory(\A2G\A2gProducts\Domain\Model\Products $product, $categories){
}
/**
* action show
*
* @param \A2G\A2gProducts\Domain\Model\Products $product
* @param \A2G\A2gProducts\Domain\Model\ProductVariants $productVariant
* @return string|object|null|void
*/
public function showAction(\A2G\A2gProducts\Domain\Model\Products $product = null, \A2G\A2gProducts\Domain\Model\ProductVariants $productVariant = null) {
if($product === null){
return GeneralUtility::makeInstance(\TYPO3\CMS\Frontend\Controller\ErrorController::class)
->pageNotFoundAction(
$GLOBALS['TYPO3_REQUEST'],
'Shop Product not found!',
['code' => \TYPO3\CMS\Frontend\Page\PageAccessFailureReasons::INVALID_PAGE_ARGUMENTS]
);
}
$titleProvider = GeneralUtility::makeInstance(A2gPageTitleProvider::class);
$contentObject = GeneralUtility::makeInstance(ContentObjectRenderer::class);
$description = $contentObject->crop($product->getDescription(), 125 . '|...|' . true);
$imageUri=null;
if ($product->getImage() !== null) {
$processedImage = $this->imageService->applyProcessingInstructions(
$this->imageService->getImage('', $product->getImage(), false),
['width' => '1200c', 'height' => '630']
);
$imageUri = $this->imageService->getImageUri($processedImage, true);
}
$this->view->assign('product', $product);
if($productVariant === null){
$uri = $this->uriBuilder->reset()->setCreateAbsoluteUri(true)->setTargetPageUid(
$GLOBALS['TSFE']->id)->uriFor('show', ['product' => $product], 'Products', 'a2gShop', 'A2gproductsdetail');
} else {
$uri = $this->uriBuilder->reset()->setCreateAbsoluteUri(true)->setTargetPageUid(
$GLOBALS['TSFE']->id)->uriFor('show', ['product' => $product, 'productVariant' => $productVariant], 'Products', 'a2gShop', 'A2gproductsdetail');
}
if($productVariant !== null && array_key_exists('pageTitleSuffix', $this->settings) && $this->settings['pageTitleSuffix'] !== '' && (strlen($product->getTitle()) + (strlen($productVariant->getTitle()) + strlen($this->settings['pageTitleSuffix'])) < 65 )){
$titleProvider->setTitle($product->getTitle() . ' ' .$productVariant->getTitle() .' - ' . $this->settings['pageTitleSuffix']);
$this->setMetaTags($product->getTitle(). ' ' .$productVariant->getTitle() .' - ' . $this->settings['pageTitleSuffix'], $description, $uri, $imageUri);
} else if($productVariant !== null && (strlen($product->getTitle()) + strlen($productVariant->getTitle())) < 65 ){
$titleProvider->setTitle($product->getTitle() . ' ' .$productVariant->getTitle());
$this->setMetaTags($product->getTitle(). ' ' .$productVariant->getTitle(), $description, $uri, $imageUri);
}else if(array_key_exists('pageTitleSuffix', $this->settings) && $this->settings['pageTitleSuffix'] !== '' && (strlen($product->getTitle()) + strlen($this->settings['pageTitleSuffix'])) < 66 ){
$titleProvider->setTitle($product->getTitle() .' - ' . $this->settings['pageTitleSuffix']);
$this->setMetaTags($product->getTitle() .' - ' . $this->settings['pageTitleSuffix'], $description, $uri, $imageUri);
} else {
$titleProvider->setTitle($product->getTitle());
$this->setMetaTags($product->getTitle(), $description, $uri, $imageUri);
}
if(!array_key_exists('listPage', $this->settings)){
$this->view->assign('contentObjectUid', $this->configurationManager->getContentObject()->data['uid']);
}
}
}

104
Classes/Domain/Model/Brands.php Executable file
View File

@@ -0,0 +1,104 @@
<?php
declare(strict_types=1);
namespace A2G\A2gProducts\Domain\Model;
use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy;
/**
* This file is part of the "Products" 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) 2021 Raphael Martin <raphy.martin@gmail.com>, none
*/
/**
* Brands
*/
class Brands extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
/**
* title
*
* @var string
* @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty")
*/
protected $title = '';
/**
* image
*
* @var \TYPO3\CMS\Extbase\Domain\Model\FileReference
* @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove")
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $image = null;
/**
* Returns the title
*
* @return string $title
*/
public function getTitle() {
return $this->title;
}
/**
* Sets the title
*
* @param string $title
* @return void
*/
public function setTitle(string $title) {
$this->title = $title;
}
/**
* Returns the image
*
* @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $image
*/
public function getImage() {
if ($this->image instanceof LazyLoadingProxy) {
$this->image = $this->image->_loadRealInstance();
}
return $this->image;
}
/**
* Sets the image
*
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $image
* @return void
*/
public function setImage(\TYPO3\CMS\Extbase\Domain\Model\FileReference $image) {
$this->image = $image;
}
/**
* __construct
*/
public function __construct() {
// Do not remove the next line: It would break the functionality
$this->initializeObject();
}
/**
* Initializes all ObjectStorage properties when model is reconstructed from DB (where __construct is not called)
* Do not modify this method!
* It will be rewritten on each save in the extension builder
* You may modify the constructor of this class instead
*
* @return void
*/
public function initializeObject() {
}
}

View File

@@ -0,0 +1,180 @@
<?php
declare(strict_types=1);
namespace A2G\A2gProducts\Domain\Model;
/**
* This file is part of the "altogether Products" 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) 2021 Raphael Martin <raphy.martin@gmail.com>, none
*/
/**
* Categories
*/
class Categories extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* title
*
* @var string
*/
protected $title = '';
/**
* description
*
* @var string
*/
protected $description = '';
/**
* image
*
* @var \TYPO3\CMS\Extbase\Domain\Model\FileReference
* @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove")
*/
protected $image = null;
/**
* relFilters
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\A2G\A2gProducts\Domain\Model\Filters>
*/
protected $relFilters = null;
/**
* __construct
*/
public function __construct()
{
// Do not remove the next line: It would break the functionality
$this->initializeObject();
}
/**
* Initializes all ObjectStorage properties when model is reconstructed from DB (where __construct is not called)
* Do not modify this method!
* It will be rewritten on each save in the extension builder
* You may modify the constructor of this class instead
*
* @return void
*/
public function initializeObject()
{
$this->relFilters = $this->relFilters ?: new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
}
/**
* Returns the title
*
* @return string $title
*/
public function getTitle()
{
return $this->title;
}
/**
* Sets the title
*
* @param string $title
* @return void
*/
public function setTitle(string $title)
{
$this->title = $title;
}
/**
* Returns the description
*
* @return string $description
*/
public function getDescription()
{
return $this->description;
}
/**
* Sets the description
*
* @param string $description
* @return void
*/
public function setDescription(string $description)
{
$this->description = $description;
}
/**
* Returns the image
*
* @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $image
*/
public function getImage()
{
return $this->image;
}
/**
* Sets the image
*
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $image
* @return void
*/
public function setImage(\TYPO3\CMS\Extbase\Domain\Model\FileReference $image)
{
$this->image = $image;
}
/**
* Adds a Filters
*
* @param \A2G\A2gProducts\Domain\Model\Filters $relFilter
* @return void
*/
public function addRelFilter(\A2G\A2gProducts\Domain\Model\Filters $relFilter)
{
$this->relFilters->attach($relFilter);
}
/**
* Removes a Filters
*
* @param \A2G\A2gProducts\Domain\Model\Filters $relFilterToRemove The Filters to be removed
* @return void
*/
public function removeRelFilter(\A2G\A2gProducts\Domain\Model\Filters $relFilterToRemove)
{
$this->relFilters->detach($relFilterToRemove);
}
/**
* Returns the relFilters
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\A2G\A2gProducts\Domain\Model\Filters> $relFilters
*/
public function getRelFilters()
{
return $this->relFilters;
}
/**
* Sets the relFilters
*
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\A2G\A2gProducts\Domain\Model\Filters> $relFilters
* @return void
*/
public function setRelFilters(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $relFilters)
{
$this->relFilters = $relFilters;
}
}

View File

@@ -0,0 +1,120 @@
<?php
declare(strict_types=1);
namespace A2G\A2gProducts\Domain\Model;
/**
* This file is part of the "altogether Products" 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) 2021 Raphael Martin <raphy.martin@gmail.com>, none
*/
/**
* FilterOptions
*/
class FilterOptions extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* title
*
* @var string
*/
protected $title = '';
/**
* valueMin
*
* @var float
*/
protected $valueMin = 0.0;
/**
* valueMax
*
* @var float
*/
protected $valueMax = 0.0;
/**
* Returns the title
*
* @return string $title
*/
public function getTitle()
{
return $this->title;
}
/**
* Sets the title
*
* @param string $title
* @return void
*/
public function setTitle(string $title)
{
$this->title = $title;
}
/**
* Returns the valueMin
*
* @return float $valueMin
*/
public function getValueMin()
{
return $this->valueMin;
}
/**
* Sets the valueMin
*
* @param float $valueMin
* @return void
*/
public function setValueMin(float $valueMin)
{
$this->valueMin = $valueMin;
}
/**
* Returns the valueMax
*
* @return float $valueMax
*/
public function getValueMax()
{
return $this->valueMax;
}
/**
* Sets the valueMax
*
* @param float $valueMax
* @return void
*/
public function setValueMax(float $valueMax)
{
$this->valueMax = $valueMax;
}
/**
* Getter for _localizedUid.
*
* @return int|null The _localizedUid or NULL if none set yet.
*/
public function getLocalizedUid(): ?int
{
if ($this->_localizedUid !== null) {
return (int)$this->_localizedUid;
}
return null;
}
}

View File

@@ -0,0 +1,99 @@
<?php
declare(strict_types=1);
namespace A2G\A2gProducts\Domain\Model;
/**
* This file is part of the "altogether Products" 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) 2021 Raphael Martin <raphy.martin@gmail.com>, none
*/
/**
* FilterValues
*/
class FilterValues extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
/**
* value
*
* @var float
*/
protected $value = 0.0;
/**
* relFilterOptions
*
* @var \A2G\A2gProducts\Domain\Model\FilterOptions
*/
protected $relFilterOption = null;
/**
* relFilters
*
* @var \A2G\A2gProducts\Domain\Model\Filters
*/
protected $relFilters = null;
/**
* Returns the value
*
* @return float $value
*/
public function getValue() {
return $this->value;
}
/**
* Sets the value
*
* @param float $value
* @return void
*/
public function setValue(float $value) {
$this->value = $value;
}
/**
* Returns the relFilterOption
*
* @return \A2G\A2gProducts\Domain\Model\FilterOptions $relFilterOption
*/
public function getRelFilterOption() {
return $this->relFilterOption;
}
/**
* Sets the relFilterOption
*
* @param \A2G\A2gProducts\Domain\Model\FilterOptions $relFilterOptio
* @return void
*/
public function setRelFilterOption(\A2G\A2gProducts\Domain\Model\FilterOptions $relFilterOptions) {
$this->relFilterOption = $relFilterOption;
}
/**
* Returns the relFilters
*
* @return \A2G\A2gProducts\Domain\Model\Filters $relFilters
*/
public function getRelFilters() {
return $this->relFilters;
}
/**
* Sets the relFilters
*
* @param \A2G\A2gProducts\Domain\Model\Filters $relFilters
* @return void
*/
public function setRelFilters(\A2G\A2gProducts\Domain\Model\Filters $relFilters) {
$this->relFilters = $relFilters;
}
}

234
Classes/Domain/Model/Filters.php Executable file
View File

@@ -0,0 +1,234 @@
<?php
declare(strict_types=1);
namespace A2G\A2gProducts\Domain\Model;
/**
* This file is part of the "altogether Products" 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) 2021 Raphael Martin <raphy.martin@gmail.com>, none
*/
/**
* Filters
*/
class Filters extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity
{
/**
* dbOperations
*
* @var array
*/
static public $dbOperations = [
1 => '=',
2 => '>',
3 => '<',
4 => '>=',
5 => '<=',
6 => 'IN'
];
/**
* dbType
*
* @var array
*/
static public $dbType = [
1 => 'range ( uses min and max value )',
2 => 'compare ( uses just min value )',
3 => 'useFilterOptions'
];
/**
* title
*
* @var string
*/
protected $title = '';
/**
* filterType
*
* @var int
*/
protected $filterType = '';
/**
* dbOperationMax
*
* @var int
*/
protected $dbOperationMax = 0;
/**
* dbOperationMin
*
* @var int
*/
protected $dbOperationMin = '';
/**
* relFilterOption
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\A2G\A2gProducts\Domain\Model\FilterOptions>
* @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove")
*/
protected $relFilterOption = null;
/**
* Returns the title
*
* @return string $title
*/
public function getTitle()
{
return $this->title;
}
/**
* Sets the title
*
* @param string $title
* @return void
*/
public function setTitle(string $title)
{
$this->title = $title;
}
/**
* Returns the filterType
*
* @return string $filterType
*/
public function getFilterType()
{
return $this->filterType;
}
/**
* Sets the filterType
*
* @param string $filterType
* @return void
*/
public function setFilterType(string $filterType)
{
$this->filterType = $filterType;
}
/**
* Returns the dbOperationMax
*
* @return int $dbOperationMax
*/
public function getDbOperationMax()
{
return $this->dbOperationMax;
}
/**
* Sets the dbOperationMax
*
* @param int $dbOperationMax
* @return void
*/
public function setDbOperationMax(int $dbOperationMax)
{
$this->dbOperationMax = $dbOperationMax;
}
/**
* Returns the dbOperationMin
*
* @return int dbOperationMin
*/
public function getDbOperationMin()
{
return $this->dbOperationMin;
}
/**
* Sets the dbOperationMin
*
* @param string $dbOperationMin
* @return void
*/
public function setDbOperationMin(string $dbOperationMin)
{
$this->dbOperationMin = $dbOperationMin;
}
/**
* __construct
*/
public function __construct()
{
// Do not remove the next line: It would break the functionality
$this->initializeObject();
}
/**
* Initializes all ObjectStorage properties when model is reconstructed from DB (where __construct is not called)
* Do not modify this method!
* It will be rewritten on each save in the extension builder
* You may modify the constructor of this class instead
*
* @return void
*/
public function initializeObject()
{
$this->relFilterOption = $this->relFilterOption ?: new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
}
/**
* Adds a FilterOptions
*
* @param \A2G\A2gProducts\Domain\Model\FilterOptions $relFilterOption
* @return void
*/
public function addRelFilterOption(\A2G\A2gProducts\Domain\Model\FilterOptions $relFilterOption)
{
$this->relFilterOption->attach($relFilterOption);
}
/**
* Removes a FilterOptions
*
* @param \A2G\A2gProducts\Domain\Model\FilterOptions $relFilterOptionToRemove The FilterOptions to be removed
* @return void
*/
public function removeRelFilterOption(\A2G\A2gProducts\Domain\Model\FilterOptions $relFilterOptionToRemove)
{
$this->relFilterOption->detach($relFilterOptionToRemove);
}
/**
* Returns the relFilterOption
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\A2G\A2gProducts\Domain\Model\FilterOptions> $relFilterOption
*/
public function getRelFilterOption()
{
return $this->relFilterOption;
}
/**
* Sets the relFilterOption
*
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\A2G\A2gProducts\Domain\Model\FilterOptions> $relFilterOption
* @return void
*/
public function setRelFilterOption(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $relFilterOption)
{
$this->relFilterOption = $relFilterOption;
}
}

View File

@@ -0,0 +1,303 @@
<?php
declare(strict_types=1);
namespace A2G\A2gProducts\Domain\Model;
use A2G\A2gProducts\Domain\Model\{
Products,
MasonryItem
};
use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy;
/**
* This file is part of the "Products" 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) 2021 Raphael Martin <raphy.martin@gmail.com>, none
*/
/**
* Ingredients
*/
class Ingredients extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
/**
* title
*
* @var string
* @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty")
*/
protected $title = '';
/**
* pathSegment
*
* @var string
*/
protected $pathSegment = '';
/**
* description
*
* @var string
*/
protected $description = '';
/**
* image
*
* @var \TYPO3\CMS\Extbase\Domain\Model\FileReference
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $image = null;
/**
* images
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $images = null;
/**
* gallery
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<MasonryItem>
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $gallery = null;
/**
* relProducts
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<Products>
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $relProducts = null;
/**
* Returns the title
*
* @return string $title
*/
public function getTitle() {
return $this->title;
}
/**
* Sets the title
*
* @param string $title
* @return void
*/
public function setTitle(string $title) {
$this->title = $title;
}
/**
* Returns the pathSegment
*
* @return string $pathSegment
*/
public function getPathSegment()
{
return $this->pathSegment;
}
/**
* Sets the pathSegment
*
* @param string $pathSegment
* @return void
*/
public function setPathSegment($pathSegment)
{
$this->pathSegment = $pathSegment;
}
/**
* Returns the description
*
* @return string $description
*/
public function getDescription() {
return $this->description;
}
/**
* Sets the description
*
* @param string $description
* @return void
*/
public function setDescription(string $description) {
$this->description = $description;
}
/**
* Returns the image
*
* @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $image
*/
public function getImage() {
if ($this->image instanceof LazyLoadingProxy) {
$this->image = $this->image->_loadRealInstance();
}
return $this->image;
}
/**
* Sets the image
*
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $image
* @return void
*/
public function setImage(\TYPO3\CMS\Extbase\Domain\Model\FileReference $image) {
$this->image = $image;
}
/**
* Returns the images
*
* @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $images
*/
public function getImages() {
return $this->images;
}
/**
* Sets the images
*
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $images
* @return void
*/
public function setImages(\TYPO3\CMS\Extbase\Domain\Model\FileReference $images) {
$this->images = $images;
}
/**
* Returns the gallery
*
* @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $gallery
*/
public function getGallery() {
return $this->gallery;
}
/**
* Sets the gallery
*
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $gallery
* @return void
*/
public function setGallery(\TYPO3\CMS\Extbase\Domain\Model\FileReference $gallery) {
$this->gallery = $gallery;
}
/**
* __construct
*/
public function __construct() {
// Do not remove the next line: It would break the functionality
$this->initializeObject();
}
/**
* Initializes all ObjectStorage properties when model is reconstructed from DB (where __construct is not called)
* Do not modify this method!
* It will be rewritten on each save in the extension builder
* You may modify the constructor of this class instead
*
* @return void
*/
public function initializeObject() {
$this->gallery = $this->gallery ?: new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$this->relProducts = $this->relProducts ?: new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
}
/**
* Adds a MasonryItem
*
* @param MasonryItem $relMasonryItem
* @return void
*/
public function addGallerys(MasonryItem $relMasonryItem) {
$this->gallery->attach($relMasonryItem);
}
/**
* Removes a MasonryItem
*
* @param MasonryItem $relMasonryItem The MasonryItem to be removed
* @return void
*/
public function removeGallerys(MasonryItem $relMasonryItem) {
$this->gallery->detach($relMasonryItem);
}
/**
* Returns the gallery
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<MasonryItem> $gallery
*/
public function getGallerys() {
return $this->gallery;
}
/**
* Sets the gallery
*
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<MasonryItem> $gallery
* @return void
*/
public function setGallerys(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $gallery) {
$this->gallery = $gallery;
}
/**
* Adds a Products
*
* @param Products $relProducts
* @return void
*/
public function addRelProducts(Products $relProducts) {
$this->relProducts->attach($relProducts);
}
/**
* Removes a Products
*
* @param Products $relProducts The Products to be removed
* @return void
*/
public function removeRelProducts(Products $relProducts) {
$this->relProducts->detach($relProducts);
}
/**
* Returns the relProducts
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<Products> $relProducts
*/
public function getRelProducts() {
return $this->relProducts;
}
/**
* Sets the relProducts
*
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<Products> $relProducts
* @return void
*/
public function setRelProducts(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $relProducts) {
$this->relProducts = $relProducts;
}
}

View File

@@ -0,0 +1,96 @@
<?php
declare(strict_types=1);
namespace A2G\A2gProducts\Domain\Model;
use A2G\A2gProducts\Domain\Model\Ingredients;
use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy;
/**
* This file is part of the "Products" 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) 2021 Raphael Martin <raphy.martin@gmail.com>, none
*/
/**
* MasonryItem
*/
class MasonryItem extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
/**
* header
*
* @var string
*/
protected $header = '';
/**
* itemClass
*
* @var string
*/
protected $itemClass = '';
/**
* image
*
* @var \TYPO3\CMS\Extbase\Domain\Model\FileReference
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $image = null;
public function getHeader(): string {
return $this->header;
}
public function getItemClass(): string {
return $this->itemClass;
}
public function getImage(): \TYPO3\CMS\Extbase\Domain\Model\FileReference {
if ($this->image instanceof LazyLoadingProxy) {
$this->image = $this->image->_loadRealInstance();
}
return $this->image;
}
public function setHeader(string $header): void {
$this->header = $header;
}
public function setItemClass(string $itemClass): void {
$this->itemClass = $itemClass;
}
public function setImage(\TYPO3\CMS\Extbase\Domain\Model\FileReference $image): void {
$this->image = $image;
}
/**
* __construct
*/
public function __construct() {
// Do not remove the next line: It would break the functionality
$this->initializeObject();
}
/**
* Initializes all ObjectStorage properties when model is reconstructed from DB (where __construct is not called)
* Do not modify this method!
* It will be rewritten on each save in the extension builder
* You may modify the constructor of this class instead
*
* @return void
*/
public function initializeObject() {
$this->relCategory = $this->relCategory ?: new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$this->relFilterValues = $this->relFilterValues ?: new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
}
}

View File

@@ -0,0 +1,180 @@
<?php
declare(strict_types=1);
namespace A2G\A2gProducts\Domain\Model;
use A2G\A2gProducts\Domain\Model\{
Ingredients,
ProductVariants
};
use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy;
/**
* This file is part of the "Products" 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) 2021 Raphael Martin <raphy.martin@gmail.com>, none
*/
/**
* ProductVariants
*/
class ProductVariantSizes extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
/**
* nr
*
* @var string
* @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty")
*/
protected $nr = '';
/**
* title
*
* @var string
*/
protected $title = '';
/**
* pathSegment
*
* @var string
*/
protected $pathSegment = '';
/**
* description
*
* @var string
*/
protected $description = '';
/**
* @var ProductVariants
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $productvariant = null;
/**
*
* @return ProductVariants
*/
public function getProductvariant(): ProductVariants {
if ($this->productvariant instanceof LazyLoadingProxy) {
$this->productvariant = $this->productvariant->_loadRealInstance();
}
return $this->productvariant;
}
/**
*
* @param ProductVariants $productvariant
* @return void
*/
public function setProductvariant(ProductVariants $productvariant): void {
$this->productvariant = $productvariant;
}
/**
* Returns the nr
*
* @return string $nr
*/
public function getNr() {
return $this->nr;
}
/**
* Sets the nr
*
* @param string $nr
* @return void
*/
public function setNr(string $nr) {
$this->nr = $nr;
}
/**
* Returns the title
*
* @return string $title
*/
public function getTitle() {
return $this->title;
}
/**
* Sets the title
*
* @param string $title
* @return void
*/
public function setTitle(string $title) {
$this->title = $title;
}
/**
* Returns the pathSegment
*
* @return string $pathSegment
*/
public function getPathSegment()
{
return $this->pathSegment;
}
/**
* Sets the pathSegment
*
* @param string $pathSegment
* @return void
*/
public function setPathSegment($pathSegment)
{
$this->pathSegment = $pathSegment;
}
/**
* Returns the description
*
* @return string $description
*/
public function getDescription() {
return $this->description;
}
/**
* Sets the description
*
* @param string $description
* @return void
*/
public function setDescription(string $description) {
$this->description = $description;
}
/**
* __construct
*/
public function __construct() {
$this->initializeObject();
}
/**
* Initializes all ObjectStorage properties when model is reconstructed from DB (where __construct is not called)
* Do not modify this method!
* It will be rewritten on each save in the extension builder
* You may modify the constructor of this class instead
*
* @return void
*/
public function initializeObject() {
}
}

View File

@@ -0,0 +1,632 @@
<?php
declare(strict_types=1);
namespace A2G\A2gProducts\Domain\Model;
use A2G\A2gProducts\Domain\Model\{
Ingredients,
Products
};
use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy;
use TYPO3\CMS\Extbase\Persistence\ObjectStorage;
/**
* This file is part of the "Products" 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) 2021 Raphael Martin <raphy.martin@gmail.com>, none
*/
/**
* ProductVariants
*/
class ProductVariants extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
/**
* nr
*
* @var string
* @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty")
*/
protected $nr = '';
/**
* title
*
* @var string
*/
protected $title = '';
/**
* pathSegment
*
* @var string
*/
protected $pathSegment = '';
/**
* description
*
* @var string
*/
protected $description = '';
/**
* image
*
* @var \TYPO3\CMS\Extbase\Domain\Model\FileReference
* @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove")
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $image = null;
/**
* tabIcon
*
* @var \TYPO3\CMS\Extbase\Domain\Model\FileReference
* @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove")
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $tabIcon = null;
/**
* images
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
* @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove")
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $images = null;
/**
* gallery
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
* @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove")
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $gallery = null;
/**
* seoImage1x1
*
* @var \TYPO3\CMS\Extbase\Domain\Model\FileReference
* @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove")
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $seoImage1x1 = null;
/**
* seoImage4x3
*
* @var \TYPO3\CMS\Extbase\Domain\Model\FileReference
* @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove")
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $seoImage4x3 = null;
/**
* seoImage16x9
*
* @var \TYPO3\CMS\Extbase\Domain\Model\FileReference
* @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove")
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $seoImage16x9 = null;
/**
* relCategory
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\A2G\A2gProducts\Domain\Model\Categories>
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $relCategory = null;
/**
* relFilterValues
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\A2G\A2gProducts\Domain\Model\FilterValues>
* @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove")
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $relFilterValues = null;
/**
* relIngredients
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<Ingredients>
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $relIngredients = null;
/**
* relFilterValues
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\A2G\A2gProducts\Domain\Model\SelectableAttribute>
* @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove")
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $relSelectableattribute = null;
/**
* relFilterValues
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\A2G\A2gProducts\Domain\Model\ProductVariantSizes>
* @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove")
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $relSizes = null;
/**
* @var Products
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $product = null;
public function getProduct(): Products {
if ($this->product instanceof LazyLoadingProxy) {
$this->product = $this->product->_loadRealInstance();
}
return $this->product;
}
public function setProduct(Products $product): void {
$this->product = $product;
}
/**
* Returns the nr
*
* @return string $nr
*/
public function getNr() {
return $this->nr;
}
/**
* Sets the nr
*
* @param string $nr
* @return void
*/
public function setNr(string $nr) {
$this->nr = $nr;
}
/**
* Returns the title
*
* @return string $title
*/
public function getTitle() {
return $this->title;
}
/**
* Sets the title
*
* @param string $title
* @return void
*/
public function setTitle(string $title) {
$this->title = $title;
}
/**
* Returns the pathSegment
*
* @return string $pathSegment
*/
public function getPathSegment()
{
return $this->pathSegment;
}
/**
* Sets the pathSegment
*
* @param string $pathSegment
* @return void
*/
public function setPathSegment($pathSegment)
{
$this->pathSegment = $pathSegment;
}
/**
* Returns the description
*
* @return string $description
*/
public function getDescription() {
return $this->description;
}
/**
* Sets the description
*
* @param string $description
* @return void
*/
public function setDescription(string $description) {
$this->description = $description;
}
/**
* Returns the tabIcon
*
* @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $tabIcon
*/
public function getTabIcon() {
if ($this->tabIcon instanceof LazyLoadingProxy) {
$this->tabIcon = $this->tabIcon->_loadRealInstance();
}
return $this->tabIcon;
}
/**
* Sets the tabIcon
*
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $tabIcon
* @return void
*/
public function setTabIcon(\TYPO3\CMS\Extbase\Domain\Model\FileReference $tabIcon) {
$this->tabIcon = $tabIcon;
}
/**
* Returns the image
*
* @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $image
*/
public function getImage() {
if ($this->image instanceof LazyLoadingProxy) {
$this->image = $this->image->_loadRealInstance();
}
return $this->image;
}
/**
* Sets the image
*
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $image
* @return void
*/
public function setImage(\TYPO3\CMS\Extbase\Domain\Model\FileReference $image) {
$this->image = $image;
}
/**
* Returns the images
*
* @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $images
*/
public function getImages() {
return $this->images;
}
/**
* Sets the images
*
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $images
* @return void
*/
public function setImages(\TYPO3\CMS\Extbase\Domain\Model\FileReference $images) {
$this->images = $images;
}
/**
* Returns the gallery
*
* @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $gallery
*/
public function getGallery() {
return $this->gallery;
}
/**
* Sets the gallery
*
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $gallery
* @return void
*/
public function setGallery(\TYPO3\CMS\Extbase\Domain\Model\FileReference $gallery) {
$this->gallery = $gallery;
}
/**
* Returns the seoImage1x1
*
* @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $seoImage1x1
*/
public function getSeoImage1x1() {
if ($this->seoImage1x1 instanceof LazyLoadingProxy) {
$this->seoImage1x1 = $this->seoImage1x1->_loadRealInstance();
}
return $this->seoImage1x1;
}
/**
* Sets the seoImage1x1
*
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $seoImage1x1
* @return void
*/
public function setSeoImage1x1(\TYPO3\CMS\Extbase\Domain\Model\FileReference $seoImage1x1) {
$this->seoImage1x1 = $seoImage1x1;
}
/**
* Returns the seoImage4x3
*
* @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $seoImage4x3
*/
public function getSeoImage4x3() {
if ($this->seoImage4x3 instanceof LazyLoadingProxy) {
$this->seoImage4x3 = $this->seoImage4x3->_loadRealInstance();
}
return $this->seoImage4x3;
}
/**
* Sets the seoImage4x3
*
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $seoImage4x3
* @return void
*/
public function setSeoImage4x3(\TYPO3\CMS\Extbase\Domain\Model\FileReference $seoImage4x3) {
$this->seoImage4x3 = $seoImage4x3;
}
/**
* Returns the seoImage16x9
*
* @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $seoImage16x9
*/
public function getSeoImage16x9() {
if ($this->seoImage16x9 instanceof LazyLoadingProxy) {
$this->seoImage16x9 = $this->seoImage16x9->_loadRealInstance();
}
return $this->seoImage16x9;
}
/**
* Sets the seoImage16x9
*
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $seoImage16x9
* @return void
*/
public function setSeoImage16x9(\TYPO3\CMS\Extbase\Domain\Model\FileReference $seoImage16x9) {
$this->seoImage16x9 = $seoImage16x9;
}
/**
* __construct
*/
public function __construct() {
// Do not remove the next line: It would break the functionality
$this->initializeObject();
}
/**
* Initializes all ObjectStorage properties when model is reconstructed from DB (where __construct is not called)
* Do not modify this method!
* It will be rewritten on each save in the extension builder
* You may modify the constructor of this class instead
*
* @return void
*/
public function initializeObject() {
$this->relCategory = $this->relCategory ?: new ObjectStorage();
$this->relFilterValues = $this->relFilterValues ?: new ObjectStorage();
$this->relIngredients = $this->relIngredients ?: new ObjectStorage();
$this->relSelectableattribute = $this->relSelectableattribute ?: new ObjectStorage();
$this->relSizes = $this->relSizes ?: new ObjectStorage();
}
/**
* Adds a Size
*
* @param \A2G\A2gProducts\Domain\Model\ProductVariantSizes $relSizes
* @return void
*/
public function addRelSizes(\A2G\A2gProducts\Domain\Model\ProductVariantSizes $relSizes) {
$this->relSizes->attach($relSizes);
}
/**
* Removes a Categories
*
* @param \A2G\A2gProducts\Domain\Model\Categories $relSizesToRemove The Categories to be removed
* @return void
*/
public function removeRelSizes(\A2G\A2gProducts\Domain\Model\ProductVariantSizes $relSizesToRemove) {
$this->relSizes->detach($relSizesToRemove);
}
/**
* Returns the relSizes
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\A2G\A2gProducts\Domain\Model\ProductVariantSizes> $relSizes
*/
public function getRelSizes() {
return $this->relSizes;
}
/**
* Sets the relSizes
*
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\A2G\A2gProducts\Domain\Model\ProductVariantSizes> $relSizes
* @return void
*/
public function setRelSizes(ObjectStorage $relSizes) {
$this->relSizes = $relSizes;
}
/**
* Adds a Categories
*
* @param \A2G\A2gProducts\Domain\Model\Categories $relCategory
* @return void
*/
public function addRelCategory(\A2G\A2gProducts\Domain\Model\Categories $relCategory) {
$this->relCategory->attach($relCategory);
}
/**
* Removes a Categories
*
* @param \A2G\A2gProducts\Domain\Model\Categories $relCategoryToRemove The Categories to be removed
* @return void
*/
public function removeRelCategory(\A2G\A2gProducts\Domain\Model\Categories $relCategoryToRemove) {
$this->relCategory->detach($relCategoryToRemove);
}
/**
* Returns the relCategory
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\A2G\A2gProducts\Domain\Model\Categories> $relCategory
*/
public function getRelCategory() {
return $this->relCategory;
}
/**
* Sets the relCategory
*
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\A2G\A2gProducts\Domain\Model\Categories> $relCategory
* @return void
*/
public function setRelCategory(ObjectStorage $relCategory) {
$this->relCategory = $relCategory;
}
/**
* Adds a FilterValues
*
* @param \A2G\A2gProducts\Domain\Model\FilterValues $relFilterValue
* @return void
*/
public function addRelFilterValue(\A2G\A2gProducts\Domain\Model\FilterValues $relFilterValue) {
$this->relFilterValues->attach($relFilterValue);
}
/**
* Removes a FilterValues
*
* @param \A2G\A2gProducts\Domain\Model\FilterValues $relFilterValueToRemove The FilterValues to be removed
* @return void
*/
public function removeRelFilterValue(\A2G\A2gProducts\Domain\Model\FilterValues $relFilterValueToRemove) {
$this->relFilterValues->detach($relFilterValueToRemove);
}
/**
* Returns the relFilterValues
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\A2G\A2gProducts\Domain\Model\FilterValues> $relFilterValues
*/
public function getRelFilterValues() {
return $this->relFilterValues;
}
/**
* Sets the relFilterValues
*
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\A2G\A2gProducts\Domain\Model\FilterValues> $relFilterValues
* @return void
*/
public function setRelFilterValues(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $relFilterValues) {
$this->relFilterValues = $relFilterValues;
}
/**
* Adds a FilterValues
*
* @param Ingredients $relIngredients
* @return void
*/
public function addRelIngredients(Ingredients $relIngredients) {
$this->relIngredients->attach($relIngredients);
}
/**
* Removes a FilterValues
*
* @param Ingredients $relIngredients The Ingredients to be removed
* @return void
*/
public function removeRelIngredients(Ingredients $relIngredients) {
$this->relIngredients->detach($relIngredients);
}
/**
* Returns the relIngredients
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<Ingredients> $relIngredients
*/
public function getRelIngredients() {
return $this->relIngredients;
}
/**
* Sets the relIngredients
*
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<Ingredients> $relIngredients
* @return void
*/
public function setRelIngredients(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $relIngredients) {
$this->relIngredients = $relIngredients;
}
/**
* Adds a SelectableAttribute
*
* @param \A2G\A2gProducts\Domain\Model\SelectableAttribute $relSelectableattribute
* @return void
*/
public function addRelSelectableattribute(\A2G\A2gProducts\Domain\Model\SelectableAttribute $relSelectableattribute) {
$this->relSelectableattribute->attach($relSelectableattribute);
}
/**
* Removes a SelectableAttribute
*
* @param \A2G\A2gProducts\Domain\Model\SelectableAttribute $relSelectableattributeToRemove The SelectableAttribute to be removed
* @return void
*/
public function removeRelSelectableattribute(\A2G\A2gProducts\Domain\Model\SelectableAttribute $relSelectableattributeToRemove) {
$this->relSelectableattribute->detach($relSelectableattributeToRemove);
}
/**
* Returns the relSelectableAttribute
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\A2G\A2gProducts\Domain\Model\SelectableAttribute> $relSelectableattribute
*/
public function getRelSelectableattribute() {
return $this->relSelectableattribute;
}
/**
* Sets the relSelectableAttribute
*
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\A2G\A2gProducts\Domain\Model\SelectableAttribute> $relSelectableattribute
* @return void
*/
public function setRelSelectableattribute(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $relSelectableattribute) {
$this->relSelectableattribute = $relSelectableattribute;
}
}

677
Classes/Domain/Model/Products.php Executable file
View File

@@ -0,0 +1,677 @@
<?php
declare(strict_types=1);
namespace A2G\A2gProducts\Domain\Model;
use A2G\A2gProducts\Domain\Model\{
Ingredients,
ProductVariants,
MasonryItem,
Brands
};
use TYPO3\CMS\Extbase\Persistence\Generic\LazyLoadingProxy;
/**
* This file is part of the "Products" 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) 2021 Raphael Martin <raphy.martin@gmail.com>, none
*/
/**
* Products
*/
class Products extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
/**
* nr
*
* @var string
* @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty")
*/
protected $nr = '';
/**
* title
*
* @var string
* @TYPO3\CMS\Extbase\Annotation\Validate("NotEmpty")
*/
protected $title = '';
/**
* pathSegment
*
* @var string
*/
protected $pathSegment = '';
/**
* description
*
* @var string
*/
protected $description = '';
/**
* descriptionHtml
*
* @var string
*/
protected $descriptionHtml = '';
/**
* image
*
* @var \TYPO3\CMS\Extbase\Domain\Model\FileReference
* @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove")
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $image = null;
/**
* images
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\TYPO3\CMS\Extbase\Domain\Model\FileReference>
* @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove")
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $images = null;
/**
* gallery
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<MasonryItem>
* @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove")
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $gallery = null;
/**
* seoImage1x1
*
* @var \TYPO3\CMS\Extbase\Domain\Model\FileReference
* @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove")
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $seoImage1x1 = null;
/**
* seoImage4x3
*
* @var \TYPO3\CMS\Extbase\Domain\Model\FileReference
* @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove")
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $seoImage4x3 = null;
/**
* seoImage16x9
*
* @var \TYPO3\CMS\Extbase\Domain\Model\FileReference
* @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove")
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $seoImage16x9 = null;
/**
* relCategory
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\A2G\A2gProducts\Domain\Model\Categories>
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $relCategory = null;
/**
* relFilterValues
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\A2G\A2gProducts\Domain\Model\FilterValues>
* @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove")
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $relFilterValues = null;
/**
* relIngredients
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<Ingredients>
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $relIngredients = null;
/**
* relProductvariants
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<ProductVariants>
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $relProductvariants = null;
/**
* relFilterValues
*
* @var \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\A2G\A2gProducts\Domain\Model\SelectableAttribute>
* @TYPO3\CMS\Extbase\Annotation\ORM\Cascade("remove")
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $relSelectableattribute = null;
/**
* relBrand
*
* @var Brands
* @TYPO3\CMS\Extbase\Annotation\ORM\Lazy
*/
protected $relBrand = null;
/**
* Returns the nr
*
* @return string $nr
*/
public function getNr() {
return $this->nr;
}
/**
* Sets the nr
*
* @param string $nr
* @return void
*/
public function setNr(string $nr) {
$this->nr = $nr;
}
/**
* Returns the title
*
* @return string $title
*/
public function getTitle() {
return $this->title;
}
/**
* Sets the title
*
* @param string $title
* @return void
*/
public function setTitle(string $title) {
$this->title = $title;
}
/**
* Returns the pathSegment
*
* @return string $pathSegment
*/
public function getPathSegment() {
return $this->pathSegment;
}
/**
* Sets the pathSegment
*
* @param string $pathSegment
* @return void
*/
public function setPathSegment($pathSegment) {
$this->pathSegment = $pathSegment;
}
/**
* Returns the description
*
* @return string $description
*/
public function getDescription() {
return $this->description;
}
/**
* Sets the description
*
* @param string $description
* @return void
*/
public function setDescription(string $description) {
$this->description = $description;
}
public function getDescriptionHtml(): string {
return $this->descriptionHtml;
}
public function setDescriptionHtml(string $descriptionHtml): void {
$this->descriptionHtml = $descriptionHtml;
}
/**
* Returns the image
*
* @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $image
*/
public function getImage() {
if ($this->image instanceof LazyLoadingProxy) {
$this->image = $this->image->_loadRealInstance();
}
return $this->image;
}
/**
* Sets the image
*
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $image
* @return void
*/
public function setImage(\TYPO3\CMS\Extbase\Domain\Model\FileReference $image) {
$this->image = $image;
}
/**
* Returns the images
*
* @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $images
*/
public function getImages() {
return $this->images;
}
/**
* Sets the images
*
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $images
* @return void
*/
public function setImages(\TYPO3\CMS\Extbase\Domain\Model\FileReference $images) {
$this->images = $images;
}
/**
* Returns the gallery
*
* @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $gallery
*/
public function getGallery() {
return $this->gallery;
}
/**
* Sets the gallery
*
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $gallery
* @return void
*/
public function setGallery(\TYPO3\CMS\Extbase\Domain\Model\FileReference $gallery) {
$this->gallery = $gallery;
}
/**
* Returns the seoImage1x1
*
* @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $seoImage1x1
*/
public function getSeoImage1x1() {
if ($this->seoImage1x1 instanceof LazyLoadingProxy) {
$this->seoImage1x1 = $this->seoImage1x1->_loadRealInstance();
}
return $this->seoImage1x1;
}
/**
* Sets the seoImage1x1
*
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $seoImage1x1
* @return void
*/
public function setSeoImage1x1(\TYPO3\CMS\Extbase\Domain\Model\FileReference $seoImage1x1) {
$this->seoImage1x1 = $seoImage1x1;
}
/**
* Returns the seoImage4x3
*
* @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $seoImage4x3
*/
public function getSeoImage4x3() {
if ($this->seoImage4x3 instanceof LazyLoadingProxy) {
$this->seoImage4x3 = $this->seoImage4x3->_loadRealInstance();
}
return $this->seoImage4x3;
}
/**
* Sets the seoImage4x3
*
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $seoImage4x3
* @return void
*/
public function setSeoImage4x3(\TYPO3\CMS\Extbase\Domain\Model\FileReference $seoImage4x3) {
$this->seoImage4x3 = $seoImage4x3;
}
/**
* Returns the seoImage16x9
*
* @return \TYPO3\CMS\Extbase\Domain\Model\FileReference $seoImage16x9
*/
public function getSeoImage16x9() {
if ($this->seoImage16x9 instanceof LazyLoadingProxy) {
$this->seoImage16x9 = $this->seoImage16x9->_loadRealInstance();
}
return $this->seoImage16x9;
}
/**
* Sets the seoImage16x9
*
* @param \TYPO3\CMS\Extbase\Domain\Model\FileReference $seoImage16x9
* @return void
*/
public function setSeoImage16x9(\TYPO3\CMS\Extbase\Domain\Model\FileReference $seoImage16x9) {
$this->seoImage16x9 = $seoImage16x9;
}
/**
* __construct
*/
public function __construct() {
// Do not remove the next line: It would break the functionality
$this->initializeObject();
}
/**
* Initializes all ObjectStorage properties when model is reconstructed from DB (where __construct is not called)
* Do not modify this method!
* It will be rewritten on each save in the extension builder
* You may modify the constructor of this class instead
*
* @return void
*/
public function initializeObject() {
$this->relCategory = $this->relCategory ?: new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$this->relFilterValues = $this->relFilterValues ?: new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$this->relIngredients = $this->relIngredients ?: new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$this->relSelectableattribute = $this->relSelectableattribute ?: new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$this->relProductvariants = $this->relProductvariants ?: new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
$this->gallery = $this->gallery ?: new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
// $this->relBrand = $this->relBrand ?: new \TYPO3\CMS\Extbase\Persistence\ObjectStorage();
}
/**
* Adds a Categories
*
* @param \A2G\A2gProducts\Domain\Model\Categories $relCategory
* @return void
*/
public function addRelCategory(\A2G\A2gProducts\Domain\Model\Categories $relCategory) {
$this->relCategory->attach($relCategory);
}
/**
* Removes a Categories
*
* @param \A2G\A2gProducts\Domain\Model\Categories $relCategoryToRemove The Categories to be removed
* @return void
*/
public function removeRelCategory(\A2G\A2gProducts\Domain\Model\Categories $relCategoryToRemove) {
$this->relCategory->detach($relCategoryToRemove);
}
/**
* Returns the relCategory
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\A2G\A2gProducts\Domain\Model\Categories> $relCategory
*/
public function getRelCategory() {
return $this->relCategory;
}
/**
* Sets the relCategory
*
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\A2G\A2gProducts\Domain\Model\Categories> $relCategory
* @return void
*/
public function setRelCategory(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $relCategory) {
$this->relCategory = $relCategory;
}
/**
* Adds a FilterValues
*
* @param \A2G\A2gProducts\Domain\Model\FilterValues $relFilterValue
* @return void
*/
public function addRelFilterValue(\A2G\A2gProducts\Domain\Model\FilterValues $relFilterValue) {
$this->relFilterValues->attach($relFilterValue);
}
/**
* Removes a FilterValues
*
* @param \A2G\A2gProducts\Domain\Model\FilterValues $relFilterValueToRemove The FilterValues to be removed
* @return void
*/
public function removeRelFilterValue(\A2G\A2gProducts\Domain\Model\FilterValues $relFilterValueToRemove) {
$this->relFilterValues->detach($relFilterValueToRemove);
}
/**
* Returns the relFilterValues
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\A2G\A2gProducts\Domain\Model\FilterValues> $relFilterValues
*/
public function getRelFilterValues() {
return $this->relFilterValues;
}
/**
* Sets the relFilterValues
*
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\A2G\A2gProducts\Domain\Model\FilterValues> $relFilterValues
* @return void
*/
public function setRelFilterValues(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $relFilterValues) {
$this->relFilterValues = $relFilterValues;
}
/**
* Adds a SelectableAttribute
*
* @param \A2G\A2gProducts\Domain\Model\SelectableAttribute $relSelectableattribute
* @return void
*/
public function addRelSelectableattribute(\A2G\A2gProducts\Domain\Model\SelectableAttribute $relSelectableattribute) {
$this->relSelectableattribute->attach($relSelectableattribute);
}
/**
* Removes a SelectableAttribute
*
* @param \A2G\A2gProducts\Domain\Model\SelectableAttribute $relSelectableattributeToRemove The SelectableAttribute to be removed
* @return void
*/
public function removeRelSelectableattribute(\A2G\A2gProducts\Domain\Model\SelectableAttribute $relSelectableattributeToRemove) {
$this->relSelectableattribute->detach($relSelectableattributeToRemove);
}
/**
* Returns the relSelectableAttribute
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\A2G\A2gProducts\Domain\Model\SelectableAttribute> $relSelectableattribute
*/
public function getRelSelectableattribute() {
return $this->relSelectableattribute;
}
/**
* Sets the relSelectableAttribute
*
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<\A2G\A2gProducts\Domain\Model\SelectableAttribute> $relSelectableattribute
* @return void
*/
public function setRelSelectableattribute(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $relSelectableattribute) {
$this->relSelectableattribute = $relSelectableattribute;
}
/**
* Adds a FilterValues
*
* @param Ingredients $relIngredients
* @return void
*/
public function addRelIngredients(Ingredients $relIngredients) {
$this->relIngredients->attach($relIngredients);
}
/**
* Removes a FilterValues
*
* @param Ingredients $relIngredients The Ingredients to be removed
* @return void
*/
public function removeRelIngredients(Ingredients $relIngredients) {
$this->relIngredients->detach($relIngredients);
}
/**
* Returns the relIngredients
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<Ingredients> $relIngredients
*/
public function getRelIngredients() {
return $this->relIngredients;
}
/**
* Sets the relIngredients
*
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<Ingredients> $relIngredients
* @return void
*/
public function setRelIngredients(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $relIngredients) {
$this->relIngredients = $relIngredients;
}
/**
* Adds a MasonryItem
*
* @param MasonryItem $relMasonryItem
* @return void
*/
public function addGallerys(MasonryItem $relMasonryItem) {
$this->gallery->attach($relMasonryItem);
}
/**
* Removes a MasonryItem
*
* @param MasonryItem $relMasonryItem The MasonryItem to be removed
* @return void
*/
public function removeGallerys(MasonryItem $relMasonryItem) {
$this->gallery->detach($relMasonryItem);
}
/**
* Returns the gallery
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<MasonryItem> $gallery
*/
public function getGallerys() {
return $this->gallery;
}
/**
* Sets the gallery
*
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<MasonryItem> $gallery
* @return void
*/
public function setGallerys(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $gallery) {
$this->gallery = $gallery;
}
//
// public function getRelProductvariants() {
// return $this->relProductvariants;
// }
//
// public function setRelProductvariants($relProductvariants): void {
// $this->relProductvariants = $relProductvariants;
// }
//
//
/**
* Adds a FilterValues
*
* @param ProductVariants $relProductvariants
* @return void
*/
public function addRelProductvariants($relProductvariants) {
$this->relProductvariants->attach($relProductvariants);
}
/**
* Removes a FilterValues
*
* @param ProductVariants $relProductvariants The ProductVariants to be removed
* @return void
*/
public function removeRelProductvariants($relProductvariants) {
$this->relProductvariants->detach($relProductvariants);
}
/**
* Returns the relProductvariants
*
* @return \TYPO3\CMS\Extbase\Persistence\ObjectStorage<ProductVariants> $relProductvariants
*/
public function getRelProductvariants() {
return $this->relProductvariants;
}
/**
* Sets the relProductvariants
*
* @param \TYPO3\CMS\Extbase\Persistence\ObjectStorage<ProductVariants> $relProductvariants
* @return void
*/
public function setRelProductvariants(\TYPO3\CMS\Extbase\Persistence\ObjectStorage $relProductvariants) {
$this->relProductvariants = $relProductvariants;
}
/**
* Returns the relBrand
*
* @return Brands|null
*/
public function getRelBrand():?Brands {
if ($this->relBrand instanceof LazyLoadingProxy) {
$this->relBrand = $this->relBrand->_loadRealInstance();
}
return $this->relBrand;
}
/**
* Sets the relBrand
*
* @param Brands|null $relBrand
* @return void
*/
public function setRelBrand(?Brands $relBrand) {
$this->relBrand = $relBrand;
}
}

View File

@@ -0,0 +1,87 @@
<?php
declare(strict_types=1);
namespace A2G\A2gProducts\Domain\Model;
/**
* This file is part of the "altogether Products" 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) 2021 Raphael Martin <raphy.martin@gmail.com>, none
*/
/**
* SelectableAttribute
*/
class SelectableAttribute extends \TYPO3\CMS\Extbase\DomainObject\AbstractEntity {
/**
* relFilterOptions
*
* @var \A2G\A2gProducts\Domain\Model\FilterOptions
*/
protected $relFilterOption = null;
/**
* relFilters
*
* @var \A2G\A2gProducts\Domain\Model\Filters
*/
protected $relFilters = null;
/**
*
* @var string
*/
protected $title = '';
/**
* Returns the relFilterOption
*
* @return \A2G\A2gProducts\Domain\Model\FilterOptions $relFilterOption
*/
public function getRelFilterOption() {
return $this->relFilterOption;
}
/**
* Sets the relFilterOption
*
* @param \A2G\A2gProducts\Domain\Model\FilterOptions $relFilterOptio
* @return void
*/
public function setRelFilterOption(\A2G\A2gProducts\Domain\Model\FilterOptions $relFilterOptions) {
$this->relFilterOption = $relFilterOption;
}
/**
* Returns the relFilters
*
* @return \A2G\A2gProducts\Domain\Model\Filters $relFilters
*/
public function getRelFilters() {
return $this->relFilters;
}
/**
* Sets the relFilters
*
* @param \A2G\A2gProducts\Domain\Model\Filters $relFilters
* @return void
*/
public function setRelFilters(\A2G\A2gProducts\Domain\Model\Filters $relFilters) {
$this->relFilters = $relFilters;
}
public function getTitle(): string {
return $this->title;
}
public function setTitle(string $title): void {
$this->title = $title;
}
}

View File

@@ -0,0 +1,43 @@
<?php
declare(strict_types=1);
namespace A2G\A2gProducts\Domain\Repository;
/* * *
*
* This file is part of the "WebX GS Map" 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) 2019 Raphael Martin <raphael@web-crossing.com>, web-crossing gmbh
*
* * */
/**
* The repository for Categories
*/
class CategoriesRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
/**
* @var array
*/
protected $defaultOrderings = [
'sorting' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING
];
/**
* @param array $uids
*/
public function findByUids(array $uids = []) {
if (!empty($uids)) {
$query = $this->createQuery();
$constraints = [];
$constraints[] = $query->in('uid', $uids);
$query->matching($query->logicalAnd($constraints));
return $query->execute();
}
}
}

View File

@@ -0,0 +1,30 @@
<?php
declare(strict_types=1);
namespace A2G\A2gProducts\Domain\Repository;
/* * *
*
* This file is part of the "WebX GS Map" 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) 2019 Raphael Martin <raphael@web-crossing.com>, web-crossing gmbh
*
* * */
/**
* The repository for FilterOptions
*/
class FilterOptionsRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
/**
* @var array
*/
protected $defaultOrderings = [
'sorting' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING
];
}

View File

@@ -0,0 +1,51 @@
<?php
declare(strict_types=1);
namespace A2G\A2gProducts\Domain\Repository;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Context\Context;
/**
* This file is part of the "Products" 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) 2021 Raphael Martin <raphy.martin@gmail.com>, none
*/
/**
* The repository for Products
*/
class FiltersRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
/**
* @var array
*/
protected $defaultOrderings = [
'sorting' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING
];
/**
* @param array $categoryUids
*/
public function getFromCategories(array $categoryUids = []) {
$languageAspect = GeneralUtility::makeInstance(Context::class)->getAspect('language');
$sys_language_uid = $languageAspect->getId();
$query = $this->createQuery();
$sql = 'SELECT DISTINCT fT.* FROM tx_a2gproducts_domain_model_filters AS fT '
. 'JOIN tx_a2gproducts_categories_filters_mm AS mmT ON mmT.uid_foreign = fT.uid'
. ' WHERE fT.hidden=0 AND fT.deleted=0 '
. (empty($categoryUids) ? '' :'AND mmT.uid_local IN (' . implode(',', $categoryUids ) . ') ')
. 'AND fT.sys_language_uid IN (:dcSysLanguageUid, -1) ORDER BY fT.sorting';
$arguments = [
':dcSysLanguageUid' => $sys_language_uid
];
$query->statement($sql, $arguments);
return $query->execute();
}
}

View File

@@ -0,0 +1,33 @@
<?php
declare(strict_types=1);
namespace A2G\A2gProducts\Domain\Repository;
/**
* This file is part of the "Products" 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) 2021 Raphael Martin <raphy.martin@gmail.com>, none
*/
/**
* The repository for Ingredients
*/
class IngredientsRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
/**
* @var array
*/
protected $defaultOrderings = [
'sorting' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING
];
public function initializeObject() {
$querySettings = $this->objectManager->get(\TYPO3\CMS\Extbase\Persistence\Generic\Typo3QuerySettings::class);
$querySettings->setRespectStoragePage(false);
$this->setDefaultQuerySettings($querySettings);
}
}

View File

@@ -0,0 +1,27 @@
<?php
declare(strict_types=1);
namespace A2G\A2gProducts\Domain\Repository;
/**
* This file is part of the "Products" 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) 2021 Raphael Martin <raphy.martin@gmail.com>, none
*/
/**
* The repository for ProductVariants
*/
class ProductVariantsRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
/**
* @var array
*/
protected $defaultOrderings = [
'sorting' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_ASCENDING
];
}

View File

@@ -0,0 +1,204 @@
<?php
declare(strict_types=1);
namespace A2G\A2gProducts\Domain\Repository;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Context\Context;
use TYPO3\CMS\Extbase\Persistence\Generic\QueryResult;
use A2G\A2gProducts\Domain\Model\Filters;
use A2G\A2gProducts\Domain\Traits\{
InjectFiltersRepositoryTrait,
InjectFilterOptionsRepositoryTrait
};
/**
* This file is part of the "Products" 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) 2021 Raphael Martin <raphy.martin@gmail.com>, none
*/
/**
* The repository for Products
*/
class ProductsRepository extends \TYPO3\CMS\Extbase\Persistence\Repository {
use InjectFiltersRepositoryTrait;
use InjectFilterOptionsRepositoryTrait;
/**
* @param array $categoryUids
*/
public function getFromCategories(array $categoryUids, int $limit = 0, int $offset = 0, array $excludeProduct = [], bool $random = false) {
if (!empty($categoryUids)) {
$languageAspect = GeneralUtility::makeInstance(Context::class)->getAspect('language');
$sys_language_uid = $languageAspect->getId();
$query = $this->createQuery();
$sql = ' SELECT DISTINCT pT.* FROM tx_a2gproducts_domain_model_products AS pT '
. 'JOIN tx_a2gproducts_domain_model_productvariants AS pvT ON pvT.product = pT.uid '
. 'JOIN tx_a2gproducts_products_categories_mm AS mmT ON mmT.uid_local = pT.uid ';
$sqlWhere = ' WHERE pT.hidden=0 AND pT.deleted=0 AND pvT.hidden=0 AND pvT.deleted=0 AND mmT.uid_foreign IN (' . implode(',', $categoryUids) . ') AND pT.sys_language_uid IN (-1, :dcSysLangUid) ';
$arguments = [
':dcSysLangUid' => $sys_language_uid
];
if (!empty($excludeProduct)) {
$sqlWhere .= ' AND pT.uid NOT IN (' . implode(',', $excludeProduct) . ') ';
}
if ($random) {
$sqlWhere .= ' ORDER BY RAND() ';
} else {
$sqlWhere .= ' ORDER BY pT.sorting ';
}
if ($limit > 0) {
$sqlWhere .= ' LIMIT :dcLimit ';
$arguments[':dcLimit'] = $limit;
}
if ($offset > 0) {
$sqlWhere .= ' OFFSET :dcOffset ';
$arguments[':dcOffset'] = $offset;
}
$query->statement($sql . $sqlWhere, $arguments);
return $query->execute();
} else {
return $this->findAll();
}
}
/**
*
* @param array $categoryUids
* @param array $mainFilter
* @param string $search
* @param int $limit
* @param int $offset
* @param QueryResult $filters
* @param bool $random
* @return QueryResult
*/
public function filter(array $categoryUids, array $mainFilter = [], string $search = '', int $limit = 0, int $offset = 0, QueryResult $filters = null, bool $random = false): QueryResult {
$languageAspect = GeneralUtility::makeInstance(Context::class)->getAspect('language');
$sys_language_uid = $languageAspect->getId();
$query = $this->createQuery();
$sql = 'SELECT DISTINCT pT.* FROM tx_a2gproducts_domain_model_products AS pT '
. 'JOIN tx_a2gproducts_domain_model_productvariants AS pvT ON pvT.product = pT.uid '
. 'JOIN tx_a2gproducts_products_categories_mm AS mmT ON mmT.uid_local = pT.uid ';
$sqlWhere = 'WHERE pT.hidden=0 AND pT.deleted=0 AND pvT.hidden=0 AND pvT.deleted=0 AND pT.sys_language_uid IN (:dcSysLangUid,-1) ';
if(!empty($categoryUids)){
$sqlWhere .= 'AND mmT.uid_foreign IN (' . implode(',', $categoryUids) . ') ';
}
$arguments = [
':dcSysLangUid' => $sys_language_uid
];
if (trim($search) !== '') {
$sqlWhere .= 'AND pT.title LIKE :dcSearch ';
$arguments[':dcSearch'] = '%' . $search . '%';
}
$filtersSortet = [];
foreach ($filters as $filter) {
$filtersSortet[$filter->getUid()] = $filter;
}
$x = 1;
$i = 0;
$sql1 = ' ';
$sqlWhere1 = ' ';
foreach ($mainFilter AS $key => $filter) {
if($filtersSortet[$key] === null){
$mainFilter[$key] = null;
}
}
$mainFilter = array_filter($mainFilter);
if (!empty($mainFilter)) {
$sqlWhere .= ' AND ( ';
foreach ($mainFilter AS $key => $filter) {
$i = 0;
if ($x > 1) {
$sqlWhere .= ' AND ';
}
$sqlWhere .= ' ( ';
// $sqlWhere1 .= ' ( ';
if (!empty($filter)) {
foreach ($filter AS $kay => $opt) {
if ($i > 0) {
$sqlWhere .= ' OR ';
} else {
// $sqlWhere .= ' ( fv' . $x . 'T.hidden = 0 OR fvpv' . $x . 'T.hidden = 0 OR sav' . $x . 'T.hidden = 0 OR savpv' . $x . 'T.hidden = 0 ) AND ( ';
}
$filterOpt = $this->filteroptionRepository->findByUid((int) $kay);
switch ($filtersSortet[$key]->getFilterType()) {
case 1:
// 'range ( uses min and max value )'
$sqlWhere .= ' ( fv' . $x . 'T.value ' . Filters::$dbOperations[$filtersSortet[$key]->getDbOperationMin()] . ' ' . $filterOpt->getValueMin() . ' ';
if ($filterOpt->getValueMax() > 0) {
$sqlWhere .= ' AND fv' . $x . 'T.value ' . Filters::$dbOperations[$filtersSortet[$key]->getDbOperationMax()] . ' ' . $filterOpt->getValueMax();
}
$sqlWhere .= ' ) ';
break;
case 2:
// 'compare ( uses just min value )'
if (Filters::$dbOperations[$filtersSortet[$key]->getDbOperationMin()] === 'IN') {
$sqlWhere .= '( fv' . $x . 'T.value IN (' . $filterOpt->getValueMin() . ' ) ';
} else {
$sqlWhere .= '( fv' . $x . 'T.value ' . Filters::$dbOperations[$filtersSortet[$key]->getDbOperationMin()] . ' ' . $filterOpt->getValueMin() . ' ) ';
}
break;
case 3:
// uses no value
$sqlWhere .= '( '
. '( fv' . $x . 'T.rel_filter_option = ' . (int) $kay . ' AND fv' . $x . 'T.hidden = 0 ) '
. 'OR ( fvpv' . $x . 'T.rel_filter_option = ' . (int) $kay . ' AND fvpv' . $x . 'T.hidden = 0 ) '
// . 'OR ( sav' . $x . 'T.rel_filter_option = ' . (int) $kay . ' AND sav' . $x . 'T.hidden = 0 ) '
. 'OR ( savpv' . $x . 'T.rel_filter_option = ' . (int) $kay . ' AND savpv' . $x . 'T.hidden = 0 ) '
. ') ';
break;
}
$i = 1;
}
// $sqlWhere .= ' ) ';
}
$sql .= 'LEFT JOIN tx_a2gproducts_domain_model_filtervalues AS fv' . $x . 'T ON fv' . $x . 'T.products = pT.uid '
. 'LEFT JOIN tx_a2gproducts_domain_model_filtervalues AS fvpv' . $x . 'T ON fvpv' . $x . 'T.productvariants = pvT.uid '
// . 'LEFT JOIN tx_a2gproducts_domain_model_selectableattribute AS sav' . $x . 'T ON sav' . $x . 'T.products = pT.uid '
. 'LEFT JOIN tx_a2gproducts_domain_model_selectableattribute AS savpv' . $x . 'T ON savpv' . $x . 'T.productvariants = pvT.uid ';
$arguments[':dcKey' . $x] = (int) $key;
$x = $x + 1;
$sqlWhere .= ' ) ';
}
$sqlWhere .= ' ) ';
}
if ($random) {
$sqlWhere .= ' ORDER BY RAND()';
} else {
$sqlWhere .= ' ORDER BY pT.sorting';
}
if ($limit > 0) {
$sqlWhere .= ' LIMIT :dcLimit ';
$arguments[':dcLimit'] = $limit;
}
if ($offset > 0) {
$sqlWhere .= ' OFFSET :dcOffset ';
$arguments[':dcOffset'] = $offset;
}
$query->statement($sql . $sqlWhere, $arguments);
return $query->execute();
}
}

View File

@@ -0,0 +1,32 @@
<?php
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/PHPClass.php to edit this template
*/
namespace A2G\A2gProducts\Domain\Traits;
use A2G\A2gProducts\Domain\Repository\CategoriesRepository;
/**
* Description of InjectCategoriesRepositoryTrait
*
* @author Raphael Martin
*/
trait InjectCategoriesRepositoryTrait {
/**
*
* @var CategoriesRepository
*/
protected $categoriesRepository = null;
/**
* @param CategoriesRepository $categoriesRepository
*/
public function injectCategoriesRepository(CategoriesRepository $categoriesRepository) {
$this->categoriesRepository = $categoriesRepository;
}
}

View File

@@ -0,0 +1,33 @@
<?php
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/PHPClass.php to edit this template
*/
namespace A2G\A2gProducts\Domain\Traits;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
/**
* Description of InjectContentObjectRendererTrait
*
* @author raphy
*/
class InjectContentObjectRendererTrait {
/**
*
* @var ContentObjectRenderer
*/
protected $contentObjectRenderer;
/**
*
* @param ContentObjectRenderer $contentObjectRenderer
*/
public function injectContentObjectRenderer(ContentObjectRenderer $contentObjectRenderer)
{
$this->contentObjectRenderer = $contentObjectRenderer;
}
}

View File

@@ -0,0 +1,35 @@
<?php
declare(strict_types=1);
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/PHPClass.php to edit this template
*/
namespace A2G\A2gProducts\Domain\Traits;
use A2G\A2gProducts\Domain\Repository\FilterOptionsRepository;
/**
* Description of InjectFilterOptionsRepositoryTrait
*
* @author Raphael Martin
*/
trait InjectFilterOptionsRepositoryTrait {
/**
*
* @var FilterOptionsRepository
*/
protected $filteroptionRepository = null;
/**
* @param FilterOptionsRepository $filteroptionRepository
*/
public function injectFilterOptionsRepository(FilterOptionsRepository $filteroptionRepository) {
$this->filteroptionRepository = $filteroptionRepository;
}
}

View File

@@ -0,0 +1,31 @@
<?php
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/PHPClass.php to edit this template
*/
namespace A2G\A2gProducts\Domain\Traits;
use A2G\A2gProducts\Domain\Repository\FiltersRepository;
/**
* Description of InjectFiltersRepositoryTrait
*
* @author Raphael Martin
*/
trait InjectFiltersRepositoryTrait {
/**
*
* @var FiltersRepository
*/
protected $filtersRepository = null;
/**
* @param FiltersRepository $filtersRepository
*/
public function injectFiltersRepository(FiltersRepository $filtersRepository) {
$this->filtersRepository = $filtersRepository;
}
}

View File

@@ -0,0 +1,35 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
declare(strict_types=1);
namespace A2G\A2gProducts\Domain\Traits;
use TYPO3\CMS\Extbase\Service\ImageService;
/**
* Description of InjectImageServiceTrait
*
* @author Raphael Martin
*/
trait InjectImageServiceTrait {
/**
* imageService
*
* @var ImageService
*/
protected $imageService = null;
/**
* @param ImageService $imageService
*/
public function injectImageService(ImageService $imageService) {
$this->imageService = $imageService;
}
}

View File

@@ -0,0 +1,27 @@
<?php
namespace A2G\A2gProducts\Domain\Traits;
use A2G\A2gProducts\Domain\Repository\IngredientsRepository;
/**
* Description of InjectIngredientsRepositoryTrait
*
* @author Raphael Martin
*/
trait InjectIngredientsRepositoryTrait {
/**
*
* @var IngredientsRepository
*/
protected $ingredientsRepository = null;
/**
* @param IngredientsRepository $ingredientsRepository
*/
public function injectIngredientsRepository(IngredientsRepository $ingredientsRepository) {
$this->ingredientsRepository = $ingredientsRepository;
}
}

View File

@@ -0,0 +1,32 @@
<?php
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Scripting/PHPClass.php to edit this template
*/
namespace A2G\A2gProducts\Domain\Traits;
use A2G\A2gProducts\Domain\Repository\ProductsRepository;
/**
* Description of InjectProductsRepositoryTrait
*
* @author Raphael Martin
*/
trait InjectProductsRepositoryTrait {
/**
*
* @var ProductsRepository
*/
protected $productsRepository = null;
/**
* @param ProductsRepository $productsRepository
*/
public function injectProductsRepository(ProductsRepository $productsRepository) {
$this->productsRepository = $productsRepository;
}
}

View File

@@ -0,0 +1,51 @@
<?php
declare(strict_types=1);
namespace A2G\A2gProducts\Hreflang\EventListener;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Frontend\ContentObject\ContentObjectRenderer;
use TYPO3\CMS\Frontend\DataProcessing\LanguageMenuProcessor;
use TYPO3\CMS\Frontend\Event\ModifyHrefLangTagsEvent;
/**
* Description of ProductsHrefLang
*
* @author Raphael Martin
*/
class ProductsHrefLang {
/** @var ContentObjectRenderer */
public $cObj;
/** @var LanguageMenuProcessor */
protected $languageMenuProcessor;
public function __construct(ContentObjectRenderer $cObj, LanguageMenuProcessor $languageMenuProcessor)
{
$this->cObj = $cObj;
$this->languageMenuProcessor = $languageMenuProcessor;
}
public function __invoke(ModifyHrefLangTagsEvent $event): void
{
$hrefLangs = $event->getHrefLangs();
$request = $event->getRequest();
// Do anything you want with $hrefLangs
$hrefLangs = [
'en-US' => 'https://example.com',
'nl-NL' => 'https://example.com/nl'
];
// Override all hrefLang tags
$event->setHrefLangs($hrefLangs);
// Or add a single hrefLang tag
$event->addHrefLang('de-DE', 'https://example.com/de');
}
}

View File

@@ -0,0 +1,22 @@
<?php
declare(strict_types=1);
namespace A2G\A2gProducts\PageTitle;
use TYPO3\CMS\Core\PageTitle\AbstractPageTitleProvider;
/**
* Description of A2gPageTitleProvider
*
* @author Raphael Martin
*/
class A2gPageTitleProvider extends AbstractPageTitleProvider
{
/**
* @param string $title
*/
public function setTitle(string $title)
{
$this->title = $title;
}
}

View File

@@ -0,0 +1,79 @@
<?php
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
namespace A2G\A2gProducts\Services;
/**
* Description of FeuserSessionService
*
* @author Raphael Martin
*/
class FeuserSessionService {
/**
* keyPrefix
*
* @var string
*/
protected $keyPrefix = '';
/**
*
* @param string $keyPrefix
*/
public function __construct(string $keyPrefix = '') {
$this->keyPrefix = $keyPrefix;
}
/**
* Returns the object stored in the user´s PHP session
* @param string $key
* @return type the stored object
*/
public function get(string $key) {
$sessionData = $GLOBALS['TSFE']->fe_user->getKey('ses', $this->keyPrefix . $key);
return unserialize($sessionData);
}
/**
* Writes an object into the PHP session
*
* @param type $object any serializable object to store into the session
* @param string $key identifier from the store in the session
* @return FeuserSessionService
*/
public function set($object, string $key): FeuserSessionService {
$sessionData = serialize($object);
$GLOBALS['TSFE']->fe_user->setKey('ses', $this->keyPrefix . $key, $sessionData);
$GLOBALS['TSFE']->fe_user->storeSessionData();
return $this;
}
/**
* Cleans up the session: removes the stored object from the PHP session
*
* @param type $key identifier from the store in the session to clean
* @return FeuserSessionService
*/
public function clean($key): FeuserSessionService {
$GLOBALS['TSFE']->fe_user->setKey('ses', $this->keyPrefix . $key, NULL);
$GLOBALS['TSFE']->fe_user->storeSessionData();
return $this;
}
/**
* set a prefix for your session store keys
*
* @param string $prefixKey
* @return void
*/
public function setKeyPrefix(string $keyPrefix = ''): void {
$this->keyPrefix = $keyPrefix;
}
}

View File

@@ -0,0 +1,127 @@
<?php
declare(strict_types=1);
namespace A2G\A2gProducts\User;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Core\Database\ConnectionPool;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
/**
* Description of FilterValuesMatcher
*
* @author Raphael Martin
*/
class FilterValuesMatcher {
protected $conRegistration;
/**
*
*/
public function __construct() {
$conPool = GeneralUtility::makeInstance(ConnectionPool::class);
$this->conRegistration = $conPool->getConnectionForTable('tx_a2gproducts_domain_model_filtervalues');
}
/**
* @param type $parameters
* @param type $parentObject
* @return bool
*/
public function showOptionsSelect(&$parameters, $parentObject): bool {
try {
$sql = 'SELECT count(foT.uid) as count '
. 'FROM tx_a2gproducts_domain_model_filteroptions AS foT '
. 'JOIN tx_a2gproducts_domain_model_filters AS fT ON fT.uid = foT.filters '
. 'WHERE fT.uid = ? AND fT.filter_type=3 AND foT.hidden = 0 AND foT.deleted=0';
$stmt = $this->conRegistration->prepare($sql);
$stmt->bindValue(1, (int) $parameters['record']['rel_filters'][0]);
$stmt->execute();
$tmp = $stmt->fetchAll();
if ($tmp[0] !== null) {
return (bool) $tmp[0]['count'];
} else {
return false;
}
} catch (\Exception $e) {
return false;
}
}
/**
*
* @param type $parameters
* @param type $parentObject
* @return bool
*/
public function showValueInput(&$parameters, $parentObject): bool {
try {
$sql = 'SELECT count(foT.uid) as count '
. 'FROM tx_a2gproducts_domain_model_filteroptions AS foT '
. 'JOIN tx_a2gproducts_domain_model_filters AS fT ON fT.uid = foT.filters '
. 'WHERE fT.uid = ? AND fT.filter_type IN ( 1,2 ) AND foT.hidden = 0 AND foT.deleted=0 AND foT.sys_language_uid = 0';
$stmt = $this->conRegistration->prepare($sql);
$stmt->bindValue(1, (int) $parameters['record']['rel_filters'][0]);
$stmt->execute();
$tmp = $stmt->fetchAll();
if ($tmp[0] !== null) {
return (bool) $tmp[0]['count'];
} else {
return false;
}
} catch (\Exception $e) {
return false;
}
}
/**
*
* @param type $parameters
* @param type $parentObject
* @return void
*/
public function title(&$parameters, $parentObject):void {
try {
if(array_key_exists('rel_filters', $parameters['row']){
if(array_key_exists(0,$parameters['row']['rel_filters'])){
$sql2 = 'SELECT fT.title AS title '
. 'FROM tx_a2gproducts_domain_model_filters AS fT '
. ' WHERE fT.uid = ? AND fT.deleted = 0 AND fT.hidden = 0';
$stmt2 = $this->conRegistration->prepare($sql2);
$stmt2->bindValue(1, (int) $parameters['row']['rel_filters'][0]);
$stmt2->execute();
$tmp2 = $stmt2->fetchAll();
if (array_key_exists(0, $tmp2)) {
$out = $tmp2[0]['title'];
} else {
$out = '';
}
$sql = 'SELECT fT.title AS title '
. 'FROM tx_a2gproducts_domain_model_filteroptions AS fT '
. ' WHERE fT.uid = ? AND fT.deleted = 0 AND fT.hidden = 0';
$stmt = $this->conRegistration->prepare($sql);
$stmt->bindValue(1, (int) $parameters['row']['rel_filter_option'][0]);
$stmt->execute();
$tmp = $stmt->fetchAll();
if (array_key_exists(0, $tmp)) {
$out .= ': ' . $tmp[0]['title'];
} else {
$out .= ': ' . $parameters['row']['value'];
}
$parameters['title'] .= $out;
}
}
} catch (\Exception $e) {
}
}
}

21
Classes/User/Tca.php Executable file
View File

@@ -0,0 +1,21 @@
<?php
namespace A2G\A2gProducts\User;
use TYPO3\CMS\Backend\Utility\BackendUtility;
/**
* Description of Tca
*
* @author Raphael Martin
*/
class Tca {
public function productVariantTitle(&$parameters) {
$record = BackendUtility::getRecord($parameters['table'], $parameters['row']['uid']);
$recordProduct = BackendUtility::getRecord('tx_a2gproducts_domain_model_products', $record['product']);
$parameters['title'] = $recordProduct['title'].' - '.$record['title'];
}
}

41
Classes/User/TypoScript.php Executable file
View File

@@ -0,0 +1,41 @@
<?php
declare(strict_types=1);
namespace A2G\A2gProducts\User;
use TYPO3\CMS\Backend\Utility\BackendUtility;
class TypoScript
{
/**
* @param string
* @param array
* @return string
*/
public function productBreadrumb(string $content, array $conf): string
{
$queryParams = $GLOBALS['TYPO3_REQUEST']->getQueryParams() ?? [];
if (!isset($queryParams['tx_a2gproducts_a2gproductsdetail']['product'])) {
return '';
}
$value = $queryParams['tx_a2gproducts_a2gproductsdetail']['product'];
$record = BackendUtility::getRecord('tx_a2gproducts_domain_model_products', $value);
return $record['title'];
}
/**
* @param string
* @param array
* @return string
*/
public function ingredientBreadrumb(string $content, array $conf): string
{
$queryParams = $GLOBALS['TYPO3_REQUEST']->getQueryParams() ?? [];
if (!isset($queryParams['tx_a2gproducts_ingredientsdetail']['ingredient'])) {
return '';
}
$value = $queryParams['tx_a2gproducts_ingredientsdetail']['ingredient'];
$record = BackendUtility::getRecord('tx_a2gproducts_domain_model_ingredients', $value);
return $record['title'];
}
}

View File

@@ -0,0 +1,68 @@
<?php
declare(strict_types=1);
namespace A2G\A2gProducts\Utility;
use TYPO3\CMS\Extbase\Annotation as Extbase;
/**
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3\CMS\Extbase\Mvc\Web\Routing\UriBuilder;
use TYPO3\CMS\Extbase\Object\ObjectManager;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManager;
use TYPO3\CMS\Extbase\Configuration\ConfigurationManagerInterface;
*/
/**
* Description of Canonical
*
* @author Raphael Martin raphael@web-crossing.com
*/
class CanonicalUtility {
/**
* objectManager
*
* @var \TYPO3\CMS\Extbase\Object\ObjectManager
* @Extbase\Inject
*/
protected $objectManager = null;
/**
* plugin
*
* @var string
*/
static private $plugin = 'tx_a2gproducts_a2gproductsdetail';
/**
* uidParamName
*
* @var string
*/
static private $uidParamName = 'resource';
/**
* setCanonical
*
* @param type $href
*/
public function setCanonical(&$href) {
/* not working > 11.x
$this->objectManager = GeneralUtility::makeInstance(ObjectManager::class);
$main = GeneralUtility::_GET(self::$plugin);
if ($main[self::$uidParamName]) {
$uriBuilder = $this->objectManager->get(UriBuilder::class);
$uriBuilder->setCreateAbsoluteUri(true);
$uriBuilder->setArguments([self::$plugin => [self::$uidParamName => $main[self::$uidParamName]]]);
$configurationManager = GeneralUtility::makeInstance(ConfigurationManager::class);
$settings = $configurationManager->getConfiguration(ConfigurationManagerInterface::CONFIGURATION_TYPE_FULL_TYPOSCRIPT);
if (isset($settings['plugin.'][self::$plugin.'.']['settings.']['canonical']) && $settings['plugin.'][self::$plugin.'.']['settings.']['canonical'] !== 0) {
$uriBuilder->setTargetPageUid($settings['plugin.'][self::$plugin.'.']['settings.']['canonical']);
$href = $uriBuilder->build();
}
}
*/
}
}

View File

@@ -0,0 +1,58 @@
<?php
/*
* This file is part of the package bk2k/bootstrap-package.
*
* For the full copyright and license information, please read the
* LICENSE file that was distributed with this source code.
*/
namespace A2G\A2gProducts\ViewHelpers;
use TYPO3\CMS\Core\Utility\GeneralUtility;
use TYPO3Fluid\Fluid\Core\Rendering\RenderingContextInterface;
use TYPO3Fluid\Fluid\Core\ViewHelper\AbstractViewHelper;
use TYPO3Fluid\Fluid\Core\ViewHelper\Traits\CompileWithRenderStatic;
/**
* JsonEncodeViewHelper
*/
class FilterActiveViewHelper extends AbstractViewHelper {
use CompileWithRenderStatic;
/**
* @var bool
*/
protected $escapeOutput = false;
/**
* Initialize arguments.
*
* @throws \TYPO3Fluid\Fluid\Core\ViewHelper\Exception
*/
public function initializeArguments() {
parent::initializeArguments();
$this->registerArgument('filter', 'array', 'The cart array', true);
$this->registerArgument('filterUid', 'int', 'The Filter Uid', true);
$this->registerArgument('optionUid', 'int', 'The Filter Option Uid', true);
}
/**
* @param array $arguments
* @param \Closure $renderChildrenClosure
* @param RenderingContextInterface $renderingContext
* @return mixed
*/
public static function renderStatic(
array $arguments,
\Closure $renderChildrenClosure,
RenderingContextInterface $renderingContext
) {
if (isset($arguments['filter'][$arguments['filterUid']][$arguments['optionUid']])) {
return 'checked';
}
return '';
}
}