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
c01849b4
Commit
c01849b4
authored
Sep 16, 2022
by
lmf
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
首页增加新品列表模块
parent
0b5776ee
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
144 additions
and
0 deletions
+144
-0
app/design/frontend/Joshine/breeze/Magento_Catalog/templates/product/widget/new/content/home_news_product.phtml
+136
-0
app/design/frontend/Joshine/breeze/Magento_Cms/templates/default/home.phtml
+5
-0
app/design/frontend/Joshine/breeze/web/css/_custom.less
+3
-0
No files found.
app/design/frontend/Joshine/breeze/Magento_Catalog/templates/product/widget/new/content/home_news_product.phtml
0 → 100644
View file @
c01849b4
<?php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
?>
<?php
/**
* Template for displaying new products widget
*
* @var $block \Magento\Catalog\Block\Product\Widget\NewWidget
*/
// phpcs:disable Magento2.Files.LineLength.MaxExceeded
// phpcs:disable Magento2.Templates.ThisInTemplate.FoundThis
if
(
$exist
=
(
$block
->
getProductCollection
()
&&
$block
->
getProductCollection
()
->
getSize
()))
{
$type
=
'widget-new-grid'
;
$mode
=
'grid'
;
$image
=
'new_products_content_widget_grid'
;
$title
=
__
(
'New Products'
);
$items
=
$block
->
getProductCollection
()
->
getItems
();
$showWishlist
=
true
;
$showCompare
=
true
;
$showCart
=
true
;
$templateType
=
\Magento\Catalog\Block\Product\ReviewRendererInterface
::
DEFAULT_VIEW
;
$description
=
false
;
}
?>
<?php
if
(
$exist
)
:?>
<
div
class
="
block
widget
block
-
new
-
products
<?=
/* @noEscape */
$mode
?>
">
<div
class=
"block-title"
>
<strong
role=
"heading"
aria-level=
"2"
>
NEW ARRIVALS
</strong>
</div>
<div
class=
"block-content"
>
<?=
/* @noEscape */
'<!-- '
.
$image
.
'-->'
?>
<div
class=
"products-
<?=
/* @noEscape */
$mode
?>
<?=
/* @noEscape */
$mode
?>
"
>
<ol
class=
"product-items
<?=
/* @noEscape */
$type
?>
"
>
<?php
foreach
(
$items
as
$_item
)
:?>
<
li
class
="
product
-
item
">
<div class="
product
-
item
-
info
">
<a href="
<?=
$block
->
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=
"
<?=
$block
->
escapeHtml
(
$_item
->
getName
())
?>
"
href=
"
<?=
$block
->
escapeUrl
(
$block
->
getProductUrl
(
$_item
))
?>
"
class=
"product-item-link"
>
<?=
$block
->
escapeHtml
(
$_item
->
getName
())
?>
</a>
</strong>
<?=
$block
->
getProductPriceHtml
(
$_item
,
$type
);
?>
<?php
if
(
$templateType
)
:?>
<?=
$block
->
getReviewsSummaryHtml
(
$_item
,
$templateType
)
?>
<?php
endif
;
?>
<?php
if
(
$showWishlist
||
$showCompare
||
$showCart
)
:?>
<
div
class
="
product
-
item
-
actions
">
<?php if (
$showCart
) :?>
<div class="
actions
-
primary
">
<?php if (
$_item->isSaleable
()) :?>
<?php if (!
$_item->getTypeInstance
()->isPossibleBuyFromList(
$_item
)) :?>
<button class="
action
tocart
primary
"
data-mage-init='{"
redirectUrl
":{"
url
":"
<?=
$block
->
escapeUrl
(
$block
->
getAddToCartUrl
(
$_item
))
?>
"}}'
type="button"
title="
<?=
$block
->
escapeHtmlAttr
(
__
(
'Add to Cart'
))
?>
">
<span>
<?=
$block
->
escapeHtml
(
__
(
'Add to Cart'
))
?>
</span>
</button>
<?php
else
:?>
<?
php
$postDataHelper
=
$this
->
helper
(
Magento\Framework\Data\Helper\PostHelper
::
class
);
$postData
=
$postDataHelper
->
getPostData
(
$block
->
escapeUrl
(
$block
->
getAddToCartUrl
(
$_item
)),
[
'product'
=>
(
int
)
$_item
->
getEntityId
()]
)
?>
<button
class=
"action tocart primary"
data-post=
'
<?=
/* @noEscape */
$postData
?>
'
type=
"button"
title=
"
<?=
$block
->
escapeHtmlAttr
(
__
(
'Add to Cart'
))
?>
"
>
<span>
<?=
$block
->
escapeHtml
(
__
(
'Add to Cart'
))
?>
</span>
</button>
<?php
endif
;
?>
<?php
else
:?>
<?
php
if
(
$_item
->
isAvailable
())
:?>
<
div
class
="
stock
available
">
<span><?=
$block->escapeHtml
(__('In stock')) ?></span>
</div>
<?php else :?>
<div class="
stock
unavailable
">
<span><?=
$block->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 (
$this->helper
(Magento\Wishlist\Helper\Data::class)->isAllow() &&
$showWishlist
) :?>
<a href="
#"
data
-
post
=
'<?= /* @noEscape */ $block->getAddToWishlistParams($_item) ?>'
class
="
action
towishlist
"
data-action="
add
-
to
-
wishlist
"
title="
<?=
$block
->
escapeHtmlAttr
(
__
(
'Add to Wish List'
))
?>
">
<span>
<?=
$block
->
escapeHtml
(
__
(
'Add to Wish List'
))
?>
</span>
</a>
<?php
endif
;
?>
<?php
if
(
$block
->
getAddToCompareUrl
()
&&
$showCompare
)
:?>
<?
php
$compareHelper
=
$this
->
helper
(
Magento\Catalog\Helper\Product\Compare
::
class
);
?>
<a
href=
"#"
class=
"action tocompare"
data-post=
'
<?=
/* @noEscape */
$compareHelper
->
getPostDataParams
(
$_item
)
?>
'
title=
"
<?=
$block
->
escapeHtmlAttr
(
__
(
'Add to Compare'
))
?>
"
>
<span>
<?=
$block
->
escapeHtml
(
__
(
'Add to Compare'
))
?>
</span>
</a>
<?php
endif
;
?>
</div>
<?php
endif
;
?>
</div>
<?php
endif
;
?>
</div>
</div>
</li>
<?php
endforeach
?>
</ol>
</div>
<?=
$block
->
getPagerHtml
()
?>
</div>
</div>
<?php
endif
;
?>
app/design/frontend/Joshine/breeze/Magento_Cms/templates/default/home.phtml
View file @
c01849b4
...
@@ -56,6 +56,10 @@
...
@@ -56,6 +56,10 @@
</div>
</div>
</div>
</div>
<?php
//<p>{{widget type="Magento\Catalog\Block\Product\Widget\NewWidget" display_type="new_products" show_pager="0" products_count="3" template="product/widget/new/content/new_list.phtml"}}</p>
echo
$this
->
getLayout
()
->
createBlock
(
"Magento\Catalog\Block\Product\Widget\NewWidget"
)
->
setDisplayType
(
"all_products"
)
->
setProductsCount
(
"3"
)
->
setTemplate
(
"product/widget/new/content/home_news_product.phtml"
)
->
toHtml
();
?>
<div
class=
"flash_sale"
>
<div
class=
"flash_sale"
>
<a
href=
"https://www.joshine.com/flashsale-0422?product_list_order=price_low"
><p
class=
"flashsale-title"
>
⚡FLASH SALE⚡
</p>
</a>
<a
href=
"https://www.joshine.com/flashsale-0422?product_list_order=price_low"
><p
class=
"flashsale-title"
>
⚡FLASH SALE⚡
</p>
</a>
...
@@ -64,6 +68,7 @@
...
@@ -64,6 +68,7 @@
<?php
<?php
$templateType
=
\Magento\Catalog\Block\Product\ReviewRendererInterface
::
SHORT_VIEW
;
$templateType
=
\Magento\Catalog\Block\Product\ReviewRendererInterface
::
SHORT_VIEW
;
$ids
=
explode
(
','
,
"133,138,148,158,167,172"
);
$ids
=
explode
(
','
,
"133,138,148,158,167,172"
);
//$ids = explode(',',"1,2");
$objectManager
=
\Magento\Framework\App\ObjectManager
::
getInstance
();
$objectManager
=
\Magento\Framework\App\ObjectManager
::
getInstance
();
$pr
=
$objectManager
->
create
(
'Magento\Catalog\Model\ProductRepository'
);
$pr
=
$objectManager
->
create
(
'Magento\Catalog\Model\ProductRepository'
);
...
...
app/design/frontend/Joshine/breeze/web/css/_custom.less
View file @
c01849b4
...
@@ -807,6 +807,9 @@ p.shopbycate-title {
...
@@ -807,6 +807,9 @@ p.shopbycate-title {
max-width: fit-content;
max-width: fit-content;
width:100%;
width:100%;
}
}
p.flashsale-title:hover {
text-decoration: underline;
}
p.flashsale-title {
p.flashsale-title {
background: #fff;
background: #fff;
font-size: 24px;
font-size: 24px;
...
...
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