def bump_cache_for_shop_product(shop_product):
 from shuup.core.models import ShopProduct
 bump_cache_for_item(shop_product)
 bump_cache_for_item(shop_product.product)
 q = Q()
 q |= Q(product__variation_parent_id=shop_product.product)
 if shop_product.product.variation_parent:
  q |= Q(product_id=shop_product.product.variation_parent.id)
 for child in ShopProduct.objects.filter(q).select_related('product'):
  bump_cache_for_item(child)
  bump_cache_for_item(child.product)
 if shop_product.product.is_package_child():
  for package_parent in shop_product.product.get_all_package_parents():
   for sp in ShopProduct.objects.filter(product_id=package_parent.id):
    bump_cache_for_item(sp)
    bump_cache_for_item(sp.product)

def bump_cache_for_shop_product ( shop_product ) : from shuup . core . models import ShopProduct bump_cache_for_item ( shop_product ) bump_cache_for_item ( shop_product . product ) q = Q ( ) q |= Q ( product__variation_parent_id = shop_product . product ) if shop_product . product . variation_parent : q |= Q ( product_id = shop_product . product . variation_parent . id ) for child in ShopProduct . objects . filter ( q ) . select_related ( 'product' ) : bump_cache_for_item ( child ) bump_cache_for_item ( child . product ) if shop_product . product . is_package_child ( ) : for package_parent in shop_product . product . get_all_package_parents ( ) : for sp in ShopProduct . objects . filter ( product_id = package_parent . id ) : bump_cache_for_item ( sp ) bump_cache_for_item ( sp . product )
bump cache for given shop product clear cache for shop product .