當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Varien_Event_Observer::getAdapter方法代碼示例

本文整理匯總了PHP中Varien_Event_Observer::getAdapter方法的典型用法代碼示例。如果您正苦於以下問題:PHP Varien_Event_Observer::getAdapter方法的具體用法?PHP Varien_Event_Observer::getAdapter怎麽用?PHP Varien_Event_Observer::getAdapter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Varien_Event_Observer的用法示例。


在下文中一共展示了Varien_Event_Observer::getAdapter方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: linkProductsToProfile

 /**
  * Link imported products to profile.
  * @param Varien_Event_Observer $observer
  * @throws Zend_Db_Exception
  */
 public function linkProductsToProfile(Varien_Event_Observer $observer)
 {
     /** @var AvS_FastSimpleImport_Model_Import_Entity_Product $adapter */
     $adapter = $observer->getAdapter();
     /** @var $coreResource Mage_Core_Model_Resource */
     $coreResource = Mage::getSingleton('core/resource');
     $entityProfileTable = $coreResource->getTableName('ho_import/entity');
     $entityTypeId = $adapter->getEntityTypeId();
     $now = Mage::helper('ho_import')->getCurrentDatetime();
     while ($bunch = $adapter->getNextBunch()) {
         $entityProfileData = array();
         foreach ($bunch as $rowNum => $rowData) {
             if ($adapter->getRowScope($rowData) !== Mage_ImportExport_Model_Import_Entity_Product::SCOPE_DEFAULT) {
                 continue;
             }
             if (!isset($rowData['ho_import_profile'])) {
                 continue;
             }
             $entity = $adapter->getEntityBySku($rowData[$adapter::COL_SKU]);
             $entityProfileData[] = array('profile' => $rowData['ho_import_profile'], 'entity_type_id' => $entityTypeId, 'entity_id' => $entity['entity_id'], 'updated_at' => $now, 'created_at' => $now);
         }
         if ($entityProfileData) {
             $adapter->getConnection()->insertOnDuplicate($entityProfileTable, $entityProfileData, array('updated_at'));
         }
     }
 }
開發者ID:tormit,項目名稱:Ho_Import,代碼行數:31,代碼來源:Observer.php

示例2: addSortArray

 /**
  * Add a new filter to the the Twig instance
  *
  * @param Varien_Event_Observer $observer
  */
 public function addSortArray($observer)
 {
     $twig = $observer->getTwig();
     $policy = $observer->getPolicy();
     $this->_adapter = $observer->getAdapter();
     $policy->setAllowedFilter('sort_array');
     $filter = new Twig_SimpleFilter('sort_array', array($this, 'sortArray'));
     $twig->addFilter($filter);
 }
開發者ID:tschifftner,項目名稱:Magento-MEP,代碼行數:14,代碼來源:SortArray.php

示例3: addUnserializeString

 /**
  * Add a new filter to the the Twig instance
  *
  * @param Varien_Event_Observer $observer
  */
 public function addUnserializeString($observer)
 {
     $twig = $observer->getTwig();
     $policy = $observer->getPolicy();
     $this->_adapter = $observer->getAdapter();
     $policy->setAllowedFilter('unserialize_string');
     $filter = new Twig_SimpleFilter('unserialize_string', array($this, 'unserializeString'));
     $twig->addFilter($filter);
 }
開發者ID:tschifftner,項目名稱:Magento-MEP,代碼行數:14,代碼來源:UnserializeString.php


注:本文中的Varien_Event_Observer::getAdapter方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。