Enabled and Disabled Product

19 views
Skip to first unread message

garyj

unread,
Jul 9, 2012, 6:53:40 AM7/9/12
to magja-...@googlegroups.com
Hi, 

I am using the latest code from the repository to sync products between our POS system and Magento store. 

What I am finding is that when I call ProductRemoteService listAllNoDep() the returned product list does not have the product status set (eg I can not tell whether the product is enabled or disabled in Magento). As we have over 1700 products the call to listAll() takes a very long time and I was hoping to avoid doing that as the product status in Magento is a very simple field. 

Is the behaviour of listAllNoDep() intentionally does not set the product status? And if so what would be the best way to get perhaps only the enabled products from Magento for example? That way I can compare to the POS products and disable only those which are disabled in POS but not in Magento. 

Thank you

Gary

Sven Wesley

unread,
Jul 9, 2012, 6:59:09 AM7/9/12
to magja-...@googlegroups.com

Getting a status means that you have to retrieve data from the EAV tables (Entity Attribute Value). Unfortunately there is no way to get a single attribtue from Magento, you get them all.

Regards,
Sven

garyj

unread,
Jul 9, 2012, 7:05:57 AM7/9/12
to magja-...@googlegroups.com
Thank you for such a quick reply Sven, 

Is there a way to perhaps use a filter to get only enabled products?

Gary

Sven Wesley

unread,
Jul 9, 2012, 7:13:41 AM7/9/12
to magja-...@googlegroups.com

Should be possible. Don't have the possibility to test right now.

/S

Hendy Irawan

unread,
Jul 9, 2012, 8:54:48 AM7/9/12
to magja-...@googlegroups.com
Since I needed this too, I decided to implement it: see https://github.com/magja/magja/issues/66

Sample:

List<Product> products = service.listAllPlus(ImmutableSet.of("status"));
Assert.assertNotNull(products);
log.info("Got {} products", products.size());
Assert.assertTrue(products.size() > 0);
for (Product product : products) {
    Assert.assertNotNull(product.getAttributes());
    Assert.assertNotNull(product.getAttributes().get("status"));
}
for (Product product : products)
    log.info("{}", product);

You can get the latest magja snapshot from https://buildhive.cloudbees.com/job/magja/job/magja/

It also requires the latest https://github.com/magja/magja-catalog-ext

Good luck. Hope this helps. :-)

Hendy
Reply all
Reply to author
Forward
0 new messages