Author Topic: [SOLVED] Bill to Information  (Read 6194 times)

kjogiste

  • Beginner
  • *
  • Posts: 11
    • Deffex Media - Your idea, our realization!
[SOLVED] Bill to Information
« on: April 22, 2010, 16:06:24 pm »
Hello everyone,

I have one issue with my order layout - i want to edit my "Bill to Information" layout to take less space in orders.

I know i can manage fields from user list, and i know that there is 3 files i can edit (printing layout in backend, e-mail_cofirmation and one in frontend, where user can see his/hers orders) - but the problem is that i cant find the file or location where i can change "Bill to Information" fields:

More clearly:

Example:

My "Bill to Information" looks like:

E-mail:           kjogiste@yahoo.com
Company:   OU NetSales Group
First name:   Kristjan
Surname:   Jogiste
Address:   Vene 20-3, Tallinn
Post index:   10123
State:           Harju
Phone:           58011620
Mobile:           56456
Fax:            456123

, but i want it to look like:

Company:   OU NetSales Group(Company)
Order from:   Kristjan(First name) Jogiste (Surname), kjogiste@yahoo.com (email)
Address:   Vene 20-3, Tallinn (address), Harju (state), 10123 (post index)
Phone:           58011620 (phone), 56456 (mobile), 456123 (fax)

I have made all changes that i want in those 3 files:
*/components/com_virtuemart/themes/vm_mynxx/templates/pages/account.order_details.tpl.php
*/components/com_virtuemart/themes/vm_mynxx/templates/order_emails/confirmation_email.tpl
*/administrator/components/com_virtuemart/html/order.order_printdetails.php

- but havent found yet where i can make this change i explained above.

* Please, it would be really nice if someone can help me out with this.  :) ;)

Best regards and all the best,
Kristjan Jogiste
kjogiste@yahoo.com
www.deffex.com
Deffex Media - Your idea, our realization! (www.deffex.com)

PRO

  • Global Moderator
  • Super Hero
  • *
  • Posts: 10404
  • VirtueMart Version: 3+
Re: Bill to Information
« Reply #1 on: April 22, 2010, 16:22:05 pm »
It will take a bit of work to do it like you want.

The Fields are Created by a foreach field as field. They are not separate.
J3.9+ VM 3.4.2
Slowest Page Speed Score (88) (Category)
Fastest Page Speed Score (94-96) (productdetails)

kjogiste

  • Beginner
  • *
  • Posts: 11
    • Deffex Media - Your idea, our realization!
Re: Bill to Information
« Reply #2 on: April 22, 2010, 16:27:40 pm »
Thank you  BanquetTables.pro for quick reply, but it is still possible?

And maybe, if you can gimme some hints how to do it?

Best regards and all the best,
Kristjan Jogiste
kjogiste@yahoo.com
www.deffex.com
Deffex Media - Your idea, our realization! (www.deffex.com)

richsung

  • Jr. Member
  • **
  • Posts: 85
Re: Bill to Information
« Reply #3 on: April 22, 2010, 16:52:34 pm »
In the order.order_printdetails.php:

As BanquetTables mentioned there's a for each statement that needs to get wiped out: Re-coding the table to pull out the specific fields is easy...

For example, to retrieve the main address field, it's: $dbbt->f('address_1');

What are the field names you have to retrieve?  Go into your database table jos_vm_order_user_info on your web host using their phpmyadmin tool and look at the fields there.

The code segment to replace is:
                foreach( $registrationfields as $field ) {
                        if( $field->name == 'email') $field->name = 'user_email';
                        if($field->type == 'captcha') continue;
                        ?>
                  <tr>
                        <td align="right"><?php echo $VM_LANG->_($field->title) ? $VM_LANG->_($field->title) : $field->title ?>:</td>
                        <td><?php
                                switch($field->name) {
                                case 'country':
                                        require_once(CLASSPATH.'ps_country.php');
                                        $country = new ps_country();
                                        $dbc = $country->get_country_by_code($dbbt->f($field->name));
                                        if( $dbc !== false ) echo $dbc->f('country_name');
                                        break;
                                default:
                                        echo $dbbt->f($field->name);
                                        break;
                          }
                          ?>
                        </td>
                  </tr>
                  <?php
                        }

kjogiste

  • Beginner
  • *
  • Posts: 11
    • Deffex Media - Your idea, our realization!
Re: Bill to Information
« Reply #4 on: April 22, 2010, 17:13:35 pm »
Hi richsung,

Thank you for your quick reply, i looked your code and tried to add <?php $dbbt->f('address_1');?> to my order.order_printdetails.php file, but after it didnt show up when i watched it from backend.

I am sure that i dont know exactly how to put it into code, so its shown from backend  ::)  :) ? (please - some hints :)?)

Best regards and all the best,
Kristjan Jogiste
kjogiste@yahoo.com
www.deffex.com
Deffex Media - Your idea, our realization! (www.deffex.com)

richsung

  • Jr. Member
  • **
  • Posts: 85
Re: Bill to Information
« Reply #5 on: April 22, 2010, 17:30:06 pm »
Hey Kristjan...

The format would be:

<?php echo $dbbt->f('address_1');?>

kjogiste

  • Beginner
  • *
  • Posts: 11
    • Deffex Media - Your idea, our realization!
Re: Bill to Information
« Reply #6 on: April 22, 2010, 17:44:15 pm »
Thank you very much richsung  ;) - i had a headache with this issue for 8 hours :) and now it works just fine with all three files:

* order.order_printdetails.php
* confirmation_email.tpl
* account.order_details.tpl.php

For others: as richsung said: use format: <?php echo $dbbt->f('address_1');?>

Best regards and all the best,
Kristjan Jogiste
kjogiste@yahoo.com
www.deffex.com
Deffex Media - Your idea, our realization! (www.deffex.com)

kjogiste

  • Beginner
  • *
  • Posts: 11
    • Deffex Media - Your idea, our realization!
Re: Bill to Information
« Reply #7 on: April 22, 2010, 17:57:19 pm »
My order.order_printdetails.php:

<td width="50%"> <!-- Begin BillTo --><?php

    // Get bill_to information

    $dbbt = new ps_DB;

    $q  = "SELECT * FROM #__{vm}_order_user_info WHERE user_id='" . $db->f("user_id") . "'  AND order_id='$order_id' ORDER BY address_type ASC";

    $dbbt->query($q);

    $dbbt->next_record();

    $user = $dbbt->record;

  ?>

      <table width="100%" cellspacing="0" cellpadding="2" border="0">

        <tr>

          <td colspan="2"><strong><br />
          Tellija andmed:</strong></td>

        </tr>

    

      <tr>

         <td width="15%" align="left">Kooli nimi:</td>

         <td width="85%"><?php echo $dbbt->f('company');?></td>

       </tr>
      <tr>
        <td align="left">Tellimuse esitaja:</td>
        <td><?php echo $dbbt->f('first_name');?> <?php echo $dbbt->f('last_name');?>, <?php echo $dbbt->f('user_email');?></td>
      </tr>
      <tr>
        <td align="left">Kooli aadress:</td>
        <td><?php echo $dbbt->f('address_1');?>, <?php echo $dbbt->f('state');?>, <?php echo $dbbt->f('zip');?></td>
      </tr>
      <tr>
        <td align="left">Kontakttelefon:</td>
        <td><?php echo $dbbt->f('phone_1');?> <?php echo $dbbt->f('phone_2');?> <?php echo $dbbt->f('fax');?></td>
      </tr>
      </table>

      <!-- End BillTo --> </td>

Best regards and all the best,
Kristjan Jogiste
kjogiste@yahoo.com
www.deffex.com
Deffex Media - Your idea, our realization! (www.deffex.com)

HighCore

  • Beginner
  • *
  • Posts: 2
Re: [SOLVED] Bill to Information
« Reply #8 on: June 23, 2011, 12:48:01 pm »
Hi my problem is a little bit difference,

I need to cut off some user fields from the bill to datas in confirmation email.php,
as i see here and in te confirmation_email.tpl  is needed to edit is somewhere here:

  <tr valign=top>
    <td width=50%> <!-- begin billto --> 
      <table width=100% cellspacing=0 cellpadding=2 border=0>
      <?php
      foreach( $registrationfields as $field ) {
         if( $field->name == 'email') $field->name = 'user_email';
         if( $field->name == 'delimiter_sendregistration') continue;
         if( $field->type == 'captcha') continue;
            if( $field->type == 'delimiter') { ?>
            <tr class="Stil1">
             <td colspan="2"><b class="Stil1"><?php echo $VM_LANG->_($field->title) ? $VM_LANG->_($field->title) : $field->title ?></b></td>
           </tr>
           <?php
         } else { ?>
           <tr class="Stil1">
             <td><?php echo $VM_LANG->_($field->title) ? $VM_LANG->_($field->title) : $field->title ?>:</td>
             <td><?php
             switch($field->name) {
                case 'country':
                   require_once(CLASSPATH.'ps_country.php');
                   $country = new ps_country();
                    $dbc = $country->get_country_by_code($dbbt->f($field->name));
                   if( $dbc !== false ) echo $dbc->f('country_name');
                   break;
                default:
                   echo $dbbt->f($field->name);
                   break;
             }
              ?></td>
           </tr>
          <?php
         } ?>
         <?php
      }
      ?>
      </table>

-------------------------------------

I tried to skipp those unwanted field names like :

if( $field->name == 'vm_xyfieldname') continue;

but not works...

If any body have a suggestions, i will be very happy,

thankyou