ltsecurityinc安防产品在线商城代码
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Amasty Team
|
||||
* @copyright Copyright (c) Amasty (https://www.amasty.com)
|
||||
* @package Improved Sorting for Magento 2
|
||||
*/
|
||||
/**
|
||||
* @var Amasty\Sorting\Block\Adminhtml\Position $block
|
||||
* @var Escaper $escaper
|
||||
*/
|
||||
|
||||
use Magento\Framework\Escaper;
|
||||
|
||||
?>
|
||||
|
||||
<td class="label">
|
||||
<?= $block->getElement()->getLabelHtml('', $block->getElement()->getScopeLabel()) ?>
|
||||
</td>
|
||||
<td colspan="3">
|
||||
<table class="amsorting-sort-order" id="amsorting-sort-order">
|
||||
<?php foreach ($block->getPositions() as $key => $index): ?>
|
||||
<tr>
|
||||
<th></th>
|
||||
<td class="item-position">
|
||||
<?= /* @noEscape */ $index ?>
|
||||
<div class="draggable"></div>
|
||||
<input type="hidden"
|
||||
name="<?= $escaper->escapeHtmlAttr($block->getNamePrefix($key)) ?>"
|
||||
value="<?= /* @noEscape */ __($index) ?>">
|
||||
</td>
|
||||
<th style="min-width: 69px; visibility: hidden;"></th>
|
||||
</tr>
|
||||
<?php endforeach ?>
|
||||
</table>
|
||||
<p class="note">
|
||||
<span>
|
||||
<?= /* @noEscape */
|
||||
__('Drag and drop sorting options in the order you want them to appear for the customers.')
|
||||
?>
|
||||
</span>
|
||||
</p>
|
||||
</td>
|
||||
<script>
|
||||
require([
|
||||
'jquery',
|
||||
'collapsable'
|
||||
], function ($) {
|
||||
$('#amsorting-sort-order').sortable({
|
||||
axis: 'y',
|
||||
handle: '.item-position',
|
||||
items: 'tr',
|
||||
tolerance: 'pointer'
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -0,0 +1,43 @@
|
||||
//
|
||||
// Amasty Improved Sorting Styles
|
||||
// ___________________________________________
|
||||
|
||||
//
|
||||
// Common
|
||||
// -------------------------------------------
|
||||
|
||||
& when (@media-common = true) {
|
||||
#amsorting-sort-order {
|
||||
& {
|
||||
margin-top: 2.2rem;
|
||||
}
|
||||
|
||||
tr {
|
||||
td,
|
||||
th {
|
||||
& {
|
||||
background: #efefef;
|
||||
border-bottom: 1px solid #fff;
|
||||
}
|
||||
|
||||
.draggable {
|
||||
color: #adadad;
|
||||
}
|
||||
}
|
||||
|
||||
td:hover {
|
||||
cursor: move;
|
||||
}
|
||||
|
||||
td.item-position {
|
||||
max-width: 87px;
|
||||
padding: 1rem;
|
||||
}
|
||||
|
||||
td:before {
|
||||
content: '\e63d';
|
||||
font-family: 'Admin Icons';
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+13
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* @author Amasty Team
|
||||
* @copyright Copyright (c) Amasty (https://www.amasty.com)
|
||||
* @package Improved Sorting for Magento 2
|
||||
*/-->
|
||||
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<referenceBlock name="content">
|
||||
<block class="Amasty\Sorting\Block\Direction" name="amasty.sorting.direction" after="-" />
|
||||
</referenceBlock>
|
||||
</page>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* @author Amasty Team
|
||||
* @copyright Copyright (c) Amasty (https://www.amasty.com)
|
||||
* @package Improved Sorting for Magento 2
|
||||
*/-->
|
||||
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<update handle="amasty_sorting_direction_handle" />
|
||||
</page>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* @author Amasty Team
|
||||
* @copyright Copyright (c) Amasty (https://www.amasty.com)
|
||||
* @package Improved Sorting for Magento 2
|
||||
*/-->
|
||||
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<update handle="amasty_sorting_direction_handle" />
|
||||
</page>
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0"?>
|
||||
<!--
|
||||
/**
|
||||
* @author Amasty Team
|
||||
* @copyright Copyright (c) Amasty (https://www.amasty.com)
|
||||
* @package Improved Sorting for Magento 2
|
||||
*/-->
|
||||
|
||||
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
|
||||
<update handle="amasty_sorting_direction_handle" />
|
||||
</page>
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Amasty Team
|
||||
* @copyright Copyright (c) Amasty (https://www.amasty.com)
|
||||
* @package Improved Sorting for Magento 2
|
||||
*/ /** @var \Amasty\Sorting\Block\Direction $block */ ?>
|
||||
|
||||
<script type="text/x-magento-init">
|
||||
{
|
||||
"[data-role='sorter']": {
|
||||
"Amasty_Sorting/js/direction": {
|
||||
"permanentDirectionMethods": <?= /** @noEscape */ $block->getPermanentDirectionAttributesJson() ?>
|
||||
}
|
||||
}
|
||||
}
|
||||
</script>
|
||||
+117
@@ -0,0 +1,117 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Amasty Team
|
||||
* @copyright Copyright (c) Amasty (https://www.amasty.com)
|
||||
* @package Improved Sorting for Magento 2
|
||||
*/
|
||||
/**
|
||||
* @var \Amasty\Sorting\Block\Widget\Featured $block
|
||||
* @var \Magento\Framework\Escaper $escaper
|
||||
*/
|
||||
?>
|
||||
|
||||
<?php if ($block->getProductCollection() && $block->getProductCollection()->getSize()): ?>
|
||||
<?php
|
||||
$type = 'widget-product-grid';
|
||||
|
||||
$mode = 'grid';
|
||||
|
||||
$image = 'featured_products_content';
|
||||
$items = $block->getProductCollection()->getItems();
|
||||
|
||||
$showWishlist = true;
|
||||
$showCompare = true;
|
||||
$showCart = true;
|
||||
$templateType = \Magento\Catalog\Block\Product\ReviewRendererInterface::SHORT_VIEW;
|
||||
$description = false;
|
||||
?>
|
||||
<div class="block widget amsorting block-products-list <?= /* @noEscape */ $mode ?>">
|
||||
<?php if ($block->getTitle()): ?>
|
||||
<div class="block-title">
|
||||
<strong><?= $escaper->escapeHtml(__($block->getTitle())) ?></strong>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<div class="block-content">
|
||||
<div class="products-<?= /* @noEscape */ $mode ?> <?= /* @noEscape */ $mode ?>">
|
||||
<ol class="product-items <?= /* @noEscape */ $type ?>">
|
||||
<?php $iterator = 1; ?>
|
||||
<?php foreach ($items as $_item): ?>
|
||||
<?= /* @noEscape */ ($iterator++ == 1)
|
||||
? '<li class="product-item">'
|
||||
: '</li><li class="product-item">' ?>
|
||||
<div class="product-item-info">
|
||||
<a href="<?= $escaper->escapeUrl($block->getProductUrl($_item)) ?>"
|
||||
class="product-item-photo">
|
||||
<?= $block->getImage($_item, $image)->toHtml() ?>
|
||||
</a>
|
||||
<div class="product-item-details">
|
||||
<strong class="product-item-name">
|
||||
<a title="<?= $escaper->escapeHtml($_item->getName()) ?>"
|
||||
href="<?= $escaper->escapeUrl($block->getProductUrl($_item)) ?>"
|
||||
class="product-item-link">
|
||||
<?= $escaper->escapeHtml($_item->getName()) ?>
|
||||
</a>
|
||||
</strong>
|
||||
<?php if ($templateType): ?>
|
||||
<?= $block->getReviewsSummaryHtml($_item, $templateType) ?>
|
||||
<?php endif; ?>
|
||||
<?= $block->getProductPriceHtml($_item, $type) ?>
|
||||
<?php if ($showWishlist || $showCompare || $showCart): ?>
|
||||
<div class="product-item-actions">
|
||||
<?php if ($showCart): ?>
|
||||
<div class="actions-primary">
|
||||
<?php if ($_item->isSaleable()): ?>
|
||||
<button class="action tocart primary"
|
||||
data-post='<?= /* @noEscape */ $block->getPostData($_item) ?>'
|
||||
type="button"
|
||||
title="<?= $escaper->escapeHtml(__('Add to Cart')) ?>">
|
||||
<span><?= $escaper->escapeHtml(__('Add to Cart')) ?></span>
|
||||
</button>
|
||||
<?php else: ?>
|
||||
<?php if ($_item->getIsSalable()): ?>
|
||||
<div class="stock available">
|
||||
<span><?= $escaper->escapeHtml(__('In stock')) ?></span>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="stock unavailable">
|
||||
<span><?= $escaper->escapeHtml(__('Out of stock')) ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php if ($showWishlist || $showCompare): ?>
|
||||
<div class="actions-secondary" data-role="add-to-links">
|
||||
<?php if ($block->isWishListAllow() && $showWishlist): ?>
|
||||
<?php $params = $block->getAddToWishlistParams($_item) ?>
|
||||
<a href="#"
|
||||
data-post='<?= /* @noEscape */ $params ?>'
|
||||
class="action towishlist"
|
||||
data-action="add-to-wishlist"
|
||||
title="<?= $escaper->escapeHtml(__('Add to Wish List')) ?>">
|
||||
<span><?= $escaper->escapeHtml(__('Add to Wish List')) ?></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
<?php if ($block->getAddToCompareUrl() && $showCompare): ?>
|
||||
<?php $params = $block->getCompareHelper()->getPostDataParams($_item) ?>
|
||||
<a href="#"
|
||||
class="action tocompare"
|
||||
data-post='<?= /* @noEscape */ $params ?>'
|
||||
title="<?= $escaper->escapeHtml(__('Add to Compare')) ?>">
|
||||
<span><?= $escaper->escapeHtml(__('Add to Compare')) ?></span>
|
||||
</a>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
<?= ($iterator == count($items)+1) ? '</li>' : '' ?>
|
||||
<?php endforeach ?>
|
||||
</ol>
|
||||
</div>
|
||||
<?= $block->getPagerHtml() ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif;?>
|
||||
Executable
+43
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Amasty Team
|
||||
* @copyright Copyright (c) Amasty (https://www.amasty.com)
|
||||
* @package Improved Sorting for Magento 2
|
||||
*/
|
||||
/**
|
||||
* @var \Amasty\Sorting\Block\Widget\Featured $block
|
||||
* @var \Magento\Framework\Escaper $escaper
|
||||
*/
|
||||
?>
|
||||
|
||||
<?php if (($_products = $block->getProductCollection()) && $_products->getSize()): ?>
|
||||
<div class="block widget amsorting block-featured-products-images">
|
||||
<?php if ($block->getTitle()): ?>
|
||||
<div class="block-title">
|
||||
<strong><?= $escaper->escapeHtml(__($block->getTitle())) ?></strong>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<div class="block-content">
|
||||
<?php $suffix = $block->getNameInLayout(); ?>
|
||||
<ol id="widget-featured-products-<?= $escaper->escapeHtml($suffix) ?>"
|
||||
class="product-items product-items-images">
|
||||
<?php foreach ($_products->getItems() as $_product): ?>
|
||||
<li class="product-item">
|
||||
<a class="product-item-photo"
|
||||
href="<?= $escaper->escapeUrl($_product->getProductUrl()) ?>"
|
||||
title="<?= /* @noEscape */ $block->stripTags($_product->getName(), null, true) ?>">
|
||||
<?php $image = $block->getImageModel($_product) ?>
|
||||
<span class="product-image-container">
|
||||
<img src="<?= $escaper->escapeUrl($image->getUrl()) ?>"
|
||||
width="<?= $escaper->escapeHtmlAttr($image->getWidth()) ?>"
|
||||
height="<?= $escaper->escapeHtmlAttr($image->getHeight()) ?>"
|
||||
alt="<?= $escaper->escapeHtmlAttr($image->getLabel()) ?>"/>
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
<?= $block->getPagerHtml() ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Amasty Team
|
||||
* @copyright Copyright (c) Amasty (https://www.amasty.com)
|
||||
* @package Improved Sorting for Magento 2
|
||||
*/
|
||||
/**
|
||||
* @var \Amasty\Sorting\Block\Widget\Featured $block
|
||||
* @var \Magento\Framework\Escaper $escaper
|
||||
*/
|
||||
|
||||
use Magento\Catalog\Block\Product\ReviewRendererInterface;
|
||||
?>
|
||||
|
||||
<?php if (($_products = $block->getProductCollection()) && $_products->getSize()): ?>
|
||||
<div class="block widget amsorting block-featured-products-list">
|
||||
<?php if ($block->getTitle()): ?>
|
||||
<div class="block-title">
|
||||
<strong><?= $escaper->escapeHtml(__($block->getTitle())) ?></strong>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<div class="block-content">
|
||||
<?php $suffix = $block->getNameInLayout(); ?>
|
||||
<?php $iterator = 1; ?>
|
||||
<ol class="product-items" id="widget-featured-products-<?= $escaper->escapeHtml($suffix) ?>">
|
||||
<?php foreach ($_products->getItems() as $_product): ?>
|
||||
<?= /* @noEscape */ ($iterator++ == 1)
|
||||
? '<li class="product-item">'
|
||||
: '</li><li class="product-item">' ?>
|
||||
<div class="product-item-info">
|
||||
<a class="product-item-photo"
|
||||
href="<?= $escaper->escapeUrl($_product->getProductUrl()) ?>"
|
||||
title="<?= /* @noEscape */ $block->stripTags($_product->getName(), null, true) ?>">
|
||||
<?php $image = $block->getImageModel($_product) ?>
|
||||
<span class="product-image-container">
|
||||
<img src="<?= $escaper->escapeUrl($image->getUrl()) ?>"
|
||||
width="<?= $escaper->escapeHtmlAttr($image->getWidth()) ?>"
|
||||
height="<?= $escaper->escapeHtmlAttr($image->getHeight()) ?>"
|
||||
alt="<?= $escaper->escapeHtmlAttr($image->getLabel()) ?>"/>
|
||||
</span>
|
||||
</a>
|
||||
<div class="product-item-details">
|
||||
<strong class="product-item-name">
|
||||
<a href="<?= $escaper->escapeUrl($_product->getProductUrl()) ?>"
|
||||
title="<?= /* @noEscape */ $block->stripTags($_product->getName(), null, true) ?>)"
|
||||
class="product-item-link">
|
||||
<?= $escaper->escapeHtml($block->getProductName($_product)) ?>
|
||||
</a>
|
||||
</strong>
|
||||
<?= $block->getReviewsSummaryHtml($_product, ReviewRendererInterface::SHORT_VIEW) ?>
|
||||
<?= $block->getProductPriceHtml($_product, '-widget-featured-' . $suffix) ?>
|
||||
<div class="product-item-actions">
|
||||
<div class="actions-primary">
|
||||
<?php if ($_product->isSaleable()): ?>
|
||||
<?php if ($_product->getTypeInstance()->hasRequiredOptions($_product)): ?>
|
||||
<?php $url = $block->getAddToCartUrl($_product); ?>
|
||||
<button type="button"
|
||||
title="<?= $escaper->escapeHtml(__('Add to Cart')) ?>"
|
||||
class="action tocart primary"
|
||||
data-mage-init='{"redirectUrl":{
|
||||
"url":"<?= $escaper->escapeHtml($url) ?>"
|
||||
}}'>
|
||||
<span><?= $escaper->escapeHtml(__('Add to Cart')) ?></span>
|
||||
</button>
|
||||
<?php else: ?>
|
||||
<?php $postData = $block->getPostData($_product); ?>
|
||||
<button type="button"
|
||||
title="<?= $escaper->escapeHtml(__('Add to Cart')) ?>"
|
||||
class="action tocart primary"
|
||||
data-post='<?= $escaper->escapeHtml($postData) ?>'>
|
||||
<span><?= $escaper->escapeHtml(__('Add to Cart')) ?></span>
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
<?php else: ?>
|
||||
<?php if ($_product->getIsSalable()): ?>
|
||||
<div class="stock available"
|
||||
title="<?= $escaper->escapeHtml(__('Availability')) ?>">
|
||||
<span><?= $escaper->escapeHtml(__('In stock')) ?></span>
|
||||
</div>
|
||||
<?php else: ?>
|
||||
<div class="stock unavailable"
|
||||
title="<?= $escaper->escapeHtml(__('Availability')) ?>">
|
||||
<span><?= $escaper->escapeHtml(__('Out of stock')) ?></span>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<?= ($iterator == count($_products->getItems())+1) ? '</li>' : '' ?>
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
<?= $block->getPagerHtml() ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
+39
@@ -0,0 +1,39 @@
|
||||
<?php
|
||||
/**
|
||||
* @author Amasty Team
|
||||
* @copyright Copyright (c) Amasty (https://www.amasty.com)
|
||||
* @package Improved Sorting for Magento 2
|
||||
*/
|
||||
/**
|
||||
* @var \Amasty\Sorting\Block\Widget\Featured $block
|
||||
* @var \Magento\Framework\Escaper $escaper
|
||||
*/
|
||||
?>
|
||||
|
||||
<?php if (($_products = $block->getProductCollection()) && $_products->getSize()): ?>
|
||||
<div class="block widget amsorting block-featured-products-names">
|
||||
<?php if ($block->getTitle()): ?>
|
||||
<div class="block-title">
|
||||
<strong><?= $escaper->escapeHtml(__($block->getTitle())) ?></strong>
|
||||
</div>
|
||||
<?php endif ?>
|
||||
<div class="block-content">
|
||||
<?php $suffix = $block->getNameInLayout(); ?>
|
||||
<ol id="widget-new-products-<?= $escaper->escapeHtmlAttr($suffix) ?>"
|
||||
class="product-items product-items-names">
|
||||
<?php foreach ($_products->getItems() as $product): ?>
|
||||
<li class="product-item">
|
||||
<strong class="product-item-name">
|
||||
<a href="<?= $escaper->escapeUrl($product->getProductUrl()) ?>"
|
||||
title="<?= $escaper->escapeHtmlAttr($block->getProductName($product)) ?>"
|
||||
class="product-item-link">
|
||||
<?= $escaper->escapeHtml($block->getProductName($product)) ?>
|
||||
</a>
|
||||
</strong>
|
||||
</li>
|
||||
<?php endforeach; ?>
|
||||
</ol>
|
||||
<?= $block->getPagerHtml() ?>
|
||||
</div>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
@@ -0,0 +1,39 @@
|
||||
define([
|
||||
'jquery'
|
||||
], function ($) {
|
||||
$.widget('mage.amSortingDirection', {
|
||||
options: {
|
||||
permanentDirectionMethods: []
|
||||
},
|
||||
selectors: {
|
||||
directionSwitcher: '[data-role="direction-switcher"]'
|
||||
},
|
||||
|
||||
_create: function () {
|
||||
this.toggleDirectionSwitcher(this.element.val());
|
||||
this.observeSortOrder();
|
||||
},
|
||||
|
||||
observeSortOrder: function () {
|
||||
var self = this;
|
||||
|
||||
self.element.on('change', function () {
|
||||
self.toggleDirectionSwitcher(self.element.val());
|
||||
});
|
||||
},
|
||||
|
||||
toggleDirectionSwitcher: function (sortMethod) {
|
||||
var directionSwitcher = $(this.selectors.directionSwitcher);
|
||||
|
||||
if (this.options.permanentDirectionMethods.indexOf(sortMethod) !== -1) {
|
||||
directionSwitcher.fadeTo(0, 0);
|
||||
directionSwitcher.css('pointer-events', 'none');
|
||||
} else {
|
||||
directionSwitcher.fadeTo(0, 1);
|
||||
directionSwitcher.css('pointer-events', '');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
return $.mage.amSortingDirection;
|
||||
});
|
||||
Reference in New Issue
Block a user