Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added a return to the previous step Button inside the seller setup wizard and adjusted RTL layout issue #2309

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 18 additions & 1 deletion assets/css/rtl.css
Original file line number Diff line number Diff line change
Expand Up @@ -251,4 +251,21 @@
text-align: right !important;
}
}

/* Adjusted RTL layout issue on the vendor dashboard withdrawal menu */
.dokan-withdraw-content .dokan-withdraw-area .dokan-panel-body .dokan-panel-inner-container .dokan-w5 {
position: absolute;
right: 80%!important;
top: 50%;
transform: translate(10px, -50%);
width: 20%!important;
float: right!important;
}
.dokan-withdraw-content .dokan-withdraw-area .dokan-panel-body .dokan-panel-inner-container .dokan-w5 a{
float:left!important;
}
#dokan-request-withdraw-button{
float:left!important;
}
.dokan-withdraw-content .dokan-withdraw-area .dokan-panel-body .dokan-panel-inner-container .dokan-w5 button{
float:left!important;
}
3 changes: 3 additions & 0 deletions assets/css/setup.css
Original file line number Diff line number Diff line change
Expand Up @@ -256,6 +256,9 @@
width: 100%;
height: 300px;
}
.dokan-vendor-setup-wizard form .wc-setup-actions .button{
padding: 11px!important;
}
span.required {
color: #e2401c;
}
Expand Down
39 changes: 25 additions & 14 deletions includes/Vendor/SetupWizard.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,21 +9,19 @@
* Seller setup wizard class
*/
class SetupWizard extends DokanSetupWizard {
/** @var string Currenct Step */
/** @var string Current Step */
protected $step = '';

/** @var array Steps for the setup wizard */
protected $steps = [];

/** @var string custom logo url of the theme */
protected $custom_logo = '';
/**
* @var int
*/

/** @var int */
public $store_id;
/**
* @var array
*/

/** @var array */
public $store_info;

/**
Expand All @@ -35,8 +33,8 @@
add_action( 'dokan_setup_wizard_enqueue_scripts', [ $this, 'frontend_enqueue_scripts' ] );
}

// define the woocommerce_registration_redirect callback
// Define the woocommerce_registration_redirect callback
public function filter_woocommerce_registration_redirect( $var ) {

Check warning on line 37 in includes/Vendor/SetupWizard.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

It is recommended not to use reserved keyword "var" as function parameter name. Found: $var
$url = $var;
$user = wp_get_current_user();

Expand Down Expand Up @@ -99,7 +97,7 @@
$this->steps = apply_filters( 'dokan_seller_wizard_steps', $steps );
$this->step = current( array_keys( $this->steps ) );

// get step from url
// Get step from URL
if ( isset( $_GET['_admin_sw_nonce'], $_GET['step'] ) && wp_verify_nonce( sanitize_key( wp_unslash( $_GET['_admin_sw_nonce'] ) ), 'dokan_admin_setup_wizard_nonce' ) ) {
$this->step = sanitize_key( wp_unslash( $_GET['step'] ) );
}
Expand Down Expand Up @@ -179,7 +177,7 @@
*/
public function dokan_setup_introduction() {
$dashboard_url = dokan_get_navigation_url();
$default_message = wp_kses_post( __( '<p>Thank you for choosing The Marketplace to power your online store! This quick setup wizard will help you configure the basic settings. <strong>It’s completely optional and shouldn’t take longer than two minutes.</strong></p>', 'dokan-lite' ) );

Check warning on line 180 in includes/Vendor/SetupWizard.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Translatable string should not be wrapped in HTML. Found: '<p>Thank you for choosing The Marketplace to power your online store! This quick setup wizard will help you configure the basic settings. <strong>It’s completely optional and shouldn’t take longer than two minutes.</strong></p>'
$setup_wizard_message = dokan_get_option( 'setup_wizard_message', 'dokan_general', $default_message );
?>
<h1><?php esc_attr_e( 'Welcome to the Marketplace!', 'dokan-lite' ); ?></h1>
Expand Down Expand Up @@ -230,7 +228,7 @@
<input type="text" id="address[street_1]" name="address[street_1]" value="<?php echo esc_attr( $address_street1 ); ?>"/>
<span class="error-container">
<?php
if ( ! empty( $_POST['error_address[street_1]'] ) ) {

Check failure on line 231 in includes/Vendor/SetupWizard.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Processing form data without nonce verification.
echo '<span class="required">' . __( 'This is required', 'dokan-lite' ) . '</span>';
}
?>
Expand All @@ -247,7 +245,7 @@
<input type="text" id="address[street_2]" name="address[street_2]" value="<?php echo esc_attr( $address_street2 ); ?>"/>
<span class="error-container">
<?php
if ( ! empty( $_POST['error_address[street_2]'] ) ) {

Check failure on line 248 in includes/Vendor/SetupWizard.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Processing form data without nonce verification.
echo '<span class="required">' . __( 'This is required', 'dokan-lite' ) . '</span>';
}
?>
Expand All @@ -265,7 +263,7 @@
<input type="text" id="address[city]" name="address[city]" value="<?php echo esc_attr( $address_city ); ?>"/>
<span class="error-container">
<?php
if ( ! empty( $_POST['error_address[city]'] ) ) {

Check failure on line 266 in includes/Vendor/SetupWizard.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Processing form data without nonce verification.
echo '<span class="required">' . __( 'This is required', 'dokan-lite' ) . '</span>';
}
?>
Expand All @@ -282,7 +280,7 @@
<input type="text" id="address[zip]" name="address[zip]" value="<?php echo esc_attr( $address_zip ); ?>"/>
<span class="error-container">
<?php
if ( ! empty( $_POST['error_address[zip]'] ) ) {

Check failure on line 283 in includes/Vendor/SetupWizard.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Processing form data without nonce verification.
echo '<span class="required">' . __( 'This is required', 'dokan-lite' ) . '</span>';
}
?>
Expand All @@ -301,7 +299,7 @@
</select>
<span class="error-container">
<?php
if ( ! empty( $_POST['error_address[country]'] ) ) {

Check failure on line 302 in includes/Vendor/SetupWizard.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Processing form data without nonce verification.
echo '<span class="required">' . __( 'This is required', 'dokan-lite' ) . '</span>';
}
?>
Expand All @@ -319,7 +317,7 @@
<input type="text" id="calc_shipping_state" name="address[state]" value="<?php echo esc_attr( $address_state ); ?>" / placeholder="<?php esc_attr_e( 'State Name', 'dokan-lite' ); ?>">
<span class="error-container">
<?php
if ( ! empty( $_POST['error_address[state]'] ) ) {

Check failure on line 320 in includes/Vendor/SetupWizard.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Processing form data without nonce verification.
echo '<span class="required">' . __( 'This is required', 'dokan-lite' ) . '</span>';
}
?>
Expand Down Expand Up @@ -365,6 +363,7 @@

</table>
<p class="wc-setup-actions step">
<a href="<?php echo esc_url( $this->get_previous_step_link() ); ?>" class="button button-large button-prev store-step-back-btn dokan-btn-theme"><?php esc_html_e( 'Return to the previous step', 'dokan-lite' ); ?></a>
<input type="button" class="button-primary button button-large button-next store-step-continue dokan-btn-theme" value="<?php esc_attr_e( 'Continue', 'dokan-lite' ); ?>"/>
<input type="submit" id="save_step_submit" style='display: none' value="submit" name="save_step"/>
<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" class="button button-large button-next store-step-skip-btn dokan-btn-theme"><?php esc_html_e( 'Skip this step', 'dokan-lite' ); ?></a>
Expand Down Expand Up @@ -503,7 +502,7 @@
$dokan_settings['find_address'] = isset( $_POST['find_address'] ) ? sanitize_text_field( wp_unslash( $_POST['find_address'] ) ) : '';
$dokan_settings['show_email'] = isset( $_POST['show_email'] ) ? 'yes' : 'no';

// Validating fileds.
// Validating fields.
$is_valid_form = true;
if ( empty( $dokan_settings['address']['street_1'] ) ) {
$is_valid_form = false;
Expand All @@ -520,9 +519,8 @@
if ( empty( $dokan_settings['address']['country'] ) ) {
$is_valid_form = false;
$_POST['error_address[country]'] = 'error';
}
else {
if ( ( isset( $states[ $dokan_settings['address']['country'] ] ) && count( $states[ $dokan_settings['address']['country'] ] ) && empty( $dokan_settings['address']['state'] ) || ( ! isset( $states[ $dokan_settings['address']['country'] ] ) && empty( $dokan_settings['address']['state'] ) ) ) ) {
} else {

Check failure on line 522 in includes/Vendor/SetupWizard.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

If control structure block found as the only statement within an "else" block. Use elseif instead.
if ( ( isset( $states[ $dokan_settings['address']['country'] ] ) && count( $states[ $dokan_settings['address']['country'] ] ) && empty( $dokan_settings['address']['state'] ) ) || ( ! isset( $states[ $dokan_settings['address']['country'] ] ) && empty( $dokan_settings['address']['state'] ) ) ) {
$is_valid_form = false;
$_POST['error_address[state]'] = 'error';
}
Expand Down Expand Up @@ -572,8 +570,8 @@
?>
</table>
<p class="wc-setup-actions step">
<a href="<?php echo esc_url( $this->get_previous_step_link() ); ?>" class="button button-large button-prev payment-step-back-btn dokan-btn-theme"><?php esc_html_e( 'Return to the previous step', 'dokan-lite' ); ?></a>
<input type="submit" class="button-primary button button-large button-next payment-continue-btn dokan-btn-theme" value="<?php esc_attr_e( 'Continue', 'dokan-lite' ); ?>" name="save_step"/>

<a href="<?php echo esc_url( $this->get_next_step_link() ); ?>" class="button button-large button-next payment-step-skip-btn dokan-btn-theme"><?php esc_html_e( 'Skip this step', 'dokan-lite' ); ?></a>
<?php wp_nonce_field( 'dokan-seller-setup' ); ?>
</p>
Expand Down Expand Up @@ -607,7 +605,7 @@
'swift' => $bank['swift'],
];

$user_bank_data = array_filter( $dokan_settings['payment']['bank'], function( $item ) { return ! empty( $item ); } );

Check failure on line 608 in includes/Vendor/SetupWizard.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Expected 1 space after FUNCTION keyword; 0 found

Check failure on line 608 in includes/Vendor/SetupWizard.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Opening brace must be the last content on the line

Check failure on line 608 in includes/Vendor/SetupWizard.php

View workflow job for this annotation

GitHub Actions / Run PHPCS inspection

Each PHP statement must be on a line by itself
$require_fields = array_keys( dokan_bank_payment_required_fields() );

$has_bank_information = true;
Expand Down Expand Up @@ -661,9 +659,22 @@

<div class="dokan-setup-done-content">
<p class="wc-setup-actions step">
<a href="<?php echo esc_url( $this->get_previous_step_link() ); ?>" class="button button-large button-prev dokan-btn-theme"><?php esc_html_e( 'Return to the previous step', 'dokan-lite' ); ?></a>
<a class="button button-primary dokan-btn-theme" href="<?php echo esc_url( $dashboard_url ); ?>"><?php esc_html_e( 'Go to your Store Dashboard!', 'dokan-lite' ); ?></a>
</p>
</div>
<?php
}

/**
* Get the previous step link.
*
* @return string
*/
protected function get_previous_step_link() {
$keys = array_keys( $this->steps );
$current_index = array_search( $this->step, $keys, true );
$prev_step = isset( $keys[ $current_index - 1 ] ) ? $keys[ $current_index - 1 ] : '';
return add_query_arg( 'step', $prev_step, remove_query_arg( 'save_step' ) );
}
}
Loading