Commit b6498894 by liumengfei

Merge branch 'developer' into production

parents 6af9e6c4 1345f595
...@@ -17,7 +17,7 @@ class MediaFeed extends Template { ...@@ -17,7 +17,7 @@ class MediaFeed extends Template {
const CACHE_TAG = 'INSTAGRAM_FEED'; const CACHE_TAG = 'INSTAGRAM_FEED';
const CACHE_LIFETIME = 60 * 60; const CACHE_LIFETIME = 60 * 60 * 24;
protected $request; protected $request;
......
...@@ -113,15 +113,16 @@ $_helper = $block->getData('outputHelper'); ...@@ -113,15 +113,16 @@ $_helper = $block->getData('outputHelper');
} }
?> ?>
<?php // Product Image ?> <?php // Product Image ?>
<a href="<?= $escaper->escapeUrl($_product->getProductUrl()) ?>" <a href="<?= $escaper->escapeUrl($_product->getProductUrl()) ?>"
class="product photo product-item-photo" class="product photo product-item-photo"
tabindex="-1"> tabindex="-1">
<?php <?php
$productImageRaw = $imageHelper->init($_product, $imageDisplayArea)->setImageFile($productImage->getFile())->resize($productImage->getWidth(),$productImage->getHeight())->getUrl(); $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): ?> <?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; ?> <?php endif; ?>
</a> </a>
<div class="product details product-item-details"> <div class="product details product-item-details">
...@@ -236,4 +237,44 @@ $_helper = $block->getData('outputHelper'); ...@@ -236,4 +237,44 @@ $_helper = $block->getData('outputHelper');
'item' : <?= json_encode($items, true) ?> 'item' : <?= json_encode($items, true) ?>
}) })
</script> </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; ?> <?php endif; ?>
...@@ -11,7 +11,7 @@ ...@@ -11,7 +11,7 @@
<referenceBlock name="checkout.cart.crosssell" remove="true"/> <referenceBlock name="checkout.cart.crosssell" remove="true"/>
<referenceBlock name="checkout.cart.summary.title" remove="true"/> <referenceBlock name="checkout.cart.summary.title" remove="true"/>
<referenceBlock name="minicart" remove="true" />
<!-- --> <!-- -->
<!-- <referenceBlock name="checkout.cart.totals">--> <!-- <referenceBlock name="checkout.cart.totals">-->
......
...@@ -18,6 +18,21 @@ $canApplyMsrp = $helper->isShowBeforeOrderConfirm($product) && $helper->isMinima ...@@ -18,6 +18,21 @@ $canApplyMsrp = $helper->isShowBeforeOrderConfirm($product) && $helper->isMinima
$objectManager = \Magento\Framework\App\ObjectManager::getInstance(); $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$mobileDetect = $objectManager->get(\Joshine\Common\Lib\MobileDetect\MobileDetect::class); $mobileDetect = $objectManager->get(\Joshine\Common\Lib\MobileDetect\MobileDetect::class);
$priceBlock = $objectManager->get(\Magento\Catalog\Block\Product\AbstractProduct::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"> <div class="cart item is_mobile">
...@@ -51,43 +66,18 @@ $priceBlock = $objectManager->get(\Magento\Catalog\Block\Product\AbstractProduct ...@@ -51,43 +66,18 @@ $priceBlock = $objectManager->get(\Magento\Catalog\Block\Product\AbstractProduct
</p> </p>
<!----------------------------item name end-------------------------------------> <!----------------------------item name end------------------------------------->
<!----------------------------item option start---------------------------------> <!----------------------------item option start--------------------------------->
<?php if ($_options = $block->getOptionList()) :?> <?php if ($_options) :?>
<div class="item-options-meta"> <div class="item-options-meta">
<?php
$countOpt = count($_options);
?>
<?php foreach ($_options as $key=>$_option) :?> <?php foreach ($_options as $key=>$_option) :?>
<strong style="font-weight: 600;margin-right: 10px;"><?= $block->escapeHtml($_option['label']) ?> :</strong> <strong style="font-weight: 600;margin-right: 10px;"><?= $block->escapeHtml($_option['label']) ?> :</strong>
<span class="item-options-line"> <span class="item-options-line">
<?php <?= $block->escapeHtml($_option['value']) ?>
$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'];
} ?>
</span><br /> </span><br />
<?php endforeach; ?> <?php endforeach; ?>
</div> </div>
<?php endif;?> <?php endif;?>
<div style="max-width: 100%;width: 100%;height: 40px;"> <div style="max-width: 100%;width: 100%;height: 40px;">
<!----------------------------item handle start---------------------------------> <!----------------------------item handle start--------------------------------->
<div class="item-handle" style="width: 16%;float:left;position: inherit;font-size: 16px;"> <div class="item-handle" style="width: 16%;float:left;position: inherit;font-size: 16px;">
<div class="item-quantity"> <div class="item-quantity">
......
...@@ -106,7 +106,7 @@ ...@@ -106,7 +106,7 @@
<referenceBlock name="copyright" remove="true"/> <referenceBlock name="copyright" remove="true"/>
</referenceContainer> </referenceContainer>
<referenceContainer name="before.body.end"> <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>
<referenceContainer name="content"> <referenceContainer name="content">
<block class="Magento\Framework\View\Element\FormKey" name="formkey"/> <block class="Magento\Framework\View\Element\FormKey" name="formkey"/>
......
...@@ -3,21 +3,11 @@ ...@@ -3,21 +3,11 @@
* Copyright © Magento, Inc. All rights reserved. * Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details. * See COPYING.txt for license details.
*/ */
?> ?>
<?php echo $block->getLayout()->createBlock('Magento\Cms\Block\Block')->setBlockId('public_footer')->toHtml();?> <?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> <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 ($){ require(['jquery'],function ($){
var flag = window.matchMedia("(pointer:coarse)").matches;
//footer //footer
$("h4").click(function () { $("h4").click(function () {
var dis = $(this).siblings("ul").css("display"); var dis = $(this).siblings("ul").css("display");
...@@ -36,6 +26,22 @@ ...@@ -36,6 +26,22 @@
$("#search_mini_form_input").toggle(); $("#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){ if (flag){
......
...@@ -19,40 +19,6 @@ $logoHeight = $logoSizeResolver !== null && $logoSizeResolver->getHeight() ...@@ -19,40 +19,6 @@ $logoHeight = $logoSizeResolver !== null && $logoSizeResolver->getHeight()
? $logoSizeResolver->getHeight() ? $logoSizeResolver->getHeight()
: $block->getLogoHeight(); : $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> <style>
.secure-span{ .secure-span{
display:none; display:none;
...@@ -64,12 +30,12 @@ $logoHeight = $logoSizeResolver !== null && $logoSizeResolver->getHeight() ...@@ -64,12 +30,12 @@ $logoHeight = $logoSizeResolver !== null && $logoSizeResolver->getHeight()
href="<?= $block->escapeUrl($block->getUrl('')) ?>" href="<?= $block->escapeUrl($block->getUrl('')) ?>"
title="<?= $block->escapeHtmlAttr($storeName) ?>" title="<?= $block->escapeHtmlAttr($storeName) ?>"
aria-label="store logo"> 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()) ?>" title="<?= $block->escapeHtmlAttr($block->getLogoAlt()) ?>"
alt="<?= $block->escapeHtmlAttr($block->getLogoAlt()) ?>" alt="<?= $block->escapeHtmlAttr($block->getLogoAlt()) ?>"
<?= $logoWidth ? 'width="' . $block->escapeHtmlAttr($logoWidth) . '"' : '' ?> <?= $logoWidth ? 'width="' . $block->escapeHtmlAttr($logoWidth) . '"' : '' ?>
<?= $logoHeight ? 'height="' . $block->escapeHtmlAttr($logoHeight) . '"' : '' ?> <?= $logoHeight ? 'height="' . $block->escapeHtmlAttr($logoHeight) . '"' : '' ?>
/> loading="lazy" />
<span class="secure-span"> <span class="secure-span">
<span class="cut-span" > <span class="cut-span" >
/ /
......
...@@ -3093,7 +3093,7 @@ strong.subtitle.empty{ ...@@ -3093,7 +3093,7 @@ strong.subtitle.empty{
margin-right: 1rem; margin-right: 1rem;
} }
.minicart-items .price-container{ .minicart-items .price-container{
font-size: 12px; font-size: 18px;
} }
button.action.primary.checkout{ button.action.primary.checkout{
height: 50px; height: 50px;
...@@ -3424,7 +3424,7 @@ div#shipping-method-buttons-container { ...@@ -3424,7 +3424,7 @@ div#shipping-method-buttons-container {
} }
span.qty-wrapper { span.qty-wrapper {
font-size: 12px; font-size: 18px;
} }
.checkout-container .action.primary, .checkout-container action.secondary{ .checkout-container .action.primary, .checkout-container action.secondary{
background-color: #ffa800 !important; 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