Convert select to radio list

  • Posts: 1119
  • Thank you received: 114
6 years 4 weeks ago #299757

Hi,

When option "Allow customers to change they payment method after checkout" is enabled we do have possibility to change payment method of the order in front-end.

However it does display as select box which don't give a lot options to customize. Is there a way to change it to radio list as example?

Thanks

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
6 years 4 weeks ago #299767

Hi,

There is no easy way to change that.
The dropdown is displayed thanks to the code in administrator/components/com_hikashop/types/plugins.php which actually uses the Joomla library to display the select dropdown.
And that file is used at different places throughout HikaShop so you don't want to directly edit it.
What I would recommend to do is to edit the file "pay" of the view "order" and remove the line:

echo $this->paymentPluginType->display('new_payment_method', $this->order->order_payment_method, $this->order->order_payment_id, false);
which generates that dropdown and instead manually add the HTML for your radios with the same values and name and it will work.
However, it won't be dynamic. You could make it dynamic but it would be more complex.

The following user(s) said Thank You: kyratn

Please Log in or Create an account to join the conversation.

  • Posts: 1119
  • Thank you received: 114
6 years 4 weeks ago #299807

Hi,

That's a good solution and it does work, Thanks

However i am not able to find how thank you page is done after changing payment method. It use html of the payment method but we have added some code in checkout end.php file which creates different content based on payment method. Is there a way to do same in pay.php file??


Thanks

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
6 years 4 weeks ago #299811

Hi,

Yes, you'll have to add similar code to the pay.php

I don't know what code you're using in the end.php so I don't know if you can use exactly the same code. It might require a bit of tweaking.

Please Log in or Create an account to join the conversation.

  • Posts: 1119
  • Thank you received: 114
6 years 3 weeks ago #299839

nicolas wrote: Hi,

Yes, you'll have to add similar code to the pay.php


Hi,

Unfortunately i can't find the part of the code which displays thank you page in pay.php view file.

In checkout end we do have this:
<?php echo $this->html;?>

So it was easy to change content based on payment method like this:
<?php if($this->order->order_payment_id == '25') { ?>

...My content here...

<?php } else {
	echo $this->html;
}

Any advise please?

Thanks

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
6 years 3 weeks ago #299840

Hi,

It's this line instead:

echo $this->checkoutHelper->getCustomHtml($this->paymentMethod->custom_html, 'payment[custom]');

Please Log in or Create an account to join the conversation.

  • Posts: 1119
  • Thank you received: 114
6 years 3 weeks ago #299885

Hi,

1. I have removed that line from pay.php but thank you page is still generated somehow? Tried with manual bank transfer payment.

I even tried to remove all code except:

<form action="<?php echo hikashop_completeLink('order&task=pay&order_id='.$this->order->order_id.$url_itemid); ?>" method="post">

<?php
		echo $this->paymentPluginType->display('new_payment_method', $this->order->order_payment_method, $this->order->order_payment_id, false);
	?>

	<input type="hidden" name="option" value="<?php echo HIKASHOP_COMPONENT; ?>" />
	<input type="hidden" name="task" value="pay" />
	<input type="hidden" name="order_id" value="<?php echo $this->order->order_id; ?>" />
	<input type="hidden" name="ctrl" value="<?php echo hikaInput::get()->getCmd('ctrl'); ?>" />
	<input type="hidden" name="order_token" value="<?php echo hikaInput::get()->getVar('order_token'); ?>" />
	<?php echo JHTML::_('form.token'); ?>
</form>

And it did work after clicking enter:)

2. Should settings "Allow customers to change their payment method after checkout" work with guest user also??

Because after checkout as a guest and going to order details i see button which allows to change payment method. The url of this button is like this "mysite.com/component/hikashop/component/hikashop/order/pay/order_id-3840/select_payment-1/order_token-akOvGjGN".

Now if i remove one line of the "/component/hikashop/" i am able to change my payment method....So i assume it should work??

However after changing payment method and using payment like paypal or paysera, after succesfull payment redirect, thank you page is not displayed. It seems that layout after_end is missing here....

Using manual payment method like bank transfer the thank you page is showing fine...

So question. Should it work for guest users or not?

Kind Regards

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
6 years 3 weeks ago #299947

Hi,

Thank you for the feedback.
For the pay URL, it's indeed an error.
The line:
'url' => hikashop_completeLink($url),
should actually be:
'url' => $url,
in the file components/com_hikashop/views/order/view.html.php

Regarding the issue with the thank you page not displaying, could you tell us more about it ? What URL do you have in the address bar of your browser ? What do you see on the screen ?
Did you enter a "return URL" in the settings of the payment plugin or did you leave that setting empty ?

Please Log in or Create an account to join the conversation.

  • Posts: 1119
  • Thank you received: 114
6 years 3 weeks ago #299962

Hi,

1. ...

2. I do not have anything in return url, so it's empty. After returning from payment processor, hkashop component view returns nothing. However, i have done few more test and found that it only effects guest users. So it works fine for registered users!

I am attaching 2 screenshots. First one is for registered user and second one is for guest user. As you can see, after doing it as a guest, in body there is missing class "layout-after_end" compared with registered user. So i assume layout after end is not loaded for guest user, those there is no thank you page....






Hope you can reproduce the issue.

Thanks

Attachments:
Last edit: 6 years 3 weeks ago by kyratn.

Please Log in or Create an account to join the conversation.

  • Posts: 1119
  • Thank you received: 114
6 years 3 weeks ago #299963

I also would like to note that this only effect during "change payment method" In checkout ALL works fine!

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
6 years 3 weeks ago #299996

Hi,

So which payment plugin are you using ? Could you provide a screenshot of its settings and blur the sensitive data on the screenshot ?
Also, it looks like the after_end view file has been heavily customized by your template. Do you have the same issue with the default template of Joomla ?

Please Log in or Create an account to join the conversation.

  • Posts: 1119
  • Thank you received: 114
6 years 3 weeks ago #299997

Hi,

Yes, i have tried with default protostar template and had same issue.
I am using payment plugin paysera. Maybe it's related only to that plugin? I couldn't test with paypal plugin as this would require to pay for the item... We will update our live site soon and then probably i will be able to give you more info regarding this....

There is nothing special in that plugin. Here is the screenshot.



Thanks

Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 82868
  • Thank you received: 13376
  • MODERATOR
6 years 3 weeks ago #299999

Hi,

From what I see and what you're saying it seems to be an issue related to the check on the ownership of the order on the after_end task of the checkout controller.
This was fixed in a recent patch to HikaShop 4.0.0
It seems you're using an earlier version of HikaShop based on what you said in your last message. So I would recommend updating and that should help.

Please Log in or Create an account to join the conversation.

Time to create page: 0.101 seconds
Powered by Kunena Forum