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
c64862c7
Commit
c64862c7
authored
Mar 20, 2023
by
dhn
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'developer' of
http://47.99.244.21:9999/root/joshine
into Branch_developer
parents
8966b011
17d0c5f5
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
154 additions
and
124 deletions
+154
-124
app/code/Joshine/Review/Block/Images.php
+124
-124
app/code/Joshine/Sales/Plugin/DefaultRendererPlugin.php
+11
-0
app/code/Joshine/Sales/Plugin/ItemsSortPlugin.php
+15
-0
app/code/Joshine/Sales/etc/di.xml
+4
-0
No files found.
app/code/Joshine/Review/Block/Images.php
View file @
c64862c7
<?php
<?php
namespace
Joshine\Review\Block
;
namespace
Joshine\Review\Block
;
use
Joshine\Review\Model\ResourceModel\Images\Collection
;
use
Joshine\Review\Model\ResourceModel\Images\Collection
;
use
Joshine\Review\Helper\ImageHelper
;
use
Joshine\Review\Helper\ImageHelper
;
use
Magento\Framework\View\Element\Template
;
use
Magento\Framework\View\Element\Template
;
use
Joshine\Review\Model\ResourceModel\Images\CollectionFactory
;
use
Joshine\Review\Model\ResourceModel\Images\CollectionFactory
;
/**
/**
* Class Images
* Class Images
* @package Amasty\AdvancedReview\Block
* @package Amasty\AdvancedReview\Block
*/
*/
class
Images
extends
\Magento\Framework\View\Element\Template
class
Images
extends
\Magento\Framework\View\Element\Template
{
{
//评论缩略图宽度
//评论缩略图宽度
const
REVIEW_COVER_WIDTH
=
200
;
const
REVIEW_COVER_WIDTH
=
200
;
/**
/**
* @var string
* @var string
*/
*/
protected
$_template
=
'Joshine_Review::images.phtml'
;
protected
$_template
=
'Joshine_Review::images.phtml'
;
private
$reviewId
;
private
$reviewId
;
private
$productId
;
private
$productId
;
/**
/**
* @var int
* @var int
*/
*/
/**
/**
* @var \Magento\Framework\Json\EncoderInterface
* @var \Magento\Framework\Json\EncoderInterface
*/
*/
private
$jsonEncoder
;
private
$jsonEncoder
;
/**
/**
* @var CollectionFactory
* @var CollectionFactory
*/
*/
private
$collectionFactory
;
private
$collectionFactory
;
/**
/**
* @var ImageHelper
* @var ImageHelper
*/
*/
private
$imageHelper
;
private
$imageHelper
;
public
function
__construct
(
public
function
__construct
(
Template\Context
$context
,
Template\Context
$context
,
CollectionFactory
$collectionFactory
,
CollectionFactory
$collectionFactory
,
\Magento\Framework\Json\EncoderInterface
$jsonEncoder
,
\Magento\Framework\Json\EncoderInterface
$jsonEncoder
,
ImageHelper
$imageHelper
,
ImageHelper
$imageHelper
,
array
$data
=
[]
array
$data
=
[]
)
{
)
{
parent
::
__construct
(
$context
,
$data
);
parent
::
__construct
(
$context
,
$data
);
$this
->
jsonEncoder
=
$jsonEncoder
;
$this
->
jsonEncoder
=
$jsonEncoder
;
$this
->
collectionFactory
=
$collectionFactory
;
$this
->
collectionFactory
=
$collectionFactory
;
$this
->
imageHelper
=
$imageHelper
;
$this
->
imageHelper
=
$imageHelper
;
}
}
/**
/**
* @return int
* @return int
*/
*/
public
function
getReviewId
()
:
int
public
function
getReviewId
()
{
{
return
$this
->
reviewId
;
return
$this
->
reviewId
;
}
}
/**
/**
* @param $reviewId
* @param $reviewId
*
*
* @return $this
* @return $this
*/
*/
public
function
setReviewId
(
$reviewId
)
:
Images
public
function
setReviewId
(
$reviewId
)
{
{
$this
->
reviewId
=
$reviewId
;
$this
->
reviewId
=
$reviewId
;
return
$this
;
return
$this
;
}
}
public
function
setProductId
(
$productId
)
:
Images
public
function
setProductId
(
$productId
)
{
{
$this
->
productId
=
$productId
;
$this
->
productId
=
$productId
;
return
$this
;
return
$this
;
}
}
public
function
getProductId
()
public
function
getProductId
()
{
{
return
$this
->
productId
;
return
$this
->
productId
;
}
}
public
function
getCollection
()
{
public
function
getCollection
()
{
/** @var Collection $collection */
/** @var Collection $collection */
$collection
=
$this
->
collectionFactory
->
create
()
$collection
=
$this
->
collectionFactory
->
create
()
->
addFieldToSelect
(
'*'
)
->
addFieldToSelect
(
'*'
)
->
addFieldToFilter
(
'review_id'
,
$this
->
getReviewId
());
->
addFieldToFilter
(
'review_id'
,
$this
->
getReviewId
());
return
$collection
;
return
$collection
;
}
}
public
function
getFullImagePath
(
$item
)
:
string
public
function
getFullImagePath
(
$item
)
{
{
return
$this
->
imageHelper
->
getFullPath
(
$item
->
getPath
());
return
$this
->
imageHelper
->
getFullPath
(
$item
->
getPath
());
}
}
/**
/**
* @param $item
* @param $item
* @return string
* @return string
* @throws \Magento\Framework\Exception\NoSuchEntityException
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
*/
public
function
getResizedImagePath
(
$item
)
:
string
public
function
getResizedImagePath
(
$item
)
{
{
return
$this
->
imageHelper
->
resize
(
$item
->
getPath
(),
self
::
REVIEW_COVER_WIDTH
);
return
$this
->
imageHelper
->
resize
(
$item
->
getPath
(),
self
::
REVIEW_COVER_WIDTH
);
}
}
/**
/**
* @param $item
* @param $item
* @return string
* @return string
* @throws \Magento\Framework\Exception\NoSuchEntityException
* @throws \Magento\Framework\Exception\NoSuchEntityException
*/
*/
public
function
getResizedImagePathByLimit
(
$item
,
$width
)
:
string
public
function
getResizedImagePathByLimit
(
$item
,
$width
)
{
{
return
$this
->
imageHelper
->
resize
(
$item
->
getPath
(),
$width
);
return
$this
->
imageHelper
->
resize
(
$item
->
getPath
(),
$width
);
}
}
}
}
app/code/Joshine/Sales/Plugin/DefaultRendererPlugin.php
View file @
c64862c7
...
@@ -2,6 +2,7 @@
...
@@ -2,6 +2,7 @@
namespace
Joshine\Sales\Plugin
;
namespace
Joshine\Sales\Plugin
;
use
\Magento\Catalog\Helper\Image
as
ImageHelper
;
use
\Magento\Catalog\Helper\Image
as
ImageHelper
;
use
Magento\Sales\Block\Adminhtml\Order\View\Items\Renderer\DefaultRenderer
;
class
DefaultRendererPlugin
{
class
DefaultRendererPlugin
{
...
@@ -40,4 +41,13 @@ class DefaultRendererPlugin {
...
@@ -40,4 +41,13 @@ class DefaultRendererPlugin {
return
$result
;
return
$result
;
}
}
public
function
afterGetColumns
(
DefaultRenderer
$subject
,
$result
)
{
if
(
isset
(
$result
[
'image'
]))
{
unset
(
$result
[
'image'
]);
$result
=
array_merge
([
'image'
=>
'col-image'
],
$result
);
}
return
$result
;
}
}
}
\ No newline at end of file
app/code/Joshine/Sales/Plugin/ItemsSortPlugin.php
0 → 100644
View file @
c64862c7
<?php
namespace
Joshine\Sales\Plugin
;
use
\Magento\Catalog\Helper\Image
as
ImageHelper
;
use
Magento\Sales\Block\Adminhtml\Order\View\Items
;
class
ItemsSortPlugin
{
public
function
afterGetColumns
(
Items
$subject
,
$result
)
{
if
(
isset
(
$result
[
'image'
]))
{
unset
(
$result
[
'image'
]);
$result
=
array_merge
([
'image'
=>
'Product Image'
],
$result
);
}
return
$result
;
}
}
app/code/Joshine/Sales/etc/di.xml
View file @
c64862c7
...
@@ -3,4 +3,7 @@
...
@@ -3,4 +3,7 @@
<type
name=
"Magento\Sales\Block\Adminhtml\Order\View\Items\Renderer\DefaultRenderer"
>
<type
name=
"Magento\Sales\Block\Adminhtml\Order\View\Items\Renderer\DefaultRenderer"
>
<plugin
name=
"order-view-image"
type=
"Joshine\Sales\Plugin\DefaultRendererPlugin"
sortOrder=
"1"
/>
<plugin
name=
"order-view-image"
type=
"Joshine\Sales\Plugin\DefaultRendererPlugin"
sortOrder=
"1"
/>
</type>
</type>
<type
name=
"\Magento\Sales\Block\Adminhtml\Order\View\Items"
>
<plugin
name=
"order-item-sort"
type=
"Joshine\Sales\Plugin\ItemsSortPlugin"
sortOrder=
"1"
/>
</type>
</config>
</config>
\ No newline at end of file
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