sheraz4pro Posted May 8, 2013 Share Posted May 8, 2013 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. Link to comment Share on other sites More sharing options...
sheraz4pro Posted May 15, 2013 Author Share Posted May 15, 2013 At least tell me the class and function which i need to customize. i have found a function getProducts() in classes/category.php. But changes in it does not make any effect on the page. Link to comment Share on other sites More sharing options...
NemoPS Posted May 15, 2013 Share Posted May 15, 2013 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 More sharing options...
sheraz4pro Posted May 15, 2013 Author Share Posted May 15, 2013 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 More sharing options...
sheraz4pro Posted May 15, 2013 Author Share Posted May 15, 2013 Please help me, where r u man?? Link to comment Share on other sites More sharing options...
NemoPS Posted May 15, 2013 Share Posted May 15, 2013 use var_dump instead of echo, then die() Link to comment Share on other sites More sharing options...
sheraz4pro Posted May 15, 2013 Author Share Posted May 15, 2013 (edited) 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 May 15, 2013 by sheraz4pro (see edit history) Link to comment Share on other sites More sharing options...
killer22 Posted May 20, 2013 Share Posted May 20, 2013 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 More sharing options...
Anton_bcn Posted June 9, 2013 Share Posted June 9, 2013 for debugging its better to use prestashop function d(); or p(); instead "echo "GETTING PRODUCTS"; exit;" try to do this: d ('GETTING PRODUCTS'); and of course you can use : d($variable); Link to comment Share on other sites More sharing options...
vekia Posted June 9, 2013 Share Posted June 9, 2013 i think is better to use p than d because d use break; p - not Link to comment Share on other sites More sharing options...
Recommended Posts