Post by yl » Sun Dec 28, 2008 5:27 am

After I finished an installment of the Latest_Featured_Special_Products_vo79.1, I got an error 1054 when disabled the product status.

I removed and replaced the admin/controller/product.php, the error's gone. Please direct me to fix the file product.php!

yl
New member

Posts

Joined
Tue Nov 25, 2008 6:46 am

Post by bthirsk » Sun Dec 28, 2008 8:07 am

Add this first at this link.
http://forum.opencart.com/index.php/top ... l#msg13098

add to your catalog/template/module/*.tpl files for the latest/feature/specials





">" title="" alt="">">



in catalog/extension/module/*.php add the following for each of the three  files for latest/featured/ specials

    if ($product_data) {
    $view->set('products', $product_data);
    }

These changes might help.

Brent


User avatar
Active Member

Posts

Joined
Wed Sep 03, 2008 11:33 am
Location - Canada

Post by yl » Sun Dec 28, 2008 11:08 am

Thank you! ;) I will Look at it tomorrow... and update.

yl
New member

Posts

Joined
Tue Nov 25, 2008 6:46 am

Post by Qphoria » Sun Dec 28, 2008 5:40 pm

I'm not sure this is necessary. If there are no products, then the foreach loop will just exit. I have added the fix for admin/controller/product.php from the other post.
Then I set Product 1 to featured: yes, special: yes. I see the product on the front page
Then I set Product 1 status to "disabled". I no longer see the product on the front page. But no error.

OpenCart 2.0.x Mod Update Info

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator
Online

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by Qphoria » Sun Dec 28, 2008 6:04 pm

I've updated the contrib with the admin/controller/product.php fix:
http://forum.opencart.com/index.php/top ... w.html#new

OpenCart 2.0.x Mod Update Info

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator
Online

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by bthirsk » Sun Dec 28, 2008 8:36 pm

  The reason for the if clause in the .tpl is if you have a module set, but no products returned yet,
you receive errors when tpl is called.
The current code still calls tpl.
  I did this when testing my random code because I wanted to check by adding one item at a time
and making sure when the random effect started.
  Because I had no products set in specials, page errors occurred until I added the if clause so tpl
code would not run until there where results.
 
Also, If you include this, no message is required because there will be no output for a module that has no data.
When testing, if there is no data, such as in specials, you don't end up displaying a SPECIAL OFFER header with the message no products to display.
Last edited by Anonymous on Sun Dec 28, 2008 8:39 pm, edited 1 time in total.

Brent


User avatar
Active Member

Posts

Joined
Wed Sep 03, 2008 11:33 am
Location - Canada

Post by Qphoria » Sun Dec 28, 2008 8:57 pm

bthirsk wrote:   The reason for the if clause in the .tpl is if you have a module set, but no products returned yet,
you receive errors when tpl is called.
The current code still calls tpl.
But like i said, the foreach loop will just exit if there are no products. There is no error:
http://kewlazme.homeip.net/r272/
All products deleted from my database.
Also, If you include this, no message is required because there will be no output for a module that has no data.
When testing, if there is no data, such as in specials, you don't end up displaying a SPECIAL OFFER header with the message no products to display.
This would be the only use for it.
Last edited by Qphoria on Sun Dec 28, 2008 9:00 pm, edited 1 time in total.

OpenCart 2.0.x Mod Update Info

Image
Donate!|OpenCart Basics|GeoZones
Image


User avatar
Administrator
Online

Posts

Joined
Tue Jul 22, 2008 3:02 am

Post by bthirsk » Mon Dec 29, 2008 12:03 am

You are correct.
The if clause was required in the original because it did not check for no data or print
the no products message.
I had just added the line so I could continue testing.

Brent


User avatar
Active Member

Posts

Joined
Wed Sep 03, 2008 11:33 am
Location - Canada
Who is online

Users browsing this forum: No registered users and 1 guest