use Lc\CaracoleBundle\Factory\Address\AddressFactory; | use Lc\CaracoleBundle\Factory\Address\AddressFactory; | ||||
use Lc\CaracoleBundle\Repository\Address\AddressRepositoryQuery; | use Lc\CaracoleBundle\Repository\Address\AddressRepositoryQuery; | ||||
use Lc\CaracoleBundle\Repository\Address\AddressStore; | use Lc\CaracoleBundle\Repository\Address\AddressStore; | ||||
use Lc\CaracoleBundle\Solver\Address\AddressSolver; | |||||
class AddressContainer | class AddressContainer | ||||
{ | { | ||||
protected AddressFactory $factory; | protected AddressFactory $factory; | ||||
protected AddressSolver $solver; | |||||
protected AddressRepositoryQuery $repositoryQuery; | protected AddressRepositoryQuery $repositoryQuery; | ||||
protected AddressStore $store; | protected AddressStore $store; | ||||
protected AddressBuilder $builder; | protected AddressBuilder $builder; | ||||
public function __construct( | public function __construct( | ||||
AddressFactory $factory, | AddressFactory $factory, | ||||
AddressSolver $solver, | |||||
AddressRepositoryQuery $repositoryQuery, | AddressRepositoryQuery $repositoryQuery, | ||||
AddressStore $store, | AddressStore $store, | ||||
AddressBuilder $builder | AddressBuilder $builder | ||||
) { | ) { | ||||
$this->factory = $factory; | $this->factory = $factory; | ||||
$this->solver = $solver; | |||||
$this->repositoryQuery = $repositoryQuery; | $this->repositoryQuery = $repositoryQuery; | ||||
$this->store = $store; | $this->store = $store; | ||||
$this->builder = $builder; | $this->builder = $builder; | ||||
return $this->factory; | return $this->factory; | ||||
} | } | ||||
public function getSolver(): AddressSolver | |||||
{ | |||||
return $this->solver; | |||||
} | |||||
public function getRepositoryQuery(): AddressRepositoryQuery | public function getRepositoryQuery(): AddressRepositoryQuery | ||||
{ | { | ||||
return $this->repositoryQuery; | return $this->repositoryQuery; |
use Lc\CaracoleBundle\Factory\Product\ProductFamilyFactory; | use Lc\CaracoleBundle\Factory\Product\ProductFamilyFactory; | ||||
use Lc\CaracoleBundle\Repository\Product\ProductFamilyRepositoryQuery; | use Lc\CaracoleBundle\Repository\Product\ProductFamilyRepositoryQuery; | ||||
use Lc\CaracoleBundle\Repository\Product\ProductFamilyStore; | use Lc\CaracoleBundle\Repository\Product\ProductFamilyStore; | ||||
use Lc\CaracoleBundle\Solver\Product\ProductFamilySolver; | |||||
class ProductFamilyContainer | class ProductFamilyContainer | ||||
{ | { | ||||
protected ProductFamilyFactory $factory; | protected ProductFamilyFactory $factory; | ||||
protected ProductFamilySolver $solver; | |||||
protected ProductFamilyRepositoryQuery $repositoryQuery; | protected ProductFamilyRepositoryQuery $repositoryQuery; | ||||
protected ProductFamilyStore $store; | protected ProductFamilyStore $store; | ||||
public function __construct( | public function __construct( | ||||
ProductFamilyFactory $factory, | ProductFamilyFactory $factory, | ||||
ProductFamilySolver $solver, | |||||
ProductFamilyRepositoryQuery $repositoryQuery, | ProductFamilyRepositoryQuery $repositoryQuery, | ||||
ProductFamilyStore $store | ProductFamilyStore $store | ||||
) { | ) { | ||||
$this->factory = $factory; | $this->factory = $factory; | ||||
$this->solver = $solver; | |||||
$this->repositoryQuery = $repositoryQuery; | $this->repositoryQuery = $repositoryQuery; | ||||
$this->store = $store; | $this->store = $store; | ||||
} | } | ||||
return $this->factory; | return $this->factory; | ||||
} | } | ||||
public function getSolver(): ProductFamilySolver | |||||
{ | |||||
return $this->solver; | |||||
} | |||||
public function getRepositoryQuery(): ProductFamilyRepositoryQuery | public function getRepositoryQuery(): ProductFamilyRepositoryQuery | ||||
{ | { | ||||
return $this->repositoryQuery; | return $this->repositoryQuery; |
namespace Lc\CaracoleBundle\Container\User; | namespace Lc\CaracoleBundle\Container\User; | ||||
use Lc\CaracoleBundle\Builder\User\VisitorBuilder; | |||||
use Lc\CaracoleBundle\Factory\User\VisitorFactory; | use Lc\CaracoleBundle\Factory\User\VisitorFactory; | ||||
use Lc\CaracoleBundle\Repository\User\VisitorRepositoryQuery; | use Lc\CaracoleBundle\Repository\User\VisitorRepositoryQuery; | ||||
use Lc\CaracoleBundle\Repository\User\VisitorStore; | use Lc\CaracoleBundle\Repository\User\VisitorStore; | ||||
use Lc\CaracoleBundle\Resolver\VisitorResolver; | |||||
use Lc\CaracoleBundle\Solver\User\VisitorSolver; | |||||
class VisitorContainer | class VisitorContainer | ||||
{ | { | ||||
protected VisitorFactory $factory; | protected VisitorFactory $factory; | ||||
protected VisitorSolver $solver; | |||||
protected VisitorRepositoryQuery $repositoryQuery; | protected VisitorRepositoryQuery $repositoryQuery; | ||||
protected VisitorStore $store; | protected VisitorStore $store; | ||||
protected VisitorResolver $resolver; | |||||
protected VisitorBuilder $visitorBuilder; | |||||
public function __construct( | public function __construct( | ||||
VisitorFactory $factory, | VisitorFactory $factory, | ||||
VisitorSolver $solver, | |||||
VisitorRepositoryQuery $repositoryQuery, | VisitorRepositoryQuery $repositoryQuery, | ||||
VisitorStore $store | |||||
VisitorStore $store, | |||||
VisitorResolver $resolver, | |||||
VisitorBuilder $builder | |||||
) { | ) { | ||||
$this->factory = $factory; | $this->factory = $factory; | ||||
$this->solver = $solver; | |||||
$this->repositoryQuery = $repositoryQuery; | $this->repositoryQuery = $repositoryQuery; | ||||
$this->store = $store; | $this->store = $store; | ||||
$this->resolver = $resolver; | |||||
$this->builder = $builder; | |||||
} | } | ||||
public function getFactory(): VisitorFactory | public function getFactory(): VisitorFactory | ||||
return $this->factory; | return $this->factory; | ||||
} | } | ||||
public function getSolver(): VisitorSolver | |||||
{ | |||||
return $this->solver; | |||||
} | |||||
public function getRepositoryQuery(): VisitorRepositoryQuery | public function getRepositoryQuery(): VisitorRepositoryQuery | ||||
{ | { | ||||
return $this->repositoryQuery; | return $this->repositoryQuery; | ||||
return $this->store; | return $this->store; | ||||
} | } | ||||
public function getResolver(): VisitorResolver | |||||
{ | |||||
return $this->resolver; | |||||
} | |||||
public function getBuilder(): VisitorBuilder | |||||
{ | |||||
return $this->builder; | |||||
} | |||||
} | } |
use Doctrine\Common\Collections\ArrayCollection; | use Doctrine\Common\Collections\ArrayCollection; | ||||
use Doctrine\Common\Collections\Collection; | use Doctrine\Common\Collections\Collection; | ||||
use Doctrine\ORM\Mapping as ORM; | use Doctrine\ORM\Mapping as ORM; | ||||
use Gedmo\Mapping\Annotation as Gedmo; | |||||
use Lc\CaracoleBundle\Model\Address\AddressInterface; | use Lc\CaracoleBundle\Model\Address\AddressInterface; | ||||
use Lc\CaracoleBundle\Model\PointSale\PointSaleInterface; | |||||
use Lc\SovBundle\Model\Newsletter\NewsletterInterface; | use Lc\SovBundle\Model\Newsletter\NewsletterInterface; | ||||
use Lc\CaracoleBundle\Model\Order\OrderShopInterface; | use Lc\CaracoleBundle\Model\Order\OrderShopInterface; | ||||
use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface; | use Lc\CaracoleBundle\Model\Product\ProductFamilyInterface; | ||||
use Lc\CaracoleBundle\Model\Reduction\ReductionCreditInterface; | use Lc\CaracoleBundle\Model\Reduction\ReductionCreditInterface; | ||||
use Lc\SovBundle\Model\User\UserModel as SovUserModel; | use Lc\SovBundle\Model\User\UserModel as SovUserModel; | ||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | ||||
use Lc\SovBundle\Model\Ticket\TicketInterface; | |||||
/** | /** | ||||
* @ORM\MappedSuperclass() | * @ORM\MappedSuperclass() |
use Doctrine\Common\Collections\Collection; | use Doctrine\Common\Collections\Collection; | ||||
use Doctrine\ORM\Mapping as ORM; | use Doctrine\ORM\Mapping as ORM; | ||||
use Lc\CaracoleBundle\Model\Order\OrderShopInterface; | use Lc\CaracoleBundle\Model\Order\OrderShopInterface; | ||||
use Lc\SovBundle\Doctrine\EntityInterface; | |||||
/** | /** | ||||
* @ORM\MappedSuperclass() | * @ORM\MappedSuperclass() | ||||
*/ | */ | ||||
abstract class VisitorModel | |||||
abstract class VisitorModel implements EntityInterface | |||||
{ | { | ||||
/** | /** | ||||
* @ORM\Column(type="string", length=255) | * @ORM\Column(type="string", length=255) |
$query = $this->createDefaultQuery($query); | $query = $this->createDefaultQuery($query); | ||||
$query | $query | ||||
->filterPropertyOrganicLabel() | |||||
->filterIsOrganicLabel() | |||||
->filterIsOnline(); | ->filterIsOnline(); | ||||
$results = $query->find(); | $results = $query->find(); | ||||
public function getFavorite($user = null, $organizeByParentCategory = true, $query = null) | public function getFavorite($user = null, $organizeByParentCategory = true, $query = null) | ||||
{ | { | ||||
if ($user) { | if ($user) { | ||||
return $this->getWithReductions($user->getProductFamiliesFavorites(), $user, false, $organizeByParentCategory); | |||||
return $this->getWithReductions($user->getFavoriteProductFamilies(), $user, false, $organizeByParentCategory); | |||||
} | } | ||||
return []; | return []; | ||||
// setReductionForProductFamilies | // setReductionForProductFamilies | ||||
public function getWithReductions( | public function getWithReductions( | ||||
array $productFamilies, | |||||
$productFamilies, | |||||
UserInterface $user = null, | UserInterface $user = null, | ||||
$organizeByCategory = false, | $organizeByCategory = false, | ||||
$organizeByParentCategory = false, | $organizeByParentCategory = false, | ||||
} | } | ||||
if ($productFamilies) { | if ($productFamilies) { | ||||
$reductionCatalogs = $this->reductionCatalogStore->getByProductFamilies( | |||||
$reductionCatalogs = $this->reductionCatalogStore->getByProductFamiliesConditions( | |||||
$conditions, | $conditions, | ||||
$user | $user | ||||
); | ); |
class ReductionCatalogRepositoryQuery extends AbstractRepositoryQuery | class ReductionCatalogRepositoryQuery extends AbstractRepositoryQuery | ||||
{ | { | ||||
protected bool $isJoinProductFamilies; | |||||
protected bool $isJoinProductFamily; | |||||
protected bool $isJoinProductCategories; | |||||
protected bool $isJoinProductFamilies = false; | |||||
protected bool $isJoinProductFamily = false; | |||||
protected bool $isJoinProductCategories = false; | |||||
use SectionRepositoryQueryTrait; | use SectionRepositoryQueryTrait; | ||||
public function __construct(ReductionCatalogRepository $repository, PaginatorInterface $paginator) | public function __construct(ReductionCatalogRepository $repository, PaginatorInterface $paginator) | ||||
public function filterConditionDate() | public function filterConditionDate() | ||||
{ | { | ||||
return $this | return $this | ||||
->andWhere('e.permanent = 1 OR (e.dateStart <= :now AND e.dateEnd >= :now)') | |||||
->andWhere('.permanent = 1 OR ( .dateStart <= :now AND .dateEnd >= :now)') | |||||
->setParameter(':now', new \DateTime()); | ->setParameter(':now', new \DateTime()); | ||||
} | } | ||||
{ | { | ||||
if ($user) { | if ($user) { | ||||
return $this | return $this | ||||
->andWhere(':user MEMBER OF e.users OR e.users is empty') | |||||
->andWhere(':user MEMBER OF .users OR .users is empty') | |||||
->setParameter('user', $user); | ->setParameter('user', $user); | ||||
} else { | } else { | ||||
return $this | return $this | ||||
->andWhere('e.users is empty'); | |||||
->andWhere('.users is empty'); | |||||
} | } | ||||
} | } | ||||
{ | { | ||||
if ($user) { | if ($user) { | ||||
return $this | return $this | ||||
->andWhere(':groupUser MEMBER OF e.groupUsers OR e.groupUsers is empty') | |||||
->andWhere(':groupUser MEMBER OF .groupUsers OR .groupUsers is empty') | |||||
->setParameter('groupUser', $user->getGroupUsers()); | ->setParameter('groupUser', $user->getGroupUsers()); | ||||
} else { | } else { | ||||
return $this | return $this | ||||
->andWhere('e.groupUsers is empty'); | |||||
->andWhere('.groupUsers is empty'); | |||||
} | } | ||||
} | } | ||||
$this->joinProductFamilies(); | $this->joinProductFamilies(); | ||||
$this->joinProductFamily(); | $this->joinProductFamily(); | ||||
return $this | return $this | ||||
->andWhere(':productFamilies MEMBER OF e.productFamilies OR e.productFamilies is empty') | |||||
->andWhere(':productFamilies MEMBER OF .productFamilies OR .productFamilies is empty') | |||||
->setParameter('productFamilies', $productFamilies); | ->setParameter('productFamilies', $productFamilies); | ||||
} | } | ||||
$this->joinProductFamilies(); | $this->joinProductFamilies(); | ||||
$this->joinProductFamily(); | $this->joinProductFamily(); | ||||
return $this | return $this | ||||
->andWhere(':productFamily MEMBER OF e.productFamilies OR e.productFamilies is empty') | |||||
->andWhere(':productFamily MEMBER OF .productFamilies OR .productFamilies is empty') | |||||
->setParameter('productFamily', $productFamily); | ->setParameter('productFamily', $productFamily); | ||||
} | } | ||||
{ | { | ||||
$this->joinProductCategories(); | $this->joinProductCategories(); | ||||
return $this | return $this | ||||
->andWhere(':productCategory MEMBER OF e.productCategories OR e.productCategories is empty') | |||||
->andWhere(':productCategory MEMBER OF .productCategories OR .productCategories is empty') | |||||
->setParameter('productCategory', $productCategories); | ->setParameter('productCategory', $productCategories); | ||||
} | } | ||||
parent::__construct($repository, 'r', $paginator); | parent::__construct($repository, 'r', $paginator); | ||||
} | } | ||||
public function filterByCookie(string $cookie) | |||||
public function filterByCookie(string $cookie = null) | |||||
{ | { | ||||
return $this | return $this | ||||
->andWhere('.cookie LIKE :cookie') | ->andWhere('.cookie LIKE :cookie') |
return $query; | return $query; | ||||
} | } | ||||
public function getOneByCookie(string $cookie, $query = null) | |||||
public function getOneByCookie(string $cookie = null, $query = null) | |||||
{ | { | ||||
$query = $this->createDefaultQuery($query); | $query = $this->createDefaultQuery($query); | ||||
$query->filterByCookie($cookie); | $query->filterByCookie($cookie); |
public function getMerchantUser(UserInterface $user = null) | public function getMerchantUser(UserInterface $user = null) | ||||
{ | { | ||||
if(is_null($user)) { | |||||
$user = $this->security->getUser(); | |||||
} | |||||
$merchants = $this->merchantStore->getOnline(); | $merchants = $this->merchantStore->getOnline(); | ||||
if ($user) { | if ($user) { | ||||
return $user->getMerchant(); | |||||
return $user->getFavoriteMerchant(); | |||||
} else { | } else { | ||||
$merchantCurrentId = $this->requestStack->getCurrentRequest()->cookies->getInt( | $merchantCurrentId = $this->requestStack->getCurrentRequest()->cookies->getInt( | ||||
$this->parameterBag->get('app.cookie_name_merchant_current') | $this->parameterBag->get('app.cookie_name_merchant_current') |
$this->messages[] = $message; | $this->messages[] = $message; | ||||
} | } | ||||
public function isOpenSaleOnlyComplementaryOrders(Section $section, UserInterface $user) | |||||
public function isOpenSaleOnlyComplementaryOrders(Section $section = null, UserInterface $user = null) | |||||
{ | { | ||||
if(is_null($section)) { | |||||
$section = $this->sectionResolver->getCurrent(); | |||||
} | |||||
if(is_null($user)) { | |||||
$user = $this->security->getUser(); | |||||
} | |||||
// @TODO : ajouter une option dans les sections (permettre les commandes complémentaires ou non) | // @TODO : ajouter une option dans les sections (permettre les commandes complémentaires ou non) | ||||
$orderShopsUser = $this->orderShopStore->setSection($section)->getByCurrentCycleAndUser($user); | $orderShopsUser = $this->orderShopStore->setSection($section)->getByCurrentCycleAndUser($user); | ||||
{% block navbar_header %} | {% block navbar_header %} | ||||
{{ parent() }} | {{ parent() }} | ||||
{% set section_current = section_resolver.getCurrent() %} | |||||
{% set section_current = section_current() %} | |||||
{% set is_display_switch_section = display_switch_section is defined and display_switch_section %} | {% set is_display_switch_section = display_switch_section is defined and display_switch_section %} | ||||
<nav class="carac navbar navbar-expand navbar-light main-header{% if is_display_switch_section %} display-section-switch{% endif %}" {% if is_display_switch_section %}style="border-color: {{ section_current.color }};"{% endif %}> | <nav class="carac navbar navbar-expand navbar-light main-header{% if is_display_switch_section %} display-section-switch{% endif %}" {% if is_display_switch_section %}style="border-color: {{ section_current.color }};"{% endif %}> | ||||
{% block append_body %} | {% block append_body %} | ||||
{# modal switch merchant #} | {# modal switch merchant #} | ||||
{% set user = app.user %} | {% set user = app.user %} | ||||
{% set merchant_current = merchant_resolver.getCurrent() %} | |||||
{% set merchant_current = merchant_current() %} | |||||
{% if(user.favoriteMerchant != merchant_current) %} | {% if(user.favoriteMerchant != merchant_current) %} | ||||
{# modal affichée uniquement si la sessionStorage.visit_merchant n'est pas défini (js) #} | {# modal affichée uniquement si la sessionStorage.visit_merchant n'est pas défini (js) #} |
} | } | ||||
// isProductAvailable | // isProductAvailable | ||||
public function isAvailable(ProductInterface $product, $quantityOrder = 0, $checkCart = false, $orderShop = null) | |||||
public function isProductAvailable(ProductInterface $product, $quantityOrder = 0, $checkCart = false, $orderShop = null) | |||||
{ | { | ||||
if ($product->getStatus() != 1 || $product->getProductFamily()->getStatus() != 1 || !$this->productSolver->isProductSaleStatusOn($product)) { | if ($product->getStatus() != 1 || $product->getProductFamily()->getStatus() != 1 || !$this->productSolver->isProductSaleStatusOn($product)) { | ||||
return false; | return false; | ||||
public function isOneProductAvailableAddCart(OrderShopInterface $orderShop, $products): bool | public function isOneProductAvailableAddCart(OrderShopInterface $orderShop, $products): bool | ||||
{ | { | ||||
foreach ($products as $product) { | foreach ($products as $product) { | ||||
if ($this->isAvailable($product, 1, true, $orderShop)) { | |||||
if ($this->isProductAvailable($product, 1, true, $orderShop)) { | |||||
return true; | return true; | ||||
} | } | ||||
} | } |
<?php | |||||
namespace Lc\CaracoleBundle\Solver\User; | |||||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBagInterface; | |||||
class VisitorSolver | |||||
{ | |||||
protected ParameterBagInterface $parameterBag; | |||||
public function __construct(ParameterBagInterface $parameterBag) | |||||
{ | |||||
$this->parameterBag = $parameterBag; | |||||
} | |||||
// getCookieNameVisitor | |||||
public function getCookieName() | |||||
{ | |||||
return $this->parameterBag->get('app.cookie_name_visitor'); | |||||
} | |||||
} |
namespace Lc\CaracoleBundle\Twig; | namespace Lc\CaracoleBundle\Twig; | ||||
use Lc\CaracoleBundle\Model\Merchant\MerchantInterface; | |||||
use Lc\CaracoleBundle\Model\Order\OrderShopInterface; | |||||
use Lc\CaracoleBundle\Model\Section\SectionInterface; | |||||
use Lc\CaracoleBundle\Model\User\UserMerchantInterface; | |||||
use Lc\CaracoleBundle\Repository\Config\TaxRateStore; | use Lc\CaracoleBundle\Repository\Config\TaxRateStore; | ||||
use Lc\CaracoleBundle\Repository\Config\UnitStore; | use Lc\CaracoleBundle\Repository\Config\UnitStore; | ||||
use Lc\CaracoleBundle\Repository\Merchant\MerchantRepositoryQuery; | use Lc\CaracoleBundle\Repository\Merchant\MerchantRepositoryQuery; | ||||
use Lc\CaracoleBundle\Resolver\MerchantResolver; | use Lc\CaracoleBundle\Resolver\MerchantResolver; | ||||
use Lc\CaracoleBundle\Resolver\SectionResolver; | use Lc\CaracoleBundle\Resolver\SectionResolver; | ||||
use Lc\ShopBundle\Context\UnitInterface; | use Lc\ShopBundle\Context\UnitInterface; | ||||
use Lc\SovBundle\Solver\Setting\SettingSolver; | |||||
use Twig\Extension\AbstractExtension; | use Twig\Extension\AbstractExtension; | ||||
use Twig\TwigFunction; | use Twig\TwigFunction; | ||||
protected TaxRateStore $taxRateStore; | protected TaxRateStore $taxRateStore; | ||||
protected ProductCategoryStore $productCategoryStore; | protected ProductCategoryStore $productCategoryStore; | ||||
protected OrderShopStore $orderShopStore; | protected OrderShopStore $orderShopStore; | ||||
protected SettingSolver $settingSolver; | |||||
public function __construct( | public function __construct( | ||||
MerchantResolver $merchantResolver, | MerchantResolver $merchantResolver, | ||||
UnitStore $unitStore, | UnitStore $unitStore, | ||||
TaxRateStore $taxRateStore, | TaxRateStore $taxRateStore, | ||||
ProductCategoryStore $productCategoryStore, | ProductCategoryStore $productCategoryStore, | ||||
OrderShopStore $orderShopStore | |||||
OrderShopStore $orderShopStore, | |||||
SettingSolver $settingSolver | |||||
) { | ) { | ||||
$this->merchantResolver = $merchantResolver; | $this->merchantResolver = $merchantResolver; | ||||
$this->sectionResolver = $sectionResolver; | $this->sectionResolver = $sectionResolver; | ||||
$this->taxRateStore = $taxRateStore; | $this->taxRateStore = $taxRateStore; | ||||
$this->productCategoryStore = $productCategoryStore; | $this->productCategoryStore = $productCategoryStore; | ||||
$this->orderShopStore = $orderShopStore; | $this->orderShopStore = $orderShopStore; | ||||
$this->settingSolver = $settingSolver; | |||||
} | } | ||||
public function getFunctions() | public function getFunctions() | ||||
new TwigFunction('carac_tax_rates', [$this, 'getTaxRates']), | new TwigFunction('carac_tax_rates', [$this, 'getTaxRates']), | ||||
new TwigFunction('carac_reduction_cart_codes', [$this, 'getTaxRates']), | new TwigFunction('carac_reduction_cart_codes', [$this, 'getTaxRates']), | ||||
new TwigFunction('carac_product_categories', [$this, 'getProductCategories']), | new TwigFunction('carac_product_categories', [$this, 'getProductCategories']), | ||||
); | |||||
} | |||||
public function getProductCategories() | |||||
{ | |||||
return $this->productCategoryStore | |||||
->setSection($this->sectionResolver->getCurrent()) | |||||
->getParent(false); | |||||
new TwigFunction('cart_current', [$this, 'getCartCurrent']), | |||||
new TwigFunction('merchant_current', [$this, 'getMerchantCurrent']), | |||||
new TwigFunction('user_merchant_current', [$this, 'getUserMerchantCurrent']), | |||||
new TwigFunction('section_current', [$this, 'getSectionCurrent']), | |||||
new TwigFunction('merchant_setting', [$this, 'getMerchantSetting']), | |||||
new TwigFunction('merchant_setting_current', [$this, 'getMerchantSettingCurrent']), | |||||
new TwigFunction('section_setting', [$this, 'getSectionSetting']), | |||||
new TwigFunction('section_setting_current', [$this, 'getSectionSettingCurrent']), | |||||
); | |||||
} | } | ||||
public function getSections() | public function getSections() | ||||
->getOnline(); | ->getOnline(); | ||||
} | } | ||||
public function getSectionCurrent() | |||||
public function getMerchants() | |||||
{ | |||||
return $this->merchantStore->getOnline(); | |||||
} | |||||
public function getSectionCurrent(): SectionInterface | |||||
{ | { | ||||
return $this->sectionResolver->getCurrent(); | return $this->sectionResolver->getCurrent(); | ||||
} | } | ||||
public function getCartCurrent() | |||||
public function getCartCurrent(): OrderShopInterface | |||||
{ | { | ||||
return $this->orderShopStore | return $this->orderShopStore | ||||
->setSection($this->sectionResolver->getCurrent()) | ->setSection($this->sectionResolver->getCurrent()) | ||||
->getOneCartCurrent(); | ->getOneCartCurrent(); | ||||
} | } | ||||
public function getMerchants() | |||||
public function getMerchantCurrent(): MerchantInterface | |||||
{ | { | ||||
return $this->merchantStore->getOnline(); | |||||
return $this->merchantResolver->getCurrent(); | |||||
} | |||||
public function getUserMerchantCurrent(): UserMerchantInterface | |||||
{ | |||||
$this->merchantResolver->getUserMerchant(); | |||||
} | |||||
public function getMerchantSetting(MerchantInterface $merchant, string $settingName): string | |||||
{ | |||||
return $this->settingSolver->getSettingValue($merchant, $settingName); | |||||
} | |||||
public function getMerchantSettingCurrent(string $settingName): string | |||||
{ | |||||
return $this->settingSolver->getSettingValue($this->getMerchantCurrent(), $settingName); | |||||
} | |||||
public function getSectionSetting(SectionInterface $section, string $settingName): string | |||||
{ | |||||
return $this->settingSolver->getSettingValue($section, $settingName); | |||||
} | |||||
public function getSectionSettingCurrent(string $settingName): string | |||||
{ | |||||
return $this->settingSolver->getSettingValue($this->getSectionCurrent(), $settingName); | |||||
} | |||||
public function getProductCategories() | |||||
{ | |||||
return $this->productCategoryStore | |||||
->setSection($this->sectionResolver->getCurrent()) | |||||
->getParent(false); | |||||
} | } | ||||
public function getReminders($params = []) | public function getReminders($params = []) | ||||
//TODO mettre à jour une fois les repo fait | //TODO mettre à jour une fois les repo fait | ||||
return array(); | return array(); | ||||
} | } | ||||
} | } |