M
M
Maxim Demidov2018-08-18 12:49:45
Joomla
Maxim Demidov, 2018-08-18 12:49:45

How to display certain categories by id in Joomshopping?

Hello dear toaster users! I suffer with Joomshopping. The task is this - to display in an arbitrary place of the template (in my case, I need in the category template), several arbitrary categories by id ... How can this be done? Help, if it's not difficult, I've already broken my whole head (

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
max3wq, 2019-03-05
@MaximusDem

Hello, I do this - I assign all categories of the store to the main page, then in the template along the path
/components/com_jshopping/templates/Your template/category/maincategory.php
(In your case, it is possible in category_default.php)
Change the content to:

<div class="jshop_list_category">


<?php if (count($this->categories)){ ?>
<div class = "jshop list_category">
    <?php echo ('<h2 class="subtitle">Подзаголовок</h2>');?>
 <?php foreach(JTable::getInstance("Category", "JShop")->getSubCategories(62, $ordering) as $k=>$category){?>
        <?php if ($k%$this->count_category_to_row==0) echo '<div class="clear"></div><div class="str_category">'; ?>
        <div class="jshop_categ width<?php echo round(100/$this->count_category_to_row, 0)?>">

          <div class = "category">
            <div class="image">
                <a href = "<?php echo $category->category_link;?>"><img class="jshop_img" src="<?php echo $this->image_category_path;?>/<?php if ($category->category_image) echo $category->category_image; else echo $this->noimage;?>" alt="<?php echo htmlspecialchars($category->name)?>" title="<?php echo htmlspecialchars($category->name)?>" /></a>
            </div>
            <div>
               <h2 class="category_title"><a class = "product_link" href = "<?php echo $category->category_link?>"><?php echo $category->name?></a></h2>
               <p class = "category_short_description"><?php echo $category->short_description?></p>
            </div>
           </div>
 
        </div>    
        <?php if ($k%$this->count_category_to_row==$this->count_category_to_row-1) echo '</div>'; ?>
    <?php } ?>
        <?php if ($k%$this->count_category_to_row!=$this->count_category_to_row-1) echo '</div>'; ?>
</div>
<?php }?>

Instead of 62, put the id of the category you need, it will display its subcategories with a photo.
This code can be repeated several times by changing the id and achieve a beautiful output of only the necessary subcategories.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question