Пример #1
0
 def update_solr_index(self):
     product = self.rate_chart.product
     try:
         tag = ProductTags.objects.get(product=product, tag__tag="steal")
     except ProductTags.DoesNotExist:
         assign_tag = Tag.objects.get(tag="steal")
         tag = ProductTags(product=product, tag=assign_tag)
         tag.save()
     product.update_solr_index()
Пример #2
0
 def update_solr_index(self):
     product = self.rate_chart.product
     try:
         tag = ProductTags.objects.get(product=product, tag__tag="steal")
     except ProductTags.DoesNotExist:
         assign_tag = Tag.objects.get(tag="steal")
         tag = ProductTags(product=product, tag=assign_tag)
         tag.save()
     product.update_solr_index()
Пример #3
0
 def update_solr_index(self):
     for l in self.listitem_set.all():
         product = l.sku.product
         try:
             tag = ProductTags.objects.get(product=product,
                                           tag__tag=self.type)
         except ProductTags.DoesNotExist:
             assign_tag = Tag.objects.get(tag=self.type)
             tag = ProductTags(product=product, tag=assign_tag)
             tag.save()
Пример #4
0
 def create_update_product_tags(self, product, tags):
     for tag_info in tags:
         tag_field = slugify(tag_info['value'])
         display_name = tag_info['value']
         tag_type = tag_info['type']
         try:
             tag = Tag.objects.using('default').get(tag = tag_field)
         except Tag.DoesNotExist:
             tag = Tag(display_name = display_name)
             tag.tag = tag_field
             tag.save(using='default')
         try:
             product_tag = ProductTags.objects.using('default').get(product = product, tag = tag, type = tag_type)
         except ProductTags.DoesNotExist:
             product_tag = ProductTags(product = product, tag = tag, type = tag_type)
             product_tag.save(using='default')
Пример #5
0
def get_or_create_product_tag(item, list, tab):
    product = item['product']
    try:
        product_tag = ProductTags.objects.get(product=product,
                                              type='sabse_sasta_sale')
        product_tag.tab = tab
        product_tag.sort_order = item['row_no']
    except ProductTags.DoesNotExist:
        product_tag = ProductTags()
        product_tag.product = product
        product_tag.type = 'sabse_sasta_sale'
        product_tag.tab = tab
        product_tag.sort_order = item['row_no']
    product_tag.save()
    return product_tag
Пример #6
0
def get_or_create_product_tag(item, list, tab):
    product = item['product']
    try:
        product_tag = ProductTags.objects.get(product=product, type='sabse_sasta_sale')
        product_tag.tab = tab
        product_tag.sort_order = item['row_no']
    except ProductTags.DoesNotExist:
        product_tag = ProductTags()
        product_tag.product = product
        product_tag.type = 'sabse_sasta_sale'
        product_tag.tab = tab
        product_tag.sort_order = item['row_no']
    product_tag.save()
    return product_tag
Пример #7
0
def compute(sync):
    _client_id = 5
    last_month = datetime.now() + timedelta(days=-30)
    # Get srcs of products created before 1 month
    new_rate_charts = SellerRateChart.objects.select_related('product', 'product__status').filter(product__is_online=True, seller__client=_client_id,\
                      product__created_on__gte=last_month).order_by("-product__created_on")[:200]
    new_products = []
    for src in new_rate_charts:
        new_products.append(src.product)
    # New arrivals products should be atleast 45 items
    if len(new_products) < 45:
        new_rate_charts = SellerRateChart.objects.select_related('product', 'product__status').filter(product__is_online=True,\
                          seller__client=_client_id).order_by("-product__created_on")[:200]
        new_products = []
        for src in new_rate_charts:
            new_products.append(src.product)

    # Create popular_deal tag, for indexing products into solr
    tag_type = 'new_arrivals'
    tag = Tag.objects.filter(tag=tag_type)
    if not tag:
        tag = Tag(tag=tag_type)
        tag.display_name = tag_type.capitalize()
        tag.save()
    else:
        tag = tag[0]
    products = []
    # variant_products contains product obj of {normal, variant} type
    # so replace variant products by variable 
    # to reindex in solr
    variant_products = new_products
    productvariants = ProductVariant.objects.select_related('blueprint', 'variant').filter(variant__in=variant_products)
    variant_product_map = {}
    for pv in productvariants:
        # get {variable : variant} mapping
        variant_product_map[pv.variant] = pv.blueprint
    for product in variant_products:
        prod = product
        if product.type == 'variant':
            try:
                # get corresponding variable of variant from variable:variant mapping
                prod = variant_product_map[product]
            except KeyError:
                continue
        if prod not in products:
            products.append(prod)
    # products list contains all products with type {variable, normal}
    product_ids_to_reindexed = []
    for product in products:
        try:
            pt = ProductTags.objects.select_related('product').get(type=tag_type, product=product, tag=tag)
        except ProductTags.DoesNotExist:
            pt = ProductTags()
            pt.type = tag_type
            pt.product = product  
            pt.tag = tag
            pt.save()
            # if product is not included in previous list then
            # then create ProductTag for it and reindex it 
        product_ids_to_reindexed.append(int(product.id))
    # Get previously indexed new arrivals from solr
    from utils.solrutils import solr_search
    q = 'tag_id:%s AND client_id:%s' % (tag.id, _client_id)
    params = {'rows':1000}
    solr_result = solr_search(q, fields='id', highlight=None, score=True, sort=None, sort_order="asc", operation='/select',\
                  active_product_query='', boost_query='', request=None, **params)

    indexed_new_arrivals = [int(res['id']) for res in solr_result.results]

    # ProductTags of (previously_indexed_new_arrivals - current_new_arrivals)
    # should to be removed
    new_arrivals_to_remove = set(indexed_new_arrivals) - set(product_ids_to_reindexed)
    product_ids_to_reindexed = set(product_ids_to_reindexed) - set(indexed_new_arrivals)
    log.info("New Arrivals ID:: %s" % product_ids_to_reindexed)
    sync.found = len(indexed_new_arrivals)
    sync.deletes = len(new_arrivals_to_remove)
    sync.add = len(product_ids_to_reindexed)
    sync.save()
    if not product_ids_to_reindexed:
        log.info("Found no new_arrivals")    
        return
    products_to_reindexed = Product.objects.filter(id__in=product_ids_to_reindexed)
    
    removed_new_arrivals = []
    for product_tag in ProductTags.objects.select_related('product').filter(product__in=new_arrivals_to_remove, tag=tag):
        removed_new_arrivals.append(product_tag.product)
        product_tag.delete()

    for product in products_to_reindexed:
        # Reindex:
        # 1) new product set (to add tag entry into solr)
        # 2) old tagged product set (to delete tag entry from solr)
        product.update_solr_index()
    for product in removed_new_arrivals:
        product.update_solr_index()
Пример #8
0
os.environ['DJANGO_SETTINGS_MODULE'] = 'tinla.fbsettings'

ROOT_FOLDER = os.path.realpath(os.path.dirname(__file__))
ROOT_FOLDER = ROOT_FOLDER[:ROOT_FOLDER.rindex('/')]

if ROOT_FOLDER not in sys.path:
    sys.path.insert(1, ROOT_FOLDER + '/')

# also add the parent folder
PARENT_FOLDER = ROOT_FOLDER[:ROOT_FOLDER.rindex('/')+1]
if PARENT_FOLDER not in sys.path:
    sys.path.insert(1, PARENT_FOLDER)

from catalog.models import Tag, ProductTags

pt = ProductTags.objects.select_related('tag').filter(type='clearance_sale')
for d in pt:
    tag_field = '%s-clearance'%d.tag.tag
    try:
        t = Tag.objects.using("default").get(tag=tag_field, type="clearance")
    except Tag.DoesNotExist:
        t = Tag(tag=tag_field, type="clearance")
        t.display_name = d.tag.display_name
        t.save(using='default')
    try:
        p = ProductTags.objects.using("default").get(tag=t, type="new_clearance_sale", product=d.product)
    except ProductTags.DoesNotExist:
        p = ProductTags(tag=t, type="new_clearance_sale", product=d.product)
        p.save(using='default')
    p.product.update_solr_index()
Пример #9
0
for product in variant_products:
    prod = product
    if product.type == 'variant':
        try:
            prod = variant_product_map[product]
        except KeyError:
            continue
    if prod not in products:
        products.append(prod)

for product in products:
    pt = ProductTags.objects.filter(type=promotion_name,
                                    product=product,
                                    tag=tag)
    if not pt:
        pt = ProductTags(type=promotion_name, product=product, tag=tag)
        pt.save()
        products_to_reindexed.append(product)
    else:
        pt = pt[0]
        if pt.product in previously_added_products:
            previously_added_products.remove(pt.product)

print "TOTAL NEW FOUND: ", len(products_to_reindexed)
product_tags = product_tags.filter(product__in=previously_added_products)
print "TOTAL OLD TAG TO BE INDEXED FOUND: ", product_tags.count()
for pt in product_tags:
    products_to_reindexed.append(pt.product)
    print "DELETING PREVIOUSLY ADDED PRODUCT TAG:: %s" % pt
    pt.delete()
Пример #10
0
    variant_product_map[pv.variant] = pv.blueprint

for product in variant_products:
    prod = product
    if product.type == 'variant':
        try:
            prod = variant_product_map[product]
        except KeyError:
            continue
    if prod not in products:
        products.append(prod)

for product in products:
    pt = ProductTags.objects.filter(type=promotion_name, product=product, tag=tag)
    if not pt:
        pt = ProductTags(type=promotion_name, product=product, tag=tag)
        pt.save()
        products_to_reindexed.append(product)
    else:
        pt = pt[0]
        if pt.product in previously_added_products:
            previously_added_products.remove(pt.product)

print "TOTAL NEW FOUND: ",len(products_to_reindexed)
product_tags = product_tags.filter(product__in=previously_added_products)
print "TOTAL OLD TAG TO BE INDEXED FOUND: ",product_tags.count()
for pt in product_tags:    
    products_to_reindexed.append(pt.product)
    print "DELETING PREVIOUSLY ADDED PRODUCT TAG:: %s" % pt
    pt.delete()
Пример #11
0
                            listitem.list = list
                            listitem.sku = itz_prods.seller_rate_chart
                            listitem.sequence = count
                            listitem.status = 'active'
                            listitem.save()
                            print "Okay - Listitem added -- %s" % itz_prods.seller_rate_chart
                        '''
                        try:
                            pt = ProductTags.objects.get(
                                type=list_type,
                                product=itz_prods.seller_rate_chart.product,
                                tag=tag)
                            print "Okay - ProductTags exists -- ", itz_prods.seller_rate_chart.product
                        except ProductTags.DoesNotExist:
                            pt = ProductTags(
                                type=list_type,
                                product=itz_prods.seller_rate_chart.product,
                                tag=tag)
                            pt.save()
                            print "Okay - ProductTags added -- %s" % itz_prods.seller_rate_chart.product

                        if int(itz_prods.seller_rate_chart.product.id
                               ) not in prod_ids_in_solr:
                            prod_ids_in_solr.append(
                                int(itz_prods.seller_rate_chart.product.id))

                    print "prod_ids_in_solr-----", prod_ids_in_solr

                    products = Product.objects.filter(id__in=prod_ids_in_solr)

                    for prod in products:
                        try:
Пример #12
0
def index_popular_deals(popular_pending_deals,
                        popular_confirmed_deals,
                        client_id=5):
    popular_products = popular_pending_deals + popular_confirmed_deals
    popular_products = Product.objects.filter(id__in=popular_products,
                                              is_online=True)
    if not popular_products:
        popular_orders = OrderCountByState.objects.select_related('product').filter(client=client_id,\
                         product__is_online=True).order_by('-order_count')[:200]
        popular_products = [order.product for order in popular_orders]
    # Create popular_deal tag, for indexing products into solr
    popular_type = 'popular_deals'
    tag = Tag.objects.filter(tag=popular_type)
    if not tag:
        tag = Tag(tag=popular_type)
        tag.display_name = popular_type.capitalize()
        tag.save()
    else:
        tag = tag[0]
    product_ids_to_reindexed = []
    products = []
    variant_products = popular_products
    productvariants = ProductVariant.objects.select_related(
        'blueprint', 'variant').filter(variant__in=variant_products)
    variant_product_map = {}
    for pv in productvariants:
        variant_product_map[pv.variant] = pv.blueprint
    for product in variant_products:
        prod = product
        if product.type == 'variant':
            try:
                prod = variant_product_map[product]
            except KeyError:
                continue
        if prod not in products:
            products.append(prod)
    for product in products:
        try:
            pt = ProductTags.objects.select_related('product').get(
                type=popular_type, product=product, tag=tag)
        except ProductTags.DoesNotExist:
            pt = ProductTags()
            pt.type = popular_type
            pt.product = product
            pt.tag = tag
            pt.save()
            product_ids_to_reindexed.append(int(product.id))

    from utils.solrutils import solr_search
    q = 'tag_id:%s AND client_id:%s' % (tag.id, client_id)
    params = {'rows': 1000}
    solr_result = solr_search(q, fields='id', highlight=None, score=True, sort=None, sort_order="asc", operation='/select',\
                  active_product_query='', boost_query='', request=None, **params)

    indexed_popular_deals = [int(res['id']) for res in solr_result.results]

    popular_deals_to_remove = set(indexed_popular_deals) - set(
        product_ids_to_reindexed)
    product_ids_to_reindexed = set(product_ids_to_reindexed) - set(
        indexed_popular_deals)
    log.info("Popular Deals ID:: %s" % product_ids_to_reindexed)
    sync.found = len(indexed_popular_deals)
    sync.deletes = len(popular_deals_to_remove)
    sync.add = len(product_ids_to_reindexed)
    sync.save()
    if not product_ids_to_reindexed:
        log.info("Found no popular_deals")
        return

    products_to_reindexed = Product.objects.filter(
        id__in=product_ids_to_reindexed)

    removed_popular_deals = []
    for product_tag in ProductTags.objects.select_related('product').filter(
            product__in=popular_deals_to_remove, tag=tag):
        removed_popular_deals.append(product_tag.product)
        product_tag.delete()

    for product in products_to_reindexed:
        # Reindex:
        # 1) new product set (to add tag entry into solr)
        # 2) old tagged product set (to delete tag entry from solr)
        product.update_solr_index()
    for product in removed_popular_deals:
        product.update_solr_index()
Пример #13
0
for product in variant_products:
    prod = product
    if product.type == 'variant':
        try:
            prod = variant_product_map[product]
        except KeyError:
            continue
    if prod not in products:
        products.append(prod)

for product in products:
    pt = ProductTags.objects.filter(type=promotion_name,
                                    product=product,
                                    tag=tag)
    if not pt:
        pt = ProductTags(type=promotion_name, product=product,
                         tag=tag)  # , sort_order = product.sequence
        pt.save()
        products_to_reindexed.append(product)
    else:
        pt = pt[0]
        if pt.product in previously_added_products:
            previously_added_products.remove(pt.product)
        products_to_reindexed.append(product)  #####EXTRA ADDED

print "TOTAL NEW FOUND: ", len(products_to_reindexed)
product_tags = product_tags.filter(product__in=previously_added_products)
print "TOTAL OLD TAG TO BE INDEXED FOUND: ", product_tags.count()
for pt in product_tags:
    products_to_reindexed.append(pt.product)
    print "DELETING PREVIOUSLY ADDED PRODUCT TAG:: %s" % pt
    pt.delete()
Пример #14
0
def compute(sync):
    _client_id = 5
    last_month = datetime.now() + timedelta(days=-30)
    # Get srcs of products created before 1 month
    new_rate_charts = SellerRateChart.objects.select_related('product', 'product__status').filter(product__is_online=True, seller__client=_client_id,\
                      product__created_on__gte=last_month).order_by("-product__created_on")[:200]
    new_products = []
    for src in new_rate_charts:
        new_products.append(src.product)
    # New arrivals products should be atleast 45 items
    if len(new_products) < 45:
        new_rate_charts = SellerRateChart.objects.select_related('product', 'product__status').filter(product__is_online=True,\
                          seller__client=_client_id).order_by("-product__created_on")[:200]
        new_products = []
        for src in new_rate_charts:
            new_products.append(src.product)

    # Create popular_deal tag, for indexing products into solr
    tag_type = 'new_arrivals'
    tag = Tag.objects.filter(tag=tag_type)
    if not tag:
        tag = Tag(tag=tag_type)
        tag.display_name = tag_type.capitalize()
        tag.save()
    else:
        tag = tag[0]
    products = []
    # variant_products contains product obj of {normal, variant} type
    # so replace variant products by variable
    # to reindex in solr
    variant_products = new_products
    productvariants = ProductVariant.objects.select_related(
        'blueprint', 'variant').filter(variant__in=variant_products)
    variant_product_map = {}
    for pv in productvariants:
        # get {variable : variant} mapping
        variant_product_map[pv.variant] = pv.blueprint
    for product in variant_products:
        prod = product
        if product.type == 'variant':
            try:
                # get corresponding variable of variant from variable:variant mapping
                prod = variant_product_map[product]
            except KeyError:
                continue
        if prod not in products:
            products.append(prod)
    # products list contains all products with type {variable, normal}
    product_ids_to_reindexed = []
    for product in products:
        try:
            pt = ProductTags.objects.select_related('product').get(
                type=tag_type, product=product, tag=tag)
        except ProductTags.DoesNotExist:
            pt = ProductTags()
            pt.type = tag_type
            pt.product = product
            pt.tag = tag
            pt.save()
            # if product is not included in previous list then
            # then create ProductTag for it and reindex it
        product_ids_to_reindexed.append(int(product.id))
    # Get previously indexed new arrivals from solr
    from utils.solrutils import solr_search
    q = 'tag_id:%s AND client_id:%s' % (tag.id, _client_id)
    params = {'rows': 1000}
    solr_result = solr_search(q, fields='id', highlight=None, score=True, sort=None, sort_order="asc", operation='/select',\
                  active_product_query='', boost_query='', request=None, **params)

    indexed_new_arrivals = [int(res['id']) for res in solr_result.results]

    # ProductTags of (previously_indexed_new_arrivals - current_new_arrivals)
    # should to be removed
    new_arrivals_to_remove = set(indexed_new_arrivals) - set(
        product_ids_to_reindexed)
    product_ids_to_reindexed = set(product_ids_to_reindexed) - set(
        indexed_new_arrivals)
    log.info("New Arrivals ID:: %s" % product_ids_to_reindexed)
    sync.found = len(indexed_new_arrivals)
    sync.deletes = len(new_arrivals_to_remove)
    sync.add = len(product_ids_to_reindexed)
    sync.save()
    if not product_ids_to_reindexed:
        log.info("Found no new_arrivals")
        return
    products_to_reindexed = Product.objects.filter(
        id__in=product_ids_to_reindexed)

    removed_new_arrivals = []
    for product_tag in ProductTags.objects.select_related('product').filter(
            product__in=new_arrivals_to_remove, tag=tag):
        removed_new_arrivals.append(product_tag.product)
        product_tag.delete()

    for product in products_to_reindexed:
        # Reindex:
        # 1) new product set (to add tag entry into solr)
        # 2) old tagged product set (to delete tag entry from solr)
        product.update_solr_index()
    for product in removed_new_arrivals:
        product.update_solr_index()
Пример #15
0
def index_popular_deals(popular_pending_deals, popular_confirmed_deals, client_id=5):
    popular_products = popular_pending_deals + popular_confirmed_deals
    popular_products = Product.objects.filter(id__in=popular_products, is_online=True)
    if not popular_products:
        popular_orders = OrderCountByState.objects.select_related('product').filter(client=client_id,\
                         product__is_online=True).order_by('-order_count')[:200]
        popular_products = [order.product for order in popular_orders]
    # Create popular_deal tag, for indexing products into solr
    popular_type = 'popular_deals'
    tag = Tag.objects.filter(tag=popular_type)
    if not tag:
        tag = Tag(tag=popular_type)
        tag.display_name = popular_type.capitalize()
        tag.save()
    else:
        tag = tag[0]
    product_ids_to_reindexed = []
    products = []
    variant_products = popular_products
    productvariants = ProductVariant.objects.select_related('blueprint', 'variant').filter(variant__in=variant_products)
    variant_product_map = {}
    for pv in productvariants:
        variant_product_map[pv.variant] = pv.blueprint
    for product in variant_products:
        prod = product
        if product.type == 'variant':
            try:
                prod = variant_product_map[product]
            except KeyError:
                continue
        if prod not in products:
            products.append(prod)
    for product in products:
        try:
            pt = ProductTags.objects.select_related('product').get(type=popular_type, product=product, tag=tag)
        except ProductTags.DoesNotExist:
            pt = ProductTags()
            pt.type = popular_type
            pt.product = product  
            pt.tag = tag
            pt.save()
            product_ids_to_reindexed.append(int(product.id))

    from utils.solrutils import solr_search
    q = 'tag_id:%s AND client_id:%s' % (tag.id, client_id)
    params = {'rows':1000}
    solr_result = solr_search(q, fields='id', highlight=None, score=True, sort=None, sort_order="asc", operation='/select',\
                  active_product_query='', boost_query='', request=None, **params)

    indexed_popular_deals = [int(res['id']) for res in solr_result.results]

    popular_deals_to_remove = set(indexed_popular_deals) - set(product_ids_to_reindexed)
    product_ids_to_reindexed = set(product_ids_to_reindexed) - set(indexed_popular_deals)
    log.info("Popular Deals ID:: %s" % product_ids_to_reindexed)
    sync.found = len(indexed_popular_deals)
    sync.deletes = len(popular_deals_to_remove)
    sync.add = len(product_ids_to_reindexed)
    sync.save()
    if not product_ids_to_reindexed:
        log.info("Found no popular_deals")
        return

    products_to_reindexed = Product.objects.filter(id__in=product_ids_to_reindexed)

    removed_popular_deals= []
    for product_tag in ProductTags.objects.select_related('product').filter(product__in=popular_deals_to_remove, tag=tag):
        removed_popular_deals.append(product_tag.product)
        product_tag.delete()

    for product in products_to_reindexed:
        # Reindex:
        # 1) new product set (to add tag entry into solr)
        # 2) old tagged product set (to delete tag entry from solr)
        product.update_solr_index()
    for product in removed_popular_deals:
        product.update_solr_index()
Пример #16
0
def mark_itz_cat_hero(request, commission_on_id):
    error = ''
    is_marked_hero = False
    tag_hero_name = 'itz_hero'
    list_type = 'itz_offer'
    
    net_details = save_franc_network_in_dict(request)

    tag_hero = Tag.objects.filter(tag=tag_hero_name)
    if tag_hero:
        tag_hero = tag_hero[0]
    else:
        error = "No ITZ hero tag found"
    
    if not error:
        try:
            commision_on = CommisionOn.objects.get(network = net_details['network'], id = commission_on_id)
            this_prod_id = int(commision_on.seller_rate_chart.product.id)
            
            from catalog.models import ProductTags, Product
            try:
                pt = ProductTags.objects.get(type = list_type, product = commision_on.seller_rate_chart.product, tag=tag_hero)
                is_marked_hero = True
            except ProductTags.DoesNotExist:
                pt = ProductTags(type = list_type, product = commision_on.seller_rate_chart.product, tag=tag_hero)
                pt.save()
                is_marked_hero = True
            
                commision_on.seller_rate_chart.product.update_solr_index()
                parent_cat_dict = get_categories_by_id(request, [str(commision_on.seller_rate_chart.product.id)])
                parent_c1_id = parent_cat_dict['c1_categories'][0].id
            
                from utils.solrutils import solr_search
                params = {'rows':200}
                q = 'tag_id:%s AND category_id:%s' % (tag_hero.id, parent_c1_id)
                
                try:
                    solr_result = solr_search(q, **params)
                    prod_ids_in_solr = [int(doc['id']) for doc in solr_result.results]
                    if this_prod_id in prod_ids_in_solr:
                        prod_ids_in_solr.remove(this_prod_id)
                    
                    for prod in prod_ids_in_solr:
                        try:
                            pt = ProductTags.objects.get(type = list_type, product = prod, tag=tag_hero).delete()
                        except:
                            pass
                        try:
                            product = Product.objects.get(id = prod)
                            product.update_solr_index()
                        except:
                            pass
                    
                except:
                    error = "Solr query failed. Query:",q
        except:
            error = 'Itz product not found'
    
    if not error:
        ajax_response = dict(status='success', is_marked_hero = is_marked_hero, error=error)
    else:
        ajax_response = dict(status='failed', error=error)
    
    return HttpResponse(simplejson.dumps(ajax_response))
Пример #17
0
         listitem = ListItem.objects.get(list__id=list_id, sku = itz_prods.seller_rate_chart)
         print "Okay - listitem exists -- ",listitem
     except:
         listitem = ListItem()
         listitem.list = list
         listitem.sku = itz_prods.seller_rate_chart
         listitem.sequence = count
         listitem.status = 'active'
         listitem.save()
         print "Okay - Listitem added -- %s" % itz_prods.seller_rate_chart
     '''
     try:
         pt = ProductTags.objects.get(type = list_type, product = itz_prods.seller_rate_chart.product, tag=tag)
         print "Okay - ProductTags exists -- ",itz_prods.seller_rate_chart.product
     except ProductTags.DoesNotExist:
         pt = ProductTags(type = list_type, product = itz_prods.seller_rate_chart.product, tag=tag)
         pt.save()
         print "Okay - ProductTags added -- %s" % itz_prods.seller_rate_chart.product
     
     if int(itz_prods.seller_rate_chart.product.id) not in prod_ids_in_solr:
         prod_ids_in_solr.append(int(itz_prods.seller_rate_chart.product.id))
 
 
 print "prod_ids_in_solr-----",prod_ids_in_solr
 
 products = Product.objects.filter(id__in =prod_ids_in_solr)
 
 for prod in products:
     try:
         if prod.status != 'active':
             print "\nProduct found. But product.status is deactive on ",prod