Disable custom order fields based on shipping type

  • Posts: 45
  • Thank you received: 1
9 years 4 months ago #207165

-- HikaShop version -- : 2.5.0
-- Joomla version -- : 2.5.28
-- PHP version -- : n/a
-- Browser(s) name and version -- : n/a

Hi all,

From what I've read disabling custom fields based on shipping type may still not be possible? If so, is there a workaround?

The problem I have is that I have added custom fields for Time, Date, Location etc but these only apply to people that come to the store and does not apply to people that are mailing their device in. Hence, I need a way to enable/disable the display of those custom fields based on shipping type. Any help would be great.

Regards,
Michael.

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

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

Hi,

There is indeed no option to restrict custom order fields based on the shipping method selected.
The simplest is to have the fields not required and to modify the "fields" file of the "checkout" view via the menu Display>Views to skip their display based on the shipping method selected.
For example, with such code at the top of the file:

<?php $app = JFactory::getApplication();
if($app->getUserState(HIKASHOP_COMPONENT.'.shipping_id') == XXX) return; ?>
where XXX is the id of the shipping mehtod for which you don't want to display the fields.
If the fields are to be required, it's more complex as the system will refuse the validation of the step where the fields are normally displayed. So it would require a developer to help you with that customization.

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

Time to create page: 0.058 seconds
Powered by Kunena Forum