Skip to content

Commit

Permalink
holamugar#13 Document option were added to system 2
Browse files Browse the repository at this point in the history
  • Loading branch information
Oliverio committed Mar 11, 2020
1 parent f2e9622 commit f621a2e
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
19 changes: 11 additions & 8 deletions Plugin/CidConfiguration.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,6 @@ public function afterProcess(
LayoutProcessor $processor,
array $jsLayout
) {
$writer = new \Zend\Log\Writer\Stream(BP . '/var/log/oliverio.log');
$logger = new \Zend\Log\Logger();
$logger->addWriter($writer);

if (!$this->helper->isShippingEnabled()) {
$jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
Expand All @@ -51,20 +48,26 @@ public function afterProcess(
['payment']['children']['cid-billing-form']['config']['componentDisabled'] = true;
}

$currentOptions = $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
$currentShippingOptions = $jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
['shippingAddress']['children']['cid-shipping-form']['children']['cid-shipping-form-container']['children']['cid-shipping-form-fieldset']['children']['shipping_cid_type']['options'];

foreach ($this->helper->getShippingDocumentTypes() as $k => $v) {
$currentOptions[] = ['value' => $k, 'label' => $v];
$currentShippingOptions[] = ['value' => $k, 'label' => $v];
}

$jsLayout['components']['checkout']['children']['steps']['children']['shipping-step']['children']
['shippingAddress']['children']['cid-shipping-form']['children']['cid-shipping-form-container']['children']['cid-shipping-form-fieldset']['children']['shipping_cid_type']['options'] = $currentOptions;
['shippingAddress']['children']['cid-shipping-form']['children']['cid-shipping-form-container']['children']['cid-shipping-form-fieldset']['children']['shipping_cid_type']['options'] = $currentShippingOptions;

$currentBillingOptions = $jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children']
['payment']['children']['cid-billing-form']['children']['cid-billing-form-container']['children']['cid-billing-form-fieldset']['children']['billing_cid_type']['options'];

foreach ($this->helper->getBillingDocumentTypes() as $k => $v) {
$currentBillingOptions[] = ['value' => $k, 'label' => $v];
}

$jsLayout['components']['checkout']['children']['steps']['children']['billing-step']['children']
['payment']['children']['cid-billing-form']['children']['cid-billing-form-container']['children']['cid-billing-form-fieldset']['children']['billing_cid_type']['options'] = $currentOptions;
['payment']['children']['cid-billing-form']['children']['cid-billing-form-container']['children']['cid-billing-form-fieldset']['children']['billing_cid_type']['options'] = $currentBillingOptions;

$logger->info(print_r($currentOptions, true));
return $jsLayout;
}
}
2 changes: 2 additions & 0 deletions view/frontend/layout/checkout_index_index.xml
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
<item name="label" xsi:type="string">Please select value</item>
<item name="value" xsi:type="string"></item>
</item>
<!--
<item name="1" xsi:type="array">
<item name="label" xsi:type="string">DNI</item>
<item name="value" xsi:type="string">DNI</item>
Expand All @@ -150,6 +151,7 @@
<item name="label" xsi:type="string">Passport</item>
<item name="value" xsi:type="string">Passport</item>
</item>
-->
</item>
<item name="provider" xsi:type="string">checkoutProvider</item>
<item name="dataScope" xsi:type="string">cidBillingForm.billing_cid_type</item>
Expand Down

0 comments on commit f621a2e

Please sign in to comment.