Author Topic: address_type and #__users  (Read 6173 times)

durian

  • Beginner
  • *
  • Posts: 49
address_type and #__users
« on: November 15, 2005, 19:41:31 pm »
I'm looking at the authorize.net code so I can update my PayFlow Pro module.  Around line 236 in
ps_authorize.php, I see the following code:

Code: [Select]
        // Get user billing information
        $dbbt = new ps_DB;
        $qt = "SELECT * FROM #__users WHERE id='".$auth["user_id"]."' AND address_type='BT'";
        $dbbt->query($qt);
        $dbbt->next_record();

When I try to use similar code in ps_pfp.php, I get an error stating:
 Unknown column 'address_type' in 'where clause'

Looking at other code, I see most address_type accesses are to #__{vm}_user_info, as in the code right below my citation that gathers the shipping address:
Code: [Select]
            // Get user billing information
            $dbst =& new ps_DB;
            $qt = "SELECT * FROM #__{vm}_user_info WHERE user_info_id='".$d["ship_to_info_id"]."' AND address_type='ST'";
            $dbst->query($qt);
            $dbst->next_record();

Is the code shown above correct (and thus I just have a bug in my own code), or there an error here?

Thanks,
mike

Soeren

  • Administrator
  • Sr. Member
  • *
  • Posts: 3106
  • VirtueMart Starter
    • virtuemart.net
Re: address_type and #__users
« Reply #1 on: November 16, 2005, 20:43:10 pm »
Your code correction is ok.
I've changed that in CVS now.

ciao, Soeren
The future of eCommerce: VirtueMart & Joomla!
http://virtuemart.net

buddyq

  • Beginner
  • *
  • Posts: 12
Re: address_type and #__users
« Reply #2 on: June 24, 2010, 17:23:09 pm »
 :(

Hey so I just found this post and its from 2005?? I turned on DEBUG and upon final checkout got this same error with this code in checkout.confirm.php

Code: [Select]
$q  = "SELECT * from #__users WHERE ";
$q .= "id='" . $auth["user_id"] . "' ";
$q .= "AND address_type='BT'";
$db->query($q);
if(!$db->num_rows()) {
    $q  = "SELECT * from #__{vm}_user_info WHERE ";
    $q .= "user_id='" . $auth["user_id"] . "' ";
    $q .= "AND address_type='BT'";
    $db->query($q);
}

So, I'm not sure how to fix this error other than getting rid  of the address_type in the first sequence but then $db->num_rows() would be have something... and if I changed the table to be user_info.. then its the exact same code as inside the IF statement. So what's the proper thing to do here? If this post is from 2005, why hasn't this been fixed yet?

Buddy