Jump to content

[solved] Overriding classes in module is not working after module reset


xezus
 Share

Recommended Posts

Hi guys I not sure if it's just my problem or if it's some prestashop bug.

 

The problem is

 

I am overriding two classes Category.php and Link.php after install is everything ok, but when I what to reset the module I get a error

 

Cannot install this module.

Unable to install override: directory (C:\xampp\htdocs\prestashop\override\override/classes) not writable

 

 

 

As you can see it adds twice override\override into the path. Only solution I found working is to remove the overriding classes reset the module add them again reset the module, and then it works.

 

I tested this on prestashop 1.5.5 and 1.5.4 and I got the same result.

 

Has anyone the same problem?

Edited by El Patron (see edit history)

Share this post


Link to post
Share on other sites

Yes I have

 

modules/modulename/override/classes/Category.php

modules/modulename/override/classes/Link.php

 

And with the first install It's everything ok. They are install in root/override/classes

But during reinstall I get the above error and module is not install, and the classes in root/override/classes are still there. They are not removed or uninstall.

Share this post


Link to post
Share on other sites

  • 2 months later...

I am getting below error when I am trying to install below module

 

  • - ILLICOPRESTA_P15_StockManagement : 
    Unable to install override: The method getAllProductSupplierPrice in the class ProductSupplier is already overriden.

 

Urgent help will be appreciated..

Share this post


Link to post
Share on other sites

this is my code in the file ProductSupplier.php

<?php

class ProductSupplier extends ProductSupplierCore
{
    public static function getAllProductSupplierPrice($id_product, $id_product_attribute, $with_currency = false)
    {
            // build query
            $query = new DbQuery();
            $query->select('ps.product_supplier_price_te, s.name as supplier_name');
            if ($with_currency)
                            $query->select('ps.id_currency');
            $query->from('product_supplier', 'ps');
            $query->where('ps.id_product = '.(int)$id_product.' AND ps.id_product_attribute = '.(int)$id_product_attribute );
             $query->leftJoin('supplier', 's', 'ps.id_supplier = s.id_supplier');

            if (!$with_currency)
                            return Db::getInstance(_PS_USE_SQL_SLAVE_)->getValue($query);

            return Db::getInstance(_PS_USE_SQL_SLAVE_)->executeS($query);
    }

}

Share this post


Link to post
Share on other sites

I am getting below error when I am trying to install below module

 

  • - ILLICOPRESTA_P15_StockManagement : 

    Unable to install override: The method getAllProductSupplierPrice in the class ProductSupplier is already overriden.

 

Urgent help will be appreciated..

 

the error is just as stated, and the module will need to be installed 'manually'.

 

there is already existing in your override/classes ProductSupplier.php

 

you will need to merge the function getAllProductSupplierPrice with the new override...

Share this post


Link to post
Share on other sites

So, I just copy the file via FTP to the module folder.. instead of "installing" it via adminPanel.. I can do that however I dont know how to do below..

 

"you will need to merge the function getAllProductSupplierPrice with the new override..."

Share this post


Link to post
Share on other sites

the error is just as stated, and the module will need to be installed 'manually'.

 

there is already existing in your override/classes ProductSupplier.php

 

you will need to merge the function getAllProductSupplierPrice with the new override...

 

So I uploaded the files via FTP, and still same thing is issue, I need to "install" it and when I do that I get the same error.. so question is how to I merge the function.. I believe if I merge the function, and than install the module it will work..

Share this post


Link to post
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
 Share

×
×
  • Create New...

Important Information

Cookies ensure the smooth running of our services. Using these, you accept the use of cookies. Learn More