News:

Support the VirtueMart project and become a member

Main Menu

Display value in an array | Userfields

Started by mediax, March 23, 2016, 13:41:35 PM

Previous topic - Next topic

mediax

Hi Guys,

I am trying to display one value in an array and keep on getting a null value. Kindly could someone help me with this.

This is the array in $this->userfields  (invoice_items template VM3)

["volume2"]=>
array(8) {
["name"]=>
string(7) "volume2"
["value"]=>
string(6) "0.08m3"
["title"]=>
string(16) "Packaging Volume"
["type"]=>
string(4) "text"
["required"]=>
string(1) "0"
["hidden"]=>
bool(false)
["formcode"]=>
string(102) " "
["description"]=>
string(0) ""
}

I want to display the volume2 value on my invoice: I have tried
$this->userfields['volume2'] but this gives me a null result as well as $this->userfields['volume2']['value']

Regards,
MediaX

GJC Web Design

r u sure volume2 is an array?

try $this->userfields->volume2['value']

use print 'Debug Line '.__LINE__.' $this->userfields <pre>'; print_r ($this->userfields); print "</pre><br />\n";

to dump -- easier to see what it is
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

mediax

Hi GJC,

Thanks for assistance ... $this->userfields->volume2['value'] does not give me any value.  After looking at the output from the debug line you suggested I found that:

echo $this->userfields['fields']['volume2']['value'];

gave me the value I was looking for.

Thanks man,
MediaX