Add is_active_for_store()
method to products handler
with some basic logic, which assumes a volatile cache table has accurate data...
This commit is contained in:
parent
01b538ca90
commit
b5688a09dd
|
@ -594,6 +594,16 @@ class ProductsHandler(GenericHandler):
|
||||||
|
|
||||||
return get_product_by_code(session, entry)
|
return get_product_by_code(session, entry)
|
||||||
|
|
||||||
|
def is_active_for_store(self, product, store, **kwargs):
|
||||||
|
"""
|
||||||
|
Return boolean indicating whether the given product is
|
||||||
|
considered "active" at the given store.
|
||||||
|
"""
|
||||||
|
info = product.store_infos.get(store.uuid)
|
||||||
|
if info and info.recently_active:
|
||||||
|
return True
|
||||||
|
return False
|
||||||
|
|
||||||
def normalize_product(self, product, fields=None, **kwargs):
|
def normalize_product(self, product, fields=None, **kwargs):
|
||||||
"""
|
"""
|
||||||
Normalize the given product to a JSON-serializable dict.
|
Normalize the given product to a JSON-serializable dict.
|
||||||
|
|
Loading…
Reference in a new issue