Пример #1
0
 public function executeManuf(sfWebRequest $request)
 {
     $this->param = array();
     $this->param['category'] = 'Fuses';
     $this->param['cat_slug'] = 'fuses';
     $this->param['manuf_slug'] = $this->getRequestParameter('manuf_slug');
     $this->param['manuf_id'] = LWS::getManufPk($this->param['manuf_slug']);
     $this->param['manuf'] = LWS::unslugify($this->param['manuf_slug'], true);
     $this->param['subnav_grouping'] = intval(sfConfig::get('app_cb_max_subcat_grouping'));
     $this->param['subcategory'] = 'Classes/Types';
     $this->param['subcat_slug'] = 'class-type';
     // should be overwritten for each section
     $category = new FUCategory();
     $this->param['manuf_list'] = $category->fetchManufList($this->param['manuf_id']);
     $this->param['manuf_list_class'] = 'bottom';
     $this->param['sections'] = $category->fetchSectionsByManuf(LWS::getManufPk($this->param['manuf_slug']));
     if (!$this->param['sections']) {
         // do something as a backup indexing/flattening strategy if DAO returned NULL
         $this->param['subnav_count'] = 0;
         // no subnav for sections of subcategory
     } else {
         if (count($this->param['sections']) > $this->param['subnav_grouping']) {
             $this->param['subnav_count'] = ceil(sizeof($this->param['sections']) / $this->param['subnav_grouping']);
             // just experimenting with various ways to control the subnav grouping etc.
             // so far it is too much work for the results.  only edge cases matter so far.
             /*$xtra = count($this->param['sections']) - intval(sfConfig::get('app_subnav_grouping_top'));
             		$mids = ceil($xtra / intval(sfConfig::get('app_subnav_grouping_middle')));
             		$rem = $xtra % intval(sfConfig::get('app_subnav_grouping_middle'));
             		$lows = ceil($rem / intval(sfConfig::get('app_subnav_grouping_bottom')));
             		$this->param['subnav_count'] = $mids + $lows;*/
         } else {
             $this->param['subnav_count'] = 1;
         }
     }
     $this->featured_parts = $category->fetchFeaturedParts($this->param['manuf_id']);
     // count number of cycle images for this manufacturer
     $cycle_img_dir = sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'cycle' . DIRECTORY_SEPARATOR . $this->param['cat_slug'] . DIRECTORY_SEPARATOR . $this->param['manuf_slug'] . DIRECTORY_SEPARATOR;
     $this->param['manuf_box_class'] = '_' . count(glob('' . $cycle_img_dir . '*.png'));
     if (!$this->featured_parts) {
         // what to do if there are no featured parts found. we are missing data.
     }
     $response = $this->getResponse();
     $response->addMeta('description', "LiveWire Supply is the Internet's #1 Supplier for {$this->param['manuf']} Fuses. We have a massive selection and shipping points across the country.");
     $response->setSlot('body_class', 'fu_manuf');
     $response->setSlot('body_id', $this->param['manuf_slug']);
     $response->setTitle("{$this->param['manuf']} Fuses - " . sfConfig::get('app_biz_name'));
     return sfView::SUCCESS;
 }
Пример #2
0
 /**
  * Method to prepare circuit breaker tool selection process for a
  * particular manufacturer.  
  * @param sfWebRequest $request
  */
 public function executeManuf(sfWebRequest $request)
 {
     $this->param = array();
     $this->param['category'] = 'Circuit Breakers';
     $this->param['cat_slug'] = 'circuit-breakers';
     $this->param['manuf_slug'] = $this->getRequestParameter('manuf_slug');
     $this->param['manuf_id'] = LWS::getManufPk($this->param['manuf_slug']);
     $this->param['manuf'] = LWS::unslugify($this->param['manuf_slug'], true);
     $this->param['subnav_grouping'] = intval(sfConfig::get('app_cb_max_subcat_grouping'));
     $this->param['subcategory'] = 'Frame Types';
     $this->param['subcat_slug'] = 'frame-types';
     $category = new CBCategory();
     $category->setSubcatStrategy(new FrameTypeSubcategory());
     $this->param['manuf_list'] = $category->fetchManufList($this->param['manuf_id']);
     $this->param['manuf_list_class'] = 'top';
     $this->param['sections'] = $category->fetchSectionsByManuf(LWS::getManufPk($this->param['manuf_slug']));
     if (!$this->param['sections']) {
         // do something as a backup indexing/flattening strategy if DAO returned NULL
         // besides throwing a 404!
         $this->param['subnav_count'] = 0;
         // no subnav for sections of subcategory
     } else {
         if (sizeof($this->param['sections']) > $this->param['subnav_grouping']) {
             $this->param['subnav_count'] = ceil(sizeof($this->param['sections']) / $this->param['subnav_grouping']);
         } else {
             $this->param['subnav_count'] = 1;
         }
     }
     $landing_data = $category->fetchManufLandingData($this->param['manuf_id']);
     if ($landing_data) {
         // filter featured parts vs. frame types
         $this->featured_parts = isset($landing_data['featured_parts']) ? $landing_data['featured_parts'] : NULL;
         $this->frame_types = $landing_data['frame_types'];
     } else {
         // need backup plan
     }
     // count number of cycle images for this manufacturer
     $cycle_img_dir = sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'cycle' . DIRECTORY_SEPARATOR . $this->param['cat_slug'] . DIRECTORY_SEPARATOR . $this->param['manuf_slug'] . DIRECTORY_SEPARATOR;
     $this->param['manuf_box_class'] = '_' . count(glob('' . $cycle_img_dir . '*.png'));
     $response = $this->getResponse();
     $response->addMeta('description', "LiveWire Supply is the Internet's #1 Supplier for {$this->param['manuf']} Circuit Breakers. We have a massive selection and shipping points across the country.");
     $response->setSlot('body_class', 'cb_manuf');
     $response->setSlot('body_id', $this->param['manuf_slug']);
     $response->setTitle("{$this->param['manuf']} Circuit Breakers - " . sfConfig::get('app_biz_name'));
     return sfView::SUCCESS;
 }
Пример #3
0
 public function executeManuf(sfWebRequest $request)
 {
     $this->param = array();
     $this->param['category'] = 'Busway';
     $this->param['cat_slug'] = 'busway';
     $this->param['manuf_slug'] = $this->getRequestParameter('manuf_slug');
     $this->param['manuf_id'] = LWS::getManufPk($this->param['manuf_slug']);
     $this->param['manuf'] = LWS::unslugify($this->param['manuf_slug'], true);
     $this->param['subnav_grouping'] = intval(sfConfig::get('app_cb_max_subcat_grouping'));
     $this->param['subcategory'] = 'Busway Components';
     $this->param['subcat_slug'] = 'component';
     $category = new BUCategory();
     $this->param['manuf_list'] = $category->fetchManufList($this->param['manuf_id']);
     $this->param['manuf_list_class'] = 'bottom';
     $this->param['sections'] = $category->fetchSectionsByManuf(LWS::getManufPk($this->param['manuf_slug']));
     if (!$this->param['sections']) {
         // do something as a backup indexing/flattening strategy if DAO returned NULL
         $this->param['subnav_count'] = 0;
         // no subnav for sections of subcategory
     } else {
         if (sizeof($this->param['sections']) > $this->param['subnav_grouping']) {
             $this->param['subnav_count'] = ceil(sizeof($this->param['sections']) / $this->param['subnav_grouping']);
         } else {
             $this->param['subnav_count'] = 1;
         }
     }
     $this->featured_parts = $category->fetchFeaturedParts($this->param['manuf_id']);
     // count number of cycle images for this manufacturer
     $cycle_img_dir = sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'cycle' . DIRECTORY_SEPARATOR . $this->param['cat_slug'] . DIRECTORY_SEPARATOR . $this->param['manuf_slug'] . DIRECTORY_SEPARATOR;
     $this->param['manuf_box_class'] = '_' . count(glob('' . $cycle_img_dir . '*.png'));
     // start preload logic
     $num_cycle_imgs = count(glob('' . $cycle_img_dir . '*.png'));
     $this->param['cycle_imgs'] = array();
     for ($i = 0; $i < $num_cycle_imgs; $i++) {
         $this->param['cycle_imgs'][] = "/images/cycle/busway/{$this->param['manuf_slug']}/cycle-{$i}-trans.png";
     }
     // end preload logic
     $response = $this->getResponse();
     $response->addMeta('description', "LiveWire Supply is the Internet's #1 Supplier for {$this->param['manuf']} Busway. We have a massive selection and shipping points across the country.");
     $response->setSlot('body_class', 'bu_manuf');
     $response->setSlot('body_id', $this->param['manuf_slug']);
     $response->setTitle("{$this->param['manuf']} Busway - " . sfConfig::get('app_biz_name'));
     return sfView::SUCCESS;
 }
Пример #4
0
 public function executeManuf(sfWebRequest $request)
 {
     $this->param = array();
     $this->param['category'] = 'Electrical Transformers';
     $this->param['cat_slug'] = 'electrical-transformers';
     $this->param['manuf_slug'] = $this->getRequestParameter('manuf_slug');
     $this->param['manuf_id'] = LWS::getManufPk($this->param['manuf_slug']);
     // No manuf-level page for 'Rebuilt' manufacturer
     $this->forward404If($this->param['manuf_id'] == 23);
     $this->param['manuf'] = LWS::unslugify($this->param['manuf_slug'], true);
     $this->param['subnav_grouping'] = intval(sfConfig::get('app_subnav_grouping_max'));
     $this->param['subcategory'] = 'KVA Ratings';
     $this->param['subcat_slug'] = 'kva-rating';
     $category = new TRCategory();
     $this->param['manuf_list'] = $category->fetchManufList($this->param['manuf_id']);
     $this->param['manuf_list_class'] = 'bottom';
     $this->param['sections'] = $category->fetchSectionsByManuf(LWS::getManufPk($this->param['manuf_slug']));
     if (!$this->param['sections']) {
         // do something as a backup indexing/flattening strategy if DAO returned NULL
         $this->param['subnav_count'] = 0;
         // no subnav for sections of subcategory
     } else {
         if (sizeof($this->param['sections']) > $this->param['subnav_grouping']) {
             $this->param['subnav_count'] = ceil(sizeof($this->param['sections']) / $this->param['subnav_grouping']);
         } else {
             $this->param['subnav_count'] = 1;
         }
     }
     $this->featured_parts = $category->fetchFeaturedParts($this->param['manuf_id']);
     // count number of cycle images for this manufacturer
     $cycle_img_dir = sfConfig::get('sf_web_dir') . DIRECTORY_SEPARATOR . 'images' . DIRECTORY_SEPARATOR . 'cycle' . DIRECTORY_SEPARATOR . 'electrical-transformers' . DIRECTORY_SEPARATOR . $this->param['manuf_slug'] . DIRECTORY_SEPARATOR;
     $this->param['manuf_box_class'] = '_' . count(glob('' . $cycle_img_dir . '*.png'));
     $response = $this->getResponse();
     $response->addMeta('description', "LiveWire Supply is the Internet's #1 Supplier for {$this->param['manuf']} Electrical Transformers. We have a massive selection and shipping points across the country.");
     $response->setSlot('body_class', 'tr_manuf');
     $response->setSlot('body_id', $this->param['manuf_slug']);
     $response->setTitle("{$this->param['manuf']} Transformers - " . sfConfig::get('app_biz_name'));
     return sfView::SUCCESS;
 }
Пример #5
0
 public function executeSubpagination(sfWebRequest $request)
 {
     // eliminated subcategory route to prevent dup. content issues on page-1
     $manuf_slug = $request->getParameter('manuf_slug');
     $this->param = array();
     $this->param['cat_id'] = LWS::getCategoryPk($request->getParameter('cat_slug'));
     $this->param['manuf'] = LWS::unslugify($manuf_slug, true);
     $this->param['category'] = LWS::getCategoryName($request->getParameter('cat_slug'));
     $this->param['subcategory'] = LWS::unslugify($request->getParameter('subcat_slug'));
     $this->param['section'] = LWS::getSectionName($this->param['subcategory'], $request->getParameter('section'));
     $this->param['current_page_num'] = LWS::extractPaginationNum($request->getParameter('page_num'));
     $category = CategoryFactory::make(array('cat_id' => $this->param['cat_id'], 'list_decorator_type' => 'basic'));
     $this->param['parts'] = $category->fetchSubcatListByManuf(LWS::getManufPk($manuf_slug), $this->param['section'], $this->param['current_page_num']);
     $this->forward404Unless($this->param['parts']);
     $this->param['part_count'] = $this->param['parts'][0]['part_count'];
     $this->param['next_page_num'] = $this->param['current_page_num'] + 1;
     $this->param['total_pages'] = ceil($this->param['part_count'] / intval(sfConfig::get('app_pagination_items_limit', 100)));
     $prefix = $this->param['current_page_num'] > 1 ? "Page {$this->param['current_page_num']} of {$this->param['total_pages']} : " : '';
     $response = $this->getResponse();
     $response->setSlot('body_id', str_replace('-', '_', $request->getParameter('cat_slug')));
     $response->setSlot('body_class', 'pagination');
     $response->addMeta('description', "{$this->param['manuf']} {$this->param['category']} {$this->param['section']} {$this->param['subcategory']} Catalog - {$prefix}");
     $response->setTitle("{$prefix}{$this->param['section']} {$this->param['subcategory']} - {$this->param['manuf']} {$this->param['category']} - " . sfConfig::get('app_biz_name'));
     return sfView::SUCCESS;
 }