From b7dac3838b586f856436e2a61ef15347a3e76c69 Mon Sep 17 00:00:00 2001 From: Florian Eisenmenger Date: Fri, 25 Feb 2022 16:13:54 +0100 Subject: [PATCH] check check --- AtlDiscountExtension-main/.DS_Store | Bin 0 -> 6148 bytes AtlDiscountExtension-main/README.md | 5 + AtlDiscountExtension-main/composer.json | 34 +++ AtlDiscountExtension-main/src/.DS_Store | Bin 0 -> 6148 bytes .../src/AtlDiscountExtension.php | 22 ++ .../src/Command/CheckDiscountEligibility.php | 136 ++++++++++++ .../RepeatDiscountCollection.php | 19 ++ .../RepeatDiscountDefinition.php | 44 ++++ .../RepeatDiscount/RepeatDiscountEntity.php | 75 +++++++ .../Checkout/Customer/CustomerExtension.php | 24 +++ .../Migration1645524148SpwnRepeatDiscount.php | 36 ++++ .../src/Resources/config/config.xml | 37 ++++ .../src/Resources/config/plugin.png | Bin 0 -> 4219 bytes .../src/Resources/config/services.xml | 31 +++ .../StateMachineTransitionSubscriber.php | 198 ++++++++++++++++++ .../app/storefront/src/scss/base.scss | 3 + .../scss/component/_filter-multi-select.scss | 24 +++ .../src/scss/component/_product-box.scss | 12 ++ .../storefront/src/scss/layout/_footer.scss | 99 +++++++++ .../storefront/src/scss/layout/_header.scss | 19 ++ .../src/scss/page/content/_breadcrumb.scss | 13 ++ .../preview.html | 9 - .../swag-gallery-buybox-abnehmplan/styles.css | 35 ---- .../filter/filter-multi-select.html.twig | 56 +++++ .../product/card/box-standard.html.twig | 8 + .../storefront/layout/footer/footer.html.twig | 4 + .../storefront/layout/header/header.html.twig | 141 +++++++++++++ .../js/zenit-platform-atmos-set2.js | 118 +++++++++++ .../block/cms-block-gallery-buybox.html.twig | 40 ++++ ...lery-buybox-abnehmplan-component.html.twig | 0 .../component/buy-widget/buy-widget.html.twig | 21 ++ .../checkout/offcanvas-cart.html.twig | 74 +++++++ .../checkout/offcanvas-item.html.twig | 69 ++++++ .../filter/filter-multi-select.html.twig | 56 +++++ .../product/card/box-standard.html.twig | 170 +++++++++++++++ .../product/card/price-unit.html.twig | 55 +++++ .../component/product/listing.html.twig | 41 ++++ .../storefront/layout/footer/footer.html.twig | 11 + .../storefront/layout/header/header.html.twig | 141 +++++++++++++ .../page/checkout/cart/index.html.twig | 63 ++++++ .../page/checkout/checkout-item.html.twig | 50 +++++ .../confirm/confirm-address.html.twig | 17 ++ .../page/checkout/confirm/index.html.twig | 112 ++++++++++ .../summary/summary-shipping.html.twig | 25 +++ .../page/product-detail/description.html.twig | 16 ++ .../page/product-detail/index.html.twig | 18 ++ 46 files changed, 2137 insertions(+), 44 deletions(-) create mode 100644 AtlDiscountExtension-main/.DS_Store create mode 100644 AtlDiscountExtension-main/README.md create mode 100644 AtlDiscountExtension-main/composer.json create mode 100644 AtlDiscountExtension-main/src/.DS_Store create mode 100644 AtlDiscountExtension-main/src/AtlDiscountExtension.php create mode 100644 AtlDiscountExtension-main/src/Command/CheckDiscountEligibility.php create mode 100644 AtlDiscountExtension-main/src/Core/System/RepeatDiscount/RepeatDiscountCollection.php create mode 100644 AtlDiscountExtension-main/src/Core/System/RepeatDiscount/RepeatDiscountDefinition.php create mode 100644 AtlDiscountExtension-main/src/Core/System/RepeatDiscount/RepeatDiscountEntity.php create mode 100644 AtlDiscountExtension-main/src/Extension/Checkout/Customer/CustomerExtension.php create mode 100644 AtlDiscountExtension-main/src/Migration/Migration1645524148SpwnRepeatDiscount.php create mode 100644 AtlDiscountExtension-main/src/Resources/config/config.xml create mode 100644 AtlDiscountExtension-main/src/Resources/config/plugin.png create mode 100644 AtlDiscountExtension-main/src/Resources/config/services.xml create mode 100644 AtlDiscountExtension-main/src/Subscriber/StateMachineTransitionSubscriber.php create mode 100644 zenitPlatformAtmosSet1/src/Resources/app/storefront/src/scss/component/_filter-multi-select.scss create mode 100644 zenitPlatformAtmosSet1/src/Resources/app/storefront/src/scss/layout/_footer.scss create mode 100644 zenitPlatformAtmosSet1/src/Resources/app/storefront/src/scss/page/content/_breadcrumb.scss delete mode 100644 zenitPlatformAtmosSet1/src/Resources/cms/blocks/swag-gallery-buybox-abnehmplan/preview.html delete mode 100644 zenitPlatformAtmosSet1/src/Resources/cms/blocks/swag-gallery-buybox-abnehmplan/styles.css create mode 100644 zenitPlatformAtmosSet1/src/Resources/views/storefront/component/listing/filter/filter-multi-select.html.twig create mode 100644 zenitPlatformAtmosSet1/src/Resources/views/storefront/layout/header/header.html.twig create mode 100644 zenitPlatformAtmosSet2/src/Resources/views/storefront/block/cms-block-gallery-buybox.html.twig create mode 100644 zenitPlatformAtmosSet2/src/Resources/views/storefront/block/cms-block-swag-gallery-buybox-abnehmplan-component.html.twig create mode 100644 zenitPlatformAtmosSet2/src/Resources/views/storefront/component/buy-widget/buy-widget.html.twig create mode 100644 zenitPlatformAtmosSet2/src/Resources/views/storefront/component/checkout/offcanvas-cart.html.twig create mode 100644 zenitPlatformAtmosSet2/src/Resources/views/storefront/component/checkout/offcanvas-item.html.twig create mode 100644 zenitPlatformAtmosSet2/src/Resources/views/storefront/component/listing/filter/filter-multi-select.html.twig create mode 100644 zenitPlatformAtmosSet2/src/Resources/views/storefront/component/product/card/box-standard.html.twig create mode 100644 zenitPlatformAtmosSet2/src/Resources/views/storefront/component/product/card/price-unit.html.twig create mode 100644 zenitPlatformAtmosSet2/src/Resources/views/storefront/component/product/listing.html.twig create mode 100644 zenitPlatformAtmosSet2/src/Resources/views/storefront/layout/footer/footer.html.twig create mode 100644 zenitPlatformAtmosSet2/src/Resources/views/storefront/layout/header/header.html.twig create mode 100644 zenitPlatformAtmosSet2/src/Resources/views/storefront/page/checkout/cart/index.html.twig create mode 100644 zenitPlatformAtmosSet2/src/Resources/views/storefront/page/checkout/checkout-item.html.twig create mode 100644 zenitPlatformAtmosSet2/src/Resources/views/storefront/page/checkout/confirm/confirm-address.html.twig create mode 100644 zenitPlatformAtmosSet2/src/Resources/views/storefront/page/checkout/confirm/index.html.twig create mode 100644 zenitPlatformAtmosSet2/src/Resources/views/storefront/page/checkout/summary/summary-shipping.html.twig create mode 100644 zenitPlatformAtmosSet2/src/Resources/views/storefront/page/product-detail/description.html.twig create mode 100644 zenitPlatformAtmosSet2/src/Resources/views/storefront/page/product-detail/index.html.twig diff --git a/AtlDiscountExtension-main/.DS_Store b/AtlDiscountExtension-main/.DS_Store new file mode 100644 index 0000000000000000000000000000000000000000..9a874b5768f336915163bb88cd434575b859f936 GIT binary patch literal 6148 zcmeH~Jr2S!425ml0g0s}V-^m;4I%_5-~tF3k&vj^b9A16778<}(6eNJu~Vz<8=6`~ zboab&MFtUB!i}=AFfm2m$tVxGT*u4pe81nUlA49C} z?O@64YO)2RT{MRe%{!}2F))pG(Sih~)xkgosK7*lF7m<7{{#Hn{6A@7N(HFEpDCdI z{V+K427TDNJVtRvdg(bZ!iLS0xr-(SX82o6vRF|uHEM!Bv8nkeepUserData()) { + return; + } + + $connection = $this->container->get(Connection::class); + $connection->executeStatement("DROP TABLE IF EXISTS `spwn_repeat_discount`"); + } +} \ No newline at end of file diff --git a/AtlDiscountExtension-main/src/Command/CheckDiscountEligibility.php b/AtlDiscountExtension-main/src/Command/CheckDiscountEligibility.php new file mode 100644 index 0000000..ca5c6d9 --- /dev/null +++ b/AtlDiscountExtension-main/src/Command/CheckDiscountEligibility.php @@ -0,0 +1,136 @@ +systemConfigService = $systemConfigService; + $this->repeatDiscountRepository = $repeatDiscountRepository; + $this->customerTagRepository = $customerTagRepository; + } + + protected function configure(): void + { + $this->setDescription('Checks the discount eligibility and removes the discount customer tag if it expired.'); + } + + /** + * @param InputInterface $input + * @param OutputInterface $output + * @return int + */ + protected function execute(InputInterface $input, OutputInterface $output): int + { + $io = new ShopwareStyle($input, $output); + + $tagId = $this->systemConfigService->get('AtlDiscountExtension.config.tag'); + + if (empty($tagId)) { + $io->warning('Customer tag assignment in plugin configuration is missing.'); + return self::FAILURE; + } + + $expiredDiscounts = $this->getExpiredDiscounts(); + + if (empty($expiredDiscounts)) { + $io->success('No customer tags were removed.'); + return self::SUCCESS; + } + + $tags = []; + $discounts = []; + foreach ($expiredDiscounts as $expiredDiscount) { + $tags[] = [ + 'customerId' => $expiredDiscount->getCustomerId(), + 'tagId' => $tagId + ]; + + $discounts[] = [ + 'id' => $expiredDiscount->getId() + ]; + } + + $this->removeCustomerTags($tags); + $this->removeDiscounts($discounts); + + $io->success(sprintf('Successfully deleted %d expired discounts.', count($expiredDiscounts))); + + return self::SUCCESS; + } + + /** + * @return array + */ + private function getExpiredDiscounts(): array + { + $expirationDays = $this->systemConfigService->get('AtlDiscountExtension.config.expirationDays'); + + // Go $expirationDays back in time + $expirationDate = (new \DateTime())->add(\DateInterval::createFromDateString('-' . $expirationDays . ' days')); + + $criteria = new Criteria(); + $criteria->addFilter( + new RangeFilter('lastOrderDate', + [ + // last order date is earlier than expiration date + RangeFilter::LTE => $expirationDate->format(\DATE_ATOM), + ] + )); + $criteria->setLimit(999); + + return $this->repeatDiscountRepository->search($criteria, Context::createDefaultContext())->getElements(); + } + + /** + * @param array $tags + * @return void + */ + private function removeCustomerTags(array $tags): void + { + $this->customerTagRepository->delete($tags, Context::createDefaultContext()); + } + + /** + * @param array $discounts + * @return void + */ + private function removeDiscounts(array $discounts): void + { + $this->repeatDiscountRepository->delete($discounts, Context::createDefaultContext()); + } +} \ No newline at end of file diff --git a/AtlDiscountExtension-main/src/Core/System/RepeatDiscount/RepeatDiscountCollection.php b/AtlDiscountExtension-main/src/Core/System/RepeatDiscount/RepeatDiscountCollection.php new file mode 100644 index 0000000..844ae2d --- /dev/null +++ b/AtlDiscountExtension-main/src/Core/System/RepeatDiscount/RepeatDiscountCollection.php @@ -0,0 +1,19 @@ +addFlags(new ApiAware(), new PrimaryKey(), new Required()), + (new FkField('customer_id', 'customerId', CustomerDefinition::class))->addFlags(new ApiAware(), new Required()), + (new DateTimeField('last_order_date', 'lastOrderDate'))->addFlags(new ApiAware(), new Required()), + new OneToOneAssociationField('customer', 'customer_id', 'id', CustomerDefinition::class, false) + ]); + } +} diff --git a/AtlDiscountExtension-main/src/Core/System/RepeatDiscount/RepeatDiscountEntity.php b/AtlDiscountExtension-main/src/Core/System/RepeatDiscount/RepeatDiscountEntity.php new file mode 100644 index 0000000..cf749e4 --- /dev/null +++ b/AtlDiscountExtension-main/src/Core/System/RepeatDiscount/RepeatDiscountEntity.php @@ -0,0 +1,75 @@ +customerId; + } + + /** + * @param string $customerId + */ + public function setCustomerId(string $customerId): void + { + $this->customerId = $customerId; + } + + /** + * @return \DateTimeInterface + */ + public function getLastOrderDate(): \DateTimeInterface + { + return $this->lastOrderDate; + } + + /** + * @param \DateTimeInterface $lastOrderDate + */ + public function setLastOrderDate(\DateTimeInterface $lastOrderDate): void + { + $this->lastOrderDate = $lastOrderDate; + } + + /** + * @return CustomerEntity + */ + public function getCustomer(): CustomerEntity + { + return $this->customer; + } + + /** + * @param CustomerEntity $customer + */ + public function setCustomer(CustomerEntity $customer): void + { + $this->customer = $customer; + } +} \ No newline at end of file diff --git a/AtlDiscountExtension-main/src/Extension/Checkout/Customer/CustomerExtension.php b/AtlDiscountExtension-main/src/Extension/Checkout/Customer/CustomerExtension.php new file mode 100644 index 0000000..5e0676c --- /dev/null +++ b/AtlDiscountExtension-main/src/Extension/Checkout/Customer/CustomerExtension.php @@ -0,0 +1,24 @@ +add( + (new OneToOneAssociationField('repeatDiscount', 'id', 'customer_id', RepeatDiscountDefinition::class)) + ); + } + + public function getDefinitionClass(): string + { + return CustomerDefinition::class; + } +} \ No newline at end of file diff --git a/AtlDiscountExtension-main/src/Migration/Migration1645524148SpwnRepeatDiscount.php b/AtlDiscountExtension-main/src/Migration/Migration1645524148SpwnRepeatDiscount.php new file mode 100644 index 0000000..a49e408 --- /dev/null +++ b/AtlDiscountExtension-main/src/Migration/Migration1645524148SpwnRepeatDiscount.php @@ -0,0 +1,36 @@ +executeStatement(' + CREATE TABLE IF NOT EXISTS `spwn_repeat_discount` ( + `id` BINARY(16) NOT NULL, + `customer_id` BINARY(16) NOT NULL, + `last_order_date` DATETIME(3) NOT NULL, + `created_at` DATETIME(3) NOT NULL, + `updated_at` DATETIME(3) NULL, + PRIMARY KEY (`id`), + CONSTRAINT `uniq.spwn_repeat_discount.customer_id` UNIQUE (`customer_id`), + CONSTRAINT `fk.spwn_repeat_discount.customer_id` FOREIGN KEY (`customer_id`) + REFERENCES `customer` (`id`) ON DELETE CASCADE ON UPDATE CASCADE + ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_unicode_ci; + '); + } + + public function updateDestructive(Connection $connection): void + { + // implement update destructive + } +} diff --git a/AtlDiscountExtension-main/src/Resources/config/config.xml b/AtlDiscountExtension-main/src/Resources/config/config.xml new file mode 100644 index 0000000..add4433 --- /dev/null +++ b/AtlDiscountExtension-main/src/Resources/config/config.xml @@ -0,0 +1,37 @@ + + + + + Settings + Einstellungen + + + customField + custom_field + + + + + + minAmountDiscountableLineItems + + + 3 + + + + tag + tag + + + + + + expirationDays + + + 56 + + + \ No newline at end of file diff --git a/AtlDiscountExtension-main/src/Resources/config/plugin.png b/AtlDiscountExtension-main/src/Resources/config/plugin.png new file mode 100644 index 0000000000000000000000000000000000000000..6f325b161b27689c4f132f5c48a5b93fdc6dd96c GIT binary patch literal 4219 zcmWkyc{r4h6MuKT%jNM61ho2 zRL&eZOUZrhSC0Mp{V_9t%slfvGxN;MXC{$&{tP>d5DNeR?4~A$7mpi5w_8vtNoQ$vDf$kn=9TFIM}ub`w%#$Qr(fecW=qR z>CK1To8Hb&d~h*}YBvik1taRtV9UM6GxfQp(f5chDavLj!Xm!RJ$8}<;vNH*M)$<5 zx0!O2wf6nb;$Ta}#P?DNIC3urV7FMozqN}cDRYs9EgIkUgwjZBr+4GY&Eo5L$PF)+ zI>m#QvI%n!_BFvBc1BTX`wItZ7mySsNMzlE8n!Z1dUe|A(0$?Vy)|YnjT}6DOkba7s=G)EC6Uq@7SNL1K8--1|Ke7ei1o!R~$o87p=jd zoG{>`<>7keVRcUtYBaB9@)X;VVw8&WT~>z`+@oJQj$o> zxA$Yrarv9vSXILGScxj-%V2Mud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8II-9qOiHy~ z_3`Tx8re%2L~Cc*A7q)>v9)G&pSwsWuW>@m{AabN{7&B)tR9;3ZkUv;u`AmU!deAt zHrfVo#Y;{$U16|fIXTp0edD%?i&LM2VTi+P5AS*J`R9!l3mo%vouv0COfqVbBkUV* zkx=?ZKhWWYH*MKBw|o9+V@2&{9ftzp+!5zr9~opM^Y-|UO`1(>A!wRe3q5FUrKp0? zU__>4jwR^Fgr2UntUmTTGIlc!*$(k%T}*%wF20~Thczo#2K?&w zLy*Nb-3XFo(3trY1K`3b(gAqV*N7uz-7A2Wc3VWFd*HI5cWdQy;|g8kwqY@#}@ysvmS7;u#PQH zy#Yz#svwH<7e;Kg@u_@1Fi-x%%-M4&!Z?Cs!~v8Bsvryc2#IS#^FUXap9xy3ok)L4EDu6o~@Pz>(v1}<^~=efzk=0t~)gcr<+K$-r1`8MX-{`i+gnDgouF3M1>MAu^p z0qnQE&n45!zO|cgJ + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/AtlDiscountExtension-main/src/Subscriber/StateMachineTransitionSubscriber.php b/AtlDiscountExtension-main/src/Subscriber/StateMachineTransitionSubscriber.php new file mode 100644 index 0000000..677ada9 --- /dev/null +++ b/AtlDiscountExtension-main/src/Subscriber/StateMachineTransitionSubscriber.php @@ -0,0 +1,198 @@ +systemConfigService = $systemConfigService; + $this->orderDeliveryRepository = $orderDeliveryRepository; + $this->customFieldRepository = $customFieldRepository; + $this->customerRepository = $customerRepository; + } + + /** + * @return string[] + */ + public static function getSubscribedEvents(): array + { + return [ + StateMachineTransitionEvent::class => 'onStateTransition' + ]; + } + + /** + * @param StateMachineTransitionEvent $event + * @return void + */ + public function onStateTransition(StateMachineTransitionEvent $event): void + { + // Early return if transition state is not 'shipped' + if ($event->getToPlace()->getTechnicalName() !== OrderDeliveryStates::STATE_SHIPPED) { + return; + } + + $orderDeliveryId = $event->getEntityId(); + $orderDelivery = $this->getOrderDelivery($orderDeliveryId, $event); + + // In case no order delivery could be found - return + if (empty($orderDelivery)) { + return; + } + + $amountDiscountableLineItems = $this->getAmountDiscountableLineItems($orderDelivery->getPositions(), $event); + $minAmountDiscountableLineItems = $this->systemConfigService->get('AtlDiscountExtension.config.minAmountDiscountableLineItems'); + + if ($amountDiscountableLineItems < $minAmountDiscountableLineItems) { + return; + } + + $customer = $orderDelivery->getOrder()->getOrderCustomer()->getCustomer(); + + // Tag the customer and trace timestamp in 'spwn_repeat_discount' table + $this->tagCustomer($customer, $event); + } + + /** + * @param string $orderDeliveryId + * @param StateMachineTransitionEvent $event + * @return OrderDeliveryEntity + */ + private function getOrderDelivery(string $orderDeliveryId, StateMachineTransitionEvent $event): OrderDeliveryEntity + { + $criteria = new Criteria(); + $criteria->addFilter(new EqualsFilter('id', $orderDeliveryId)); + $criteria->addAssociation('positions.orderLineItem'); + $criteria->addAssociation('order.orderCustomer.customer'); + + return $this->orderDeliveryRepository->search($criteria, $event->getContext())->first(); + } + + /** + * @param OrderDeliveryPositionCollection $positions + * @return int + */ + private function getAmountDiscountableLineItems(OrderDeliveryPositionCollection $positions, StateMachineTransitionEvent $event): int + { + $customFieldName = $this->getCustomFieldName($event); + + // In case no custom field was assigned in the plugin config - return + if ($customFieldName === '') { + return 0; + } + + $amountDiscountableLineItems = 0; + foreach($positions as $position) { + $customFields = $position->getOrderLineItem()->getPayload()['customFields']; + + // Checks if the custom field is set to true + if ($customFields[$customFieldName] === true) { + $amountDiscountableLineItems++; + } + } + + return $amountDiscountableLineItems; + } + + /** + * @param StateMachineTransitionEvent $event + * @return string + */ + private function getCustomFieldName(StateMachineTransitionEvent $event): string + { + $customFieldId = $this->systemConfigService->get('AtlDiscountExtension.config.customField'); + + $criteria = new Criteria(); + $criteria->addFilter(new EqualsFilter('id', $customFieldId)); + + /** @var CustomFieldEntity $customField */ + $customField = $this->customFieldRepository->search($criteria, $event->getContext())->first(); + + // In case no custom field was assigned in the plugin config - return + if (empty($customField)) { + return ''; + } + + return $customField->getName(); + } + + /** + * @param CustomerEntity $customer + * @param StateMachineTransitionEvent $event + * @return void + */ + private function tagCustomer(CustomerEntity $customer, StateMachineTransitionEvent $event): void + { + $tagId = $this->systemConfigService->get('AtlDiscountExtension.config.tag'); + + if (empty($tagId)) { + return; + } + + $update = [ + 'id' => $customer->getId(), + 'tags' => [ + [ + 'id' => $tagId + ] + ], + 'repeatDiscount' => [ + 'customerId' => $customer->getId(), + 'lastOrderDate' => new \DateTime() + ] + ]; + + /** @var RepeatDiscountEntity $repeatDiscount */ + $repeatDiscount = $customer->getExtensions()['repeatDiscount']; + + // If a discount is already applied, update its duration, else create one + if (!empty($repeatDiscount)) { + $repeatDiscountId = $repeatDiscount->getId(); + $update['repeatDiscount']['id'] = $repeatDiscountId; + } + + $this->customerRepository->update([$update], $event->getContext()); + } +} diff --git a/zenitPlatformAtmosSet1/src/Resources/app/storefront/src/scss/base.scss b/zenitPlatformAtmosSet1/src/Resources/app/storefront/src/scss/base.scss index 0bcd6f1..e82ca31 100644 --- a/zenitPlatformAtmosSet1/src/Resources/app/storefront/src/scss/base.scss +++ b/zenitPlatformAtmosSet1/src/Resources/app/storefront/src/scss/base.scss @@ -1,7 +1,10 @@ @import 'layout/header'; +@import 'layout/footer'; @import 'component/card'; @import 'component/cms-block'; @import 'component/cms-element'; +@import 'component/filter-multi-select'; @import 'component/product-box'; +@import 'page/content/breadcrumb'; @import 'page/checkout/cart'; @import 'page/product-detail/product-detail'; \ No newline at end of file diff --git a/zenitPlatformAtmosSet1/src/Resources/app/storefront/src/scss/component/_filter-multi-select.scss b/zenitPlatformAtmosSet1/src/Resources/app/storefront/src/scss/component/_filter-multi-select.scss new file mode 100644 index 0000000..97def6c --- /dev/null +++ b/zenitPlatformAtmosSet1/src/Resources/app/storefront/src/scss/component/_filter-multi-select.scss @@ -0,0 +1,24 @@ +.filter-panel-items-container { + display: block; +} + +.filter-panel-item { + margin-right: 0; +} + +.filter-multi-select-list { + display: flex; + justify-content: center; +} + +.filter-multi-select-list-item { + background-color: transparent; + border-bottom: none; + &:hover { + background-color: transparent; + } +} + +.filter-multi-select-item-label { + color: #222; +} \ No newline at end of file diff --git a/zenitPlatformAtmosSet1/src/Resources/app/storefront/src/scss/component/_product-box.scss b/zenitPlatformAtmosSet1/src/Resources/app/storefront/src/scss/component/_product-box.scss index bb3ae8b..e0463ed 100644 --- a/zenitPlatformAtmosSet1/src/Resources/app/storefront/src/scss/component/_product-box.scss +++ b/zenitPlatformAtmosSet1/src/Resources/app/storefront/src/scss/component/_product-box.scss @@ -2,6 +2,10 @@ &.highlight { background-color: #E9F4FC; } + .brandLogo { + max-width: 60px; + margin: 8px 0 0 0; + } .product-name { font-size: 18px; line-height: 20px; @@ -31,4 +35,12 @@ .product-cheapest-price { display: none; } +} + +.cms-block.easyfit { + .product-box { + .product-info { + min-height: 135px; + } + } } \ No newline at end of file diff --git a/zenitPlatformAtmosSet1/src/Resources/app/storefront/src/scss/layout/_footer.scss b/zenitPlatformAtmosSet1/src/Resources/app/storefront/src/scss/layout/_footer.scss new file mode 100644 index 0000000..d7a9bc1 --- /dev/null +++ b/zenitPlatformAtmosSet1/src/Resources/app/storefront/src/scss/layout/_footer.scss @@ -0,0 +1,99 @@ + +#collapseFooterCustom { + p { + margin-bottom: 5px; + img { + margin-bottom: 8px; + } + } +} + +.footer-newsletter { + .newsletter-inner-text { + font-size: 18px; + line-height: 24px; + } + .footer-newsletter-column-input-email { + border-bottom: 2px solid $sw-color-brand-primary; + margin: 0 15px; + padding: 0; + } + .form-control, + .input-group-append .btn { + border: none; + } + .form-control { + padding-top: 0; + padding-left: 0; + padding-bottom: 0; + font-size: 18px; + line-height: 24px; + } +} + +.footer-hotline-column { + .footer-contact-hotline { + margin-bottom: 8px; + a:not(.btn) { + margin-top: 16px; + margin-bottom: 0; + line-height: 15px; + } + } + .footer-contact-form { + margin-top: 0; + a { + color: #222; + text-decoration: underline; + &:hover { + color: #222; + text-decoration: none; + } + } + } +} + + +.footer-column-headline { + margin-bottom: 0; + &:before { + display: none; + } +} + +.footer-link-item { + a { + &:after { + top: 75%; + } + } +} + + +@media (min-width: 768px) { + .footer-link-item { + padding: 0; + } +} + +.social-icons { + display: flex; + justify-content: center; + margin-bottom: 10px; + .icon { + border: 2px solid $sw-color-brand-primary; + border-radius: 50%; + width: 40px; + height: 40px; + margin: 0 8px; + &.icon-facebook { + padding: 8px; + } + &.icon-instagram { + padding: 5px; + } + } + svg { + color: $sw-color-brand-primary; + } +} \ No newline at end of file diff --git a/zenitPlatformAtmosSet1/src/Resources/app/storefront/src/scss/layout/_header.scss b/zenitPlatformAtmosSet1/src/Resources/app/storefront/src/scss/layout/_header.scss index 0251020..0470c50 100644 --- a/zenitPlatformAtmosSet1/src/Resources/app/storefront/src/scss/layout/_header.scss +++ b/zenitPlatformAtmosSet1/src/Resources/app/storefront/src/scss/layout/_header.scss @@ -1,3 +1,8 @@ +.header-row { + padding-top: 10px; + border-bottom: 1px solid #B1C3D9; +} + .header-main { .header-cart-btn { .header-cart-total { @@ -51,4 +56,18 @@ line-height: 18px; text-transform: uppercase; padding: 0; + .main-navigation-link-text { + &:after { + height: 3px; + left: 0; + right: 0; + bottom: -18px; + } + } + &.active { + .main-navigation-link-text { + color: $sw-color-brand-primary; + } + } } + diff --git a/zenitPlatformAtmosSet1/src/Resources/app/storefront/src/scss/page/content/_breadcrumb.scss b/zenitPlatformAtmosSet1/src/Resources/app/storefront/src/scss/page/content/_breadcrumb.scss new file mode 100644 index 0000000..1c6a178 --- /dev/null +++ b/zenitPlatformAtmosSet1/src/Resources/app/storefront/src/scss/page/content/_breadcrumb.scss @@ -0,0 +1,13 @@ +.breadcrumb-wrap { + a { + &.is-active { + font-weight: 700; + border-bottom: 0; + } + } + .breadcrumb-placeholder { + svg { + color: #222; + } + } +} \ No newline at end of file diff --git a/zenitPlatformAtmosSet1/src/Resources/cms/blocks/swag-gallery-buybox-abnehmplan/preview.html b/zenitPlatformAtmosSet1/src/Resources/cms/blocks/swag-gallery-buybox-abnehmplan/preview.html deleted file mode 100644 index 9e572e3..0000000 --- a/zenitPlatformAtmosSet1/src/Resources/cms/blocks/swag-gallery-buybox-abnehmplan/preview.html +++ /dev/null @@ -1,9 +0,0 @@ -
-
-

Lorem ipsum dolor

-

Lorem ipsum dolor sit amet, consetetur sadipscing elitr.

-
- - - Preview image -
\ No newline at end of file diff --git a/zenitPlatformAtmosSet1/src/Resources/cms/blocks/swag-gallery-buybox-abnehmplan/styles.css b/zenitPlatformAtmosSet1/src/Resources/cms/blocks/swag-gallery-buybox-abnehmplan/styles.css deleted file mode 100644 index 7705d7d..0000000 --- a/zenitPlatformAtmosSet1/src/Resources/cms/blocks/swag-gallery-buybox-abnehmplan/styles.css +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Styling of your block preview in the CMS sidebar - */ - .sw-cms-preview-swag-image-text-reversed { - display: grid; - grid-template-columns: 1fr 1fr; - grid-column-gap: 20px; - padding: 15px; -} - -/* - * Styling of your block in the CMS editor - * Pattern: sw-cms-block-${block.name}-component - */ -.sw-cms-block-swag-image-text-reversed-component { - display: grid; - grid-template-columns: repeat(auto-fit, minmax(195px, 1fr)); - grid-gap: 40px; -} - -/* - * Each slot will have an additional class - * Pattern: sw-cms-slot-${slot.name} - */ -.sw-cms-block-swag-image-text-reversed-component .sw-cms-slot-left { - -} - -/* - * Each slot will have an additional class - * Pattern: sw-cms-slot-${slot.name} - */ -.sw-cms-block-swag-image-text-reversed-component .sw-cms-slot-right { - -} \ No newline at end of file diff --git a/zenitPlatformAtmosSet1/src/Resources/views/storefront/component/listing/filter/filter-multi-select.html.twig b/zenitPlatformAtmosSet1/src/Resources/views/storefront/component/listing/filter/filter-multi-select.html.twig new file mode 100644 index 0000000..c898e7e --- /dev/null +++ b/zenitPlatformAtmosSet1/src/Resources/views/storefront/component/listing/filter/filter-multi-select.html.twig @@ -0,0 +1,56 @@ +{% sw_extends '@Storefront/storefront/component/listing/filter/filter-multi-select.html.twig' %} + +{% block component_filter_multi_select %} + +{% endblock %} \ No newline at end of file diff --git a/zenitPlatformAtmosSet1/src/Resources/views/storefront/component/product/card/box-standard.html.twig b/zenitPlatformAtmosSet1/src/Resources/views/storefront/component/product/card/box-standard.html.twig index 821be3f..bc5e051 100644 --- a/zenitPlatformAtmosSet1/src/Resources/views/storefront/component/product/card/box-standard.html.twig +++ b/zenitPlatformAtmosSet1/src/Resources/views/storefront/component/product/card/box-standard.html.twig @@ -107,6 +107,14 @@ {% block component_product_box_info %}
+ {% if product.customFields.custom_productteaser_logo is defined %} + {% set logoImageId = product.customFields.custom_productteaser_logo %} + {% set mediaCollection = searchMedia([logoImageId], context.context) %} + {% set logoImage = mediaCollection.get(logoImageId) %} + + {% endif %} {% block component_product_box_rating %} {% if theme_config('zen-product-listing-card-rating-position') is same as ('default') %} {{ parent() }} diff --git a/zenitPlatformAtmosSet1/src/Resources/views/storefront/layout/footer/footer.html.twig b/zenitPlatformAtmosSet1/src/Resources/views/storefront/layout/footer/footer.html.twig index a1116d7..abdd7c6 100644 --- a/zenitPlatformAtmosSet1/src/Resources/views/storefront/layout/footer/footer.html.twig +++ b/zenitPlatformAtmosSet1/src/Resources/views/storefront/layout/footer/footer.html.twig @@ -1,5 +1,9 @@ {% sw_extends '@Storefront/storefront/layout/footer/footer.html.twig' %} +{% block layout_footer_payment_shipping_logos %} +{% endblock %} + + {% block layout_footer_copyright %}