Customising Theme_Catalog_RightColumnEmptyPlugin

ThemeBurn SupportForumsOpenCart ThemesShoppica OpenCart ThemeCustomising Theme_Catalog_RightColumnEmptyPlugin

This topic has been marked as resolved.

Hello,

I am using a module that shows related products on the product page. This module is situated in the right column and is the only one present. When viewing a product which has no related products the module correctly renders no content but the column remains.

I believe this is because the extension ‘Theme_Catalog_RightColumnEmptyPlugin’ correctly finds the related products module for the layout. I was hoping to modify the plugin to check for the existence of my module and, if found, count the number of related products using something like this…

$this->model_catalog_product->getProductRelated($product_id)

I think model_catalog_product is associated with controllers only and not the TB_ExtensionPlugin but there must be an equivalent approach (even if it’s a little hacky!).

Hope that makes sense. Any help would be greatly appreciated.

Thanks

 ceg
December 20, 2012 at 7:36 pm #16180
You will need to register in order to post topics and read replies in the ThemeBurn.com support forums!
December 27, 2012 at 3:08 pm #16441

Many thanks for your reply.

Unfortunately that’s pretty much exactly what I did (pleasing to see in some ways!). This gives the following errors:

Notice: Undefined property: Theme_Catalog_RightColumnEmptyPlugin::$model_catalog_product in …\tb_themes\shoppica2\catalog\plugin\RightColumnEmptyPlugin.php on line 21
Fatal error: Call to a member function getProductRelated() on a non-object in …\tb_themes\shoppica2\catalog\plugin\RightColumnEmptyPlugin.php on line 21

These led me to believe the product model isn’t ‘available’ at this point… (forgive my poor MVC terminology!).

p.s. Sorry it took me a while to get back to you, I didn’t get an email notification about your reply for some reason.

 ceg
January 8, 2013 at 5:47 pm #16925

Did you try to insert $this->load->model('catalog/product'); before using $this->model_catalog_product->getProductRelated.... ?

January 11, 2013 at 6:39 pm #17074

Yes I did. That gives the following error:

Notice: Undefined property: Theme_Catalog_RightColumnEmptyPlugin::$load in ..\tb_themes\shoppica2\catalog\plugin\RightColumnEmptyPlugin.php on line 21
Fatal error: Call to a member function model() on a non-object in ..\tb_themes\shoppica2\catalog\plugin\RightColumnEmptyPlugin.php on line 21

 ceg
January 12, 2013 at 12:46 am #17082
You will need to register in order to post topics and read replies in the ThemeBurn.com support forums!

Regards,
ThemeBurn team

January 15, 2013 at 3:30 pm #17188

That’s the one, thanks very much!

If it’s not too much to ask would you mind providing a brief explaination of the difference between the two calls and why one worked over the other?

From what I can see getOcModel is a specific way to pull in models from your extensions, presumably where “load” is unavailable.

Either way, thanks again!

 ceg
January 15, 2013 at 3:42 pm #17190

From what I can see getOcModel is a specific way to pull in models from your extensions, presumably where “load” is unavailable.

You answered your own question very correctly :) There is no other functional difference, just a shortcut.

January 15, 2013 at 4:05 pm #17191

Great stuff, thanks :)

 ceg
January 15, 2013 at 4:42 pm #17201

You’re welcome, mate :)

Best,
ThemeBurn team

January 15, 2013 at 5:22 pm #17213
Viewing 10 posts - 1 through 10 (of 10 total)
  • You must be logged in to reply to this topic.