How to call Address custom fields individually?

  • Posts: 80
  • Thank you received: 1
12 years 10 months ago #42277

Hello,

Hikashop has got this code responsible to show all the custom fields for Address table:

			<?php

			foreach($this->extraFields['address'] as $fieldName => $oneExtraField) {
			?>
				<tr class="hikashop_address_<?php echo $fieldName;?>_line">
					<td class="key">
						<?php echo $this->fieldsClass->getFieldName($oneExtraField);?>
					</td>
					<td>
						<?php echo $this->fieldsClass->display($oneExtraField,$this->address->$fieldName,'data[address]['.$fieldName.']'); ?>
					</td>
				</tr>
			<?php }	?>

I want to show some fields only if someone is visiting one particular page:
$CurrentUrl = 'http://www.xyz.com' . $_SERVER['REQUEST_URI'];

if($CurrentUrl=='http://www.xyz.com/affiliate-registration.html'){

show the list of custom fields specified individually...

}

Please advice

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

  • Posts: 83103
  • Thank you received: 13416
  • MODERATOR
12 years 10 months ago #42412

You already gave the solution so I'm not sure what you want ?
The combination of both code ? That's really simple:

<?php
 $CurrentUrl = 'http://www.xyz.com' . $_SERVER['REQUEST_URI'];
 $show = false;
if($CurrentUrl=='http://www.xyz.com/affiliate-registration.html'){
$show = true;
}
			foreach($this->extraFields['address'] as $fieldName => $oneExtraField) {
if(!$show && $fieldName=='namekey of field I do not want to show on pages other than the registration') continue;
			?>
				<tr class="hikashop_address_<?php echo $fieldName;?>_line">
					<td class="key">
						<?php echo $this->fieldsClass->getFieldName($oneExtraField);?>
					</td>
					<td>
						<?php echo $this->fieldsClass->display($oneExtraField,$this->address->$fieldName,'data[address]['.$fieldName.']'); ?>
					</td>
				</tr>
			<?php }	?>

The following user(s) said Thank You: seoweb

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

Time to create page: 0.054 seconds
Powered by Kunena Forum