Skip to main content

How to call Address custom fields individually?

More
14 years 6 months ago #42277 by seoweb
Hello,

Hikashop has got this code responsible to show all the custom fields for Address table:
Code:
<?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:
Code:
$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.

More
14 years 6 months ago #42412 by nicolas
You already gave the solution so I'm not sure what you want ?
The combination of both code ? That's really simple:
Code:
<?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.181 seconds
Powered by Kunena Forum