VirtueMart Forum

VirtueMart 2 + 3 + 4 => Templating & Layouts => Topic started by: panoss on September 08, 2017, 16:09:16 PM

Title: Menu item that displays Latest products only?
Post by: panoss 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'.
Title: Re: Menu item that displays Latest products only?
Post by: Milbo 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.
Title: Re: Menu item that displays Latest products only?
Post by: garikello on February 17, 2018, 17:01:42 PM
Quote from: Milbo on September 10, 2017, 20:31:19 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
Title: Re: Menu item that displays Latest products only?
Post by: lostmail on December 14, 2020, 15:44:29 PM
Old but i can not find the menu link for new, featured, bestsellers, random....

:-[
Title: Re: Menu item that displays Latest products only?
Post by: pinochico on December 15, 2020, 04:14:42 AM
really?