Custom fields "Display limited to" issue

  • Posts: 86
  • Thank you received: 4
  • Hikashop Business
8 years 5 months ago #216328

-- HikaShop version -- : 2.6.0
-- Joomla version -- : 3.4.4
-- PHP version -- : 5.4.45-0
-- Browser(s) name and version -- : Firefox 41.0.1

HikaShop Business: 2.6.0 (05-10-2015)
Joomla version: 3.4.4
PHP Version: 5.4.45-0+deb7u1
Browser: Firefox 41.0.1 / Chrome Version 45.0.2454.101 m

Afternoon,



could it be that the custom fields function “Display limited to” is not working in Hikashop version 2.6 as it did in the 2.5 version?

The setting of the default value is no longer working, but it will use the first value of the Values table instead.

As a result fields depending on the default value are not working as they should.

For instance if I have some fields that should only show if you select the none default value they do show if you load a page and will only hide as soon as you make the selection twice.

So fields that should only show if you select “Grapes” do show with the default value “Apples” in the initial view and are only hidden after you select “Grapes” and then select “Appels”.

Regards, Rene

Attachments:

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

  • Posts: 81361
  • Thank you received: 13035
  • MODERATOR
8 years 5 months ago #216348

Hi,

This works fine for me.
If it doesn't work when the page is loaded, it usually indicates that there is a javascript error on the page preventing the custom field JS which initialize the display/hide of the custom fields to run.
Could you give a link to the page with the issue on your website so that we could look at the problem ?
Could you also provide a screenshot of both custom fields (the one with the display limited to setting used, and the one selected in the display limited to setting of the first one) ?

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

  • Posts: 86
  • Thank you received: 4
  • Hikashop Business
8 years 5 months ago #216610

Afternoon Nicolas,

yesterday I did send you the website address information by private mail.

The two pictures are the address_account and the address_company, the address_company field should only show if you select “Zakelijk” (business) form the address_company.

Not sure about the javascript error, as far as I know I did nothing special except the update to Hikashop 2.6 and the removal of User Group FTW For Hikashop.

Before that it was just working fine, maybe go back to the 2.5 version from the backup?

Regards, Rene




Attachments:

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

  • Posts: 81361
  • Thank you received: 13035
  • MODERATOR
8 years 5 months ago #216627

Hi,

Thank you for the details. We've identified the problem. It's indeed a javascript error, which is caused by a modification in the 2.6.0 release.
I've added a patch to fix it.
Simply download the new install package via the menu My account>My subscriptions on our website and install it on your website and it will add the patch.

The following user(s) said Thank You: EnerW

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

  • Posts: 86
  • Thank you received: 4
  • Hikashop Business
8 years 5 months ago #216721

Morning Nicolas,

thank you, problem solved!

Regards, Rene

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

  • Posts: 86
  • Thank you received: 4
  • Hikashop Business
8 years 5 months ago #216918

Evening Nicolas,

made some changes and either I did not test it as I should have or I am nuts, but it is not working and the problem is as it was.

The default field value is not loaded on opening of the registration page and the depending fields will only show if you make the selection business → private → business.

Just did load the latest version of Hikashop to be sure that I did install the latest version, but no improvement.

Any help would be appropriated since now I am stuck and will have to revert to only a Joomla registration page.

Rene

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

  • Posts: 86
  • Thank you received: 4
  • Hikashop Business
8 years 5 months ago #217183

Evening Nicolas,

made a complete new install of Joomla and Hikashop 2.6 on a separate server to see if there is any difference in the behavior of the custom fields, but it is still not working.

I did test it with my own template and the standard Protostart template, but the result is the same, so I do not think that I did anything wrong.

Is there nobody else with these complaints or a solution?

Rene

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

  • Posts: 86
  • Thank you received: 4
  • Hikashop Business
8 years 5 months ago #217195

Evening Nicolas,

So I did change back to Hikashop 2.5 and all is working as it should, clearly there is something wrong with the current Hikashop releases, would be nice if some of you could get back on this and fix it.

Rene

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

  • Posts: 86
  • Thank you received: 4
  • Hikashop Business
8 years 5 months ago #217407

I think I found the problem, in Hikashop 2.5 you could use numeric and alphabetic values for the values fields. In Hikashop 2.6 they are limited to alphabetic values only.

Actually really stupid, since the Title field (Mr./Mrs.) was functioning all the time in Hikashop 2.5 and 2.6 and I did not notice that :angry:

Rene



Attachments:

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

  • Posts: 86
  • Thank you received: 4
  • Hikashop Business
8 years 5 months ago #217443

The difference as seen in Firebug, with the numeric value the selected="selected" is gone.

Although the correct value is now showing if you load the front page the fields depending on the selected value are still not showing and will only show if you switch between the to values :(

<tr id="hikashop_address_address_account" class="hikashop_registration_address_account_line">
<td class="key">
<label for="address_account">Type account</label>
</td>
<td>
<select id="address_account" class="hikashop_field_dropdown" onchange="hikashopToggleFields(this.value,'address_account','address',0);" size="1" name="data[address][address_account]">
<option id="address_account_B" value="B">Business</option>
<option id="address_account_P" selected="selected" value="P">Private</option>
</select>
</td>
</tr>



tr id="hikashop_address_address_account" class="hikashop_registration_address_account_line">
<td class="key">
<label for="address_account">Type account</label>
</td>
<td>
<select id="address_account" class="hikashop_field_dropdown" onchange="hikashopToggleFields(this.value,'address_account','address',0);" size="1" name="data[address][address_account]">
<option id="address_account_1" value="1">Business</option>
<option id="address_account_2" value="2">Private</option>
</select>
</td>
</tr>

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

  • Posts: 81361
  • Thank you received: 13035
  • MODERATOR
8 years 5 months ago #217539

Hi,

Thank you for the details.
Change the code:

	if($oneValue === $field->field_default){
		$selected = (is_string($field->field_default) && $oneValue === $field->field_default) || is_array($field->field_default) && in_array($oneValue,$field->field_default) ? 'selected="selected" ' : '';
to:
	$defaultValueEqualToCurrentValue = (is_numeric($field->field_default) && is_numeric($oneValue) && $oneValue == $field->field_default) || is_string($field->field_default) && $oneValue === $field->field_default;
	if($defaultValueEqualToCurrentValue){
		$selected = ($defaultValueEqualToCurrentValue || is_array($field->field_default) && in_array($oneValue,$field->field_default)) ? 'selected="selected" ' : '';
in the file administrator/components/com_hikashop/classes/field.php and that will fix the problem.

Last edit: 8 years 5 months ago by Jerome. Reason: indent fix

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

  • Posts: 86
  • Thank you received: 4
  • Hikashop Business
8 years 5 months ago #217667

Evening Nicolas,

this did fix the numeric problem, but that was something I could live with.. :whistle:

So now the correct value is showing if you load the page but the fields depending on the default value are still not showing and will only show if you switch between the to values.

The problem is the same for the registration page and the registration part of the checkout page.

Either I am doing something completely wrong or there is still a javascript error that prevents the initialization of the custom fields JS.

Is there anything else I could test to see were the JS problem comes from?

Rene

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

  • Posts: 86
  • Thank you received: 4
  • Hikashop Business
8 years 5 months ago #218332

Afternoon Nicolas,

On the register form page in the JS with: function hikashopSubmitForm(form, action)

hikashopToggleFields('','address_account_type','address',0);

the value 1 or 2 (depending on the default selection) before ,'address_account_type' is missing.

I think that is what will prevent the loading of the default value.

If I do a test on the on the order check out page with one field depending on an other it will work and does show the correct value

hikashopToggleFields('2','order_test1','order',0);

Please let me know if this is correct and, if so, what I should do to correct this.

Rene

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

  • Posts: 86
  • Thank you received: 4
  • Hikashop Business
8 years 4 months ago #218843

Any news on this, should be a simple fix?

Rene

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

  • Posts: 86
  • Thank you received: 4
  • Hikashop Business
8 years 4 months ago #218852

Just some extra information, the first part is from the registration page and the second part is from the order page.

On the registration page both values are loaded and on the order page only the set default values are loaded.

I suspect that, since both custom field values are loaded on the registration page, there will be no default value set for the single drop down or radio menu.

<!--
function hikashopToggleFields(new_value, namekey, field_type, id, prefix) {
if(!window.hikashop)
return false;
if(!window.hikashop.fields_data && window.hikashopFieldsJs)
window.hikashop.fields_data = window.hikashopFieldsJs;
return window.hikashop.toggleField(new_value, namekey, field_type, id, prefix);
}
window.hikashopFieldsJs = {};
window.hikashopFieldsJs = {};
window.hikashopFieldsJs = {};
window.hikashopFieldsJs = 'eet_nootjes';
window.hikashopFieldsJs = {};
window.hikashopFieldsJs = 'eet_wortels';
window.hikashop.ready(function(){

hikashopToggleFields('','keuze_1_2','user',0);
});
//-->

<!--
function hikashopToggleFields(new_value, namekey, field_type, id, prefix) {
if(!window.hikashop)
return false;
if(!window.hikashop.fields_data && window.hikashopFieldsJs)
window.hikashop.fields_data = window.hikashopFieldsJs;
return window.hikashop.toggleField(new_value, namekey, field_type, id, prefix);
}
window.hikashopFieldsJs = {};
window.hikashopFieldsJs = {};
window.hikashopFieldsJs = {};
window.hikashopFieldsJs = 'order_extra_information';
window.hikashop.ready(function(){

hikashopToggleFields('2','order_test1','order',0);
});
//-->

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

  • Posts: 86
  • Thank you received: 4
  • Hikashop Business
8 years 1 month ago #229189

Afternoon Nicolas,

With the current update to Hikashop 2.6.1 (07.02.2016) it does look like the conditional fields are working.

There is still a small problem with a condition based on an other condition (condition 1 -> condition 2) but that is something I can live with.

I will do some more tests but at this moment I am very pleased with the result and consider this topic to be solved.

Rene

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

Time to create page: 0.087 seconds
Powered by Kunena Forum