Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
S
store
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
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
Jobs
Commits
Open sidebar
Telenkov Ruslan
store
Commits
05f648ec
Commit
05f648ec
authored
Jun 28, 2022
by
Telenkov Ruslan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
promo
parent
e986de77
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
23 additions
and
15 deletions
+23
-15
check.module
app/docroot/modules/custom/check/check.module
+19
-14
commerce_chekout.module
...t/modules/custom/commerce_chekout/commerce_chekout.module
+0
-1
promo.info.yml
app/docroot/modules/custom/promo/promo.info.yml
+4
-0
MyPromo.php
app/docroot/modules/custom/promo/src/Plugin/MyPromo.php
+0
-0
No files found.
app/docroot/modules/custom/check/check.module
View file @
05f648ec
...
...
@@ -9,21 +9,20 @@ function check_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_sta
{
if
(
$form_id
==
'commerce_checkout_flow_multistep_default'
){
//убираю ненужные поля с формы
$form
[
'shipping_information'
][
'shipping_profile'
]
=
null
;
$form
[
'shipping_information'
][
'recalculate_shipping'
]
=
null
;
$form
[
'shipping_information'
][
'shipping_profile'
]
[
'#access'
]
=
false
;
$form
[
'shipping_information'
][
'recalculate_shipping'
]
[
'#access'
]
=
false
;
//if ($form_state->getUserInput()['shipping_information']['shipments'][0]['shipping_method'][0] == '2--default'){
//добавляю поле с адресом и прикручиваю стейты по радиокнопкам (наше в консоли разраба)
$form
[
'shipping_information'
][
'site_address'
]
=
array
(
'#type'
=>
'textfield'
,
'#title'
=>
(
'Site address:'
),
'#states'
=>
array
(
'visible'
=>
array
(
':input[name = "shipping_information[shipments][0][shipping_method][0]"]'
=>
array
(
'value'
=>
'2--default'
,
),
$form
[
"shipping_information"
][
"shipments"
][
0
][
"field_adress"
][
'#states'
]
=
[
'visible'
=>
[
':input[name = "shipping_information[shipments][0][shipping_method][0]"]'
=>
array
(
'value'
=>
'1--default'
,
),
),
);
]
];
// по айди магазина получаю магазин
$formTest
=
$form_state
->
getBuildInfo
()[
'callback_object'
];
$store
=
\Drupal
::
entityTypeManager
()
...
...
@@ -37,11 +36,17 @@ function check_form_alter(&$form, \Drupal\Core\Form\FormStateInterface $form_sta
$stocks
=
$store
[
$formTest
->
getOrder
()
->
get
(
'store_id'
)
->
target_id
]
->
field_stocks
->
referencedEntities
();
// прохожусь по складам
foreach
(
$stocks
as
$stock
){
$concr_stock
[]
=
$stock
->
get
(
'name'
)
->
value
;
}
$form
[
"shipping_information"
][
"shipments"
][
0
][
"field_stocks"
][
"widget"
][
"#options"
]
=
$concr_stock
;
//}
$form
[
"shipping_information"
][
"shipments"
][
0
][
"field_stocks"
][
'#states'
]
=
[
'visible'
=>
[
':input[name = "shipping_information[shipments][0][shipping_method][0]"]'
=>
array
(
'value'
=>
'2--default'
,
),
]
];
}
}
app/docroot/modules/custom/commerce_chekout/commerce_chekout.module
View file @
05f648ec
...
...
@@ -5,5 +5,4 @@ use Drupal\Core\Form\FormStateInterface;
* Implements hook_form_alter().
*/
function
commerce_chekout_form_alter
(
&
$form
,
\Drupal\Core\Form\FormStateInterface
$form_state
,
$form_id
)
{
$a
=
1
;
}
app/docroot/modules/custom/promo/promo.info.yml
0 → 100644
View file @
05f648ec
name
:
Promo
package
:
Custom
type
:
module
core_version_requirement
:
^8.8 || ^9
app/docroot/modules/custom/promo/src/Plugin/MyPromo.php
0 → 100644
View file @
05f648ec
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