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
|
|
You will need to register in order to post topics and read replies in the ThemeBurn.com support forums!
|
|
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.
|
|
Did you try to insert $this->load->model('catalog/product'); before using $this->model_catalog_product->getProductRelated.... ?
|
|
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
|
|
You will need to register in order to post topics and read replies in the ThemeBurn.com support forums!
Regards,
ThemeBurn team
|
|
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!
|
|
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.
|
|
You’re welcome, mate
Best,
ThemeBurn team
|
|