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
fc452160
Commit
fc452160
authored
Mar 28, 2023
by
wd
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修改站点名称来源为site 修改书
parent
b7612df5
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
6 deletions
+16
-6
app/code/Joshine/GoogleFeed/Console/Command/GoogleFeed.php
+16
-6
No files found.
app/code/Joshine/GoogleFeed/Console/Command/GoogleFeed.php
View file @
fc452160
...
...
@@ -19,6 +19,7 @@ use Magento\Store\Model\StoreManagerInterface;
use
Magento\Catalog\Model\CategoryList
;
use
Magento\Framework\App\Config\ScopeConfigInterface
;
use
Magento\Eav\Api\AttributeRepositoryInterface
;
use
Magento\Store\Model\Website
;
/**
* Class SomeCommand
*/
...
...
@@ -46,7 +47,8 @@ class GoogleFeed extends Command
private
$scopeConfigInterface
;
/* @var AttributeRepositoryInterface */
private
$attributeRepositoryInterface
;
/* @var Website */
private
$webSite
;
/*table title*/
private
$columns
=
array
(
'id'
,
...
...
@@ -143,7 +145,8 @@ class GoogleFeed extends Command
StoreManagerInterface
$storeManager
,
CategoryList
$categoryList
,
ScopeConfigInterface
$scopeConfigInterface
,
AttributeRepositoryInterface
$attributeRepositoryInterface
AttributeRepositoryInterface
$attributeRepositoryInterface
,
Website
$webSite
)
{
$this
->
state
=
$state
;
...
...
@@ -158,6 +161,7 @@ class GoogleFeed extends Command
$this
->
categoryList
=
$categoryList
;
$this
->
scopeConfigInterface
=
$scopeConfigInterface
;
$this
->
attributeRepositoryInterface
=
$attributeRepositoryInterface
;
$this
->
webSite
=
$webSite
;
parent
::
__construct
();
}
...
...
@@ -289,7 +293,7 @@ class GoogleFeed extends Command
$data
[
'price'
]
=
number_format
(
$finalPriceAmt
,
2
)
.
' USD'
;
$data
[
'brand'
]
=
$this
->
getStoreName
();
$mpu
=
explode
(
'-
'
,
$product
->
getSku
())[
0
];
$mpu
=
stripos
(
$product
->
getSku
(),
'-'
)
?
explode
(
'-'
,
$product
->
getSku
())[
0
]
:
explode
(
'_
'
,
$product
->
getSku
())[
0
];
$data
[
'mpn'
]
=
$mpu
;
$data
[
'gender'
]
=
'Female'
;
$data
[
'age group'
]
=
'Adult'
;
...
...
@@ -298,7 +302,7 @@ class GoogleFeed extends Command
$optionText
=
$attribute
->
getSource
()
->
getOptionText
(
$product
->
getColor
());
if
(
in_array
(
$optionText
,
$this
->
pattern
)){
$colorShort
=
$this
->
explode
(
'-
'
,
$product
->
getSku
())[
1
];
$colorShort
=
stripos
(
$product
->
getSku
(),
'-'
)
?
explode
(
'-'
,
$product
->
getSku
())[
1
]
:
explode
(
'_
'
,
$product
->
getSku
())[
1
];
$data
[
'color'
]
=
$this
->
color
[
$colorShort
];
}
else
{
$data
[
'color'
]
=
$optionText
;
...
...
@@ -306,7 +310,11 @@ class GoogleFeed extends Command
$data
[
'size system'
]
=
''
;
$attribute
=
$this
->
attributeRepositoryInterface
->
get
(
'4'
,
'size'
);
$sizeText
=
$attribute
->
getSource
()
->
getOptionText
(
$product
->
getSize
());
$sizeText
=
$attribute
->
getSource
()
->
getOptionText
(
$attribute
->
getSize
());
$skuSize
=
stripos
(
$product
->
getSku
(),
'-'
)
?
explode
(
'-'
,
$product
->
getSku
())
:
explode
(
'_'
,
$product
->
getSku
());
if
(
isset
(
$skuSize
[
2
])){
$sizeText
=
$skuSize
[
2
];
}
$data
[
'size'
]
=
$sizeText
;
$data
[
'item group id'
]
=
$mpu
;
$data
[
'material'
]
=
''
;
...
...
@@ -328,7 +336,9 @@ class GoogleFeed extends Command
*/
public
function
getStoreName
()
{
return
$this
->
storeManager
->
getStore
()
->
getName
();
$webSiteId
=
$this
->
storeManager
->
getStore
()
->
getWebsiteId
();
$collection
=
$this
->
webSite
->
load
(
$webSiteId
,
'website_id'
);
return
$collection
->
getName
();
}
public
function
getPrdouctType
(
$category
,
&
$name
){
...
...
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