0

We are getting the following error on or site when some customers try to proceed to checkout.

There has been an error processing your request

SQLSTATE[42S22]: Column not found: 1054 Unknown column '0F' in 'where clause'


Trace:
#0 /chroot/home/bearcree/bearcreekarsenal.com/html/lib/Varien/Db/Statement/Pdo/Mysql.php(110): Zend_Db_Statement_Pdo->_execute(Array)
#1 /chroot/home/bearcree/bearcreekarsenal.com/html/app/code/core/Zend/Db/Statement.php(291): Varien_Db_Statement_Pdo_Mysql->_execute(Array)
#2 /chroot/home/bearcree/bearcreekarsenal.com/html/lib/Zend/Db/Adapter/Abstract.php(480): Zend_Db_Statement->execute(Array)
#3 /chroot/home/bearcree/bearcreekarsenal.com/html/lib/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('??SELECT ?id,??...', Array)
#4 /chroot/home/bearcree/bearcreekarsenal.com/html/lib/Varien/Db/Adapter/Pdo/Mysql.php(428): Zend_Db_Adapter_Pdo_Abstract->query('??SELECT ?id,??...', Array)
#5 /chroot/home/bearcree/bearcreekarsenal.com/html/_edreamz/customer/_inc.get-all-saved-customer-ffls.php(89): Varien_Db_Adapter_Pdo_Mysql->query('??SELECT ?id,??...')
#6 /chroot/home/bearcree/bearcreekarsenal.com/html/_edreamz/checkout/_inc.ffl_shipping-customer-saved-dealers.php(3): include('/chroot/home/be...')
#7 /chroot/home/bearcree/bearcreekarsenal.com/html/app/design/frontend/default/edreamz/template/checkout/onepage/shipping.phtml(36): include('/chroot/home/be...')
#8 /chroot/home/bearcree/bearcreekarsenal.com/html/app/code/core/Mage/Core/Block/Template.php(241): include('/chroot/home/be...')
#9 /chroot/home/bearcree/bearcreekarsenal.com/html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/defaul...')
#10 /chroot/home/bearcree/bearcreekarsenal.com/html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#11 /chroot/home/bearcree/bearcreekarsenal.com/html/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Template->_toHtml()
#12 /chroot/home/bearcree/bearcreekarsenal.com/html/app/code/core/Mage/Core/Block/Abstract.php(637): Mage_Core_Block_Abstract->toHtml()
#13 /chroot/home/bearcree/bearcreekarsenal.com/html/app/code/core/Mage/Core/Block/Abstract.php(581): Mage_Core_Block_Abstract->_getChildHtml('shipping', true)
#14 /chroot/home/bearcree/bearcreekarsenal.com/html/app/design/frontend/default/edreamz/template/checkout/onepage.phtml(43): Mage_Core_Block_Abstract->getChildHtml('shipping')
#15 /chroot/home/bearcree/bearcreekarsenal.com/html/app/code/core/Mage/Core/Block/Template.php(241): include('/chroot/home/be...')
#16 /chroot/home/bearcree/bearcreekarsenal.com/html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/defaul...')
#17 /chroot/home/bearcree/bearcreekarsenal.com/html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#18 /chroot/home/bearcree/bearcreekarsenal.com/html/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Template->_toHtml()
#19 /chroot/home/bearcree/bearcreekarsenal.com/html/app/code/core/Mage/Core/Block/Text/List.php(43): Mage_Core_Block_Abstract->toHtml()
#20 /chroot/home/bearcree/bearcreekarsenal.com/html/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Text_List->_toHtml()
#21 /chroot/home/bearcree/bearcreekarsenal.com/html/app/code/core/Mage/Core/Block/Abstract.php(637): Mage_Core_Block_Abstract->toHtml()
#22 /chroot/home/bearcree/bearcreekarsenal.com/html/app/code/core/Mage/Core/Block/Abstract.php(581): Mage_Core_Block_Abstract->_getChildHtml('content', true)
#23 /chroot/home/bearcree/bearcreekarsenal.com/html/app/design/frontend/default/edreamz/template/page/2columns-right.phtml(55): Mage_Core_Block_Abstract->getChildHtml('content')
#24 /chroot/home/bearcree/bearcreekarsenal.com/html/app/code/core/Mage/Core/Block/Template.php(241): include('/chroot/home/be...')
#25 /chroot/home/bearcree/bearcreekarsenal.com/html/app/code/core/Mage/Core/Block/Template.php(272): Mage_Core_Block_Template->fetchView('frontend/defaul...')
#26 /chroot/home/bearcree/bearcreekarsenal.com/html/app/code/core/Mage/Core/Block/Template.php(286): Mage_Core_Block_Template->renderView()
#27 /chroot/home/bearcree/bearcreekarsenal.com/html/app/code/core/Mage/Core/Block/Abstract.php(919): Mage_Core_Block_Template->_toHtml()
#28 /chroot/home/bearcree/bearcreekarsenal.com/html/app/code/core/Mage/Core/Model/Layout.php(555): Mage_Core_Block_Abstract->toHtml()
#29 /chroot/home/bearcree/bearcreekarsenal.com/html/app/code/core/Mage/Core/Controller/Varien/Action.php(390): Mage_Core_Model_Layout->getOutput()
#30 /chroot/home/bearcree/bearcreekarsenal.com/html/app/code/core/Mage/Checkout/controllers/OnepageController.php(215): Mage_Core_Controller_Varien_Action->renderLayout()
#31 /chroot/home/bearcree/bearcreekarsenal.com/html/app/code/core/Mage/Core/Controller/Varien/Action.php(418): Mage_Checkout_OnepageController->indexAction()
#32 /chroot/home/bearcree/bearcreekarsenal.com/html/app/code/core/Mage/Core/Controller/Varien/Router/Standard.php(250): Mage_Core_Controller_Varien_Action->dispatch('index')
#33 /chroot/home/bearcree/bearcreekarsenal.com/html/app/code/core/Mage/Core/Controller/Varien/Front.php(172): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#34 /chroot/home/bearcree/bearcreekarsenal.com/html/app/code/core/Mage/Core/Model/App.php(354): Mage_Core_Controller_Varien_Front->dispatch()
#35 /chroot/home/bearcree/bearcreekarsenal.com/html/app/Mage.php(684): Mage_Core_Model_App->run(Array)
#36 /chroot/home/bearcree/bearcreekarsenal.com/html/index.php(88): Mage::run('', 'store')
#37 {main}

Update:

Here are the additional files

File: _inc.get-all-saved-customer-ffls.php

<?php

// Load magento
require_once $_SERVER['DOCUMENT_ROOT'] . '/app/Mage.php';
umask(0);
Mage::app();

// Initializes the Session for the FRONTEND 
$session = Mage::getSingleton('core/session', array('name'=>'frontend'));

if(Mage::getSingleton('customer/session')->isLoggedIn()) {
     $customerData = Mage::getSingleton('customer/session')->getCustomer();
     $custId = $customerData->getId();
     $defaultFFL = $customerData->getData('preferred_ffl');
     $savedFFLs = $customerData->getData('user_ffls');

     if(!empty($savedFFLs) && $savedFFLs != '') {
    $fflArray = explode(':', $savedFFLs);

 } 

 }
    $fflSearch = $defaultFFL;

//  if($fflArray) :

//     $ids = implode(", ", $fflArray);
//     $ids = rtrim($ids,', ');
//     $fflSearch .= ", " . implode(", ", $fflArray);
//     $fflSearch = rtrim($fflSearch,', ');


// endif;




// Magento PDO
$db = Mage::getSingleton('core/resource')->getConnection('core_write');

$fflCountries = json_decode(Mage::helper('directory')->getRegionJson());

$count = 1;



if(!empty($defaultFFL) && $defaultFFL != '') :
// select for default dealer
$sql = "
    SELECT  id,
        license_name,
        IFNULL(business_name, license_name) AS business_name,
        premise_street,
        premise_city,
        premise_state,
        latitude,
        longitude,
        LEFT(premise_zip, 5) AS premise_zip,
        CONCAT_WS('-', regn, dist, cnty, type, xprdte, seqn) AS license,
        voice_phone,
        is_license_on_file,
        is_preferred,
        CASE
            WHEN IFNULL(is_preferred, 0) = 1 THEN 'Preferred Dealer'
            WHEN IFNULL(is_license_on_file, 0) = 1 THEN 'License On File'
            ELSE ''
        END AS label,
        CASE
            WHEN IFNULL(is_preferred, 0) = 1 THEN '1'
            WHEN IFNULL(is_license_on_file, 0) = 1 THEN '2'
            ELSE '3'
        END AS label_sort,

        CASE
            WHEN IFNULL(is_preferred, 0) = 0 THEN ''
            ELSE 'Preferred Dealer '
        END AS preferred,
        CASE
            WHEN IFNULL(is_license_on_file, 0) = 0 THEN ''
            ELSE 'On File'
        END AS on_file
FROM    edreamz_ffl
WHERE   id IN (".$fflSearch.")
AND     accept_transfers = 1
LIMIT   100
";

    // run query
$qFFL = $db->query($sql);

// default json variable
$json = array();


// loop through query & populate json variable
while ($row = $qFFL->fetch()) :
// get ratings and transfer fees 
$rateSql = "
    SELECT  id,
            user_id,
            ffl_id,
            transfer_fee,
            rating,
            created
    FROM    edreamz_ffl_rating
    WHERE   ffl_id = '". $row['id'] ."'
";
$qRatings = $db->query($rateSql);
$ratings = 0;
$fees = 0;
$totalRatings = 0;
//var_dump($qRatings->fetch());

    while($rateRow = $qRatings->fetch() ) :
        $totalRatings++;
        $ratings += (int)$rateRow['rating'];
        $fees += $rateRow['transfer_fee'];
        /*$row['rating'] = $finalRating;
        $row['total_ratings'] = $thisTotal;
        echo $row['rating'];
        echo $rateRow['rating'];*/
    endwhile;
    if($totalRatings != 0) {
    $row['rating'] = ($ratings / $totalRatings);
    $row['avg_transfer_fee'] = ($fees / $totalRatings);
    $row['total_ratings'] = $totalRatings;
    } else {
        $row['rating'] = 0;
        $row['avg_transfer_fee'] = 0;
        $row['total_ratings'] = 0;
    }
$row['business_name'] = (trim($row['business_name']) == "") ? $row['license_name'] : $row['business_name'];

foreach((array)$fflCountries->US as $num => $item) :
    if($item->code == $row['premise_state']) :
        $row['region_id'] = $num;
        $row['region'] = $item->name;
    endif;

    $count++;
endforeach;


$json = $row;
endwhile;


$user_ffl = $json;
// echo '<div style="display: none;"><pre>';
// var_dump($user_ffl);
// echo '</pre></div>';
endif;

?>
  • I'd say you need just to disable Compilation and than try it out again :) – StasGrin Jul 13 '17 at 21:44
0

So we ended up finding an answer that was simple and right in front of our faces. Our customer service department started entering FFL numbers with "-" and the system didn't know how to handle the information as entered. We ended up going into the database and removing the incorrect data manually. Once we did this it functions correctly.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.