Custom Fiel display in checkout

  • Posts: 79
  • Thank you received: 0
7 years 9 months ago #261699

-- HikaShop version -- : 2.6.3
-- Joomla version -- : 3.6.4

Hi,
I created a few custom fields in the "order" table to get more info about customer.
I added th block "Custom field" in the check out process and it works!!

But I would like to change the display (not just css). so change the code below by adding one by one my custom fields and add more html

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;
	}
?>
	<tr class="hikashop_checkout_<?php echo $fieldName;?>_line" id="hikashop_<?php echo $type.'_'.$oneExtraField->field_namekey; ?>">
		<td class="key">
			<?php echo $this->fieldsClass->getFieldName($oneExtraField);?>
		</td>
		<td>

ex
<div>
       custom_field_1
        custom_field_2
</div>
<div>
          custom_field_3
          custom_field_4
</div>

Is there any tag or else to custom this part please? I need to display the label ant the input

Last edit: 7 years 9 months ago by arveni.

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
7 years 9 months ago #261744

Hi,

You will need to completely change the code in the view so the fields won't be displayed automatically in the loop but you will display yourself each field manually.
So you can put the HTML you want between the fields because nothing will be automatic and all will be customized like you want.

Please note that such kind of customization require some PHP skills.
www.hikashop.com/support/documentation/1...-display.html#layout

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.

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

  • Posts: 79
  • Thank you received: 0
7 years 9 months ago #261784

That is what I want. I would like the generic php code for insert a custom field. I guess is a mix between this to code

<?php echo $this->fieldsClass->getFieldName($oneExtraField);?>
name="data['.$type.']['.$fieldName.']" value="'.$this->escape($this->$type->$fieldName).

with my case custom field are in the "order" table so $type will be "order" and $fieldName will be "custom_field_1" by example

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

  • Posts: 26158
  • Thank you received: 4028
  • MODERATOR
7 years 9 months ago #261808

Hi,

Best would to use the "display" function of the Field Class, like it is currently done in the view.
So you will support every type of custom field, input, radio, date picker, etc.

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.

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

Time to create page: 0.060 seconds
Powered by Kunena Forum