Display 'Related Products' to Customer based on Cust

Posted by Community Admin on 04-Aug-2018 15:30

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

All Replies

Posted by Community Admin on 31-Jul-2015 00:00

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

           ??

 

Posted by Community Admin on 01-Aug-2015 00:00

I got the answer from below post of similar kind. 

www.sitefinity.com/.../get-all-tags-(taxons)-in-a-list-from-taxonomymanager

thanks everyone.

 

 

This thread is closed