Jump to content

Display products list by viewed and non-viewed items


Recommended Posts

Hi, i am working on a prestashop project. i have to display products in a way that the products page

  • fist lists the new products/ or the products not viewed by customer with pagination
  • secondly show the products recently/previously viewed by customer/user with its own pagination.

Both will be displayed with their own pagination and on the same page.

can somebody guide me how i can do this or is there any module to do this functionality. just give me some hints to do this.

 

For more clear view. please see the image.

post-344066-0-33027600-1368019180_thumb.png

Link to comment
Share on other sites

In a category, products are retrieved uysing Category::getProducts()

 

THere is no way (I believe( to query by products viewed. but you might achieve something after the query is done. I have no clue atm, but basically I believe you'd want to retrieve viewed entries from a cookie, like the blockviewed module does:

 

 $productsViewed = (isset($params['cookie']->viewed) && !empty($params['cookie']->viewed)) ? array_slice(explode(',', $params['cookie']->viewed), 0, Configuration::get('PRODUCTS_VIEWED_NBR')) : array();

Link to comment
Share on other sites

I have echo a string in this function , even i removed function body and then only display string. But in the product listing page. it is still showing products. and string which i echoed is not showing on the listing page.i have also cleared the compiled cache but in vain.

 

i made following changes in classes/category.php

 

public function getProducts($id_lang, $p, $n, $order_by = null, $order_way = null, $get_total = false, $active = true, $random = false, $random_number_products = 1, $check_access = true, Context $context = null)

{

echo "GETTING PRODUCTS"; exit;

if (!$context)

$context = Context::getContext();

if ($check_access && !$this->checkAccess($context->customer->id))

return false;

 

 

but category page is still showing products.? can u tell me what is wrong with it??

Link to comment
Share on other sites

i don't know, what you are talking about. this category::getProducts() is working fine on home page. if i echo something it also shows on home page. But if i click on a category it list all products of that category. i echoed the query but on category product page it does not show the query i echoed in category class. i even removed the function body but it still shows category's products.

i just want to know which function is used to get products of a category. i have to customize that function according to my needs.is the category::getProducts() function is used to get category products or product::getProducts()???

Please just guide me.

Edited by sheraz4pro (see edit history)
Link to comment
Share on other sites

i don't know, what you are talking about. this category::getProducts() is working fine on home page.....

I got same problem. I need change product list but when i change "getProducts()" in Product Class or category Class nothing happend in product list (in home screen it work).

Link to comment
Share on other sites

  • 3 weeks later...
×
×
  • Create New...