Monday, December 20, 2010

virtuemart: Enable Billing information in Order Review page

Quick script to paste into the virtuemart checkout confirmation page to show the billing information under the shipping info.

Step 1:
Search for "if(NO_SHIPTO=='')" in your components/com_virutemart/themes/YOURTHEME/templates/checkout/get_final_confirmation.tpl.php

Step 2:
and find the last line that reads
echo "</td></tr>";


Step 3:
Just after that last line paste the below contents.

$db->query("SELECT * FROM #__{vm}_user_info WHERE user_id=".strip_tags($db->f("user_id"))." and address_type='BT'");
    $db->next_record();
 
    
    echo '<tr><td valign="top"><strong>'.$VM_LANG->_('PHPSHOP_ORDER_PRINT_CUST_BILLING_LBL') . ":</strong></td>";
    echo '<td>';
    echo vmFormatAddress( array('name' => $db->f("first_name")." ".$db->f("last_name"),
                                        'address_1' => $db->f("address_1"),
                                        'address_2' => $db->f("address_2"),
                                        'state' => $db->f("state"),
                                        'zip' => $db->f("zip"),
                                        'city' => $db->f("city"),
                                        'country' => $db->f('country')
                                    ), true );
    
    echo "</td></tr>";



Stumble Upon CodePyro

3 comments:

Anonymous said...

Is it possible to show more user data, e.g. costum user fields there?

Anonymous said...

AWESOME! I've been looking for this ALL OVER. Many thanks. Testing it right now. Will check back either way! .... Okay just did it, works PERFECT!!!

Josh Tischer :: CodePyro said...

to add custom user fields or company name just output the data just above the vmFormatAddress function.

likea so
if($db->f("company"))
echo $db->f("company")."
";

I tried adding company field to the vmFormatAddress and gave up after about 30mins of no-worky

Post a Comment