Jump to content

Only one page checkout only by guests, show payment methods without selecting guest checkout


rreimche

Recommended Posts

I don't want clients to register and I want them to be able to buy in one single step, which is out-of-the-box in Prestashop 1.6.

 

I have enabled one step and guest checkout and I have also removed the choice "guest/register" from the checkout page theme template.

 

However, seems Prestashop is so built that in order to see payment methods guest MUST click the corresponding something to show that he wants guest checkout (I've read this in a thread relatived to Prestashop 1.4).

 

Now when I get to the checkout page I see the order summary, the choice for a delivery method, the textarea for a message and in the payment methods area I see "Please sign in to see payment methods." instead of payment methods. (again, I have removed the guest/register(ed) choice from this page).

 

How can I make payment methods available in this case?

 

(I'm OK with coding and I know how overrides are done and I can manage creating plugins, I think)

Link to comment
Share on other sites

You can make a modifications to displaying the available payment methods to visitor, but this payment method should be "disabled/inactivated" until your visitor became a guest or registered on the system.

The default Prestashop system, doing this by displaying a text :
"Please sign in to see payment methods."

Became a guest or registered on the system mean, visitor should input the required data for the next process (email, firstname, lastname, address, etc)
Therefore you should modify each payment modules that you used, so it will displaying the payment method even though visitor yet registered, but this should only displaying payment method in inactivated mode.

Payment method in inactivated mode mean if your visitor click on it, then it won't go to the next process (Payment execution).
It should only show the payment logo and text to describe about the payment method it self.

It's up to you how you will handle this, a window alert on click, a warning message etc.

It should be activated after visitor registered, became a guest or customer (the required data was validated and saved on the system)

 

Modify each payment method to add custom method to display "inactivated mode" of payment method

for example :

public function showInactivatedMode()
{
	$this->smarty->assign(array(
            // Your Smarty Vars goes here
	));
   
        // payment_inactivated_mode.tpl file should be placed on 
        // directory : ..\views\templates\front\payment_inactivated_mode.tpl
	return $this->display(__FILE__, 'payment_inactivated_mode.tpl');
}

And modify (override) controller file : ..\controllers\front\OrderOpcController.php within protected function _getPaymentMethods()

to return output from the showInactivatedMode() of each payment method

instead displaying warning message "Please sign in to see payment methods"

protected function _getPaymentMethods()
{
	if (!$this->isLogged) {
		$installedPaymentModule = PaymentModule::getInstalledPaymentModules();
		$output = '';
		foreach ($installedPaymentModule as $payment_module) {
			$payment_modules = Module::getInstanceByName($payment_module['name']);
			if ($payment_modules->active)
				$output .= $payment_modules->showInactivatedMode();
		}
		return $output;

		// disabling default Prestashop warning message
		// return '<p class="warning">'.Tools::displayError('Please sign in to see payment methods.').'</p>';
	}
 
    return parent::_getPaymentMethods();
}
  • Like 1
Link to comment
Share on other sites

Thank you... I don't yet understand everything you wrote, but I think I'll handle it.

 

There one more thing to make it all more precise: I don't want customers to register... actually, I don't want to have registered customers at all.

 

That means, all customers are guests. 

 

As far as I understand, that means I should:

- remove the choice "registered/guest", clicking which makes payment methods availvable

- make the form for entering customer data like email, phone, address, etc available by default

 

I've done the first part by commenting this choice in the theme template. Now, should I look into the theme template again and find out how to make the "customer data form" visible by default or should I restore what I've done to the starting state and do something quietly different?

Link to comment
Share on other sites

Well it's up to you if you don't wanna have a registered customers at all.
But i hope you are understand about the choices you've made, and your customer are comfortable with that.

To displaying opc guest account form by default, you need to modify this files :

order-opc-new-account.tpl to remove login_form and opc_account_choice

and

order-opc.js to show opc_account_form by default

 

I guess you've already know how to modify order-opc-new-account.tpl file to remove login_form and opc_account_choice from.

But still find out how to enable/show opc_account_form by default

Open order-opc.js file and simply change the jquery event from hide() to show()

// default prestashop
// $('#opc_account_form, #opc_invoice_address').hide();

// modified
$('#opc_account_form, #opc_invoice_address').show();
Edited by gonebdg - webindoshop.com (see edit history)
Link to comment
Share on other sites

 

 

Modify each payment method to add custom method to display "inactivated mode" of payment method

for example :

public function showInactivatedMode()
{
	$this->smarty->assign(array(
            // Your Smarty Vars goes here
	));
   
        // payment_inactivated_mode.tpl file should be placed on 
        // directory : ..\views\templates\front\payment_inactivated_mode.tpl
	return $this->display(__FILE__, 'payment_inactivated_mode.tpl');
}

And modify (override) controller file : ..\controllers\front\OrderOpcController.php within protected function _getPaymentMethods()

to return output from the showInactivatedMode() of each payment method

instead displaying warning message "Please sign in to see payment methods"

protected function _getPaymentMethods()
{
	if (!$this->isLogged) {
		$installedPaymentModule = PaymentModule::getInstalledPaymentModules();
		$output = '';
		foreach ($installedPaymentModule as $payment_module) {
			$payment_modules = Module::getInstanceByName($payment_module['name']);
			if ($payment_modules->active)
				$output .= $payment_modules->showInactivatedMode();
		}
		return $output;

		// disabling default Prestashop warning message
		// return '<p class="warning">'.Tools::displayError('Please sign in to see payment methods.').'</p>';
	}
 
    return parent::_getPaymentMethods();
}

 

Why is it better than just showing the alarm on !$this->isLogged as one person has done here?

Edited by rreimche (see edit history)
Link to comment
Share on other sites

Please read my previous post #2

With  "inactivated mode" modification, each payment module may customized to have different output and actions.

 

In Prestashop and common e-commerce software, a payment can only be executed after user data especially billing address was recorded on the system (saved on database).
It doesn't matter if your customer is a guest or registered user, they became eligible customer once their data was recorded on the system.

Why ?

Well ... i have to ask you following questions :

  1. In your point of view, what's the difference between "Guest Customer" and "Registered Customer" ?
  2. Do you want to process their order without having their data at all ?
  3. How you will process their order without shipping/billing address ?
  4. How your online shop system can calculate shipping cost without shipping address ?
  5. Do you want your customer able to pay for their order without having their billing address on your system ?

I guess you should take a look the default five step checkout to find out step by step checkout procedure.

  • Like 1
Link to comment
Share on other sites

One more question. It seems, it's impossible to override a modules php file. Then, after every module update I have to repeat the changes that you' described. It's not a lot of work, but I don't want to bother with that. 

 

At this point I'm starting to think of this solution:

 

1. Provide payment methods instead of the fact that no customer data was yet input. But provide it hidden with the same label ("Please fill in customer data to see payment methods" or something like that).

2. When customer enters the data and clicks "save", show payment methods. Sure, it would be appropriate to show payment methods not when "save" is clicked, but when the operation "save" is finished. This raises a question: how is it done? Is customer data just stored as a cookie or is it saved into database with AJAX?

 

How do you think, how good would be this way?

Link to comment
Share on other sites

Just use default Prestashop flow, it will be hidden until visitor become eligible customer (guest or registered).

Guest customer data are saved on the database, for order processing and for your future references (after sales service, complaint, and other business matters).

i'm curious ... what would you sell on your online shop ?

Link to comment
Share on other sites

  • 3 months later...

 

You can make a modifications to displaying the available payment methods to visitor, but this payment method should be "disabled/inactivated" until your visitor became a guest or registered on the system.

 

The default Prestashop system, doing this by displaying a text :

"Please sign in to see payment methods."

 

Became a guest or registered on the system mean, visitor should input the required data for the next process (email, firstname, lastname, address, etc)

Therefore you should modify each payment modules that you used, so it will displaying the payment method even though visitor yet registered, but this should only displaying payment method in inactivated mode.

 

Payment method in inactivated mode mean if your visitor click on it, then it won't go to the next process (Payment execution).

It should only show the payment logo and text to describe about the payment method it self.

It's up to you how you will handle this, a window alert on click, a warning message etc.

 

It should be activated after visitor registered, became a guest or customer (the required data was validated and saved on the system)

 

Modify each payment method to add custom method to display "inactivated mode" of payment method

for example :

public function showInactivatedMode()
{
	$this->smarty->assign(array(
            // Your Smarty Vars goes here
	));
   
        // payment_inactivated_mode.tpl file should be placed on 
        // directory : ..\views\templates\front\payment_inactivated_mode.tpl
	return $this->display(__FILE__, 'payment_inactivated_mode.tpl');
}

And modify (override) controller file : ..\controllers\front\OrderOpcController.php within protected function _getPaymentMethods()

to return output from the showInactivatedMode() of each payment method

instead displaying warning message "Please sign in to see payment methods"

protected function _getPaymentMethods()
{
	if (!$this->isLogged) {
		$installedPaymentModule = PaymentModule::getInstalledPaymentModules();
		$output = '';
		foreach ($installedPaymentModule as $payment_module) {
			$payment_modules = Module::getInstanceByName($payment_module['name']);
			if ($payment_modules->active)
				$output .= $payment_modules->showInactivatedMode();
		}
		return $output;

		// disabling default Prestashop warning message
		// return '<p class="warning">'.Tools::displayError('Please sign in to see payment methods.').'</p>';
	}
 
    return parent::_getPaymentMethods();
}

Hi. Sorry, but i dont know put the smarty vars...it's too much trouble to tell me the exact code I put in

            // Your Smarty goes Vars? thanks

Link to comment
Share on other sites

  • 2 months later...

hi folks, im trying to remove the text: "please sign in to view payment methods".

 

if (!$this->isLogged)
return '<p class="warning">'.Tools::displayError('Please sign in to see payment methods.').'</p>';
 
if i delete Please sign in to see payment methods i get error. if i delete 'Please sign in to see payment methods.' i get error, if i delete all these lines i get error. if i have :
 
if (!$this->isLogged)
return Tools::displayError('');  i get error any fast way to simply remove this text?
 
thank you
Link to comment
Share on other sites

  • 2 months later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...