Пример #1
0
 protected function _prepareParams($params)
 {
     $pageMode = isset($params['pageMode']) ? $params['pageMode'] : '';
     unset($params['pageMode']);
     $tmsActivityId = isset($params['activity']) ? $params['activity'] : null;
     Mage::register('current_activity', $tmsActivityId);
     if (null === $tmsActivityId) {
         $tmsActivityId = Vikont_Fitment_Helper_Data::getActivityId();
     }
     unset($params['activity']);
     // TMS activity
     $fitmentId = isset($params['fitment']) ? $params['fitment'] : null;
     unset($params['fitment']);
     $vehicleName = isset($params['vehicle']) ? $params['vehicle'] : '';
     unset($params['vehicle']);
     $brandId = isset($params['brand']) ? $params['brand'] : '';
     unset($params['brand']);
     $categoryId = isset($params['category']) ? $params['category'] : ('tireBySize' == $pageMode || 'tireByRide' == $pageMode ? Mage::helper('fitment')->getTiresCategoryId() : '');
     unset($params['category']);
     $subCategoryId = isset($params['subCategory']) ? $params['subCategory'] : '';
     unset($params['subCategory']);
     $viewMode = isset($params['viewMode']) ? $params['viewMode'] : Vikont_Fitment_Block_Fitment_Toolbar::getViewMode();
     unset($params['viewMode']);
     $options = array('sort' => Vikont_Fitment_Block_Fitment_Toolbar::getDefaultSort(), 'skip' => 0, 'take' => (int) Vikont_Fitment_Block_Fitment_Pager::getDefaultPageSize(), 'term' => '', 'includeFacets' => 'true', 'minPrice' => null, 'maxPrice' => null);
     $options = array_merge($options, $params);
     if ($brandId) {
         $options['brandId'] = array($brandId);
     }
     if ($categoryId) {
         $options['categoryId'] = array($categoryId);
     }
     if ($subCategoryId) {
         $options['subCategoryId'] = array($subCategoryId);
     }
     $rideRequired = true;
     if ('tireBySize' == $pageMode) {
         $fitmentId = null;
         $rideRequired = false;
     } else {
         if ($fitmentId) {
             $rideRequired = false;
             $options['fitmentId'] = $fitmentId;
             $ride = Mage::helper('fitment')->setCurrentRide($tmsActivityId, $fitmentId, $vehicleName);
             $vehicleName = $ride['name'];
         } else {
             $ride = Mage::helper('fitment')->getCurrentRide($tmsActivityId);
             $fitmentId = $ride['id'];
             $vehicleName = $ride['name'];
             $options['fitmentId'] = $fitmentId;
             $rideRequired = !$fitmentId;
         }
     }
     $rideRequired = false;
     // this prevents forcing customers to pick vehicle first
     $pageHeader = $pageMode ? $this->__('Tireshop') : $this->__('Shop by Fitment');
     return array('params' => array('activity' => $tmsActivityId), 'options' => $options, 'viewMode' => $viewMode, 'activityId' => $tmsActivityId, 'ariActivityId' => Vikont_Fitment_Helper_Data::getTmsActivity($tmsActivityId, 'ari_activity'), 'fitmentId' => $fitmentId, 'vehicle' => $vehicleName, 'pageMode' => $pageMode, 'rideRequired' => $rideRequired, 'pageHeader' => $pageHeader);
 }
Пример #2
0
 public static function collectCommonParams()
 {
     $result = array('includeFacets' => true, 'skip' => 0, 'take' => Vikont_Fitment_Block_Fitment_Pager::getDefaultPageSize(), 'sort' => Vikont_Fitment_Block_Fitment_Toolbar::getDefaultSort());
     return $result;
 }