Display 'Related Products' to Customer based on Customer's Previous Orders
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
??
I got the answer from below post of similar kind.
www.sitefinity.com/.../get-all-tags-(taxons)-in-a-list-from-taxonomymanager
thanks everyone.