Adjust Login Switcher Page

  • Posts: 75
  • Thank you received: 2
10 years 10 months ago #166072


-- HikaShop version -- : 2.3.4
-- Joomla version -- : 3.3.3
-- PHP version -- : 5.x

Hello.
I need to adjust the login "switcher" page slightly. Basically, I will be changing the page to separate the login in to two more steps. Step 1 - user selects register, login or guest checkout and Step 2 - the process for their selection (See screenshot).
What view(s) will I need to edit in order to complete this and can you give me any tips.

I will most likely do this using javascript/CSS in order to avoid having to hack the actual php code much. The reason I think this will be hard to do in two steps is because I think your code is set up that it would be hard to submit the page.

Unless you can tell me how I add/edit views to the Hikashop component.

Attachments:

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

  • Posts: 13201
  • Thank you received: 2322
10 years 10 months ago #166087

Hi,

To have it in two steps you will mainly have to edit the view "checkout / login".
In this view, edit the display to have what you want, and then add some checks on the current step ($this->step).

If the step is, for example, 1 so display the different options, if it is 2, hide the options but display the form.
In step 1, when selecting the desired method, you can store the value in session, this way when on the second step load the desired form. When clicking on a button of the first step, submit the whole checkout form to move to step 2.

It can potentially require the edition of core file regarding the checks made on the forms to see if the fields are filled or not.

Conclusion, there is a lot of changes to do.

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

  • Posts: 75
  • Thank you received: 2
10 years 10 months ago #166159

How do I find these two files/data.

$this->loadTemplate('form');

and all the text loaded by the JTEXT class for example
JText::_('HIKA_REGISTRATION')

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

  • Posts: 83905
  • Thank you received: 13581
  • MODERATOR
10 years 10 months ago #166175

The template form is: login_form that you can also find via Display->Views

All the text loaded by JText comes from the HikaShop language file that you can edit via the Languages tab of the HikaShop configuration.

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

  • Posts: 75
  • Thank you received: 2
10 years 10 months ago #166254

It looks like the registration form is loaded in the "login" view using

echo hikashop_getLayout('user','registration',$params,$js);

Could you explain that function to me or direct me to the source code for it.

Also, where would I find the javascript file (file location and code lines) that handles dynamically changing the switcher form from Login to Registration to Guest when the pertinent radio button is selected. It looks like it is the function named "displayRegistration()".

Thanks.

Last edit: 10 years 10 months ago by rodopemu.

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

  • Posts: 83905
  • Thank you received: 13581
  • MODERATOR
10 years 9 months ago #166259

That function allows us to load a view file's HTML from anywhere in HikaShop. Usually, we try to use the loadTemplate function of Joomla instead, but it only works for view files of the same view.
You can find the source code of that function in the file administrator/components/com_hikashop/helpers/helper.php, the core file of HikaShop. That's where you'll find the definition of all the functions starting with hikashop_

That's indeed the displayRegistration function you're looking for. It's defined in the login function of the file components/com_hikashop/views/checkout/view.html.php

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

  • Posts: 75
  • Thank you received: 2
10 years 9 months ago #166329

Thanks for your help on this I am getting there.

From this line in the checkout/login view

echo JHTML::_('hikaselect.radiolist',  $values, 'data[register][registration_method]', ' onchange="displayRegistration(this)"', 'value', 'text', $defaultSelection, false, false, true );

Where would I find the 'hikaselect.radiolist' helper function in the code. I think I want to either create my own helper or maybe just replace the JHTML function with my own php code.

Should I search the Joomla documentation for how to create a new helper? I am sure the original helper will be a good starting point as well.

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

  • Posts: 83905
  • Thank you received: 13581
  • MODERATOR
10 years 9 months ago #166377

The radiolist code is in administrator/components/com_hikashop/helpers/joomla30.php
We had to override the radiolist system of Joomla on 3.x so that it works properly on the frontend.

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

  • Posts: 75
  • Thank you received: 2
10 years 9 months ago #166656

How do I tell which view is being called by the load template call. For example from the user/registration view there are calls for:

echo $this->loadTemplate('bootstrap');

However there is are two bootstrap views "custom_fields_bootstrap" and "registration_bootstrap"

I am having similar problems understanding
$this->type = 'address';
		echo $this->loadTemplate();

Since there are multiple address views.

Basically, I am trying to track down where the all the code that generates the HTML code for the various registration fields in the login switcher as shown in the screenshot. I have found the code for the login radiolist on the left thanks to your comments. I hope you can help.

Attachments:

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

  • Posts: 26247
  • Thank you received: 4038
  • MODERATOR
10 years 9 months ago #166659

Hi,

loadTemplate is a Joomla function which allow to load a view (or sub view).
If your current view is "registration", loadTemplate('bootstrap') will load "registration_bootstrap".

$this->type is used in the view custom_fields in order to know which time of custom field the view as to display (user, address, etc).

Regards,


Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.

Also helping the HikaShop support team when having some time or couldn't sleep.
By the way, do not send me private message, use the "contact us" form instead.

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

  • Posts: 75
  • Thank you received: 2
10 years 9 months ago #166749

Ok. Thanks. That makes sense. One last thing, if I want to add a view is that hard to do or would it be easier to just add the code to the existing pertinent view.

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

  • Posts: 83905
  • Thank you received: 13581
  • MODERATOR
10 years 9 months ago #166757

It's way easier to add the code to an existing one.
When you add it to an existing one via the menu Display>views, you don't loose the changes when you update HikaShop.
If you add new views, it's highly probable that you will loose your changes during each update.

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

  • Posts: 75
  • Thank you received: 2
10 years 9 months ago #167711

Hi.
I have completed most of the changes however I have a problem with Guest Checkout. When the guest form is submitted I get the message "Please enter a value for the field password" in an alert box. I have included attachments of the files I edited. If you could look it over and help me identify the problem that would be great. At very minimum I need to know where the function that displays that error is defined and/or where the function validates the fields. Any help would be much appreciated. The Login and the Registration parts work fine. The link to the test site is www.inkacollective.com/testing/consilium/

The only file I changed was the login view. I copy and pasted the javascript from the displayRegistration() function and modified it slightly for my uses, mainly just changing it so it got the value 2 and 3 from the div.id instead of the radio buttons. I left the extra code in there just to be safe. On a side note, in the part of the code where the js declaration is whenever I scroll to that section in the backend of joomla the screen freezes. I have tried copy and pasting from a text file to the login view as well.

Attachments:

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

  • Posts: 75
  • Thank you received: 2
10 years 9 months ago #167926

Seemed to have figured it out. Just added back the login switcher radio list and hid it. Then added javascript code that switches the radio buttons when the custom divs are selected. That way it still calls hikashops field Check Function.

The following user(s) said Thank You: Mohamed Thelji

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

Time to create page: 0.095 seconds
Powered by Kunena Forum