示例#1
0
 /**
  * Constructor with parameters
  * Array of arguments with keys
  *  - 'connection' Varien_Db_Adapter_Interface
  *  - 'metadata' Enterprise_Mview_Model_Metadata
  *  - 'factory' Enterprise_Mview_Model_Factory
  *
  * @param array $args
  */
 public function __construct(array $args)
 {
     $this->_setConnection($args['connection']);
     $this->_setMetadata($args['metadata']);
     $this->_setFactory($args['factory']);
     $this->_changelog = $this->_factory->getMagentoDbObjectTable($this->_connection, $this->_metadata->getChangelogName());
 }
 /**
  * Constructor with parameters
  *
  * @param array $args Array of arguments with keys
  *  - 'metadata' Enterprise_Mview_Model_Metadata
  *  - 'connection' Varien_Db_Adapter_Interface
  *  - 'factory' Enterprise_Mview_Model_Factory
  */
 public function __construct(array $args)
 {
     $this->_metadata = $args['metadata'];
     $this->_app = !empty($args['app']) ? $args['app'] : Mage::app();
     $this->_factory = $args['factory'];
     $this->_indexer = $this->_factory->getSingleton('smile_virtualcategories/indexer_virtualCategories_product_position');
 }
 /**
  * Constructor with parameters
  *
  * @param array $args Array of arguments with keys
  *  - 'metadata' Enterprise_Mview_Model_Metadata
  *  - 'connection' Varien_Db_Adapter_Interface
  *  - 'factory' Enterprise_Mview_Model_Factory
  */
 public function __construct(array $args)
 {
     $this->_metadata = $args['metadata'];
     $this->_app = !empty($args['app']) ? $args['app'] : Mage::app();
     $this->_factory = $args['factory'];
     $this->_indexer = $this->_factory->getSingleton('smile_elasticsearch/indexer_search_terms_position');
 }
示例#4
0
 /**
  * Constructor with parameters
  * Array of arguments with keys
  *  - 'connection' Varien_Db_Adapter_Interface
  *  - 'metadata' Enterprise_Mview_Model_Metadata
  *  - 'factory' Enterprise_Mview_Model_Factory
  *
  * @param array $args
  */
 public function __construct(array $args)
 {
     $this->_setConnection($args['connection']);
     $this->_setMetadata($args['metadata']);
     $this->_setFactory($args['factory']);
     $this->_table = $this->_factory->getMagentoDbObjectTable($this->_connection, $this->_metadata->getTableName());
     $this->_view = $this->_factory->getMagentoDbObjectView($this->_connection, $this->_metadata->getViewName());
 }
 /**
  * Constructor with parameters
  *
  * @param array $args Array of arguments with keys
  *  - 'metadata' Enterprise_Mview_Model_Metadata
  *  - 'connection' Varien_Db_Adapter_Interface
  *  - 'factory' Enterprise_Mview_Model_Factory
  */
 public function __construct(array $args)
 {
     $this->_app = !empty($args['app']) ? $args['app'] : Mage::app();
     $this->_factory = $args['factory'];
     parent::__construct($args);
     /** @var $changelog Enterprise_Index_Model_Changelog */
     $changelog = $this->_factory->getModel('enterprise_index/changelog', array('connection' => $this->_connection, 'metadata' => $this->_metadata));
     $this->_changedIds = $changelog->loadByMetadata();
     $this->_changedIds = array_unique($this->_changedIds);
 }
 /**
  * Retrieve default connection
  *
  * @return Varien_Db_Adapter_Interface
  */
 protected function _getDefaultConnection()
 {
     if (null === $this->_defaultConnection) {
         $this->_defaultConnection = $this->_factory->getSingleton('core/resource')->getConnection(Mage_Core_Model_Resource::DEFAULT_WRITE_RESOURCE);
     }
     return $this->_defaultConnection;
 }
 /**
  * Constructor with parameters
  * Array of arguments with keys
  *  - 'metadata' Enterprise_Mview_Model_Metadata
  *  - 'connection' Varien_Db_Adapter_Interface
  *  - 'factory' Mage_Core_Model_Factory
  *
  * @param array $args
  */
 public function __construct(array $args)
 {
     $this->_setConnection($args['connection']);
     $this->_setMetadata($args['metadata']);
     $this->_setFactory($args['factory']);
     $this->_uniqueIdentifier = $this->_factory->getHelper('core')->uniqHash();
 }
示例#8
0
 /**
  * Multi add entities data to fulltext search table
  *
  * @deprecated since version 1.13.2
  * @param int $storeId
  * @param array $entityIndexes
  * @return void
  */
 protected function _saveEntityIndexes($storeId, $entityIndexes)
 {
     $data = array();
     $storeId = (int) $storeId;
     foreach ($entityIndexes as $entityId => $index) {
         $data[] = array('product_id' => (int) $entityId, 'store_id' => $storeId, 'data_index' => $index);
     }
     if ($data) {
         $this->_factory->getResourceHelper('catalogsearch')->insertOnDuplicate($this->_getMainTable(), $data, array('data_index'));
     }
 }
示例#9
0
 /**
  * Get select for all products
  *
  * @param $store
  * @return Varien_Db_Select
  */
 protected function _getAllProducts(Mage_Core_Model_Store $store)
 {
     if (!isset($this->_allProductsSelect[$store->getId()])) {
         /** @var $eavConfig Mage_Eav_Model_Config */
         $eavConfig = $this->_factory->getSingleton('eav/config');
         $statusAttributeId = $eavConfig->getAttribute(Mage_Catalog_Model_Product::ENTITY, 'status')->getId();
         $visibilityAttributeId = $eavConfig->getAttribute(Mage_Catalog_Model_Product::ENTITY, 'visibility')->getId();
         $select = $this->_connection->select()->from(array('cp' => $this->_getTable('catalog/product')), array())->joinInner(array('cpw' => $this->_getTable('catalog/product_website')), 'cpw.product_id = cp.entity_id', array())->joinInner(array('cpsd' => $this->_getTable(array('catalog/product', 'int'))), 'cpsd.entity_id = cp.entity_id AND cpsd.store_id = 0 AND cpsd.attribute_id = ' . $statusAttributeId, array())->joinLeft(array('cpss' => $this->_getTable(array('catalog/product', 'int'))), 'cpss.entity_id = cp.entity_id AND cpss.attribute_id = cpsd.attribute_id' . ' AND cpss.store_id = ' . $store->getId(), array())->joinInner(array('cpvd' => $this->_getTable(array('catalog/product', 'int'))), 'cpvd.entity_id = cp.entity_id AND cpvd.store_id = 0' . ' AND cpvd.attribute_id = ' . $visibilityAttributeId, array())->joinLeft(array('cpvs' => $this->_getTable(array('catalog/product', 'int'))), 'cpvs.entity_id = cp.entity_id AND cpvs.attribute_id = cpvd.attribute_id ' . 'AND cpvs.store_id = ' . $store->getId(), array())->joinLeft(array('ccp' => $this->_getTable('catalog/category_product')), 'ccp.product_id = cp.entity_id', array())->where('cpw.website_id = ?', $store->getWebsiteId())->where($this->_connection->getIfNullSql('cpss.value', 'cpsd.value') . ' = ?', Mage_Catalog_Model_Product_Status::STATUS_ENABLED)->where($this->_connection->getIfNullSql('cpvs.value', 'cpvd.value') . ' IN (?)', array(Mage_Catalog_Model_Product_Visibility::VISIBILITY_BOTH, Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_CATALOG, Mage_Catalog_Model_Product_Visibility::VISIBILITY_IN_SEARCH))->group('cp.entity_id')->columns(array('category_id' => new Zend_Db_Expr($store->getRootCategoryId()), 'product_id' => 'cp.entity_id', 'position' => new Zend_Db_Expr($this->_connection->getCheckSql('ccp.product_id IS NOT NULL', 'ccp.position', '0')), 'is_parent' => new Zend_Db_Expr($this->_connection->getCheckSql('ccp.product_id IS NOT NULL', '0', '1')), 'store_id' => new Zend_Db_Expr($store->getId()), 'visibility' => new Zend_Db_Expr($this->_connection->getIfNullSql('cpvs.value', 'cpvd.value'))));
         $this->_allProductsSelect[$store->getId()] = $select;
     }
     return $this->_allProductsSelect[$store->getId()];
 }
示例#10
0
 /**
  * Returns subscriber collection instance
  *
  * @return Enterprise_Mview_Model_Resource_Subscriber_Collection
  */
 protected function _getSubscriberCollection()
 {
     return $this->_factory->getModel('enterprise_mview/subscriber')->getCollection();
 }