Developer forum

Forum » Templates » Customers who bought this also bought not returning any products

Customers who bought this also bought not returning any products

Cátia Torego
Reply
I'm using the "Customers who bought this also bought" loop in the product page (eCom:Related.CustomersWhoBoughtThisItemAlsoBought) but i'm not getting any products.

I made several orders, shouldn't it have some products?

 

DW version 9.5.7


Replies

 
Nicolai Pedersen
Reply

I can make it work - it can be a language issue.

This is the SQL it runs:

  SELECT DISTINCT TOP 10 *
            FROM EcomProducts
            INNER JOIN
            (
                SELECT DISTINCT(E2.OrderLineProductID),
                (
                    SELECT COUNT(*)
                    FROM EcomOrderLines E3
                    WHERE E3.OrderLineProductID = E2.OrderLineProductID
                    AND E3.OrderLineOrderID IN
                    (
                        SELECT DISTINCT(OrderLineOrderID)
                        FROM EcomOrderLines E4
                        WHERE E4.OrderLineProductID = 'PROD23'
                    )
                ) AS Frequency
                FROM EcomOrderLines AS E1
                INNER JOIN EcomOrderLines AS E2
                ON E1.OrderLineOrderID = E2.OrderLineOrderID
                INNER JOIN EcomOrders AS O
                ON E1.OrderLineOrderID = O.OrderID
                WHERE E1.OrderLineProductID = 'PROD23'
                AND E2.OrderLineProductID <> 'PROD23'
                AND O.OrderComplete = 1
            ) AS SelectorTable
            ON EcomProducts.ProductID = SelectorTable.OrderLineProductID
            WHERE EcomProducts.ProductVariantID IS NULL OR EcomProducts.ProductVariantID = ''  AND EcomProducts.ProductLanguageID = 'lang1'

BR Nicolai

 
Cátia Torego
Reply

Hi Nicolai,

What do you mean a language issue? 

There is only one language and the products have the language id. 

 
Nicolai Pedersen
Reply

ok

 
Cátia Torego
Reply

Hi Nicolai,

Can you help me with the next steps to try and fix this? 
Could i be missing something, is there a schedule task that needs to exist for this to work?

The site has one language and all the products have that language id. 
I'm using the loop in the product detail page, there are a lot of orders done in the site, but the loop is still empty.

Do i need to provide you some other information that would be helpful?

 

 
Nicolai Pedersen
Reply

Run the SQL I provided for a product that you know has been on an order and post the results here.

Post information about what you do - template code etc. Provide screendumps of the orders...

Another thing can be that if you have an old license and do not have the feature called 'eCom_PowerPack' which you can locate in setttings, system, license information.

BR Nicolai

 
Cátia Torego
Reply

I run the sql for a product that was in the order, with the id Word_080689595172. The result is in the image i added.

This is my code in the template:

var products = GetLoop("eCom:Related.CustomersWhoBoughtThisItemAlsoBought");
foreach (var prod in products)
{
    @prod.GetString("Ecom:Product.Name")
}

The eCom_PowerPack is present.

order.JPG queryResult.JPG
 
Nicolai Pedersen
Reply

Can I get the full template? And what did your license page say?

 

You must be logged in to post in the forum