Remove custom field in only one language

  • Posts: 43
  • Thank you received: 0
9 years 5 months ago #206635

-- HikaShop version -- : 2.5.0
-- Joomla version -- : 3.4.1
-- PHP version -- : 5.4.41-1
-- Browser(s) name and version -- : all

Hi,

In the checkout is a custom field labelled "State".
Is it possible to remove it from the Dutch version of the site while
preserving it in the English version?

Another field reads (in Dutch): "Familienaam", which is rather oldfashioned.
Could it be replaced by "Achternaam"?
In English it is correct ("Last name".

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

  • Posts: 12953
  • Thank you received: 1778
9 years 5 months ago #206643

Hello,
1.
To remove your order custom field (not required) from your Dutch version, the solution will be to directly edit the "custom_fields" file of the "Checkout" view of your front-end template via "Hikashop->Display->Views", and change these lines :

foreach($this->extraFields[$type] as $fieldName => $oneExtraField) {
	if(isset($showfields[$fieldName]) && $this->step != $showfields[$fieldName]) {
		echo '<tr style="display:none;"><td><input type="hidden" name="data['.$type.']['.$fieldName.']" value="'.$this->escape($this->$type->$fieldName).'"/></td></tr>';
		continue;
	}
By :
$lang = JFactory::getLanguage();
foreach($this->extraFields[$type] as $fieldName => $oneExtraField) {
	if(isset($showfields[$fieldName]) && $this->step != $showfields[$fieldName]) {
		echo '<tr style="display:none;"><td><input type="hidden" name="data['.$type.']['.$fieldName.']" value="'.$this->escape($this->$type->$fieldName).'"/></td></tr>';
		continue;
	}
	if($lang->get('tag') == 'nl-NL' && $fieldName == 'Your_Customfield_Column')
		continue;
2.
Here is the documentation of Hikashop custom fields :

Label : The label of the field. You can translate it via joomfish. Note that core custom fields should be translated via the translation file of hikashop so that everyone can benefit of the translations. In the translation file, you will find them by searching for the english label which will be uppercase and spaces replaced with _. For example, you will find "Middle name" with the key MIDDLE_NAME in the translation file. You can edit the translation files of HikaShop in the configuration page of HikaShop, under the tab languages.

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

  • Posts: 43
  • Thank you received: 0
9 years 4 months ago #206733

Hi,
Joomfish won't install on my Joomla 3.
Would Falang do?

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

  • Posts: 43
  • Thank you received: 0
9 years 4 months ago #206739

I replaced the code but it has no effect. Perhaps I did something wrong?
I assumed that I had to replace 'Your_Customfield_Column' by 'address_state'.
Is that correct?

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

  • Posts: 12953
  • Thank you received: 1778
9 years 4 months ago #206742

Yes.

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

  • Posts: 43
  • Thank you received: 0
9 years 4 months ago #206880

But I still see a field labelled 'Staat' in the Dutch version.

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

  • Posts: 12953
  • Thank you received: 1778
9 years 4 months ago #206892

Hello,
Can you show me how did you edited the code that I gave you and how you configured your "Staat" custom field through some screenshots ?
Thanks.

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

  • Posts: 43
  • Thank you received: 0
9 years 4 months ago #206983

Hi,

Attachments:

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

  • Posts: 82910
  • Thank you received: 13379
  • MODERATOR
9 years 4 months ago #206985

Hi,

Can you try to replace the line:
if($lang->get('tag') == 'nl-NL' && $fieldName == 'address_state')
by:
if($lang->getTag() == 'nl-NL' && $fieldName == 'address_state')
in your file ?

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

  • Posts: 43
  • Thank you received: 0
9 years 4 months ago #207020

Hi,
I'm afraid that doesn't work too.

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

  • Posts: 13201
  • Thank you received: 2322
9 years 4 months ago #207037

Hi,

Is the custom field "address_state" the one created by default by HikaShop or you have created a new custom order field for that ?

If it is the default one, so the view to edit in your case is "address / form".

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

  • Posts: 43
  • Thank you received: 0
9 years 4 months ago #207128

Hi,
I would be very happy with some code to add/replace in the address/form file.

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

  • Posts: 82910
  • Thank you received: 13379
  • MODERATOR
9 years 4 months ago #207130

Hi,

Xavier is right in that the code Mohamed provided is only for custom fields of the table "order" not for custom address fields like the one you want to display/hide. However, he was wrong on the file to edit.
For custom address fields on the registration form, you want instead to edit the file "custom_fields" of the view "user".
There, you can add such code:

$lang = JFactory::getLanguage();
if($lang->get('tag') == 'nl-NL' && $fieldName == 'address_state')
		continue;
after the line:
foreach($this->extraFields[$type] as $fieldName => $oneExtraField) {

The following user(s) said Thank You: elbertbos

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

  • Posts: 43
  • Thank you received: 0
9 years 4 months ago #207193

It works!

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

  • Posts: 43
  • Thank you received: 0
9 years 4 months ago #207304

Uhrm....
When I click the button in the checkout to change the billing / shipping address
the 'State' field appears again in the Dutch site.
I assume some other PHP file(s) should be edited?.

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

  • Posts: 82910
  • Thank you received: 13379
  • MODERATOR
9 years 4 months ago #207309

Hi,

Yes, for that page, the same change should be made in the file "form" of the view "address".

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

  • Posts: 43
  • Thank you received: 0
9 years 4 months ago #207378

Hi,

If my editing is correct (see screenshot) I 'm afraid I edited the wrong file.
"Staat" is still there in Dutch.

Attachments:

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

  • Posts: 26159
  • Thank you received: 4028
  • MODERATOR
9 years 4 months ago #207395

Hi,

It depends on which front-end template you're using (you are editing the view for the template "beez3") and which kind of address selector you're using in the checkout.
Depending if you're using the "popup", the "list" or the "dropdown" address selector, the used view in HikaShop might not be the same.

The "list" and "dropdown" selectors are using "address | show" while the popup is using "address | form".

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.
The following user(s) said Thank You: elbertbos

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

  • Posts: 43
  • Thank you received: 0
9 years 4 months ago #207452

Hi,
You're perfectly right. I wasn't paying attention so I edited the address / form file for the beez3 template.
I should have edited this file for the favouritedark template. Now I've done that the problem is solved.

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

Time to create page: 0.119 seconds
Powered by Kunena Forum