Issue: The list also bought/also viewed products do not show on the cart and CMS page when not enter the product ID

Created by Rosa Truong, Modified on Tue, 16 Jun, 2020 at 3:15 PM by Rosa Truong

Issue:

 

I am using the Customer also Bought/Viewed module v1.0.5 with Magento 2.3.5 and having an issue while creating a widget for the customer also bought on the cart page. When I have checked the logs find product_id undefined error and said that I have to enter product ID to show the list.

The module should not depend on the product. I can not add the product id manually, it should be dynamical.

For example, If I want the customer also Bought / View widget slider on the cart and home page, then on which base we can add the product ID?

Can you please look and make it dynamic, without any dependencies of product ID?


Solution:


As may you know about our module logic, it will automatically track and display related products of an item based on the real behavior of customers with this item.
Hence, when a customer visits another page of which is different from with product page, it needs to have something to base to list also bought/also viewed products.
Hence, we choose the product ID as the basis for listing bought/also viewed products.

In case, if you do not want to enter the product ID, we would like to give you a solution of which is without any dependencies of the product ID and it allows showing the list the bestseller products/most viewed products. 

We have updated and edited two files

app/code/Bss/CabavCustom/Controller/Alsobought/Product.php

app/code/Bss/CabavCustom/Controller/Alsoview/Product.php

Please check and add them to your site and then flush the cache.


If you have any issues, please feel free to contact us. 

We are more than happy to support you.



Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article