Post by salehjoon » Wed Nov 30, 2011 5:27 am

Using OC 1.5.1.3. I want to hide the line "There are no products to list in this category." for specific categories. I found the corresponding line in catalog\view\theme\default\template\product\category.tpl:

Code: Select all

  <?php if (!$categories && !$products) { ?>
  <div class="content"><?php echo $text_empty; ?></div>
  <div class="buttons">
    <div class="right"><a href="<?php echo $continue; ?>" class="button"><span><?php echo $button_continue; ?></span></a></div>
  </div>
  <?php } ?>
and tried to add a case to the if statement for that specific category:

Code: Select all

  <?php if (!$categories && !$products && !$category_id != 72) { ?>
I'm not good with php and I know I'm not doing this right. Could someone tell me what I need to replace the category_id with to make this work?

New member

Posts

Joined
Sun Nov 20, 2011 12:17 pm

Post by OpenCart Addons » Wed Nov 30, 2011 5:58 am

Hi salehjoon,

You're in the correct file, but it's actually easier than you think:

catalog / view / theme / default / template / product / category.tpl

Find:

Code: Select all

<?php if (!$categories && !$products) { ?>
  <div class="content"><?php echo $text_empty; ?></div>
  <div class="buttons">
    <div class="right"><a href="<?php echo $continue; ?>" class="button"><span><?php echo $button_continue; ?></span></a></div>
  </div>
  <?php } ?>
Remove:

Code: Select all

<?php echo $text_empty; ?>
If you'd like, I can create a vQmod version of this so you don't have to edit any of your files.

Cheers,

Joel

Canada's Leading Expert In OpenCart Development & Certified OpenCart Development Partner Image


User avatar
Active Member

Posts

Joined
Thu Nov 24, 2011 10:51 am
Location - Canada

Post by salehjoon » Wed Nov 30, 2011 6:17 am

Thanks Joel. I've edited a lot of my files (I know that's probably not a good habit especially if I want to upgrade). I didn't remove that line on purpose. I want to keep it for certain categories. I have some categories (i.e. services) that have no products, just text and maybe some pictures. I want to remove the line just for those categories.

New member

Posts

Joined
Sun Nov 20, 2011 12:17 pm

Post by wcbenyip » Thu Feb 02, 2012 4:54 am

Hi Joel,

I have to express my sincerely thanks to you as I am looking for this effect as well~~ If you don't mind, a vQmod version would definitely helpful for anyone who need this!! Thanks in advance!

BTW, at this moment, I want to comment it instead of remove it from file, do you know what's the way to comment the statement in this file? I tried "//" and "*" and "<! -->" all didn't work... I am intended to remove the "<?php echo $text_empty; ?>" and also below lines to make it "smoothly" display the category content only:

<div class="buttons">
<div class="right"><a href="<?php echo $continue; ?>" class="button"><span><?php echo $button_continue; ?></span></a></div>
</div>

Rgds,

Ben

Newbie

Posts

Joined
Tue Jan 31, 2012 11:41 am

Post by DSGI » Tue Feb 14, 2012 4:11 pm

OpenCart Addons wrote:Hi salehjoon,

You're in the correct file, but it's actually easier than you think:

catalog / view / theme / default / template / product / category.tpl

Find:

Code: Select all

<?php if (!$categories && !$products) { ?>
  <div class="content"><?php echo $text_empty; ?></div>
  <div class="buttons">
    <div class="right"><a href="<?php echo $continue; ?>" class="button"><span><?php echo $button_continue; ?></span></a></div>
  </div>
  <?php } ?>
Remove:

Code: Select all

<?php echo $text_empty; ?>
If you'd like, I can create a vQmod version of this so you don't have to edit any of your files.

Cheers,

Joel

Joel,

I'm extremely new to Opencart/php coding in general. I thought I'd take a stab at this (only as a post on the forums though to have someone who actually knows what they are doing take a look at my code and tell me if I'm in the ball park). Here is the VQmod code I wrote thinking this would fix this. Please let me know if this is even close to being correct. I've also included my logic so people can understand my train of thought.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<modification>
        <id>Remove There are no products to list in this category. message</id>
        <version>1.0</version>
        <vqmver>2.1.5</vqmver>
        <author>DSGI</author>
        <file name=catalog/view/theme/default/template/product/category.tpl">
                <operation>
                        <search position="replace"><![CDATA[
                        $var = '<?php echo $text_empty; ?>';
                        ]]></search>
                        <add><![CDATA[
                        $var = '';
                        ]]></add>
                </operation>
        </file>
</modification>
I'm assuming that that VQmod would find the

Code: Select all

<?php echo $text_empty;?>
and simply replace it with nothing - thus removing the message that the category has no products to display in the category.

Any feedback/construction criticism is much appreciated since I've never written a VQmod script before!

New member

Posts

Joined
Wed Feb 08, 2012 5:28 pm

Post by az@a2z-computing.com » Tue Jul 10, 2012 5:24 am

HI All

I did what you said and removed the <?php echo $text_empty; ?>

yes it works, but if I have products in the list, the GRID options no longer work and stays as a list

help please..

site is www.a2z-computing.com

thanks
Az


Posts

Joined
Mon Jun 18, 2012 2:57 am
Who is online

Users browsing this forum: No registered users and 74 guests