コード例 #1
0
 static function parseParam(&$page, &$params, $languages_id, $languages_code)
 {
     $pos = array_search(self::$query_key, $params);
     if (!empty($params[$pos + 1])) {
         $products_id = $params[$pos + 1];
         // recalculate 'page', just in case the product_type passed is wrong
         if (self::getMainPage() == $page) {
             self::$main_page = $page = zen_get_info_page($products_id);
         }
         $params[$pos] = self::getName($products_id, $languages_id, $languages_code);
         // recalculate cPath if needed to
         /*if(self::getMainPage() == $page){
         			if(($cPos  = array_search(categoriesParser::$query_key, $params)) !== false){
         				$cPath = self::getProductPath($products_id, $params[$cPos+1]);
         				$params[$cPos] = categoriesParser::getName($cPath, $languages_id, $languages_code);
         				unset($params[$cPos+1]);
         			}
         			else {
         				$cPath = self::getProductPath($products_id, 0);
         				$params = array_merge(array(categoriesParser::getName($cPath, $languages_id, $languages_code)), $params);
         				$pos++;
         			}
         		}*/
     } else {
         unset($params[$pos]);
     }
     unset($params[$pos + 1]);
 }
コード例 #2
0
ファイル: products.php プロジェクト: jucorant/simple-seo-url
 static function parseParam(&$_get, &$params, $languages_id, $languages_code)
 {
     $pos = array_search(self::$query_key, $params);
     $products_id = 0;
     if (!empty($params[$pos + 1])) {
         $products_id = (int) $params[$pos + 1];
         // recalculate 'page', just in case the product_type passed is wrong
         if (self::getMainPage() == $_get['main_page']) {
             self::$main_page = $_get['main_page'] = zen_get_info_page($products_id);
         }
         $cPos = array_search(categoriesParser::$query_key, $params);
         if (self::getMainPage() == $_get['main_page'] || $cPos !== false) {
             // we want to make sure the order is correct, categories first then product
             unset($params[$pos]);
             unset($params[$pos + 1]);
             if ($cPos !== false) {
                 $_get['cPath'] = $cPath = self::getProductPath($products_id, $params[$cPos + 1]);
                 unset($params[$cPos]);
                 unset($params[$cPos + 1]);
             } else {
                 $_get['cPath'] = $cPath = self::getProductPath($products_id, 0);
             }
             $temp_params[0] = categoriesParser::getName($cPath, $languages_id, $languages_code);
             $temp_params[1] = self::getName($products_id, $languages_id, $languages_code);
             $params = array_merge($params, $temp_params);
         } else {
             $params[$pos] = self::getName($products_id, $languages_id, $languages_code);
             unset($params[$pos + 1]);
         }
     } else {
         unset($params[$pos]);
     }
     return $products_id;
 }