Post by pla1829 » Wed Feb 04, 2015 12:45 pm

Hi! On my website I have some categories that are simply categories to arrange other categories. For example, one category is "Dresses" and within this category are the different categories for the different types of dresses. Is there a way to remove "There are no products to list in this category." ONLY from select categories?

In essence, I have some categories that do not have products (yet) where I want the message to stay; and other categories are not suppose to have products so I do not want the message within these categories.

Thanks in advance!

New member

Posts

Joined
Sat Nov 22, 2014 12:16 pm

Post by viethemes » Wed Feb 04, 2015 9:43 pm

pla1829 wrote:Hi! On my website I have some categories that are simply categories to arrange other categories. For example, one category is "Dresses" and within this category are the different categories for the different types of dresses. Is there a way to remove "There are no products to list in this category." ONLY from select categories?

In essence, I have some categories that do not have products (yet) where I want the message to stay; and other categories are not suppose to have products so I do not want the message within these categories.

Thanks in advance!
You can edit the file catalog\view\theme\default\template\product\category.tpl, find

Code: Select all

<p><?php echo $text_empty; ?></p>
and replace with

Code: Select all

<?php $ids = explode('_', $_GET['path']); if (in_array(end($ids), array(1, 2, 3))) { ?>
<p><?php echo $text_empty; ?></p>
<?php } ?>
Note that, you change 1, 2, 3 to the category ids you want to display the warning.

http://www.viethemes.com - OpenCart turtorials, news, tips and stricks, extension

Our extensions:
Visual Theme Editor - Powerful tool for customizing style of any theme visually
Live Theme Editor - Customize layout, colors, backgrounds, fonts of the default theme
Theme Animation - Animation Editor for any theme

Extra Positions PRO, Custom JavaScript, Custom CSS and others


User avatar
Active Member

Posts

Joined
Thu Jan 08, 2015 12:17 pm


Post by pla1829 » Thu Feb 05, 2015 1:36 am

Thanks for the response!

New member

Posts

Joined
Sat Nov 22, 2014 12:16 pm

Post by Brandt07 » Fri Mar 13, 2015 4:48 am

Hi,

I am having the same problem and can't seem to remove this message and the continue button. I have two categories that I use as a showcase with a photo gallery. They don't contain products, so I want to delete this message. My open cart version is 2.0.1.1.

This is how the code looked first.

Code: Select all

<?php if (!$categories && !$products) { ?>
      <p><?php echo $text_empty; ?></p>
        <div class="buttons">
        <div class="pull-right"><a href="<?php echo $continue; ?>" class="btn btn-primary"><?php echo $button_continue; ?></a></div>
      </div>
      <?php } ?>
Using your alteration gave this result:

Code: Select all

<?php if (!$categories && !$products) { ?>
      <?php $ids = explode('_', $_GET['path']); if (in_array(end($ids), array(60, 33))) { ?>
<p><?php echo $text_empty; ?></p>
<?php } ?>
        <div class="buttons">
        <div class="pull-right"><a href="<?php echo $continue; ?>" class="btn btn-primary"><?php echo $button_continue; ?></a></div>
      </div>
      <?php } ?>
Category id 60 and 33 are actually the ones where I want to hide the message. Since I have hundreds of categories with products, it's not doable to do it the other way around. But whatever I try there, the message is not removed.
Even when I try removing it all together, like this, does nothing:

Code: Select all

<?php if (!$categories && !$products) { ?>
        <div class="buttons">
        <div class="pull-right"><a href="<?php echo $continue; ?>" class="btn btn-primary"><?php echo $button_continue; ?></a></div>
      </div>
      <?php } ?>
Any idea what I might be doing wrong?

Newbie

Posts

Joined
Fri Mar 13, 2015 3:51 am

Post by thanhhoalaptop » Sun Mar 22, 2015 9:42 pm

Category A contains B and C sub-category, B contains D item. You want to show D item when you choose cat-A or subcat-B, you must set D item belong to both cat-A and subcat-B. Edit Product >> choose Tab Links >>in Categories text box, you choose both cat-A and subcat-B. Finish.


Posts

Joined
Sun Mar 22, 2015 9:35 pm
Who is online

Users browsing this forum: No registered users and 8 guests