Skip to main content

How do I add the field "Username" to Invoice?

More
12 years 2 months ago #166550 by qjawebadmin
-- HikaShop version -- : 2.3.2
-- Joomla version -- : 2.5.24
-- PHP version -- : 5.4
-- Browser(s) name and version -- : chrome

I would like to add the field "username" to the invoice. I have found the Display->Views->Invoice and can edit the code. I would like to add the following but obviously I have the syntax wrong as it is not displaying the username:

<?php echo JText::_('QJA Member').': '.@$this->username;?>

Can anyone help with some advice on the syntax for the username field please.

Thanks,
Keith

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

More
12 years 2 months ago #166565 by nicolas
Hi,

Try like that:
<?php echo JText::_('QJA Member').': '.@$this->element->username;?>

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

More
12 years 2 months ago - 12 years 2 months ago #166675 by qjawebadmin
Thank you for you reply. I updated my syntax to match your suggestion - unfortunately it displays the text "QJA Member" fine but the field content is still blank.

The syntax reads:
Code:
<fieldset class="adminform" id="htmlfieldset_billing"> <legend style="background-color: #FFFFFF;"><?php echo JText::_('HIKASHOP_BILLING_ADDRESS'); ?></legend> <?php echo JText::_('QJA Member').': '.@$this->element->username;?><br/> <?php $this->setLayout('address_template'); $html = $this->loadTemplate(); foreach($this->element->fields as $field){ $fieldname = $field->field_namekey; $html=str_replace('{'.$fieldname.'}',$this->fieldsClass->show($field,$this->element->billing_address->$fieldname),$html); } echo str_replace("\n","<br/>\n",trim(str_replace("\n\n","\n",preg_replace('#{(?:(?!}).)*}#i','',$html)),"\n")); ?> </fieldset>
Third line down is the line I have added.

Any ideas?

Regards,
Keith
Last edit: 12 years 2 months ago by Jerome. Reason: [code] is nice !!

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

More
12 years 2 months ago #166698 by Jerome
Hi,

I will make the supposition that you are edting the view "backend | order | invoice" (it is always better the provide the full localisation of the view, because if there are several views with the same name ; they don't have the same path !)

The full order is loaded under $this->element
The user is loaded by the full order, it will be under $this->element->customer
So, the username : $this->element->customer->username

Regards,

Jerome - Obsidev.com
HikaMarket & HikaSerial developer / HikaShop core dev team.
The following user(s) said Thank You: qjawebadmin

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

More
12 years 2 months ago #166838 by qjawebadmin
Perfect - worked a charm. Thank you very much.
Keith

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

Time to create page: 0.110 seconds
Powered by Kunena Forum