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

panoss

  • Jr. Member
  • **
  • Posts: 96
  • 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.4 on Joomla! 3.8.0

Milbo

  • Virtuemart Projectleader
  • Administrator
  • Super Hero
  • *
  • Posts: 9591
  • 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/

garikello

  • Beginner
  • *
  • Posts: 39
  • A beginner
  • Skype Name: garikello123
Re: Menu item that displays Latest products only?
« Reply #2 on: February 17, 2018, 17:01:42 pm »
Since vm3.2 (...) You just need to create a menu item and select the "latest product" group only, thats it.

Hi,

Does not work for me.... Not sure, what is the problem. Category is just empty.

This is what debug gives me:

1 vmdebug 3 Languages, default shoplanguage (VmConfig::$jDefLang): lv_lv lv-LV Selected VM language (VmConfig::$vmlang): lv_lv lv-LV SEF: lv
2 vmdebug vmTime: time to load config: 0.00406408309936523
3 vmdebug There is no requested itemid loaded home Itemid Var1:

551

4 vmdebug Start used Ram 14M
5 vmdebug Common jQuery is disabled
6 vmdebug getVendorId normal shopper
7 vmdebug My Memory Limit in Bytes 268435456
8 vmdebug vmTime: getSearchCustom after setUserState: 4.05311584472656E-6
9 vmdebug vmTime: getSearchCustom End: 0.00312089920043945
10 vmdebug $limitStart Var1:

0

11 vmdebug vmTime: sortSearchQuery products: : 0.020313024520874
12 vmdebug Common jQuery is disabled
13 vmdebug Fallback active
14 vmdebug Going to set pw fields unrequired
15 vmdebug End used Ram 18M
16 vmdebug Peak memory peak 18M
17 vmdebug vmTime: "VirtuemartControllerCategory" Finished task : 0.0855941772460938
18 vmdebug Common jQuery is disabled
19 vmdebug shipmentmethod Izņemt personīgi = TRUE for variable weight = 0 Reason: is within Range of the condition from 0.000 to 1000.000
20 vmdebug shipmentmethod Izņemt personīgi = TRUE for variable order amount = 0 Reason: no boundary conditions set
21 vmdebug shipmentmethod Izņemt personīgi = TRUE for variable zip = 0 Reason: is lower than the set 999999
22 vmdebug shipmentmethod Izņemt personīgi = TRUE for variable virtuemart_country_id = 223, Reason: Countries in rule or none set
23 vmdebug vmTime: Time consumed for shipment/payment plugins: 0.0293750762939453