コード例 #1
0
 function setListCollection()
 {
     $flexibleSearch = new VF_FlexibleSearch(new VF_Schema(), $this->getRequest());
     if ($flexibleSearch->shouldClear()) {
         return;
     }
     $this->getChild('search_result_list')->setCollection($this->_getProductCollection());
 }
コード例 #2
0
 public function onBootstrap(MvcEvent $e)
 {
     if (!isset($_SESSION)) {
         session_start();
     }
     define('ELITE_CONFIG_DEFAULT', dirname(__FILE__) . '/config.default.ini');
     define('ELITE_CONFIG', dirname(__FILE__) . '/config.ini');
     define('ELITE_PATH', '');
     /** @var $zf2DB  \Zend\Db\Adapter\Adapter */
     $zf2DB = $e->getApplication()->getServiceManager()->get('Zend\\Db\\Adapter\\Adapter');
     $pdo = $zf2DB->getDriver()->getConnection()->getResource();
     $zf1DB = $this->createDB($pdo);
     \VF_Singleton::getInstance()->setReadAdapter($zf1DB);
     \VF_Singleton::getInstance()->setRequest(new \Zend_Controller_Request_Http());
     \VF_Singleton::getInstance()->setProcessURL('/vf/process?');
     $search = new \VF_FlexibleSearch(new \VF_Schema(), new \Zend_Controller_Request_Http());
     //$search->setConfig(new \Zend_Config(array()));
     $search->storeFitInSession();
 }
コード例 #3
0
ファイル: Singleton.php プロジェクト: vehiclefits/library
 /** @return VF_FlexibleSearch */
 function flexibleSearch()
 {
     if (!$this->flexibleSearch instanceof VF_FlexibleSearch) {
         $this->flexibleSearch = new VF_FlexibleSearch($this->schema(), $this->getRequest());
         $this->flexibleSearch->setConfig($this->getConfig());
     }
     if ($this->shouldEnableVafWheelModule()) {
         $this->flexibleSearch = new VF_Wheel_FlexibleSearch($this->flexibleSearch);
     }
     if ($this->shouldEnableVaftireModule()) {
         $this->flexibleSearch = new VF_Tire_FlexibleSearch($this->flexibleSearch);
     }
     if ($this->shouldEnableVafwheeladapterModule()) {
         $this->flexibleSearch = new VF_Wheeladapter_FlexibleSearch($this->flexibleSearch);
     }
     return $this->flexibleSearch;
 }
コード例 #4
0
 /** @return VF_FlexibleSearch */
 function flexibleSearch()
 {
     $search = new VF_FlexibleSearch($this->schema(), $this->getRequest());
     $search->setConfig($this->getConfig());
     if (file_exists(ELITE_PATH . '/Vafwheel')) {
         $search = new Elite_Vafwheel_Model_FlexibleSearch($search);
     }
     if (file_exists(ELITE_PATH . '/Vaftire')) {
         $search = new Elite_Vaftire_Model_FlexibleSearch($search);
     }
     if (file_exists(ELITE_PATH . '/Vafwheeladapter')) {
         $search = new Elite_Vafwheeladapter_Model_FlexibleSearch($search);
     }
     return $search;
 }
 function testShouldAutomaticallyClearInvalidSession()
 {
     $_SESSION = array('make'=>99, 'model'=>99, 'year'=>99);
     $helper = $this->getHelper();
     $flexibleSearch = new VF_FlexibleSearch(new VF_Schema, $this->getRequest());
     $this->assertFalse($flexibleSearch->getFlexibleDefinition(), 'when fitment is deleted should automatically clear invalid session');
 }
コード例 #6
0
 /** @return array */
 function getRequestLevels()
 {
     $levels = array();
     $displayLevels = $this->getLevels();
     foreach ($displayLevels as $level) {
         $search = new VF_FlexibleSearch($this->getSchema(), $this->getRequest());
         $val = $search->getValueForSelectedLevel($level);
         if (!is_null($val)) {
             $levels[$level] = $val;
         }
     }
     return $levels;
 }
コード例 #7
0
ファイル: FitMMYTest.php プロジェクト: vehiclefits/library
 function testGetLevelAndValueForSelectedPreviousLevels()
 {
     $vehicle1 = $this->createVehicle(array('make' => 'Toyota', 'model' => 'Camry', 'year' => '2002', 'engine' => '2.4L 2AZ-FE'));
     $vehicle2 = $this->createVehicle(array('make' => 'Chevrolet', 'model' => 'Astro Van', 'year' => '2001', 'engine' => '4.3L V6'));
     $vehicle3 = $this->createVehicle(array('make' => 'Chevrolet', 'model' => 'Tahoe', 'year' => '2002', 'engine' => '5.3L V8'));
     $flexibleSearch = new VF_FlexibleSearch(new VF_Schema(), $this->getRequest($vehicle3->toValueArray()));
     $expectedResponse = array('make' => $vehicle3->getLevel('make')->getId(), 'model' => $vehicle3->getLevel('model')->getId(), 'year' => $vehicle3->getLevel('year')->getId());
     $this->assertEquals($expectedResponse, $flexibleSearch->getLevelAndValueForSelectedPreviousLevels('engine'));
 }