0

I have upgraded to Magento 1.9.2 and am using the rwd theme (with a few tweaks). I have checkout as guest enabled. When you get to the stage in ordering where you choose between 'Checkout as Guest' or 'Register and Checkout', no matter which option you choose the continue button does not work. I enabled logging and the following errors were in the log although they don't seem to be created by clicking the continue button as such, i.e. clicking the button repeatedly does not create any more errors. Could they nonetheless be the reason the button isn't working?:

 ERR (3): Notice: Undefined offset: 1 in /var/www/html/magento/lib/Zend/Db/Adapter/Abstract.php on line 814

and

 ERR (3): Notice: Undefined offset: 1 in /var/www/html/magento/app/code/local/Bintime/Sinchimport/Model/Layer/Filter/Price.php on line 146

The code around line 814 in Abstract.php is:

 public function fetchPairs($sql, $bind = array())
 {
      $stmt = $this->query($sql, $bind);
      $data = array();
      while ($row = $stmt->fetch(Zend_Db::FETCH_NUM)) {
            $data[$row[0]] = $row[1];   //This is line 814
      }
      return $data;
 }

The code around line 146 in Price.php is

 protected function _getItemsData()
 {
      $import=Mage::getModel('sinchimport/sinch');
      $price_breaks=$import->price_breaks_filter;

      if(strstr($price_breaks, ';')){
          $price_ranges = explode(';', $price_breaks);

          foreach ($price_ranges as $price_range) {
                $price_range_value=trim($price_range);
                if($price_range && $price_range!=''){

                     $price_range = explode('-', $price_range);
                     list($minPrice, $maxPrice) = $price_range;  // This is line 146
                     if(((int)$minPrice || $minPrice==0) && ((int)$maxPrice || $maxPrice=='*')){
                          $count=$this->_getResource()->getCountMinMaxPrice($this, $minPrice, $maxPrice);
                          if($count){
                              $data[] = array(
                                      'label' => $this->_renderItemLabelMinMaxPrice($minPrice, $maxPrice),
                                      'value' =>$price_range_value,
                                      'count' => $count,
                                       );
                           }
                      }
                }
           }
           if($data){
               return $data;
           }
       }

       $range         = $this->getPriceRange();
       $dbRanges      = $this->getRangeItemCounts($range);
       $data          = array();

       foreach ($dbRanges as $index=>$count) {
           $data[] = array(
                   'label' => $this->_renderItemLabel($range, $index),
                   'value' => $index . ',' . $range,
                   'count' => $count,
                   );
        }

        return $data;
  }
2
  • Notice errors should be turned off on a production store. Do you have Developer Mode turned on in your index.php? Sep 18, 2015 at 10:23
  • Not yet, but I am about to as per answer below. This is a dev site btw
    – Alistair67
    Sep 18, 2015 at 10:25

1 Answer 1

2

Turn on SQL Logging.

Example in Lib/Varien/Db/Adapter/Pdo/Mysql.php:

protected $_debug               = true;
protected $_logAllQueries       = true;
protected $_logCallStack        = true;

Then turn on errors/reporting and put Magento in developers mode, so it will raise a exception and stop executing in index.php.

$_SERVER['MAGE_IS_DEVELOPER_MODE'] = true;
ini_set('display_errors', 1);

Flush Cache 'full' (just to be on the safe side) and reload page.

Then open your log file in /var/log/ and scroll down to the last SELECT ... query and look at it. Than try this out on your database, and look if its a warning or it has two field pairs. Like KEY + VALUE >== $data[$row[0]] = $row[1];

Good luck and happy hacking !

9
  • Thanks for answering @Roger. I edited Mysql.php as you suggest, then added $_SERVER etc before if (isset($_SERVER['MAGE_IS_DEVELOPER_MODE'])) { Mage::setIsDeveloperMode(true); } and uncommented ini_set etc in index.php. Then I added an item to my basket and on continue to checkout nothing happened, as before. When I check system.log in [magento directory]/var/log there are no more error messages. I also tried 'mysqld.log' in /var/log but nothing. Is there somewhere else I should look?
    – Alistair67
    Sep 18, 2015 at 10:55
  • What do you mean with: "I also tried 'mysqld.log' in /var/log but nothing." is it empty ? There should be SQL in it... You want to know the last select statement executed. Sep 18, 2015 at 11:14
  • I mean that there is only the startup/shutdown info, there are no SQL queries.
    – Alistair67
    Sep 18, 2015 at 11:16
  • Ok copy that, try this for 'sanity check': assert(get_class(Mage::getSingleton('core/resource')->getConnection('core_read')) == 'Magento_Db_Adapter_Pdo_Mysql'); If it failes 'revert' the adaptor file and find the 'used' adapter...(get_class = dir+filename) Sep 18, 2015 at 11:32
  • Sorry ! It's: LIB/MAGENTO/..... not LIB/VARIEN/..... for my instance. (Magento 1.9.2 with my config...), so just do: die(get_class(Mage::getSingleton('core/resource')->getConnection('core_read')‌​)); and read the class name and lookup the file. Sorry, i'm assuming that it would be the same i use for a project. I'm now on a 'fresh' installation....(Oeps, that was silly of me) Sep 18, 2015 at 11:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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