|
Apache/2.4.41 (Ubuntu) Linux vmi616275.contaboserver.net 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) server ip : 62.171.164.128 | your ip : 127.0.0.1 safemode OFF > / home / dev2.destoffenstraat.com / app / code / Amasty / Checkout / Model / |
Filename | /home/dev2.destoffenstraat.com/app/code/Amasty/Checkout/Model/BillingAddress.php |
Size | 1.74 kb |
Permission | rwxrwxrwx |
Owner | root : root |
Create time | 17-Aug-2025 10:26 |
Last modified | 23-Nov-2022 12:33 |
Last accessed | 22-Aug-2025 22:34 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
<?php
declare(strict_types=1);
/**
* @author Amasty Team
* @copyright Copyright (c) 2022 Amasty (https://www.amasty.com)
* @package One Step Checkout for Magento 2
*/
namespace Amasty\Checkout\Model;
use Amasty\CheckoutCore\Block\Onepage\LayoutWalker;
use Amasty\CheckoutStyleSwitcher\Model\ConfigProvider as StyleSwitcherConfig;
class BillingAddress
{
/**
* @var StyleSwitcherConfig
*/
private $styleSwitcherConfig;
public function __construct(
StyleSwitcherConfig $styleSwitcherConfig
) {
$this->styleSwitcherConfig = $styleSwitcherConfig;
}
public function getBillingPath(LayoutWalker $walker): array
{
$billingAddressPath = [];
$billingAddressDisplayOn = $this->styleSwitcherConfig->getBillingAddressDisplayOn();
switch ($billingAddressDisplayOn) {
case StyleSwitcherConfig::BILLING_ADDRESS_ON_PAYMENT_METHOD:
$billingRoot = $walker->getValue('{PAYMENT}.>>.payments-list.>>');
foreach ($billingRoot as $key => $item) {
if (isset($item['children']['form-fields'])) {
$billingAddressPath[] = '{PAYMENT}.>>.payments-list.>>.' . $key . '.>>.form-fields.>>';
}
}
break;
case StyleSwitcherConfig::BILLING_ADDRESS_ON_PAYMENT_PAGE:
$billingAddressPath[] = '{PAYMENT}.>>.afterMethods.>>.billing-address-form.>>.form-fields.>>';
break;
case StyleSwitcherConfig::BILLING_ADDRESS_BELOW_SHIPPING_ADDRESS:
$billingAddressPath[] = '{SHIPPING_ADDRESS}.>>.billing-address-form.>>.form-fields.>>';
break;
}
return $billingAddressPath;
}
}
declare(strict_types=1);
/**
* @author Amasty Team
* @copyright Copyright (c) 2022 Amasty (https://www.amasty.com)
* @package One Step Checkout for Magento 2
*/
namespace Amasty\Checkout\Model;
use Amasty\CheckoutCore\Block\Onepage\LayoutWalker;
use Amasty\CheckoutStyleSwitcher\Model\ConfigProvider as StyleSwitcherConfig;
class BillingAddress
{
/**
* @var StyleSwitcherConfig
*/
private $styleSwitcherConfig;
public function __construct(
StyleSwitcherConfig $styleSwitcherConfig
) {
$this->styleSwitcherConfig = $styleSwitcherConfig;
}
public function getBillingPath(LayoutWalker $walker): array
{
$billingAddressPath = [];
$billingAddressDisplayOn = $this->styleSwitcherConfig->getBillingAddressDisplayOn();
switch ($billingAddressDisplayOn) {
case StyleSwitcherConfig::BILLING_ADDRESS_ON_PAYMENT_METHOD:
$billingRoot = $walker->getValue('{PAYMENT}.>>.payments-list.>>');
foreach ($billingRoot as $key => $item) {
if (isset($item['children']['form-fields'])) {
$billingAddressPath[] = '{PAYMENT}.>>.payments-list.>>.' . $key . '.>>.form-fields.>>';
}
}
break;
case StyleSwitcherConfig::BILLING_ADDRESS_ON_PAYMENT_PAGE:
$billingAddressPath[] = '{PAYMENT}.>>.afterMethods.>>.billing-address-form.>>.form-fields.>>';
break;
case StyleSwitcherConfig::BILLING_ADDRESS_BELOW_SHIPPING_ADDRESS:
$billingAddressPath[] = '{SHIPPING_ADDRESS}.>>.billing-address-form.>>.form-fields.>>';
break;
}
return $billingAddressPath;
}
}