Jump to content

[SOLVED] Product::getProducts() is it deprecated?


fusillicode

Recommended Posts

Hi community I'm trying to customize a bit the getProducts() to satisfy some common needs like get all the products that are classified in two different categories and I'm planning to ask for a pull request once I'm done.

 

Just for curiosity I tried to search for the over mentioned function but I didn't find anything. It seems to be completely unused.

 

Is there something that I'm missing here? Is the function intended to be deprecated anytime soon?

 

Thanks in advance to everyone would answer :)

 

Cheers!

Edited by fusillicode (see edit history)
Link to comment
Share on other sites

It seems that most of the classes use the Cart::getProducts function, I'm not finding any direct usage of Product::getProducts. 

 

I'm also finding that many classes define their own getProducts function (Scene, Manufacturer etc...)

 

I do see some indirect usage in the admin controllers.  I say indirect because of the use of $object, see examples below.  So it depends on what the Object is during runtime, which might be a Product

 

AdminScenesControllerCore

$this->tpl_form_vars['products'] = $obj->getProducts(true, $this->context->language->id, false, $this->context);

AdminSuppliersControllerCore

$products = $this->object->getProductsLite($this->context->language->id);

AdminTagsControllerCore

$previousProducts = $obj->getProducts();
Link to comment
Share on other sites

Thank you very much for the quick and complete answer! :)

 

The fact that most of the classes define their own method to retrieve the products discourages me from asking the pull request.

 

But sincerely I find the getProducts of the Product class a little bit to strict.

 

I think I'll go with a custom getProducts. What bothers me about this solution is that on every PS update I'll have to check if something changed.

 

Anyway thank you agian ;)

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...