News:

Looking for documentation? Take a look on our wiki

Main Menu

PHP: IF user field is NOT EMPTY display userfield value.

Started by servlet, May 31, 2017, 18:21:16 PM

Previous topic - Next topic

servlet

Hello
I am not good enough in PHP. Please help.

I have additional user-fields like ROOM and others...
I need to display in confirmation mail value of field ROOM from DB if value is not empty (if user is filled in some data)

How to do it?
Он-лайн магазин за фототапети http://mishelfoster.com

GJC Web Design

This has been explain on here b4.. please use the search

basically the display in the email just uses a loop

you have to do a check on each value inside the loop

i.e if(!empty($value->my_value)){
echo $value->my_value;
}
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

servlet

After a lot of hour I found solution, but I cannot order them in my needs. They are displayed in mail in order set in VM Shopper Field List configuration

It there a way to order them?

The code and order is shown below but order is messed up in confirmation e-mail. I found this but I cannot modify it for my needs: http://forum.virtuemart.net/index.php?topic=131881.msg455400#msg455400


    <?php

    foreach (
$this->userfields['fields'] as $field) {
if (!empty($field['value'])) {

if ($field['name']=='first_name') {
echo $field['value'];
}
if ($field['name']=='middle_name') {
echo ' ' $field['value'];
}
if ($field['name']=='last_name') {
echo ' ' $field['value'] . '<br/>';
}
if ($field['name']=='phone_2') {
echo 'Телефон: ' $field['value'] . '<br/>';
}
if ($field['name']=='virtuemart_hood_id') {
echo 'кв. ' $field['value'] . ', ';
}
if ($field['name']=='virtuemart_street_id') {
echo 'ул. ' $field['value'] . ', ';
}
if ($field['name']=='virtuemart_block_id') {
echo 'бл. ' $field['value'] . ', ';
}
if ($field['name']=='virtuemart_entrance_id') {
echo 'вх. ' $field['value'] . ', ';
}
if ($field['name']=='virtuemart_floor_id') {
echo 'ет. ' $field['value'] . ', ';
}
if ($field['name']=='virtuemart_apartament_id') {
echo 'ап. ' $field['value'];
}
if ($field['name']=='zip') {
echo '<br/>' $field['value'] . ' ';
}
if ($field['name']=='city') {
echo $field['value'] . '<br/>';
}
    }
}
    ?>
Он-лайн магазин за фототапети http://mishelfoster.com