Author Topic: Menu item that displays Latest products only?  (Read 100 times)

panoss

  • Jr. Member
  • **
  • Posts: 78
  • A beginner
Menu item that displays Latest products only?
« on: September 08, 2017, 16:09:16 pm »
I want a menu item which when is clicked, only Latest products will be displayed.
What I have done so far:
APPROACH A:
1. I have overriden the Category view with file: templates\protostar\html\com_virtuemart\category\default-latestproducts.php
2. I have overriden the Products sublayout with file: templates\protostar\html\com_virtuemart\sublayouts\products-latest.php
3. In the first file (the view), I have replaced a line (around line 147, where there is a 'renderVmSubLayout' command) with: echo shopFunctionsF::renderVmSubLayout('products-latest',array('products'=>$this->products,'currency'=>$this->currency,'products_per_row'=>$this->perRow,'showRating'=>$this->showRating));
4. in the second file (the sublayout) after line 32 , after 'foreach', I have put: if($type==='latest'){ , so that only latest products are displayed.
5. In back-end, at my menu item: Virtuemart category view settings > Page Layout I have selected 'default-latestproducts'.

It works, it displays only the Latest products, which is what I want.
BUT pagination is not correct (shows pagination for all products, not only for Latest ones).

I suppose this is not the correct way, so which is the correct way to display Latest products?

edit:

APPROACH B:
1. I have overriden the Category view with file: templates\protostar\html\com_virtuemart\category\default-latestproducts.php. It's totally empty, not a single line of code.
2. In the back-end, at my menu item: Virtuemart category view settings > Page Layout I have selected 'default-latestproducts'.
edit:
3. In VM 's back end, I created a new Category named 'New'.  left it unpublished.
4. My menu item now 'points' to the VM Category 'New'.
5. I made a copy of module 'VirtueMart Products' which I renamed to 'Virtuemart Latest Products' where I put In: Module > Display, I selected 'Latest Products'.
Virtuemart 3.2.2 on Joomla! 3.7.4

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9322
  • VM3.2 Cached and Optimized
    • VM3 Extensions
  • VirtueMart Version: VirtueMart 3 on joomla 3
Re: Menu item that displays Latest products only?
« Reply #1 on: September 10, 2017, 20:31:19 pm »
Since vm3.2 you do not need to write, change, edit any file. You just need to create a menu item and select the "latest product" group only, thats it.
I should fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/