public function _construct()
 {
     parent::_construct();
     $this->_init('webpos/posorder');
     $this->_resource = Mage::getResourceSingleton('core/resource');
     $magentoVersion = Mage::getVersion();
     //vietdq fix checkout 1.5
     if (version_compare($magentoVersion, '1.5', '>=') && version_compare($magentoVersion, '1.6', '<')) {
         $this->_adapter = Mage::getSingleton('core/resource')->getConnection('core_read');
     } else {
         $this->_adapter = $this->_resource->getReadConnection();
     }
 }
Exemple #2
0
 /**
  * Fill static versions arrays.
  * This routine fetches Db and Data versions of at once to optimize sql requests. However, when upgrading, it's
  * possible that 'data' column will be created only after all Db installs are passed. So $neededType contains
  * information on main purpose of calling this routine, and even when 'data' column is absent - it won't require
  * reissuing new sql just to get 'db' version of module.
  *
  * @param string $needType Can be 'db' or 'data'
  * @return Mage_Core_Model_Resource_Resource
  */
 protected function _loadVersionData($needType)
 {
     if ($needType == 'db' && is_null(self::$_versions) || $needType == 'data' && is_null(self::$_dataVersions)) {
         self::$_versions = array();
         // Db version column always exists
         self::$_dataVersions = null;
         // Data version array will be filled only if Data column exist
         if ($this->_getReadAdapter()->isTableExists($this->getMainTable())) {
             $select = $this->_getReadAdapter()->select()->from($this->getMainTable(), '*');
             $rowset = $this->_getReadAdapter()->fetchAll($select);
             foreach ($rowset as $row) {
                 self::$_versions[$row['code']] = $row['version'];
                 if (array_key_exists('data_version', $row)) {
                     if (is_null(self::$_dataVersions)) {
                         self::$_dataVersions = array();
                     }
                     self::$_dataVersions[$row['code']] = $row['data_version'];
                 }
             }
         }
     }
     return $this;
 }
 /**
  * DB1_AnyMarket_Helper_CustomerGenerator constructor.
  */
 public function __construct()
 {
     $this->_resource = Mage::getResourceSingleton('core/resource');
     $this->_adapter = $this->_resource->getReadConnection();
 }
 /**
  * Retrieve DB table name
  *
  * @param string $factoryName
  *
  * @return string
  */
 protected function _getTableName($factoryName)
 {
     return $this->_resourceModel->getTable($factoryName);
 }