Esempio n. 1
0
 public static function get_instance()
 {
     if (empty(self::$instance)) {
         self::$instance = new WPSC_Checkout_Wizard();
     }
     return self::$instance;
 }
 private function init_checkout_wizard()
 {
     $this->wizard = WPSC_Checkout_Wizard::get_instance();
     $this->wizard->steps = array('shipping-and-billing' => __('Details', 'wp-e-commerce'), 'shipping-method' => __('Delivery', 'wp-e-commerce'), 'payment' => __('Place Order', 'wp-e-commerce'), 'results' => __('Complete', 'wp-e-commerce'));
     if (!wpsc_uses_shipping()) {
         unset($this->wizard->steps['shipping-method']);
     }
     if (is_user_logged_in() && (!array_key_exists($this->wizard->active_step, $this->wizard->steps) || in_array($this->wizard->active_step, $this->wizard->disabled))) {
         wp_redirect(wpsc_get_checkout_url($this->wizard->pending_step));
         exit;
     }
 }
Esempio n. 3
0
function wpsc_get_checkout_steps()
{
    if (_wpsc_get_current_controller_name() != 'checkout') {
        return '';
    }
    $wizard = WPSC_Checkout_Wizard::get_instance();
    $steps = $wizard->steps;
    $output = '<ul class="wpsc-wizard">';
    $step_count = 1;
    foreach ($steps as $step => $title) {
        $classes = array('wpsc-wizard-step wpsc-wizard-step-' . $step);
        if ($wizard->is_active($step)) {
            $classes[] = 'active';
        }
        if ($wizard->is_disabled($step)) {
            $classes[] = 'disabled';
        } elseif ($wizard->is_completed($step)) {
            $classes[] = 'completed';
        } else {
            $classes[] = 'pending';
        }
        $classes[] = 'split-' . count($steps);
        $output .= '<li class="' . implode(' ', $classes) . '">';
        if (!$wizard->is_completed($step)) {
            $output .= '<span>';
        } else {
            $output .= '<a href="' . wpsc_get_checkout_url($step) . '">';
        }
        $output .= '<span class="step">' . $step_count . '.</span> ' . $title;
        if (!$wizard->is_completed($step)) {
            $output .= '</span>';
        } else {
            $output .= '</a>';
        }
        $output .= '</li>';
        $step_count++;
    }
    $output .= '</ul>';
    return $output;
}