Keycaptcha, how to move it in cart?

  • Posts: 52
  • Thank you received: 2
11 years 10 months ago #84434

Hikashop business 2.0.0
Joomla 2.5.8

I am trying hard to get Keycaptcha working in Hikashop. If you have used it you will know that in Hikashop, when an unregistered buyer presses "proceed to checkout" and the registration form is put onto the cart, the Keycaptcha is misplaced way down the page.

I've emailed the Keycaptcha support team and this is their reply.....

Do you mean registration after pressing checkout button?
If so, then to change captcha location you should:
1. Open your page and find html before which you want to place captcha.
2. Edit file /plugins/system/keycaptcha/keycaptcha.php, find line
$captcha_before = '<div id="hikashop_checkout_cart" class="hikashop_checkout_cart">';
(line 694), and replace it with your html:
$captcha_before = 'HTML of your page where you want to place captcha'


I'm still lost with what to do, I've no problem editing the keycaptcha.php file but what html do I replace "$captcha_before = '<div id="hikashop_checkout_cart" class="hikashop_checkout_cart">';" with to get the captcha above the "register button".

I've got the shop set up almost exactly as I want it and the last thing I want to do is break it with a bit of dodgy editing :)

So, can anyone offer any insights here?

Jeff

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

  • Posts: 52
  • Thank you received: 2
11 years 10 months ago #84612

Sorted it :woohoo:

Jeff.

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

  • Posts: 13201
  • Thank you received: 2322
11 years 9 months ago #84697

Glad to know that, could you share the solution in case of other users have the same problem ?

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

  • Posts: 52
  • Thank you received: 2
11 years 9 months ago #84767

Heh heh heh,

Just teasing :)
I've seen the question asked a few times now and I WAS going to show the solution :)

It was embarrassingly simple.

I wanted the Keycaptcha to appear just before the line in the checkout register form where it says "Fields marked with an asterisk (*) are required."

Then, I just edited the file /plugins/system/keycaptcha/keycaptcha.php and changed line 694 from:

$captcha_before = '<div id="hikashop_checkout_cart" class="hikashop_checkout_cart">';

To

$captcha_before = 'Fields marked with an asterisk (*) are required.';

It was that simple, just like me.

Xavier, thank you for some seriously brilliant software and magnificent support, hope the above helps someone.

Jeff.

The following user(s) said Thank You: Xavier

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

  • Posts: 24
  • Thank you received: 2
11 years 7 months ago #97506

Hello all,

-- Joomla 3.0.3, Hikashop Starter 2.1.1 on Localhost, keycaptcha displays correctly on Joomla registration form.

Can some "savy" person explain this in more details because :

  1. My keycaptcha.php is installed by default in /plugins/captcha/keycaptcha and not in /plugins/system/keycaptcha
  2. My keycaptcha.php is 250 lines long
  3. On the keycaptcha website, there is the common API method that suggests use of hidden field to display the keycaptcha as well as the Php code and I am at a loss as to which one to use and how.

The hidden field method as discussed here http://www.hikashop.com/en/forum/2-general-talk-about-hikashop/65763-adding-a-hidden-field-for-keycaptcha-process.html
is not detailed enough -- it is not clear exactly what to add at the end of the registration file.

A step-by-step procedure targeted at non-coders would be welcome (by many I'm sure!)

Stephan

same question posted on Keycaptcha site


EDIT : Keycaptcha has now updated their plugin for Joomla 3.
Good news for everyone : IT WORKS as is! [it positions itself above the register button]

Last edit: 11 years 7 months ago by xantof.

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

  • Posts: 13201
  • Thank you received: 2322
11 years 7 months ago #97681

Hi,

As I can see it's working fine now.

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

  • Posts: 24
  • Thank you received: 2
11 years 7 months ago #97787

Hi Xavier and all keycaptcha fans,

Not quite...
The keycaptcha (with changes as described above) works if all checkout steps are on one page and it serves to accept the entered data as a whole.

My checkout spreads accross several pages [cart,login,address,shipping,payment,confirm_cart_status_fields,end] but with keycaptcha activated, it is impossible to change the cart -- quantity, erase, reload, and to proceed to the next page that contains the registration and the keycaptcha.

Any idea ?

Stephan

Last edit: 11 years 7 months ago by xantof.

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

  • Posts: 82761
  • Thank you received: 13348
  • MODERATOR
11 years 7 months ago #97945

Hi,

Please give more information on the problem.

What doesn't work exactly ? Do you get an error ? How did you configure the plugin ?

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

  • Posts: 24
  • Thank you received: 2
11 years 7 months ago #98020

Hello Hika team,

I would like the keycaptcha to be used ONLY to validate user registration in the checkout process while still being able to modify shipping, payment and cart data.





However, wherever it is positionned, the keycaptcha requires that ALL data for ALL checkout steps be correctly entered before it allows you proceed/modify data.

The information in the posts above addresses the positioning the keycaptcha within the form -- which is already a positive point.

This is the code pertaining to Hikashop in the keycaptcha.php with the $captcha_before line modified to position the keycaptcha.
// HikaShop
		if ( $extname == 'com_hikashop' ) {
			// Contact US
			if ( JRequest::getVar('layout') == 'contact' ) {
				$kcpars[0] = '1';
				$insert_params = '1';
				$full_content = str_replace( '<button type="button" onclick="submitform(\'send_email\');">', '<button type="button" onclick="submitform(\'send_email\');" id="kc_submit_butHS">', $full_content );
				$content = $full_content;
				$all_submit_names[] = 'kc_submit_butHS';
				$captcha_before = '<input type="hidden" name="ctrl" value="product"';
			}
			// Checkout
			if ( JRequest::getVar('ctrl') == 'checkout' ) {
				//$captcha_before = '<div id="hikashop_checkout_cart" class="hikashop_checkout_cart">';
				$captcha_before = 'Les champs signalés par une astérisque (*) sont obligatoires.';
			}
		}
		//---------------------------------------------------------------------------------------------------------

I am not fluent enough with programming nor with the logic of it all to be able to sort this out by myself.

(by the way, I was one of the 'wide-eyed' listeners of your Toulouse talks -- thousand thanks)

Stephan

Attachments:

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

  • Posts: 82761
  • Thank you received: 13348
  • MODERATOR
11 years 7 months ago #98262

Hi,

You say it is impossible but you still didn't say what happens. Do you get an error message ? Which one ?

I would guess that you might have a problem when all the views are on one step and that it would work fine on several steps but you're actually saying the opposite. Is that right ? I don't see why keycaptcha would be triggered on the other steps of the checkout even though it is not displayed and that there is no other code related to HikaShop in keycaptcha unless I'm missing something about the keycaptcha plugin.

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

  • Posts: 24
  • Thank you received: 2
11 years 7 months ago #98303

Hello Nicolas,

Thanks for looking into this.

It is a nagging problem and I do not seem to be able to explain it clearly.

Here's another try :

In fact, prior to entering correct user registration and resolving the keycaptcha, NOTHING can be changed within the checkout whether it is on one or several pages : it is IMPOSSIBLE to change any of the cart, shipping, payment options.

  • If it is a one-page checkout that includes the registration form and you fill it up correctly and resolve the keycaptcha, only THEN can you access and modify the rest of the data.
  • If checkout is on several pages (and I wish to have my registration form on the second page, with the cart on the first page), it is impossible to move on to the next page as it requests the keycaptcha to be resolved (see error message below). And since this one is on the 2nd page...
The error message is "Error - The solution of task you submitted was incorrect. Please read the instruction and try again."
Which reflects the "expect the keycaptcha to be solved" situation.

I am conducting several tests with previous versions to try pin point the problem but feel slightly out of my competency zone! I am keen on getting this to work as I had security issues through brute force password hacking with my site.

Stephan

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

  • Posts: 82761
  • Thank you received: 13348
  • MODERATOR
11 years 6 months ago #98450

Hi,

Ok, I checked the code of the keycaptcha plugin more in depth and I think that there is a bug on the line:
( (isset( $d ) && ($d != '') && ($this->params->get('KC_Register')=='Yes') )) )

it should actually be:
( (JRequest::getString('login_view_action','')=='register' && ($this->params->get('KC_Register')=='Yes') )) )


Try to change that in the keycaptcha.php file of the plugin and that should help.
Whether it works or not, I would recommend you to contact keycaptcha about that as that code is not correct as it will exact the captcha check as long as the registration form was displayed on the checkout page where you did the action, regardless of the action you did.
With my code, I'm making sure that the check only happens when the user clicks on the register button.

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

Time to create page: 0.094 seconds
Powered by Kunena Forum