Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
webkul-magento-connector
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
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Akeneo bundles
webkul-magento-connector
Commits
81809b6b
Commit
81809b6b
authored
Aug 26, 2020
by
Bartosz Kubicki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Updating module with async features
parent
e6151136
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
35 additions
and
5 deletions
+35
-5
.gitignore
.gitignore
+2
-0
BaseWriter.php
Connector/Writer/BaseWriter.php
+3
-0
ProductQueueWriter.php
Connector/Writer/ProductQueueWriter.php
+11
-1
ProductWriter.php
Connector/Writer/ProductWriter.php
+2
-1
CredentialController.php
Controller/Rest/CredentialController.php
+7
-0
Magento2Extension.php
DependencyInjection/Magento2Extension.php
+2
-0
rabbitmq.yml
Resources/config/rabbitmq.yml
+4
-2
jsmessages.en.yml
Resources/translations/jsmessages.en.yml
+3
-0
ApiEndPointsTrait.php
Traits/ApiEndPointsTrait.php
+1
-1
No files found.
.gitignore
0 → 100644
View file @
81809b6b
.idea
\ No newline at end of file
Connector/Writer/BaseWriter.php
View file @
81809b6b
...
...
@@ -8,6 +8,8 @@ use Webkul\Magento2Bundle\Traits\StepExecutionTrait;
use
Webkul\Magento2Bundle\Services\Magento2Connector
;
use
Webkul\Magento2Bundle\Traits\ApiEndPointsTrait
;
$obj
=
new
\Webkul\Magento2Bundle\EventListener\AkeneoVersionsCompatibility
;
$obj
->
checkVersionAndCreateClassAliases
();
/**
* Add products to magento2 Api
*
...
...
@@ -15,6 +17,7 @@ use Webkul\Magento2Bundle\Traits\ApiEndPointsTrait;
* @copyright 2010-2017 Webkul pvt. ltd.
* @license https://store.webkul.com/license.html
*/
abstract
class
BaseWriter
implements
\StepExecutionAwareInterface
{
use
StepExecutionTrait
;
...
...
Connector/Writer/ProductQueueWriter.php
View file @
81809b6b
...
...
@@ -43,6 +43,7 @@ class ProductQueueWriter extends ProductWriter
}
$parameters
=
$this
->
getParameters
();
$this
->
initialise
();
$storeMappings
=
$this
->
getStoreMapping
();
$storeSettings
=
$this
->
connectorService
->
getOtherSettings
();
$this
->
channel
=
$this
->
getChannelScope
(
$this
->
stepExecution
);
...
...
@@ -67,6 +68,7 @@ class ProductQueueWriter extends ProductWriter
switch
(
$item
[
PropertiesNormalizer
::
FIELD_MAGENTO_PRODUCT_TYPE
])
{
case
'simple'
:
$product
=
[
self
::
AKENEO_ENTITY_NAME
=>
$item
];
$this
->
addProduct
(
$product
);
$this
->
stepExecution
->
incrementSummaryInfo
(
'added_to_queue'
);
break
;
...
...
@@ -106,15 +108,23 @@ class ProductQueueWriter extends ProductWriter
protected
function
addProduct
(
$productData
)
{
if
(
!
empty
(
$productData
))
{
unset
(
$productData
[
'product'
][
'main_image_data'
]);
/* similar data in all store view */
if
(
$this
->
storeViewCode
===
$this
->
defaultStoreViewCode
)
{
$baseData
=
$this
->
checkProductAndModifyData
(
$productData
,
'all'
);
if
(
!
empty
(
$baseData
))
{
$productAddUrl
=
$this
->
oauthClient
->
getApiUrlByEndpoint
(
'addProductQueue'
,
'all'
);
try
{
$this
->
oauthClient
->
fetch
(
$productAddUrl
,
is_array
(
$baseData
)
?
json_encode
(
$baseData
)
:
$baseData
,
'POST'
,
$this
->
jsonHeaders
);
$this
->
oauthClient
->
fetch
(
$productAddUrl
,
is_array
(
$baseData
)
?
json_encode
(
$baseData
)
:
$baseData
,
'POST'
,
$this
->
jsonHeaders
);
}
catch
(
\Exception
$e
)
{
$info
=
$this
->
oauthClient
->
getLastResponseInfo
();
if
(
isset
(
$info
[
'http_code'
])
&&
$info
[
'http_code'
]
==
404
)
{
throw
new
\Exception
(
'RabbitMQ Module not found on magento2 server.'
);
}
...
...
Connector/Writer/ProductWriter.php
View file @
81809b6b
...
...
@@ -381,6 +381,7 @@ class ProductWriter extends BaseWriter implements \ItemWriterInterface
}
if
(
!
empty
(
$formatted
[
'custom_attributes'
]))
{
$attributeMappings
=
!
empty
(
$attributeMappings
)
?
$attributeMappings
:
[];
$formatted
[
'custom_attributes'
]
=
$this
->
modifyOptionValues
(
$formatted
[
'custom_attributes'
],
$attributeMappings
);
foreach
(
$formatted
[
'custom_attributes'
]
as
$index
=>
$value
)
{
...
...
@@ -519,7 +520,7 @@ class ProductWriter extends BaseWriter implements \ItemWriterInterface
foreach
(
$attr
[
'value'
]
as
$singleValue
)
{
$attributeOption
=
$this
->
getMappingByCode
(
$singleValue
.
'('
.
$attribute
->
getCode
()
.
')'
,
'option'
);
if
(
$attributeOption
)
{
if
(
$this
->
magentoVersion
<
"2.3"
)
{
if
(
version_compare
(
$this
->
magentoVersion
,
"2.3"
,
"<"
)
)
{
$attributeOptionValue
[]
=
$attributeOption
->
getExternalId
();
}
else
{
$attributeOptionValue
.=
','
.
$attributeOption
->
getExternalId
();
...
...
Controller/Rest/CredentialController.php
View file @
81809b6b
...
...
@@ -33,7 +33,14 @@ class CredentialController extends Controller
}
else
{
$credential
=
new
CredentialConfig
();
}
$data
=
json_decode
(
$request
->
getContent
(),
true
);
if
(
isset
(
$data
[
'hostName'
]))
{
$credentialCheck
=
$em
->
getRepository
(
CredentialConfig
::
class
)
->
findOneByHostName
(
$data
[
'hostName'
]);
if
(
!
empty
(
$credentialCheck
))
{
return
new
JsonResponse
([
'hostName'
=>
'Host Name already used Please try another !.'
],
Response
::
HTTP_BAD_REQUEST
);
}
}
$em
=
$this
->
getDoctrine
()
->
getManager
();
$connectorService
=
$this
->
get
(
'magento2.connector.service'
);
...
...
DependencyInjection/Magento2Extension.php
View file @
81809b6b
...
...
@@ -51,6 +51,8 @@ class Magento2Extension extends Extension
$loader
->
load
(
'data_sources.yml'
);
$loader
->
load
(
'cli_commands.yml'
);
$loader
->
load
(
'rabbitmq.yml'
);
$loader
->
load
(
'jobs.yml'
);
$loader
->
load
(
'steps.yml'
);
$loader
->
load
(
'readers.yml'
);
...
...
Resources/config/rabbitmq.yml
View file @
81809b6b
...
...
@@ -47,7 +47,8 @@ services:
-
'
@pim_catalog.repository.channel'
-
'
@pim_catalog.repository.attribute'
-
'
@pim_connector.processor.bulk_media_fetcher'
-
'
@?pim_catalog.values_filler.product'
# - '@?pim_catalog.values_filler.product'
-
'
@pim_catalog.product_model.fill_missing_values'
-
'
@pim_connector.doctrine.cache_clearer'
webkul_magento2.processor.rabbitmq.magento_normalization.product
:
...
...
@@ -58,7 +59,8 @@ services:
-
'
@pim_catalog.repository.attribute'
-
'
@akeneo_storage_utils.doctrine.object_detacher'
-
'
@pim_connector.processor.bulk_media_fetcher'
-
'
@?pim_catalog.values_filler.product'
# - '@?pim_catalog.values_filler.product'
-
'
@pim_catalog.product_model.fill_missing_values'
-
'
@router'
-
'
@magento2.connector.service'
...
...
Resources/translations/jsmessages.en.yml
View file @
81809b6b
...
...
@@ -288,3 +288,5 @@ magento2.duplicateCategory.name.title: Are Duplicate Category Name Available in
magento2.duplicateCategory.name.tooltip
:
Matched Category named will be update.
configurable_product_status
:
Configurable Product Status
pim_enrich.entity.attribute.property.visual_swatch
:
Export attribute as Visual Swatch
batch_jobs.default_steps.rabbitmq_product_export
:
Product Export(RabbitMQ)
batch_jobs.default_steps.rabbimq_product_model_export
:
Product Model Export(RabbitMQ)
\ No newline at end of file
Traits/ApiEndPointsTrait.php
View file @
81809b6b
...
...
@@ -11,7 +11,7 @@ trait ApiEndPointsTrait
'storeViews'
=>
'/rest/V1/store/storeViews'
,
'storeConfigs'
=>
'/rest/V1/store/storeConfigs'
,
'product'
=>
'/rest/{_store}/V1/products/{sku}?searchCriteria='
,
'addProductQueue'
=>
'/rest/{_store}/async/V1/
add-
products'
,
'addProductQueue'
=>
'/rest/{_store}/async/V1/products'
,
'currency'
=>
'/rest/{_store}/V1/directory/currency'
,
'getAttributeSets'
=>
'/rest/{_store}/V1/products/attribute-sets/sets/list?searchCriteria[pageSize]=50'
,
'addAttributeSet'
=>
'/rest/{_store}/V1/products/attribute-sets'
,
...
...
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