Hidden custom order fields shown in frontpage

  • Posts: 33
  • Thank you received: 0
12 years 7 months ago #24529

Set up custom order field, not to be displayed on the frontpage.

During checkout ok, will not display.

but when the customer later checks his order via de frontend webaccess, all extra custom order fields are displayed.

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

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
12 years 7 months ago #24547

You need to add the code:
if(empty($this->order->$fieldName)) continue;

after the line
$foreach($this->fields as $fieldName => $oneExtraField) {

in the file "show" of the view "order" of the front end via the menu Display->Views and that will do what you want.

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

  • Posts: 33
  • Thank you received: 0
12 years 7 months ago #24559

Hi Nicolas,

thx, that is indeed the solution.. this is how it is expect to work or not? Will it be included in new versions?

thx!

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

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
12 years 7 months ago #24567

Well, it would be more logical that way I think. So yes, we'll add it to next version.

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

  • Posts: 33
  • Thank you received: 0
12 years 7 months ago #24569

Sorry Nicolas, but it does not work completely yet..

Just added another order custom field, but this time a checkbox, hidden for frontend.

When I tick the box in the backend for an order it will still show up on the frontend.
Tried with Radio Buttons, same results...

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

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
12 years 7 months ago #24575

Then, try with that line instead:
if(!@$oneExtraField->field_frontcomp || empty($this->order->$fieldName)) continue;

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

  • Posts: 33
  • Thank you received: 0
12 years 7 months ago #24579

Yes, this seems to work.

It also has an extra benefit which I don't know if it is intended or not, but if the field is empty, it will not show up. ( I can use that because I first setup another box to set show/not show for that other tekst field. )

But I can imaging this 'side effect' is not what you want perhaps.

thx again.

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

  • Posts: 81481
  • Thank you received: 13062
  • MODERATOR
12 years 7 months ago #24584

In most cases, it's what you want though so we'll leave it like that. It can easily be changed anyway.

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

Time to create page: 0.055 seconds
Powered by Kunena Forum