Jump to content

product description override


Ehsanai

Recommended Posts

Hi,

I've a module for internal link an this module is not working for product descriptions.

can somebody tell me that this override is correct or not?

PS 1.7.6.1

 

class ProductController extends ProductControllerCore
{
    public function initContent()
    {
        if(Module::isInstalled('g_internallinking') && Module::isEnabled('g_internallinking'))
        {
            // overide product content
            $formObj = Module::getInstanceByName('g_internallinking');
            $contents = array(
                'description_short'=>$this->product->description_short,
                'description'=>$this->product->description,
            );
            $results = $formObj->getContentInternallinking('product',(int)$this->product->id,$contents);
            $this->product->description = $results['description'];
            $this->product->description_short = $results['description_short'];
            //# overide product content
        }
        parent::initContent();
    }
}

 

Link to comment
Share on other sites

Did you  try to output text, or write to a log to make sure your code is being called?

When you are calling parent::initContent(); you are essentially running the same function you are overwriting, and if you are initiating the same variable as the original function, it will overwrite whatever you are doing.

Link to comment
Share on other sites

I don't know exactly.

I have problem with module and I think the override is not working well.

Do you know the product description override is difference between PS 1.6 and 1.7?

the module has the same override for this and I think it's wrong.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...