News:

Support the VirtueMart project and become a member

Main Menu

Menu item that displays Latest products only?

Started by panoss, September 08, 2017, 16:09:16 PM

Previous topic - Next topic

panoss

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

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.
Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

garikello

#2
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

lostmail

#3
Old but i can not find the menu link for new, featured, bestsellers, random....

:-[
Joomla 3.x | VirtueMart 4.0.12 107771 | HORME3 PRO 1.9.6 / 2.0
VirtueMart 4.2.4 | Joomla 4.4.1 | PHP 8.1 | Vp_neoteric 1.3

pinochico

www.minijoomla.org  - new portal for Joomla!, Virtuemart and other extensions
XML Easy Feeder - feeds for FB, GMC,.. from products, categories, orders, users, articles, acymailing subscribers and database table
Virtuemart Email Manager - customs email templates
Import products for Virtuemart - from CSV and XML
Rich Snippets - Google Structured Data
VirtueMart Products Extended - Slider with products, show Others bought, Products by CF ID and others filtering products