Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
joshine
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
joshine
Commits
3e017a0c
Commit
3e017a0c
authored
May 11, 2023
by
liumengfei
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'developer' into production
parents
ae4fd322
2b5ac30b
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
175 additions
and
58 deletions
+175
-58
app/code/Joshine/Category/Block/Html/Topmenu.php
+14
-2
app/code/Joshine/Category/Model/Category/Attribute/Source/Columns.php
+1
-0
app/code/Joshine/Category/Plugin/Block/Topmenu.php
+6
-0
app/code/Joshine/Category/Setup/UpgradeData.php
+43
-1
app/code/Joshine/Category/etc/module.xml
+1
-1
app/code/Joshine/Category/view/adminhtml/ui_component/category_form.xml
+49
-3
app/design/frontend/Joshine/breeze/Magento_Catalog/templates/product/list.phtml
+2
-42
app/design/frontend/Joshine/breeze/Magento_Catalog/templates/product/view/gallery.phtml
+55
-0
app/design/frontend/Joshine/breeze/Magento_Theme/templates/html/header/logo.phtml
+4
-8
app/design/frontend/Joshine/breeze/web/css/_custom.less
+0
-1
No files found.
app/code/Joshine/Category/Block/Html/Topmenu.php
View file @
3e017a0c
...
...
@@ -205,9 +205,13 @@ class Topmenu extends JoshineMenu
$columns
=
"11"
;
}
if
(
$childLevel
==
0
)
{
$leftMargin
=
$child
->
getChildLeftMargin
();
if
(
$leftMargin
!=
"0"
&&
empty
(
$leftMargin
))
{
$leftMargin
=
"1"
;
}
$html
=
"<div class=
\"
level
{
$childLevel
}
{
$childrenWrapClass
}
\"
>"
;
$html
.=
"<div class=
\"
row
\"
>
<ul class=
\"
subchildmenu joshine-col-lg-push-
1
mega-columns joshine-clearfix joshine-col-lg-
{
$columns
}
{
$child
->
getMenuImage
()
}
\"
>
<ul class=
\"
subchildmenu joshine-col-lg-push-
{
$leftMargin
}
mega-columns joshine-clearfix joshine-col-lg-
{
$columns
}
{
$child
->
getMenuImage
()
}
\"
>
{
$this
->
_getHtml
(
$child
,
$childrenWrapClass
,
$limit
,
$colStops
)
}
</ul>"
;
$html
.=
$this
->
appendImage
(
$child
);
...
...
@@ -228,7 +232,15 @@ class Topmenu extends JoshineMenu
}
if
(
$child
->
getMenuImage
())
{
$html
.=
"<div class=
\"
pull-right joshine-col-lg-3 joshine-col-lg-push-1 joshine-hidden-xs joshine-hidden-sm joshine-hidden-md
\"
>"
;
$imageLeftMargin
=
$child
->
getImageLeftMargin
();
if
(
empty
(
$imageLeftMargin
))
{
$imageLeftMargin
=
"0"
;
}
$imageWidth
=
$child
->
getImageWidth
();
if
(
empty
(
$imageWidth
))
{
$imageWidth
=
"3"
;
}
$html
.=
"<div class=
\"
pull-right joshine-col-lg-
{
$imageWidth
}
joshine-col-lg-push-
{
$imageLeftMargin
}
joshine-hidden-xs joshine-hidden-sm joshine-hidden-md
\"
>"
;
$html
.=
"<img src='
{
$child
->
getMenuImage
()
}
'/>"
;
$html
.=
"</div>"
;
}
...
...
app/code/Joshine/Category/Model/Category/Attribute/Source/Columns.php
View file @
3e017a0c
...
...
@@ -27,6 +27,7 @@ class Columns extends \Magento\Eav\Model\Entity\Attribute\Source\AbstractSource
if
(
!
$this
->
_optionsData
)
{
$this
->
_optionsData
=
[
[
'value'
=>
''
,
'label'
=>
'----'
],
[
'value'
=>
'0'
,
'label'
=>
'0-columns'
],
[
'value'
=>
'1'
,
'label'
=>
'1-columns'
],
[
'value'
=>
'2'
,
'label'
=>
'2-columns'
],
[
'value'
=>
'3'
,
'label'
=>
'3-columns'
],
...
...
app/code/Joshine/Category/Plugin/Block/Topmenu.php
View file @
3e017a0c
...
...
@@ -147,6 +147,9 @@ class Topmenu extends Menu
'badge'
=>
$category
->
getData
(
'badge'
),
'submenu_columns_total'
=>
$category
->
getData
(
'submenu_columns_total'
),
'self_columns'
=>
$category
->
getData
(
'self_columns'
),
'image_left_margin'
=>
$category
->
getData
(
'image_left_margin'
),
'image_width'
=>
$category
->
getData
(
'image_width'
),
'child_left_margin'
=>
$category
->
getData
(
'child_left_margin'
),
'submenu_columns_single'
=>
$category
->
getData
(
'submenu_columns_single'
),
'menu_image'
=>
$category
->
getData
(
'menu_image'
),
'has_active'
=>
in_array
((
string
)
$categoryId
,
explode
(
'/'
,
(
string
)
$currentCategory
->
getPath
()),
true
),
...
...
@@ -176,6 +179,9 @@ class Topmenu extends Menu
$collection
->
addAttributeToSelect
(
'submenu_columns_total'
);
$collection
->
addAttributeToSelect
(
'submenu_columns_single'
);
$collection
->
addAttributeToSelect
(
'self_columns'
);
$collection
->
addAttributeToSelect
(
'image_left_margin'
);
$collection
->
addAttributeToSelect
(
'image_width'
);
$collection
->
addAttributeToSelect
(
'child_left_margin'
);
$collection
->
addAttributeToSelect
(
'menu_image'
);
$collection
->
addFieldToFilter
(
'path'
,
[
'like'
=>
'1/'
.
$rootId
.
'/%'
]);
//load only from store root
$collection
->
addAttributeToFilter
(
'include_in_menu'
,
1
);
...
...
app/code/Joshine/Category/Setup/UpgradeData.php
View file @
3e017a0c
...
...
@@ -146,7 +146,49 @@ class UpgradeData implements UpgradeDataInterface
'required'
=>
false
,
'sort_order'
=>
100
,
'global'
=>
\Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface
::
SCOPE_STORE
,
]
],
'image_left_margin'
=>
[
'type'
=>
'varchar'
,
'label'
=>
'image_left_margin'
,
'input'
=>
'select'
,
'sort_order'
=>
101
,
'source'
=>
'\Joshine\Category\Model\Category\Attribute\Source\Columns'
,
'global'
=>
\Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface
::
SCOPE_STORE
,
'visible_on_front'
=>
true
,
'required'
=>
false
,
'user_defined'
=>
false
,
'default'
=>
null
,
'group'
=>
'image_left_margin'
,
'backend'
=>
''
],
'image_width'
=>
[
'type'
=>
'varchar'
,
'label'
=>
'image_width'
,
'input'
=>
'select'
,
'sort_order'
=>
101
,
'source'
=>
'\Joshine\Category\Model\Category\Attribute\Source\Columns'
,
'global'
=>
\Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface
::
SCOPE_STORE
,
'visible_on_front'
=>
true
,
'required'
=>
false
,
'user_defined'
=>
false
,
'default'
=>
null
,
'group'
=>
'image_width'
,
'backend'
=>
''
],
'child_left_margin'
=>
[
'type'
=>
'varchar'
,
'label'
=>
'child_left_margin'
,
'input'
=>
'select'
,
'sort_order'
=>
101
,
'source'
=>
'\Joshine\Category\Model\Category\Attribute\Source\Columns'
,
'global'
=>
\Magento\Eav\Model\Entity\Attribute\ScopedAttributeInterface
::
SCOPE_STORE
,
'visible_on_front'
=>
true
,
'required'
=>
false
,
'user_defined'
=>
false
,
'default'
=>
null
,
'group'
=>
'child_left_margin'
,
'backend'
=>
''
]
];
foreach
(
$menu_attributes
as
$item
=>
$data
)
{
...
...
app/code/Joshine/Category/etc/module.xml
View file @
3e017a0c
...
...
@@ -6,5 +6,5 @@
*/
-->
<config
xmlns:xsi=
"http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation=
"urn:magento:framework:Module/etc/module.xsd"
>
<module
name=
"Joshine_Category"
setup_version=
"1.1.
7
"
/>
<module
name=
"Joshine_Category"
setup_version=
"1.1.
8
"
/>
</config>
app/code/Joshine/Category/view/adminhtml/ui_component/category_form.xml
View file @
3e017a0c
...
...
@@ -39,6 +39,52 @@
</argument>
</field>
<field
name=
"child_left_margin"
sortOrder=
"300"
>
<argument
name=
"data"
xsi:type=
"array"
>
<item
name=
"options"
xsi:type=
"object"
>
Joshine\Category\Model\Category\Attribute\Source\Columns
</item>
<item
name=
"config"
xsi:type=
"array"
>
<item
name=
"required"
xsi:type=
"boolean"
>
false
</item>
<item
name=
"validation"
xsi:type=
"array"
>
<item
name=
"required-entry"
xsi:type=
"boolean"
>
false
</item>
</item>
<item
name=
"dataType"
xsi:type=
"string"
>
string
</item>
<item
name=
"formElement"
xsi:type=
"string"
>
select
</item>
<item
name=
"label"
translate=
"false"
xsi:type=
"string"
>
Child left Margin(子类块左间距)
</item>
</item>
</argument>
</field>
<field
name=
"image_left_margin"
sortOrder=
"300"
>
<argument
name=
"data"
xsi:type=
"array"
>
<item
name=
"options"
xsi:type=
"object"
>
Joshine\Category\Model\Category\Attribute\Source\Columns
</item>
<item
name=
"config"
xsi:type=
"array"
>
<item
name=
"required"
xsi:type=
"boolean"
>
false
</item>
<item
name=
"validation"
xsi:type=
"array"
>
<item
name=
"required-entry"
xsi:type=
"boolean"
>
false
</item>
</item>
<item
name=
"dataType"
xsi:type=
"string"
>
string
</item>
<item
name=
"formElement"
xsi:type=
"string"
>
select
</item>
<item
name=
"label"
translate=
"false"
xsi:type=
"string"
>
image left margin(图片左间距)
</item>
</item>
</argument>
</field>
<field
name=
"image_width"
sortOrder=
"300"
>
<argument
name=
"data"
xsi:type=
"array"
>
<item
name=
"options"
xsi:type=
"object"
>
Joshine\Category\Model\Category\Attribute\Source\Columns
</item>
<item
name=
"config"
xsi:type=
"array"
>
<item
name=
"required"
xsi:type=
"boolean"
>
false
</item>
<item
name=
"validation"
xsi:type=
"array"
>
<item
name=
"required-entry"
xsi:type=
"boolean"
>
false
</item>
</item>
<item
name=
"dataType"
xsi:type=
"string"
>
string
</item>
<item
name=
"formElement"
xsi:type=
"string"
>
select
</item>
<item
name=
"label"
translate=
"false"
xsi:type=
"string"
>
image width(图片宽度)
</item>
</item>
</argument>
</field>
<field
name=
"submenu_columns_total"
sortOrder=
"300"
>
<argument
name=
"data"
xsi:type=
"array"
>
<item
name=
"options"
xsi:type=
"object"
>
Joshine\Category\Model\Category\Attribute\Source\Columns
</item>
...
...
@@ -49,7 +95,7 @@
</item>
<item
name=
"dataType"
xsi:type=
"string"
>
string
</item>
<item
name=
"formElement"
xsi:type=
"string"
>
select
</item>
<item
name=
"label"
translate=
"false"
xsi:type=
"string"
>
Submenu Columns Total
</item>
<item
name=
"label"
translate=
"false"
xsi:type=
"string"
>
Submenu Columns Total
(子类块总宽度)
</item>
</item>
</argument>
</field>
...
...
@@ -64,7 +110,7 @@
</item>
<item
name=
"dataType"
xsi:type=
"string"
>
string
</item>
<item
name=
"formElement"
xsi:type=
"string"
>
select
</item>
<item
name=
"label"
translate=
"false"
xsi:type=
"string"
>
Self Columns
</item>
<item
name=
"label"
translate=
"false"
xsi:type=
"string"
>
Self Columns
(自身宽度)
</item>
</item>
</argument>
</field>
...
...
@@ -79,7 +125,7 @@
</item>
<item
name=
"dataType"
xsi:type=
"string"
>
string
</item>
<item
name=
"formElement"
xsi:type=
"string"
>
select
</item>
<item
name=
"label"
translate=
"false"
xsi:type=
"string"
>
Submenu Columns Single(
will overwrite by Self Columns
)
</item>
<item
name=
"label"
translate=
"false"
xsi:type=
"string"
>
Submenu Columns Single(
子类自身宽度批量设置,如子类自身设置宽度,会被覆盖
)
</item>
</item>
</argument>
</field>
...
...
app/design/frontend/Joshine/breeze/Magento_Catalog/templates/product/list.phtml
View file @
3e017a0c
...
...
@@ -120,9 +120,9 @@ $_helper = $block->getData('outputHelper');
<?php
$productImageRaw
=
$imageHelper->init
(
$_product
,
$imageDisplayArea
)->setImageFile(
$productImage->getFile
())->resize(
$productImage->getWidth
(),
$productImage->getHeight
())->getUrl();
?>
<img class="
product
-
image
-
photo
" style="
background
-
color
:
#F0F0F0;
border: none;" data-
src="<?= $productImageRaw ?>" loading="lazy" width="<?= $productImage->getWidth() ?>px" height="<?= $productImage->getHeight() ?>px" />
<img class="
product
-
image
-
photo
" style="
background
-
color
:
#F0F0F0;
"
src="<?= $productImageRaw ?>" loading="lazy" width="<?= $productImage->getWidth() ?>px" height="<?= $productImage->getHeight() ?>px" />
<?
php
if
(
$hoverImg
)
:
?>
<img
class=
"hoverImg"
width=
"
<?=
$productImage
->
getWidth
()
?>
px"
height=
"
<?=
$productImage
->
getHeight
()
?>
px"
data-
src=
"
<?=
$hoverImg
?>
"
loading=
"lazy"
/>
<img
class=
"hoverImg"
width=
"
<?=
$productImage
->
getWidth
()
?>
px"
height=
"
<?=
$productImage
->
getHeight
()
?>
px"
src=
"
<?=
$hoverImg
?>
"
loading=
"lazy"
/>
<?php
endif
;
?>
</a>
<div
class=
"product details product-item-details"
>
...
...
@@ -237,44 +237,4 @@ $_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
;
?>
app/design/frontend/Joshine/breeze/Magento_Catalog/templates/product/view/gallery.phtml
0 → 100644
View file @
3e017a0c
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
/**
* Product media data template
*
* @var $block \Magento\Catalog\Block\Product\View\Gallery
*/
?>
<style>
.gallery-placeholder__image
{
height
:
1000px
;
width
:
750px
;
background-color
:
#F0F0F0
;}
@media
(
max-width
:
1024px
){
.gallery-placeholder__image
{
height
:
500px
;
width
:
400px
;
background-color
:
#F0F0F0
;}
}
</style>
<?php
$images
=
$block
->
getGalleryImages
()
->
getItems
();
$mainImage
=
current
(
array_filter
(
$images
,
function
(
$img
)
use
(
$block
)
{
return
$block
->
isMainImage
(
$img
);
}));
if
(
!
empty
(
$images
)
&&
empty
(
$mainImage
))
{
$mainImage
=
$block
->
getGalleryImages
()
->
getFirstItem
();
}
$helper
=
$block
->
getData
(
'imageHelper'
);
$mainImageData
=
$mainImage
?
$mainImage
->
getData
(
'medium_image_url'
)
:
$helper
->
getDefaultPlaceholderUrl
(
'image'
);
?>
<div
class=
"gallery-placeholder _block-content-loading"
data-gallery-role=
"gallery-placeholder"
>
<img
alt=
"main product photo"
class=
"gallery-placeholder__image"
data-src=
="
<?=
/* @noEscape */
$mainImageData
?>
"
/>
</div>
<script
type=
"text/x-magento-init"
>
{
"[data-gallery-role=gallery-placeholder]"
:
{
"mage/gallery/gallery"
:
{
"mixins"
:[
"magnifier/magnify"
],
"magnifierOpts"
:
<?=
/* @noEscape */
$block
->
getMagnifier
()
?>
,
"data"
:
<?=
/* @noEscape */
$block
->
getGalleryImagesJson
()
?>
,
"options"
:
<?=
/* @noEscape */
$block
->
getGalleryOptions
()
->
getOptionsJson
()
?>
,
"fullscreen"
:
<?=
/* @noEscape */
$block
->
getGalleryOptions
()
->
getFSOptionsJson
()
?>
,
"breakpoints"
:
<?=
/* @noEscape */
$block
->
getBreakpoints
()
?>
}
}
}
</script>
app/design/frontend/Joshine/breeze/Magento_Theme/templates/html/header/logo.phtml
View file @
3e017a0c
...
...
@@ -19,23 +19,18 @@ $logoHeight = $logoSizeResolver !== null && $logoSizeResolver->getHeight()
?
$logoSizeResolver
->
getHeight
()
:
$block
->
getLogoHeight
();
?>
<style>
.secure-span
{
display
:
none
;
}
</style>
<span
data-action=
"toggle-nav"
class=
"action nav-toggle"
><span>
<?=
$block
->
escapeHtml
(
__
(
'Toggle Nav'
))
?>
</span></span>
<a
class=
"logo show-logo"
href=
"
<?=
$block
->
escapeUrl
(
$block
->
getUrl
(
''
))
?>
"
title=
"
<?=
$block
->
escapeHtmlAttr
(
$storeName
)
?>
"
aria-label=
"store logo"
>
<img
class=
"site-logo"
data-src=
"
<?=
$block
->
escapeUrl
(
$block
->
getLogoSrc
())
?>
"
src=
"
<?=
$block
->
escapeUrl
(
$block
->
getLogoSrc
())
?>
"
<img
class=
"site-logo"
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"
/
>
<?=
$logoHeight
?
'height="'
.
$block
->
escapeHtmlAttr
(
$logoHeight
)
.
'"'
:
''
?>
/>
<?php
if
(
$block
->
getRequest
()
->
getModuleName
()
==
"checkout"
)
{
?
>
<span
class=
"secure-span"
>
<span
class=
"cut-span"
>
/
...
...
@@ -43,4 +38,5 @@ $logoHeight = $logoSizeResolver !== null && $logoSizeResolver->getHeight()
<img
class=
"logo-secure"
src=
"/media/wysiwyg/logo-secure.png"
/>
<span
class=
"cut-font"
>
<?=
__
(
'SECURE CHECKOUT'
)
?>
</span>
</span>
<?php
}
?>
</a>
app/design/frontend/Joshine/breeze/web/css/_custom.less
View file @
3e017a0c
...
...
@@ -3335,7 +3335,6 @@ div#shipping-method-buttons-container {
@media(min-width: 1024px) {
div.product-item-info:hover {
background: #ffffff !important;
border: 1px solid #bbbbbb;
position: relative;
z-index: 9;
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment