ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,101 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Lts\HomePage\Block;
|
||||
|
||||
use Magento\Catalog\Helper\Image as ImageHelper;
|
||||
use Magento\Customer\Model\Session as CustomerSession;
|
||||
use Magento\Framework\View\Element\Template;
|
||||
use Magento\Sales\Model\ResourceModel\Order\CollectionFactory as OrderCollectionFactory;
|
||||
use Magento\Wishlist\Model\WishlistFactory;
|
||||
|
||||
class CustomerDashboard extends Template
|
||||
{
|
||||
public function __construct(
|
||||
Template\Context $context,
|
||||
private readonly CustomerSession $customerSession,
|
||||
private readonly OrderCollectionFactory $orderCollectionFactory,
|
||||
private readonly WishlistFactory $wishlistFactory,
|
||||
private readonly ImageHelper $imageHelper,
|
||||
array $data = []
|
||||
) {
|
||||
parent::__construct($context, $data);
|
||||
}
|
||||
|
||||
protected function _prepareLayout(): self
|
||||
{
|
||||
if ($this->isLoggedIn()) {
|
||||
$this->pageConfig->addBodyClass('lts-customer-logged-in');
|
||||
}
|
||||
return parent::_prepareLayout();
|
||||
}
|
||||
|
||||
public function isLoggedIn(): bool
|
||||
{
|
||||
return $this->customerSession->isLoggedIn();
|
||||
}
|
||||
|
||||
public function getCustomerName(): string
|
||||
{
|
||||
return trim((string) $this->customerSession->getCustomer()->getName());
|
||||
}
|
||||
|
||||
public function getRecentOrders()
|
||||
{
|
||||
return $this->orderCollectionFactory->create()
|
||||
->addFieldToFilter('customer_id', (int) $this->customerSession->getCustomerId())
|
||||
->setOrder('created_at', 'DESC')
|
||||
->setPageSize(2);
|
||||
}
|
||||
|
||||
public function getWishlistItems(): array
|
||||
{
|
||||
$wishlist = $this->wishlistFactory->create()
|
||||
->loadByCustomerId((int) $this->customerSession->getCustomerId(), true);
|
||||
$items = [];
|
||||
foreach ($wishlist->getItemCollection() as $item) {
|
||||
$items[] = $item;
|
||||
if (count($items) === 3) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $items;
|
||||
}
|
||||
|
||||
public function getOrderImages($order): array
|
||||
{
|
||||
$images = [];
|
||||
foreach ($order->getAllVisibleItems() as $item) {
|
||||
$product = $item->getProduct();
|
||||
if ($product && $product->getId()) {
|
||||
$images[] = $this->imageHelper->init($product, 'product_thumbnail_image')
|
||||
->resize(42, 42)
|
||||
->getUrl();
|
||||
}
|
||||
if (count($images) === 2) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
return $images;
|
||||
}
|
||||
|
||||
public function getBranchName(): string
|
||||
{
|
||||
$address = $this->customerSession->getCustomer()->getDefaultBillingAddress();
|
||||
$city = $address ? trim((string) $address->getCity()) : '';
|
||||
return $city !== '' ? $city . ' Branch' : (string) __('My Local Branch');
|
||||
}
|
||||
|
||||
public function getBranchAddress(): string
|
||||
{
|
||||
$address = $this->customerSession->getCustomer()->getDefaultBillingAddress();
|
||||
if (!$address) {
|
||||
return (string) __('Add a default billing address in My Account');
|
||||
}
|
||||
$parts = array_filter([
|
||||
implode(' ', (array) $address->getStreet()),
|
||||
trim(implode(' ', [(string) $address->getCity(), (string) $address->getRegion(), (string) $address->getPostcode()]))
|
||||
]);
|
||||
return implode(', ', $parts);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Lts\HomePage\Setup\Patch\Data;
|
||||
|
||||
use Magento\Cms\Model\PageFactory;
|
||||
use Magento\Framework\Setup\Patch\DataPatchInterface;
|
||||
|
||||
class AddResourcesBlockToHomePage implements DataPatchInterface
|
||||
{
|
||||
private const PAGE_IDENTIFIER = 'athlete2-home-greece';
|
||||
private const CATEGORY_BLOCK = '{{block class="Magento\\Cms\\Block\\Block" block_id="lts-home-shop-by-category"}}';
|
||||
private const RESOURCES_BLOCK = '{{block class="Magento\\Cms\\Block\\Block" block_id="lts-home-resources"}}';
|
||||
|
||||
public function __construct(
|
||||
private readonly PageFactory $pageFactory
|
||||
) {
|
||||
}
|
||||
|
||||
public function apply(): self
|
||||
{
|
||||
$page = $this->pageFactory->create()->getCollection()
|
||||
->addFieldToFilter('identifier', self::PAGE_IDENTIFIER)
|
||||
->addStoreFilter(0, false)
|
||||
->setPageSize(1)
|
||||
->getFirstItem();
|
||||
|
||||
if (!$page->getId()) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
$content = (string) $page->getContent();
|
||||
|
||||
if (str_contains($content, self::RESOURCES_BLOCK)) {
|
||||
return $this;
|
||||
}
|
||||
|
||||
if (str_contains($content, self::CATEGORY_BLOCK)) {
|
||||
$content = str_replace(
|
||||
self::CATEGORY_BLOCK,
|
||||
self::CATEGORY_BLOCK . PHP_EOL . ' ' . self::RESOURCES_BLOCK,
|
||||
$content
|
||||
);
|
||||
} else {
|
||||
$feedbackPosition = strpos($content, '<a class="lts-feedback"');
|
||||
|
||||
if ($feedbackPosition === false) {
|
||||
$content .= PHP_EOL . self::RESOURCES_BLOCK;
|
||||
} else {
|
||||
$content = substr($content, 0, $feedbackPosition)
|
||||
. self::RESOURCES_BLOCK
|
||||
. PHP_EOL
|
||||
. ' '
|
||||
. substr($content, $feedbackPosition);
|
||||
}
|
||||
}
|
||||
|
||||
$page->setContent($content)->save();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
public static function getDependencies(): array
|
||||
{
|
||||
return [CreateShopByCategoryBlock::class];
|
||||
}
|
||||
|
||||
public function getAliases(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,131 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Lts\HomePage\Setup\Patch\Data;
|
||||
|
||||
use Magento\Cms\Model\BlockFactory;
|
||||
use Magento\Framework\Setup\Patch\DataPatchInterface;
|
||||
|
||||
class CreateFooterBlocks implements DataPatchInterface
|
||||
{
|
||||
public function __construct(
|
||||
private readonly BlockFactory $blockFactory
|
||||
) {
|
||||
}
|
||||
|
||||
public function apply(): self
|
||||
{
|
||||
$this->saveBlock(
|
||||
'lts-footer-link-columns',
|
||||
'LTS Footer - Link Columns',
|
||||
$this->getLinkColumnsContent()
|
||||
);
|
||||
$this->saveBlock(
|
||||
'lts-footer-social-app',
|
||||
'LTS Footer - Social And Mobile App',
|
||||
$this->getSocialAppContent()
|
||||
);
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function saveBlock(string $identifier, string $title, string $content): void
|
||||
{
|
||||
$block = $this->blockFactory->create()->getCollection()
|
||||
->addFieldToFilter('identifier', $identifier)
|
||||
->setPageSize(1)
|
||||
->getFirstItem();
|
||||
|
||||
if (!$block->getId()) {
|
||||
$block = $this->blockFactory->create();
|
||||
}
|
||||
|
||||
$block->setTitle($title)
|
||||
->setIdentifier($identifier)
|
||||
->setContent($content)
|
||||
->setIsActive(true)
|
||||
->setStores([0])
|
||||
->save();
|
||||
}
|
||||
|
||||
private function getLinkColumnsContent(): string
|
||||
{
|
||||
return <<<'HTML'
|
||||
<nav class="lts-footer-links" aria-label="Footer navigation">
|
||||
<div class="lts-footer-links__column">
|
||||
<h2>Support</h2>
|
||||
<a href="{{store url='downloads'}}">Downloads</a>
|
||||
<a href="https://ltsecurityinc.zendesk.com/" target="_blank" rel="noopener">Knowledge Base</a>
|
||||
<a href="{{store url='tools'}}">Tools</a>
|
||||
<a href="https://ns1.dvrlists.com/" target="_blank" rel="noopener">DDNS</a>
|
||||
<a href="{{store url='rma'}}">RMA Form</a>
|
||||
</div>
|
||||
<div class="lts-footer-links__column">
|
||||
<h2>Resources</h2>
|
||||
<a href="{{store url='solutions'}}">Solutions</a>
|
||||
<a href="{{store url='events'}}">Event</a>
|
||||
<a href="{{store url='flyers'}}">Flyers</a>
|
||||
<a href="{{store url='newsletter'}}">Newsletter</a>
|
||||
<a href="{{store url='blog'}}">Blog</a>
|
||||
<a href="https://www.youtube.com/@LTSCCTV/" target="_blank" rel="noopener">Videos</a>
|
||||
<a href="{{store url='customer-testimonials'}}">Customer Testimonials</a>
|
||||
</div>
|
||||
<div class="lts-footer-links__column">
|
||||
<h2>Partners</h2>
|
||||
<a href="{{store url='project-registration'}}">Project Registration</a>
|
||||
<a href="{{store url='technology-partners'}}">Technology Partners</a>
|
||||
<a href="{{store url='international-partners'}}">International Partners</a>
|
||||
</div>
|
||||
<div class="lts-footer-links__column">
|
||||
<h2>Company</h2>
|
||||
<a href="{{store url='about-lts'}}">About LTS</a>
|
||||
<a href="{{store url='contacts'}}">Contact Us</a>
|
||||
</div>
|
||||
<div class="lts-footer-links__column lts-footer-links__column--legal">
|
||||
<h2>Legal & Compliance</h2>
|
||||
<a href="{{store url='sla'}}">Software License Agreement</a>
|
||||
<a href="{{store url='terms-of-use'}}">Terms Of Use</a>
|
||||
<a href="{{store url='privacy-policy'}}">Privacy Policy</a>
|
||||
<a href="{{store url='terms-and-Conditions'}}">Terms And Conditions</a>
|
||||
</div>
|
||||
</nav>
|
||||
HTML;
|
||||
}
|
||||
|
||||
private function getSocialAppContent(): string
|
||||
{
|
||||
return <<<'HTML'
|
||||
<div class="lts-footer-app-block">
|
||||
<div class="lts-footer-app-block__download">
|
||||
<p>Download<br>The LTS<br>Mobile App</p>
|
||||
<a href="https://ltsecurityinc.com/" target="_blank" rel="noopener" aria-label="Open LTS website">
|
||||
<img src="{{view url='Magento_Theme::images/lts-footer/mobile-app-qr.png'}}" alt="QR code for the LTS website">
|
||||
</a>
|
||||
</div>
|
||||
<div class="lts-footer-phone" aria-hidden="true">
|
||||
<span class="lts-footer-phone__speaker"></span>
|
||||
<span class="lts-footer-phone__screen">
|
||||
<img src="{{view url='Magento_Theme::images/lts-home-v2/pro-x.png'}}" alt="">
|
||||
</span>
|
||||
</div>
|
||||
<div class="lts-footer-social" aria-label="LTS social media">
|
||||
<a href="https://www.facebook.com/CCTV.LTS/" target="_blank" rel="noopener" aria-label="Facebook"><svg viewBox="0 0 28 28" aria-hidden="true"><rect x="1" y="1" width="26" height="26" rx="3"></rect><path d="M16 25V15h3.3l.5-4H16V8.5c0-1.2.4-2 2-2h2.1V3a28 28 0 0 0-3.1-.2c-3.1 0-5.2 1.9-5.2 5.4V11H8.3v4h3.5v10"></path></svg></a>
|
||||
<a href="https://www.instagram.com/ltsecurityinc/" target="_blank" rel="noopener" aria-label="Instagram"><svg viewBox="0 0 28 28" aria-hidden="true"><rect x="1" y="1" width="26" height="26" rx="3"></rect><rect x="6" y="6" width="16" height="16" rx="5"></rect><circle cx="14" cy="14" r="4"></circle><circle cx="19.5" cy="8.7" r="1"></circle></svg></a>
|
||||
<a href="https://twitter.com/LTSecurityinc" target="_blank" rel="noopener" aria-label="X"><svg viewBox="0 0 28 28" aria-hidden="true"><rect x="1" y="1" width="26" height="26" rx="3"></rect><path d="M7 6l14 16M21 6 7 22"></path></svg></a>
|
||||
<a href="https://www.youtube.com/@LTSCCTV/" target="_blank" rel="noopener" aria-label="YouTube"><svg viewBox="0 0 28 28" aria-hidden="true"><rect x="1" y="1" width="26" height="26" rx="3"></rect><rect x="5" y="8" width="18" height="12" rx="3"></rect><path d="m12 11 6 3-6 3z"></path></svg></a>
|
||||
<a href="https://www.linkedin.com/company/ltsecurityinc/" target="_blank" rel="noopener" aria-label="LinkedIn"><svg viewBox="0 0 28 28" aria-hidden="true"><rect x="1" y="1" width="26" height="26" rx="3"></rect><circle cx="8.5" cy="9" r="1.4"></circle><path d="M7 12v9M12 21v-9m0 4c0-2.5 1.5-4 3.8-4 2.8 0 4.2 1.8 4.2 5v4"></path></svg></a>
|
||||
</div>
|
||||
</div>
|
||||
HTML;
|
||||
}
|
||||
|
||||
public static function getDependencies(): array
|
||||
{
|
||||
return [CreateShopByCategoryBlock::class];
|
||||
}
|
||||
|
||||
public function getAliases(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,91 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Lts\HomePage\Setup\Patch\Data;
|
||||
|
||||
use Magento\Cms\Model\BlockFactory;
|
||||
use Magento\Cms\Model\PageFactory;
|
||||
use Magento\Framework\Setup\Patch\DataPatchInterface;
|
||||
|
||||
class CreateShopByCategoryBlock implements DataPatchInterface
|
||||
{
|
||||
private const BLOCK_IDENTIFIER = 'lts-home-shop-by-category';
|
||||
|
||||
public function __construct(
|
||||
private readonly BlockFactory $blockFactory,
|
||||
private readonly PageFactory $pageFactory
|
||||
) {
|
||||
}
|
||||
|
||||
public function apply(): self
|
||||
{
|
||||
$block = $this->blockFactory->create()->getCollection()
|
||||
->addFieldToFilter('identifier', self::BLOCK_IDENTIFIER)
|
||||
->setPageSize(1)
|
||||
->getFirstItem();
|
||||
|
||||
if (!$block->getId()) {
|
||||
$block = $this->blockFactory->create();
|
||||
}
|
||||
|
||||
$block->setTitle('LTS Home - Shop By Category')
|
||||
->setIdentifier(self::BLOCK_IDENTIFIER)
|
||||
->setContent($this->getBlockContent())
|
||||
->setIsActive(true)
|
||||
->setStores([0])
|
||||
->save();
|
||||
|
||||
$page = $this->pageFactory->create()->getCollection()
|
||||
->addFieldToFilter('identifier', 'athlete2-home-greece')
|
||||
->addStoreFilter(0, false)
|
||||
->setPageSize(1)
|
||||
->getFirstItem();
|
||||
|
||||
if ($page->getId()) {
|
||||
$content = (string) $page->getContent();
|
||||
$categoryStart = strpos($content, '<section class="lts-categories"');
|
||||
$categoryEnd = strpos($content, '</section>', $categoryStart ?: 0);
|
||||
|
||||
if ($categoryStart !== false && $categoryEnd !== false) {
|
||||
$categoryEnd += strlen('</section>');
|
||||
$content = substr($content, 0, $categoryStart)
|
||||
. '{{block class="Magento\\Cms\\Block\\Block" block_id="'
|
||||
. self::BLOCK_IDENTIFIER
|
||||
. '"}}'
|
||||
. substr($content, $categoryEnd);
|
||||
$page->setContent($content)->save();
|
||||
}
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function getBlockContent(): string
|
||||
{
|
||||
return <<<'HTML'
|
||||
<section class="lts-categories" aria-labelledby="lts-categories-title">
|
||||
<h2 id="lts-categories-title" class="lts-home-heading">Shop By Category</h2>
|
||||
<div class="lts-categories__grid">
|
||||
<a class="lts-category" href="{{store url='products/product-categories/ip-solutions/ip-network-cameras'}}"><span class="lts-category__image"><img src="{{view url='Magento_Theme::images/lts-home-v2/ip-camera.png'}}" alt=""></span><strong>IP Cameras</strong></a>
|
||||
<a class="lts-category" href="{{store url='products/product-categories/ip-solutions/network-video-recorders'}}"><span class="lts-category__image"><img src="{{view url='Magento_Theme::images/lts-home-v2/nvr.png'}}" alt=""></span><strong>NVR</strong></a>
|
||||
<a class="lts-category lts-category--featured" href="{{store url='products/product-categories/hd-tvi-solutions/hd-tvi-camera'}}"><span class="lts-category__image"><img src="{{view url='Magento_Theme::images/lts-home-v2/tvi-camera.png'}}" alt=""></span><strong>TVI Cameras</strong></a>
|
||||
<a class="lts-category" href="{{store url='products/product-categories/hd-tvi-solutions/hd-tvi-dvr'}}"><span class="lts-category__image"><img src="{{view url='Magento_Theme::images/lts-home-v2/dvr.png'}}" alt=""></span><strong>DVR</strong></a>
|
||||
<a class="lts-category" href="{{store url='products/news/access-control'}}"><span class="lts-category__image"><img src="{{view url='Magento_Theme::images/lts-home-v2/access-control.png'}}" alt=""></span><strong>Access Control</strong></a>
|
||||
<a class="lts-category" href="{{store url='products/product-categories/ip-video-system-accessories/cable'}}"><span class="lts-category__image"><img src="{{view url='Magento_Theme::images/lts-home-v2/cable.png'}}" alt=""></span><strong>Cable</strong></a>
|
||||
<a class="lts-category" href="{{store url='products/product-categories/ip-video-system-accessories/storage-devices'}}"><span class="lts-category__image"><img src="{{view url='Magento_Theme::images/lts-home-v2/hdd.png'}}" alt=""></span><strong>HDD</strong></a>
|
||||
<a class="lts-category" href="{{store url='products/product-categories/ip-video-system-accessories/poe-switches'}}"><span class="lts-category__image"><img src="{{view url='Magento_Theme::images/lts-home-v2/accessories.png'}}" alt=""></span><strong>Accessories</strong></a>
|
||||
</div>
|
||||
</section>
|
||||
HTML;
|
||||
}
|
||||
|
||||
public static function getDependencies(): array
|
||||
{
|
||||
return [UpdateDealerPricingBlock::class];
|
||||
}
|
||||
|
||||
public function getAliases(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,205 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Lts\HomePage\Setup\Patch\Data;
|
||||
|
||||
use Magento\Cms\Model\BlockFactory;
|
||||
use Magento\Cms\Model\PageFactory;
|
||||
use Magento\Framework\Setup\ModuleDataSetupInterface;
|
||||
use Magento\Framework\Setup\Patch\DataPatchInterface;
|
||||
|
||||
class InstallHomePageContent implements DataPatchInterface
|
||||
{
|
||||
public function __construct(
|
||||
private readonly ModuleDataSetupInterface $moduleDataSetup,
|
||||
private readonly BlockFactory $blockFactory,
|
||||
private readonly PageFactory $pageFactory
|
||||
) {
|
||||
}
|
||||
|
||||
public function apply(): self
|
||||
{
|
||||
$this->moduleDataSetup->getConnection()->startSetup();
|
||||
|
||||
$this->saveBlock(
|
||||
'lts-home-announcement',
|
||||
'LTS Home - Top Announcement',
|
||||
$this->announcementContent()
|
||||
);
|
||||
$this->saveBlock(
|
||||
'lts-home-dealer-pricing',
|
||||
'LTS Home - Dealer Pricing',
|
||||
$this->dealerPricingContent()
|
||||
);
|
||||
$this->saveBlock(
|
||||
'lts-home-product-lines',
|
||||
'LTS Home - Shop By Product Line',
|
||||
$this->productLinesContent()
|
||||
);
|
||||
$this->saveBlock(
|
||||
'lts-home-shop-by-category',
|
||||
'LTS Home - Shop By Category',
|
||||
$this->shopByCategoryContent()
|
||||
);
|
||||
|
||||
$page = $this->pageFactory->create()->getCollection()
|
||||
->addFieldToFilter('identifier', 'athlete2-home-greece')
|
||||
->addStoreFilter(0, false)
|
||||
->setPageSize(1)
|
||||
->getFirstItem();
|
||||
|
||||
if ($page->getId()) {
|
||||
$page->setContent($this->homePageContent());
|
||||
$page->setPageLayout('1column');
|
||||
$page->setIsActive(true);
|
||||
$page->save();
|
||||
}
|
||||
|
||||
$this->moduleDataSetup->getConnection()->endSetup();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function saveBlock(string $identifier, string $title, string $content): void
|
||||
{
|
||||
$block = $this->blockFactory->create()->getCollection()
|
||||
->addFieldToFilter('identifier', $identifier)
|
||||
->setPageSize(1)
|
||||
->getFirstItem();
|
||||
|
||||
if (!$block->getId()) {
|
||||
$block = $this->blockFactory->create();
|
||||
}
|
||||
|
||||
$block->setTitle($title)
|
||||
->setIdentifier($identifier)
|
||||
->setContent($content)
|
||||
->setIsActive(true)
|
||||
->setStores([0])
|
||||
->save();
|
||||
}
|
||||
|
||||
private function announcementContent(): string
|
||||
{
|
||||
return <<<'HTML'
|
||||
<div class="lts-announcement" role="region" aria-label="Store announcements" data-mage-init='{"Magento_Theme/js/lts-announcement":{"delay":3000,"duration":1200}}'>
|
||||
<div class="lts-announcement__inner">
|
||||
<div class="lts-announcement__viewport" aria-live="off">
|
||||
<div class="lts-announcement__track">
|
||||
<a class="lts-announcement__item is-active" href="{{store url='promotions'}}">LTS Summer Savings Event – Save up to 40%</a>
|
||||
<a class="lts-announcement__item" href="{{store url='products/4k'}}">Explore LTS 4K Security Solutions</a>
|
||||
<a class="lts-announcement__item" href="{{store url='customer/account/login'}}">Sign In For Dealer Pricing, Availability & Checkout</a>
|
||||
</div>
|
||||
</div>
|
||||
<span class="lts-announcement__links">
|
||||
<a href="{{store url='request-a-quote'}}">Request a Quote</a>
|
||||
<a href="{{store url='contacts'}}">Help</a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
HTML;
|
||||
}
|
||||
|
||||
private function dealerPricingContent(): string
|
||||
{
|
||||
return <<<'HTML'
|
||||
<section class="lts-dealer" aria-labelledby="lts-dealer-title">
|
||||
<div class="lts-dealer__icon" aria-hidden="true">
|
||||
<img src="{{view url='Magento_Theme::images/lts-home-v2/dealer-sign-in.png'}}" alt="">
|
||||
</div>
|
||||
<div class="lts-dealer__content">
|
||||
<h2 id="lts-dealer-title">Sign In For Dealer Pricing</h2>
|
||||
<p>Unlock Dealer Pricing, Availability, And Checkout.</p>
|
||||
<div class="lts-dealer__actions">
|
||||
<a class="lts-dealer__button" href="{{store url='customer/account/login'}}">Sign In</a>
|
||||
<span class="lts-dealer__divider" aria-hidden="true"></span>
|
||||
<div class="lts-dealer__new">
|
||||
<span>New To LTS?</span>
|
||||
<a href="{{store url='customer/account/create'}}">Become A Customer Today <span aria-hidden="true">⟶</span></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
HTML;
|
||||
}
|
||||
|
||||
private function productLinesContent(): string
|
||||
{
|
||||
return <<<'HTML'
|
||||
<section class="lts-product-lines" aria-labelledby="lts-product-lines-title">
|
||||
<h2 id="lts-product-lines-title" class="lts-home-heading">Shop By Product Line</h2>
|
||||
<div class="lts-product-lines__grid">
|
||||
<a class="lts-line-card lts-line-card--platinum" href="{{store url='products/product-lines/platinum.html'}}">
|
||||
<img src="{{view url='Magento_Theme::images/lts-home-v2/platinum.png'}}" alt="Platinum Plus cameras and recorder">
|
||||
<span class="lts-line-card__copy">
|
||||
<strong>Platinum</strong>
|
||||
<i></i>
|
||||
<span>Our flagship line delivering maximum performance, reliability, and innovation.</span>
|
||||
<b>Explore ⟶</b>
|
||||
</span>
|
||||
</a>
|
||||
<a class="lts-line-card lts-line-card--prox" href="{{store url='products/product-lines/pro-x.html'}}">
|
||||
<img src="{{view url='Magento_Theme::images/lts-home-v2/pro-x.png'}}" alt="Pro-X cameras and recorder">
|
||||
<span class="lts-line-card__copy">
|
||||
<strong>PRO-<em>X</em></strong>
|
||||
<i></i>
|
||||
<span>Advanced solutions for professionals who demand more.</span>
|
||||
<b>Explore ⟶</b>
|
||||
</span>
|
||||
</a>
|
||||
<a class="lts-line-card lts-line-card--defendas" href="{{store url='products/product-lines/defendas.html'}}">
|
||||
<img src="{{view url='Magento_Theme::images/lts-home-v2/defendas.png'}}" alt="Defendas integrated access control system">
|
||||
<span class="lts-line-card__copy">
|
||||
<strong>DEFENDAS</strong>
|
||||
<i></i>
|
||||
<span>Integrated security systems for access control and device management.</span>
|
||||
<b>Explore ⟶</b>
|
||||
</span>
|
||||
</a>
|
||||
</div>
|
||||
</section>
|
||||
HTML;
|
||||
}
|
||||
|
||||
private function homePageContent(): string
|
||||
{
|
||||
return <<<'HTML'
|
||||
<div class="lts-home-content">
|
||||
{{block class="Magento\Cms\Block\Block" block_id="lts-home-dealer-pricing"}}
|
||||
{{block class="Magento\Cms\Block\Block" block_id="lts-home-product-lines"}}
|
||||
{{block class="Magento\Cms\Block\Block" block_id="lts-home-shop-by-category"}}
|
||||
{{block class="Magento\Cms\Block\Block" block_id="lts-home-resources"}}
|
||||
<a class="lts-feedback" href="{{store url='contacts'}}">Feedback</a>
|
||||
</div>
|
||||
HTML;
|
||||
}
|
||||
|
||||
private function shopByCategoryContent(): string
|
||||
{
|
||||
return <<<'HTML'
|
||||
<section class="lts-categories" aria-labelledby="lts-categories-title">
|
||||
<h2 id="lts-categories-title" class="lts-home-heading">Shop By Category</h2>
|
||||
<div class="lts-categories__grid">
|
||||
<a class="lts-category" href="{{store url='products/product-categories/ip-solutions/ip-network-cameras'}}"><span class="lts-category__image"><img src="{{view url='Magento_Theme::images/lts-home-v2/ip-camera.png'}}" alt=""></span><strong>IP Cameras</strong></a>
|
||||
<a class="lts-category" href="{{store url='products/product-categories/ip-solutions/network-video-recorders'}}"><span class="lts-category__image"><img src="{{view url='Magento_Theme::images/lts-home-v2/nvr.png'}}" alt=""></span><strong>NVR</strong></a>
|
||||
<a class="lts-category lts-category--featured" href="{{store url='products/product-categories/hd-tvi-solutions/hd-tvi-camera'}}"><span class="lts-category__image"><img src="{{view url='Magento_Theme::images/lts-home-v2/tvi-camera.png'}}" alt=""></span><strong>TVI Cameras</strong></a>
|
||||
<a class="lts-category" href="{{store url='products/product-categories/hd-tvi-solutions/hd-tvi-dvr'}}"><span class="lts-category__image"><img src="{{view url='Magento_Theme::images/lts-home-v2/dvr.png'}}" alt=""></span><strong>DVR</strong></a>
|
||||
<a class="lts-category" href="{{store url='products/news/access-control'}}"><span class="lts-category__image"><img src="{{view url='Magento_Theme::images/lts-home-v2/access-control.png'}}" alt=""></span><strong>Access Control</strong></a>
|
||||
<a class="lts-category" href="{{store url='products/product-categories/ip-video-system-accessories/cable'}}"><span class="lts-category__image"><img src="{{view url='Magento_Theme::images/lts-home-v2/cable.png'}}" alt=""></span><strong>Cable</strong></a>
|
||||
<a class="lts-category" href="{{store url='products/product-categories/ip-video-system-accessories/storage-devices'}}"><span class="lts-category__image"><img src="{{view url='Magento_Theme::images/lts-home-v2/hdd.png'}}" alt=""></span><strong>HDD</strong></a>
|
||||
<a class="lts-category" href="{{store url='products/product-categories/ip-video-system-accessories/poe-switches'}}"><span class="lts-category__image"><img src="{{view url='Magento_Theme::images/lts-home-v2/accessories.png'}}" alt=""></span><strong>Accessories</strong></a>
|
||||
</div>
|
||||
</section>
|
||||
HTML;
|
||||
}
|
||||
|
||||
public static function getDependencies(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
public function getAliases(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Lts\HomePage\Setup\Patch\Data;
|
||||
|
||||
use Magento\Cms\Model\BlockFactory;
|
||||
use Magento\Framework\Setup\Patch\DataPatchInterface;
|
||||
|
||||
class UpdateAnnouncementTicker implements DataPatchInterface
|
||||
{
|
||||
public function __construct(
|
||||
private readonly BlockFactory $blockFactory
|
||||
) {
|
||||
}
|
||||
|
||||
public function apply(): self
|
||||
{
|
||||
$block = $this->blockFactory->create()->getCollection()
|
||||
->addFieldToFilter('identifier', 'lts-home-announcement')
|
||||
->setPageSize(1)
|
||||
->getFirstItem();
|
||||
|
||||
if (!$block->getId()) {
|
||||
$block = $this->blockFactory->create()
|
||||
->setTitle('LTS Home - Top Announcement')
|
||||
->setIdentifier('lts-home-announcement')
|
||||
->setIsActive(true)
|
||||
->setStores([0]);
|
||||
}
|
||||
|
||||
$block->setContent($this->getContent())->save();
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function getContent(): string
|
||||
{
|
||||
return <<<'HTML'
|
||||
<div class="lts-announcement" role="region" aria-label="Store announcements" data-mage-init='{"Magento_Theme/js/lts-announcement":{"delay":3000,"duration":1200}}'>
|
||||
<div class="lts-announcement__inner">
|
||||
<div class="lts-announcement__viewport" aria-live="off">
|
||||
<div class="lts-announcement__track">
|
||||
<a class="lts-announcement__item is-active" href="{{store url='promotions'}}">LTS Summer Savings Event – Save up to 40%</a>
|
||||
<a class="lts-announcement__item" href="{{store url='products/4k'}}">Explore LTS 4K Security Solutions</a>
|
||||
<a class="lts-announcement__item" href="{{store url='customer/account/login'}}">Sign In For Dealer Pricing, Availability & Checkout</a>
|
||||
</div>
|
||||
</div>
|
||||
<span class="lts-announcement__links">
|
||||
<a href="{{store url='request-a-quote'}}">Request a Quote</a>
|
||||
<a href="{{store url='contacts'}}">Help</a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
HTML;
|
||||
}
|
||||
|
||||
public static function getDependencies(): array
|
||||
{
|
||||
return [InstallHomePageContent::class];
|
||||
}
|
||||
|
||||
public function getAliases(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
namespace Lts\HomePage\Setup\Patch\Data;
|
||||
|
||||
use Magento\Cms\Model\BlockFactory;
|
||||
use Magento\Framework\Setup\Patch\DataPatchInterface;
|
||||
|
||||
class UpdateDealerPricingBlock implements DataPatchInterface
|
||||
{
|
||||
public function __construct(
|
||||
private readonly BlockFactory $blockFactory
|
||||
) {
|
||||
}
|
||||
|
||||
public function apply(): self
|
||||
{
|
||||
$block = $this->blockFactory->create()->getCollection()
|
||||
->addFieldToFilter('identifier', 'lts-home-dealer-pricing')
|
||||
->setPageSize(1)
|
||||
->getFirstItem();
|
||||
|
||||
if ($block->getId()) {
|
||||
$block->setContent($this->getContent())->save();
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
private function getContent(): string
|
||||
{
|
||||
return <<<'HTML'
|
||||
<section class="lts-dealer" aria-labelledby="lts-dealer-title">
|
||||
<div class="lts-dealer__icon" aria-hidden="true">
|
||||
<img src="{{view url='Magento_Theme::images/lts-home-v2/dealer-sign-in.png'}}" alt="">
|
||||
</div>
|
||||
<div class="lts-dealer__content">
|
||||
<h2 id="lts-dealer-title">Sign In For Dealer Pricing</h2>
|
||||
<p>Unlock Dealer Pricing, Availability, And Checkout.</p>
|
||||
<div class="lts-dealer__actions">
|
||||
<a class="lts-dealer__button" href="{{store url='customer/account/login'}}">Sign In</a>
|
||||
<span class="lts-dealer__divider" aria-hidden="true"></span>
|
||||
<div class="lts-dealer__new">
|
||||
<span>New To LTS?</span>
|
||||
<a href="{{store url='customer/account/create'}}">Become A Customer Today <span aria-hidden="true">⟶</span></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</section>
|
||||
HTML;
|
||||
}
|
||||
|
||||
public static function getDependencies(): array
|
||||
{
|
||||
return [InstallHomePageContent::class];
|
||||
}
|
||||
|
||||
public function getAliases(): array
|
||||
{
|
||||
return [];
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0"?>
|
||||
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
|
||||
<module name="Lts_HomePage">
|
||||
<sequence>
|
||||
<module name="Magento_Cms"/>
|
||||
<module name="Magento_Customer"/>
|
||||
<module name="Magento_Sales"/>
|
||||
<module name="Magento_Wishlist"/>
|
||||
</sequence>
|
||||
</module>
|
||||
</config>
|
||||
@@ -0,0 +1,10 @@
|
||||
<?php
|
||||
declare(strict_types=1);
|
||||
|
||||
use Magento\Framework\Component\ComponentRegistrar;
|
||||
|
||||
ComponentRegistrar::register(
|
||||
ComponentRegistrar::MODULE,
|
||||
'Lts_HomePage',
|
||||
__DIR__
|
||||
);
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0"?>
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<body>
|
||||
<referenceContainer name="content">
|
||||
<block class="Lts\HomePage\Block\CustomerDashboard"
|
||||
name="lts.home.customer.dashboard"
|
||||
template="Lts_HomePage::customer/dashboard.phtml"
|
||||
before="cms_page"
|
||||
cacheable="false"/>
|
||||
</referenceContainer>
|
||||
</body>
|
||||
</page>
|
||||
@@ -0,0 +1,63 @@
|
||||
<?php
|
||||
/** @var \Lts\HomePage\Block\CustomerDashboard $block */
|
||||
if (!$block->isLoggedIn()) {
|
||||
return;
|
||||
}
|
||||
$orders = $block->getRecentOrders();
|
||||
$wishlistItems = $block->getWishlistItems();
|
||||
?>
|
||||
<section class="lts-customer-dashboard" aria-label="<?= $block->escapeHtmlAttr(__('Customer Dashboard')) ?>">
|
||||
<article class="lts-dashboard-card lts-dashboard-orders">
|
||||
<h2><span class="lts-dashboard-icon athlete2-icon-box"></span><?= $block->escapeHtml(__('My Recent Orders')) ?></h2>
|
||||
<div class="lts-dashboard-orders__table" role="table">
|
||||
<div class="lts-dashboard-orders__row lts-dashboard-orders__head" role="row">
|
||||
<span><?= $block->escapeHtml(__('Date')) ?></span><span><?= $block->escapeHtml(__('Purchase Order #')) ?></span><span><?= $block->escapeHtml(__('Job Name')) ?></span><span><?= $block->escapeHtml(__('Status')) ?></span><span><?= $block->escapeHtml(__('Total')) ?></span><span><?= $block->escapeHtml(__('Items')) ?></span><span></span>
|
||||
</div>
|
||||
<?php if ($orders->getSize()) : ?>
|
||||
<?php foreach ($orders as $order) : ?>
|
||||
<div class="lts-dashboard-orders__row" role="row">
|
||||
<span data-label="<?= $block->escapeHtmlAttr(__('Date')) ?>"><?= $block->escapeHtml($block->formatDate($order->getCreatedAt(), \IntlDateFormatter::MEDIUM)) ?></span>
|
||||
<span data-label="<?= $block->escapeHtmlAttr(__('Purchase Order #')) ?>"><a href="<?= $block->escapeUrl($block->getUrl('sales/order/view', ['order_id' => $order->getId()])) ?>"><?= $block->escapeHtml($order->getIncrementId()) ?></a></span>
|
||||
<span data-label="<?= $block->escapeHtmlAttr(__('Job Name')) ?>"><?= $block->escapeHtml($order->getBillingAddress()?->getCompany() ?: __('LTS')) ?></span>
|
||||
<span data-label="<?= $block->escapeHtmlAttr(__('Status')) ?>"><?= $block->escapeHtml($order->getStatusLabel()) ?></span>
|
||||
<strong data-label="<?= $block->escapeHtmlAttr(__('Total')) ?>"><?= /* @noEscape */ $order->formatPrice($order->getGrandTotal()) ?></strong>
|
||||
<span class="lts-dashboard-orders__items" data-label="<?= $block->escapeHtmlAttr(__('Items')) ?>"><b><?= (int) $order->getTotalItemCount() ?></b><?php foreach ($block->getOrderImages($order) as $image) : ?><img src="<?= $block->escapeUrl($image) ?>" width="38" height="38" alt=""><?php endforeach; ?></span>
|
||||
<a class="lts-dashboard-details" href="<?= $block->escapeUrl($block->getUrl('sales/order/view', ['order_id' => $order->getId()])) ?>"><?= $block->escapeHtml(__('Details')) ?> <span aria-hidden="true">›</span></a>
|
||||
</div>
|
||||
<?php endforeach; ?>
|
||||
<?php else : ?>
|
||||
<p class="lts-dashboard-empty"><?= $block->escapeHtml(__('You have no recent orders.')) ?></p>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<a class="lts-dashboard-card__footer-link" href="<?= $block->escapeUrl($block->getUrl('sales/order/history')) ?>"><?= $block->escapeHtml(__('See All Orders')) ?></a>
|
||||
</article>
|
||||
|
||||
<div class="lts-dashboard-grid">
|
||||
<article class="lts-dashboard-card lts-dashboard-lists">
|
||||
<h2><span class="lts-dashboard-icon athlete2-icon-heart"></span><?= $block->escapeHtml(__('My Lists')) ?></h2>
|
||||
<div class="lts-dashboard-card__body">
|
||||
<p><?= $block->escapeHtml(__('Your favorite products')) ?></p>
|
||||
<?php if ($wishlistItems) : foreach ($wishlistItems as $item) : ?>
|
||||
<div class="lts-dashboard-list-item"><span><?= $block->escapeHtml($item->getProduct()->getName()) ?></span><a href="<?= $block->escapeUrl($item->getProduct()->getProductUrl()) ?>"><?= $block->escapeHtml(__('Details')) ?> ›</a></div>
|
||||
<?php endforeach; else : ?>
|
||||
<div class="lts-dashboard-empty lts-dashboard-empty--small"><?= $block->escapeHtml(__('Your wish list is empty.')) ?></div>
|
||||
<?php endif; ?>
|
||||
<a class="lts-dashboard-outline-button" href="<?= $block->escapeUrl($block->getUrl('wishlist')) ?>"><?= $block->escapeHtml(__('See All Lists')) ?></a>
|
||||
</div>
|
||||
</article>
|
||||
<article class="lts-dashboard-card lts-dashboard-branch">
|
||||
<h2><span class="lts-dashboard-icon athlete2-icon-store"></span><?= $block->escapeHtml(__('My Branch')) ?></h2>
|
||||
<div class="lts-dashboard-card__body">
|
||||
<h3><?= $block->escapeHtml($block->getBranchName()) ?></h3>
|
||||
<dl><dt><?= $block->escapeHtml(__('Manager')) ?></dt><dd><?= $block->escapeHtml($block->getCustomerName()) ?></dd><dt><?= $block->escapeHtml(__('Address')) ?></dt><dd><?= $block->escapeHtml($block->getBranchAddress()) ?></dd><dt><?= $block->escapeHtml(__('Hours')) ?></dt><dd><?= $block->escapeHtml(__('Mon–Fri: 8AM – 6PM')) ?></dd></dl>
|
||||
</div>
|
||||
</article>
|
||||
<article class="lts-dashboard-card lts-dashboard-project">
|
||||
<h2><span class="lts-dashboard-icon athlete2-icon-edit"></span><?= $block->escapeHtml(__('Project Registration')) ?></h2>
|
||||
<div class="lts-dashboard-card__body">
|
||||
<p><?= $block->escapeHtml(__('Register a Project and Lock in Savings')) ?></p>
|
||||
<a class="lts-dashboard-outline-button" href="<?= $block->escapeUrl($block->getUrl('project-registration')) ?>"><?= $block->escapeHtml(__('Get Started')) ?></a>
|
||||
</div>
|
||||
</article>
|
||||
</div>
|
||||
</section>
|
||||
Reference in New Issue
Block a user