Add custom link near address fields

  • Posts: 1119
  • Thank you received: 114
8 years 3 months ago #247293

Hi,

I would like to add link somewhere near address post code. Link will go to post code search....
Tried with custom fields but it wont give me what I need.
Couldn't find the way via address views..
Any solution?

Thanks

Last edit: 8 years 3 months ago by kyratn.

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
8 years 3 months ago #247297

Hi,

It's indeed in the address views that you can add your code for the address form.
So you must have missed something when you tried that.

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

  • Posts: 1119
  • Thank you received: 114
8 years 3 months ago #247366

Hi,

As i understand it is address/form i should modify. However i dont see a way to add link somewhere near post code entry. Only top or bottom is possible....
This is the code:

<h3 id="hikashop_address_form_header_iframe"><?php echo JText::_('ADDRESS_INFORMATION');?></h3>
<div id="hikashop_address_form_span_iframe" class="hikashop_address_form_span_iframe">
	<form action="<?php echo hikashop_completeLink('address&task=save'); ?>" method="post" name="hikashop_address_form" enctype="multipart/form-data">
<?php
	foreach($this->extraFields['address'] as $fieldName => $oneExtraField) {
?>
			<div class="hikashop_address_<?php echo $fieldName;?>_line form-group " id="hikashop_address_<?php echo $oneExtraField->field_namekey; ?>">
				<div class="key "><?php
					echo $this->fieldsClass->getFieldName($oneExtraField);
				?></div>
				<div ><?php
					$onWhat='onchange'; if($oneExtraField->field_type=='radio') $onWhat='onclick';
					echo $this->fieldsClass->display(
						$oneExtraField,
						@$this->address->$fieldName,
						'data[address]['.$fieldName.']',
						false,
						' '.$onWhat.'="hikashopToggleFields(this.value,\''.$fieldName.'\',\'address\',0);"',
						false,
						$this->extraFields['address'],
						@$this->address
					);
				?>
				</div>
			</div>
<?php }	?>
		</table>
		<input type="hidden" name="Itemid" value="<?php global $Itemid; echo $Itemid; ?>"/>
		<input type="hidden" name="ctrl" value="address"/>
		<input type="hidden" name="tmpl" value="component"/>
		<input type="hidden" name="task" value="save"/>
		<input type="hidden" name="type" value="<?php echo JRequest::getVar('type',''); ?>"/>
		<input type="hidden" name="action" value="<?php echo JRequest::getVar('task',''); ?>"/>
		<input type="hidden" name="makenew" value="<?php echo JRequest::getInt('makenew'); ?>"/>
		<input type="hidden" name="redirect" value="<?php echo JRequest::getWord('redirect','');?>"/>
		<input type="hidden" name="step" value="<?php echo JRequest::getInt('step',-1);?>"/>
<?php
	if(!empty($address->address_user_id)){
		$id = $address->address_user_id;
	}else{
		$id = $this->user_id;
	}
?>
		<input type="hidden" name="data[address][address_user_id]" value="<?php echo $id;?>"/>
<?php
	if(!JRequest::getInt('makenew')){
?>
		<input type="hidden" name="data[address][address_id]" value="<?php echo (int)@$this->address->address_id;?>"/>
		<input type="hidden" name="address_id" value="<?php echo (int)@$this->address->address_id;?>"/>
<?php
	}
	echo JHTML::_( 'form.token' );
	echo $this->cart->displayButton(JText::_('OK'),'ok',$this->params,hikashop_completeLink('address&task=save'),'if(hikashopCheckChangeForm(\'address\',\'hikashop_address_form\')) document.forms[\'hikashop_address_form\'].submit(); return false;');
?>
	<br>
	</form>
</div>

So how can i do this?

Thank you

Last edit: 8 years 3 months ago by kyratn.

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

  • Posts: 82868
  • Thank you received: 13377
  • MODERATOR
8 years 3 months ago #247369

Hi,

Each field is displayed by that line:

echo $this->fieldsClass->display(
						$oneExtraField,
						@$this->address->$fieldName,
						'data[address]['.$fieldName.']',
						false,
						' '.$onWhat.'="hikashopToggleFields(this.value,\''.$fieldName.'\',\'address\',0);"',
						false,
						$this->extraFields['address'],
						@$this->address
					);
So you want to add your code right after that...
if($fieldName=='address_post_code') echo 'my text';

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
8 years 3 months ago #247426

Thank you Nicolas. It worked!

Have a great day

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

Time to create page: 0.062 seconds
Powered by Kunena Forum