0 Пользователей и 1 Гость просматривают эту тему.
  • 1 Ответов
  • 5530 Просмотров
*

secretlive

  • Захожу иногда
  • 52
  • 0 / 0
Надо коекак модифицировать модуль, что бы он выводил не только католог магазина, а еще картинки которые относятся к даным разделам.


В коде  модуля(mod_product_categories.php)
Цитировать
Код:
   /* MENUTPYE LINK LIST */
   require_once(CLASSPATH.'ps_product_category.php');
   $ps_product_category = new ps_product_category();
   echo $ps_product_category->get_category_tree( $category_id, $class_mainlevel );

идет редирект на клас ps_product_category.php, где используется функция get_category_tree
Цитировать
Код функции:
   function get_category_tree( $category_id=0,
                        $links_css_class="mainlevel",
                        $list_css_class="mm123",
                        $highlighted_style="font-style:italic;" ) {
      global $sess, $ps_product;


      $categories = ps_product_category::getCategoryTreeArray(); // Get array of category objects
      $result = ps_product_category::sortCategoryTreeArray($categories); // Sort array of category objects
        $images_menu =ps_product_category::get_child_list();
      $row_list = $result['row_list'];
      $depth_list = $result['depth_list'];
      $category_tmp = $result['category_tmp'];
        $images_menu1 = $images_menu['category_thumb_image'] ;
      $nrows = sizeof($category_tmp);

      /** SECOND STEP
      * Find out if we have subcategories to display
      **/
      $allowed_subcategories = Array();
      if( !empty( $categories[$category_id]["category_parent_id"] ) ) {
         // Find the Root Category of this category
         $root = $categories[$category_id];
         $allowed_subcategories[] = $categories[$category_id]["category_parent_id"];
         // Loop through the Tree up to the root
         while( !empty( $root["category_parent_id"] )) {
            $allowed_subcategories[] = $categories[$root["category_child_id"]]["category_child_id"];
            $root = $categories[$root["category_parent_id"]];
         }
      }
      // Fix the empty Array Fields
      if( $nrows < count( $row_list ) ) {
         $nrows = count( $row_list );
      }
      $html = '';
      // Now show the categories
      for($n = 0 ; $n < $nrows ; $n++) {

         if( !isset( $row_list[$n] ) || !isset( $category_tmp[$row_list[$n]]["category_child_id"] ) )
            continue;
         if( $category_id == $category_tmp[$row_list[$n]]["category_child_id"] )
            $style = $highlighted_style;
         else
            $style = "";

         $allowed = false;
         if( $depth_list[$n] > 0 ) {
            // Subcategory!
            if( isset( $root ) && in_array( $category_tmp[$row_list[$n]]["category_child_id"], $allowed_subcategories )
            || $category_tmp[$row_list[$n]]["category_parent_id"] == $category_id
            || $category_tmp[$row_list[$n]]["category_parent_id"] == @$categories[$category_id]["category_parent_id"]) {
               $allowed = true;

            }
         }
         else
            $allowed = true;
         $append = "";
         if( $allowed ) {
            if( $style == $highlighted_style ) {
               $append = 'id="active_menu"';
            }
            if( $depth_list[$n] > 0 )
               $css_class = "sublevel";
            else
               $css_class = $links_css_class;


            $catname = shopMakeHtmlSafe( $category_tmp[$row_list[$n]]["category_name"] );

//  $db = new ps_DB;
//  $ps_vendor_id = $_SESSION["ps_vendor_id"];
//  $q = "SELECT category_id, category_thumb_image, category_child_id,category_name FROM #__{vm}_category,#__{vm}_category_xref ";
//   $q .= "WHERE #__{vm}_category_xref.category_parent_id='$category_id' ";
//   $q .= "AND #__{vm}_category.category_id=#__{vm}_category_xref.category_child_id ";
//   $q .= "AND #__{vm}_category.vendor_id='$ps_vendor_id' ";
//   $q .= "AND #__{vm}_category.category_publish='Y' ";
//   $q .= "ORDER BY #__{vm}_category.list_order, #__{vm}_category.category_name ASC";
//   $db->setQuery($q);
//   $db->query();
//  $db->f("category_thumb_image");
//   $html.= $ps_product->image_tag( $db->f("category_thumb_image"), "alt=\"".$db->f("category_name")."\"", 0, "category");
//  $html.= "<br /><br/>";


            $html .='<a title="'.$catname.'" style="display:block;'.$style.'" class="'. $css_class .'" href="'. $sess->url(URL."index.php?page=shop.browse&amp;category_id=".$category_tmp[$row_list[$n]]["category_child_id"]) .'" '.$append.'>'
            . str_repeat("&nbsp;&nbsp;&nbsp;",$depth_list[$n]) . $catname
            . ps_product_category::products_in_category( $category_tmp[$row_list[$n]]["category_child_id"] )
            .'</a>';
         }
      }

      return $html;
   }


То что выделено красным я добавлял сам(на счет получения с базы даных параметров(саму картину) брал на подобе с функции get_child_list, в том же ps_product_category.php)

в итоге выводится это(скрин прилагается) , то есть получается что всетаки картинку для категории мы не получили

прошу помощи у всех посетителей)))
 

[вложение удалено Администратором]
*

sirtayler

  • Осваиваюсь на форуме
  • 12
  • 0 / 0
Re: Модификация mod_product_categories.php
« Ответ #1 : 29.11.2008, 03:40:41 »
Чтобы оставить сообщение,
Вам необходимо Войти или Зарегистрироваться
 

Перенесено: Модификация VirtueMart - что бы не слетали внесенные изменения

Автор fsv

Ответов: 0
Просмотров: 683
Последний ответ 02.10.2017, 22:02:21
от fsv
скачать mod_product_categories

Автор vsh

Ответов: 6
Просмотров: 4376
Последний ответ 10.07.2013, 16:51:00
от Елена Соколова
Модификация mod_virtuemart_product_categories-XHTMLlinklist1.0

Автор onopa_knopa

Ответов: 2
Просмотров: 2623
Последний ответ 18.06.2012, 16:39:37
от Romaha
mod_product_categories online-62 :(

Автор Gorata

Ответов: 3
Просмотров: 3074
Последний ответ 14.02.2011, 14:18:33
от frii
Модификация VirtueMart от Redsoft

Автор alexzotov

Ответов: 4
Просмотров: 1445
Последний ответ 01.08.2010, 20:32:36
от alexzotov