+1-888-365-2779
Try Now
More in this section

Forums / Developing with Sitefinity / Display 'Related Products' to Customer based on Customer's Previous Orders

Display 'Related Products' to Customer based on Customer's Previous Orders

2 posts, 0 answered
  1. Faheem
    Faheem avatar
    5 posts
    Registered:
    29 Jul 2015
    31 Jul 2015
    Link to this post

    Hi Everyone,

    I need urgent help on below. I am trying to fetch 'Related Products' for a customer based on customer's previous orders.  

    I want to use TAGs for this purpose. 

    Below is my code.

    Assume that customer id is know. First I am trying to fetch customer's previous orders and then from the order details I am extracting products information. I am stuck here as there is no direct method available to get to know TAGs list associated with a particular Product and similarly no direct method to call GetProducts() by Tags. 

    Please help !!

                 //Get orders done by a particular customer.

                OrdersManager objOrderManager = OrdersManager.GetManager();
                var orders = objOrderManager.GetOrders().Where(o => o.Customer.Id == _customerId).ToList();
                
                //Get the details of the customer's first order.
                OrderDetail _orderDetails = orders[0].Details[0];

                //Get the product id.
                Guid _productId = _orderDetails.ProductId;

                //Get Product by product id.
                CatalogManager catMgr = CatalogManager.GetManager();
                Product objProduct = catMgr.GetProduct(_productId);

                //How to get the TAG list from  objProduct

                ??

                //Get the list of all products which are having same TAG (associated with them) as the selected Product

               ??

     

  2. Faheem
    Faheem avatar
    5 posts
    Registered:
    29 Jul 2015
    01 Aug 2015 in reply to Faheem
    Link to this post

    I got the answer from below post of similar kind. 

    http://www.sitefinity.com/developer-network/forums/developing-with-sitefinity-/get-all-tags-(taxons)-in-a-list-from-taxonomymanager#HlGoy8E3622pWP8AAERlJg 

    thanks everyone.

     

     

2 posts, 0 answered