PluginProbe
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler / 1.6.5
FluentCart A New Era of eCommerce – Faster, Lighter, and Simpler v1.6.5
1.6.5 1.6.4 1.6.3 1.6.2 1.6.1 1.6.0 1.5.4 1.5.5 1.5.3 1.5.2 1.5.1 1.5.0 1.4.2 1.4.1 1.4.0 1.3.28 1.3.27 1.3.26 1.3.25 1.3.23 1.3.22 1.3.21 1.3.20 1.3.19 trunk All 48 releases
← All changes | app/Services/Renderer/AddressSelectRenderer.php +65 -11 1.3.19 → 1.6.5 View file →
@@ -244,20 +244,10 @@
244 244
245 245
246 246 <?php $this->renderNameFields(); ?>
247 247
248 - <div data-fluent-cart-checkout-page-form-input-wrapper="" class="fct_input_wrapper "
249 - id="<?php echo esc_attr($this->address_type); ?>_name_wrapper">
250 - <label for="<?php echo esc_attr($this->address_type); ?>_company_name" class="sr-only">
251 - <?php echo esc_html__('Company Name', 'fluent-cart'); ?>
252 - </label>
248 + <?php $this->renderBusinessDetailsFields(); ?>
253 249
254 - <input type="text" name="<?php echo esc_attr($this->address_type); ?>_company_name"
255 - autocomplete="name" placeholder="<?php echo esc_attr__('Company Name', 'fluent-cart'); ?>"
256 - data-required="no" data-type="input"
257 - id="<?php echo esc_attr($this->address_type); ?>_company_name">
258 - </div>
259 -
260 250 <?php if (!empty(Arr::get($this->requirements_fields, 'phone'))): ?>
261 251 <div data-fluent-cart-checkout-page-form-input-wrapper="" class="fct_input_wrapper "
262 252 id="<?php echo esc_attr($this->address_type); ?>_phone_wrapper">
263 253 <label for="<?php echo esc_attr($this->address_type); ?>_phone" class="sr-only">
@@ -461,6 +451,70 @@
461 451 </div>
462 452 <?php endif; ?>
463 453
464 454 <?php endif;
455 + }
456 +
457 + public function renderBusinessDetailsFields()
458 + {
459 + if ($this->address_type !== 'billing') {
460 + return;
461 + }
462 +
463 + $fields = [
464 + 'company_name' => __('Company Name', 'fluent-cart'),
465 + 'vat_number' => __('VAT/GST/Tax Number', 'fluent-cart'),
466 + 'legal_registration_id' => __('Legal Registration ID', 'fluent-cart'),
467 + ];
468 +
469 + $visibleFields = [];
470 + foreach ($fields as $fieldKey => $label) {
471 + $requirement = Arr::get($this->requirements_fields, $fieldKey);
472 +
473 + if (empty($requirement)) {
474 + continue;
475 + }
476 +
477 + $visibleFields[$fieldKey] = $label;
478 + }
479 +
480 + if (empty($visibleFields)) {
481 + return;
482 + }
483 +
484 + ?>
485 + <div id="<?php echo esc_attr($this->address_type); ?>_business_details_section"
486 + data-fluent-cart-checkout-page-form-section=""
487 + class="fct_checkout_form_section additional-address-field">
488 + <div class="fct_form_section_header">
489 + <h4 class="fct_form_section_header_label"><?php echo esc_html__('Business Details', 'fluent-cart'); ?></h4>
490 + </div>
491 +
492 + <div class="fct_form_section_body">
493 + <div class="fct_checkout_input_group">
494 + <?php
495 + foreach ($visibleFields as $fieldKey => $label) {
496 + $requirement = Arr::get($this->requirements_fields, $fieldKey);
497 + $fieldId = $this->address_type . '_' . $fieldKey;
498 + $isRequired = $requirement === 'required';
499 + $placeholder = $label . ($isRequired ? ' *' : '');
500 + ?>
501 + <div data-fluent-cart-checkout-page-form-input-wrapper="" class="fct_input_wrapper "
502 + id="<?php echo esc_attr($fieldId); ?>_wrapper">
503 + <label for="<?php echo esc_attr($fieldId); ?>" class="sr-only">
504 + <?php echo esc_html($label); ?>
505 + </label>
506 +
507 + <input type="text" name="<?php echo esc_attr($fieldId); ?>"
508 + autocomplete="off" placeholder="<?php echo esc_attr($placeholder); ?>"
509 + data-required="<?php echo $isRequired ? 'yes' : 'no'; ?>" data-type="input"
510 + id="<?php echo esc_attr($fieldId); ?>">
511 + </div>
512 + <?php
513 + }
514 + ?>
515 + </div>
516 + </div>
517 + </div>
518 + <?php
465 519 }
466 520 }