Commit b6498894 by liumengfei

Merge branch 'developer' into production

parents 6af9e6c4 1345f595
......@@ -17,7 +17,7 @@ class MediaFeed extends Template {
const CACHE_TAG = 'INSTAGRAM_FEED';
const CACHE_LIFETIME = 60 * 60;
const CACHE_LIFETIME = 60 * 60 * 24;
protected $request;
......
......@@ -113,15 +113,16 @@ $_helper = $block->getData('outputHelper');
}
?>
<?php // Product Image ?>
<a href="<?= $escaper->escapeUrl($_product->getProductUrl()) ?>"
class="product photo product-item-photo"
tabindex="-1">
<?php
$productImageRaw = $imageHelper->init($_product, $imageDisplayArea)->setImageFile($productImage->getFile())->resize($productImage->getWidth(),$productImage->getHeight())->getUrl();
?>
<img class="product-image-photo" src="<?= $productImageRaw ?>" loading="lazy" width="<?= $productImage->getWidth() ?>" height="<?= $productImage->getHeight() ?>" alt="Image">
<img class="product-image-photo" style="background-color: #F0F0F0;border: none;" data-src="<?= $productImageRaw ?>" loading="lazy" width="<?= $productImage->getWidth() ?>px" height="<?= $productImage->getHeight() ?>px" />
<?php if ($hoverImg): ?>
<img class="hoverImg" width="<?= $productImage->getWidth() ?>" height="<?= $productImage->getHeight() ?>" src="<?= $hoverImg ?>">
<img class="hoverImg" width="<?= $productImage->getWidth() ?>px" height="<?= $productImage->getHeight() ?>px" data-src="<?= $hoverImg ?>" loading="lazy" />
<?php endif; ?>
</a>
<div class="product details product-item-details">
......@@ -236,4 +237,44 @@ $_helper = $block->getData('outputHelper');
'item' : <?= json_encode($items, true) ?>
})
</script>
<script>
// 获取所有的图片标签
const imgs = document.getElementsByTagName("img");
// 获取可视区域的高度
const viewHeight =
window.innerHeight || document.documentElement.clientHeight;
// num用于统计当前显示到了哪一张图片,避免每次都从第一张图片开始检查是否露出
let num = 0;
function lazyload() {
for (let i = num; i < imgs.length; i++) {
// 用可视区域高度减去元素顶部距离可视区域顶部的高度
let distance = viewHeight - imgs[i].getBoundingClientRect().top;
// 如果可视区域高度大于等于元素顶部距离可视区域顶部的高度,说明元素露出
if (distance >= 0) {
// 给元素写入真实的src,展示图片
imgs[i].src = imgs[i].getAttribute("data-src");
// 前i张图片已经加载完毕,下次从第i+1张开始检查是否露出
num = i + 1;
}
}
}
// 防抖函数
function debounce(fn, delay = 500) {
let timer = null;
return function (...args) {
if (timer) clearTimeout(timer);
timer = setTimeout(() => {
fn.call(this, args);
}, delay);
};
}
// 是的页面初始化是加载首屏图片
window.onload = lazyload;
// 监听Scroll事件,为了防止频繁调用,使用防抖函数优化一下
window.addEventListener("scroll", debounce(lazyload, 600), false);
</script>
<?php endif; ?>
......@@ -11,7 +11,7 @@
<referenceBlock name="checkout.cart.crosssell" remove="true"/>
<referenceBlock name="checkout.cart.summary.title" remove="true"/>
<referenceBlock name="minicart" remove="true" />
<!-- -->
<!-- <referenceBlock name="checkout.cart.totals">-->
......
......@@ -18,6 +18,21 @@ $canApplyMsrp = $helper->isShowBeforeOrderConfirm($product) && $helper->isMinima
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$mobileDetect = $objectManager->get(\Joshine\Common\Lib\MobileDetect\MobileDetect::class);
$priceBlock = $objectManager->get(\Magento\Catalog\Block\Product\AbstractProduct::class);
$_options = $block->getOptionList();
$resource = $objectManager->get('Magento\Framework\App\ResourceConnection');
$connection = $resource->getConnection();
foreach ($_options as $key=>$_option) {
if ($_option['label'] != 'Size') {
$tableName = $resource->getTableName('eav_attribute_option_value');
$sql = "Select value FROM " . $tableName ." where store_id=0 AND option_id=".$_option['option_value'];
} else {
$tableName = $resource->getTableName('eav_attribute_option_swatch');
$sql = "Select value FROM " . $tableName ." where store_id=0 AND option_id=".$_option['option_value'];
}
$result = $connection->fetchRow($sql);
$_options[$key]['value'] = $result['value'];
}
?>
<div class="cart item is_mobile">
......@@ -51,43 +66,18 @@ $priceBlock = $objectManager->get(\Magento\Catalog\Block\Product\AbstractProduct
</p>
<!----------------------------item name end------------------------------------->
<!----------------------------item option start--------------------------------->
<?php if ($_options = $block->getOptionList()) :?>
<?php if ($_options) :?>
<div class="item-options-meta">
<?php
$countOpt = count($_options);
?>
<?php foreach ($_options as $key=>$_option) :?>
<strong style="font-weight: 600;margin-right: 10px;"><?= $block->escapeHtml($_option['label']) ?> :</strong>
<span class="item-options-line">
<?php
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$resource = $objectManager->get('Magento\Framework\App\ResourceConnection');
$connection = $resource->getConnection();
?>
<?php if ($_option['label'] != 'Size'){ ?>
<?php
$tableName = $resource->getTableName('eav_attribute_option_value');
$sql = "Select * FROM " . $tableName ." where store_id=0 AND option_id=".$_option['option_value'];
$result = $connection->fetchRow($sql);
?>
<?= $block->escapeHtml($result['value']) ?>
<?php }else{
$tableName = $resource->getTableName('eav_attribute_option_swatch');
$sql = "Select * FROM " . $tableName ." where store_id=0 AND option_id=".$_option['option_value'];
$result = $connection->fetchRow($sql);
echo $result['value'];
} ?>
<?= $block->escapeHtml($_option['value']) ?>
</span><br />
<?php endforeach; ?>
</div>
<?php endif;?>
<div style="max-width: 100%;width: 100%;height: 40px;">
<!----------------------------item handle start--------------------------------->
<div class="item-handle" style="width: 16%;float:left;position: inherit;font-size: 16px;">
<div class="item-quantity">
......
......@@ -106,7 +106,7 @@
<referenceBlock name="copyright" remove="true"/>
</referenceContainer>
<referenceContainer name="before.body.end">
<block class="Magento\Theme\Block\Html\Footer" name="footer" template="Magento_Theme::html/footer.phtml" />
<block class="Magento\Theme\Block\Html\Footer" name="footer" template="Magento_Theme::html/footer.phtml" cacheable="true" />
</referenceContainer>
<referenceContainer name="content">
<block class="Magento\Framework\View\Element\FormKey" name="formkey"/>
......
......@@ -3,21 +3,11 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
?>
<?php echo $block->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId('public_footer')->toHtml();?>
<p title="go to header" id="topBtn" style="display: none;">
<img loading="lazy" src="<?php echo $block->getViewFileUrl('images/goTop.png'); ?>">
</p>
<script>
var userAgentInfo = navigator.userAgent;
var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod");
var flag = true;
for (var v = 0; v < Agents.length; v++) {
if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; }
}
require(['jquery'],function ($){
var flag = window.matchMedia("(pointer:coarse)").matches;
//footer
$("h4").click(function () {
var dis = $(this).siblings("ul").css("display");
......@@ -36,6 +26,22 @@
$("#search_mini_form_input").toggle();
});
//auto logo height
if (flag){
var imgH = $('.logo').height();
imgH= Math.ceil(imgH/3);
$('.header ').css('margin-bottom',imgH);
}
else{
//var headerH = $('.page-header').outerHeight(true);
$('.columns').css('margin-top',0);
}
//free shipping bar not existent
if(!flag && !$('.sparsh-free-shipping-bar-goal-message').length){
$('.page-header').css('margin-top','0');
}
if (flag){
......
......@@ -19,40 +19,6 @@ $logoHeight = $logoSizeResolver !== null && $logoSizeResolver->getHeight()
? $logoSizeResolver->getHeight()
: $block->getLogoHeight();
?>
<script>
var userAgentInfo = navigator.userAgent;
var Agents = new Array("Android", "iPhone", "SymbianOS", "Windows Phone", "iPad", "iPod");
var flag = true;
for (var v = 0; v < Agents.length; v++) {
if (userAgentInfo.indexOf(Agents[v]) > 0) { flag = false; break; }
}
require(['jquery'],function ($){
//free shipping bar not existent
if(!flag && !$('.sparsh-free-shipping-bar-goal-message').length){
$('.page-header').css('margin-top','0');
}
//auto logo height
if (flag){
var imgH = $('.logo').height();
imgH= Math.ceil(imgH/3);
$('.header ').css('margin-bottom',imgH);
}
else{
//var headerH = $('.page-header').outerHeight(true);
$('.columns').css('margin-top',0);
}
});
</script>
<style>
.secure-span{
display:none;
......@@ -64,12 +30,12 @@ $logoHeight = $logoSizeResolver !== null && $logoSizeResolver->getHeight()
href="<?= $block->escapeUrl($block->getUrl('')) ?>"
title="<?= $block->escapeHtmlAttr($storeName) ?>"
aria-label="store logo">
<img class="site-logo" src="<?= $block->escapeUrl($block->getLogoSrc()) ?>"
<img class="site-logo" data-src="<?= $block->escapeUrl($block->getLogoSrc()) ?>" src="<?= $block->escapeUrl($block->getLogoSrc()) ?>"
title="<?= $block->escapeHtmlAttr($block->getLogoAlt()) ?>"
alt="<?= $block->escapeHtmlAttr($block->getLogoAlt()) ?>"
<?= $logoWidth ? 'width="' . $block->escapeHtmlAttr($logoWidth) . '"' : '' ?>
<?= $logoHeight ? 'height="' . $block->escapeHtmlAttr($logoHeight) . '"' : '' ?>
/>
loading="lazy" />
<span class="secure-span">
<span class="cut-span" >
/
......
......@@ -3093,7 +3093,7 @@ strong.subtitle.empty{
margin-right: 1rem;
}
.minicart-items .price-container{
font-size: 12px;
font-size: 18px;
}
button.action.primary.checkout{
height: 50px;
......@@ -3424,7 +3424,7 @@ div#shipping-method-buttons-container {
}
span.qty-wrapper {
font-size: 12px;
font-size: 18px;
}
.checkout-container .action.primary, .checkout-container action.secondary{
background-color: #ffa800 !important;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment