News:

Support the VirtueMart project and become a member

Main Menu

Custom product query + category layout

Started by sandomatyas, December 10, 2018, 11:10:30 AM

Previous topic - Next topic

sandomatyas

I want to create a custom product list with my special requests (like products in stock and added in the last week and cheaper than a limit and not featured and have a specific custom field value, etc). The query is okay, I can fetch the records from the database.
But what do you suggest to display them like VM displays products of a category? Basically I need using the products sublayout and a proper pagination. Building a custom component with an own pagination and use VM sublayouts?
Or any better idea?

StefanSTS

As much as possible I would try to operate with categories.

Depend if you can set a category for these products you could just create a "below this price"-category and so on and use a custom products.php like products_belowprice.php.

If that does not work, the new products_something.php could also hold higher level categories and you filter in the loop for the prices you need.

Stefan
--
Stefan Schumacher
www.jooglies.com - VirtueMart Invoice Layouts

Please use only stable versions with even numbers for your live shop! Use Alpha versions only if you know what risk you are taking.

GJC Web Design

use a custom products.php

agree with stefan - it is very easy actually to create a complete "other" VM "view"  by just duplicating and renaming the model, view folder  etc etc and then as suggested adapt the products_myname.php to what u need

have also done different views by duplicating the products.php model, renaming and the class and calling it in your view by

$productModel = VmModel::getModel('Productmy');

then use all the normal functions
GJC Web Design
VirtueMart and Joomla Developers - php developers https://www.gjcwebdesign.com
VM4 AusPost Shipping Plugin - e-go Shipping Plugin - VM4 Postcode Shipping Plugin - Radius Shipping Plugin - VM4 NZ Post Shipping Plugin - AusPost Estimator
Samport Payment Plugin - EcomMerchant Payment Plugin - ccBill payment Plugin
VM2 Product Lock Extension - VM2 Preconfig Adresses Extension - TaxCloud USA Taxes Plugin - Virtuemart  Product Review Component
https://extensions.joomla.org/profile/profile/details/67210
Contact for any VirtueMart or Joomla development & customisation

sandomatyas

Nice one thanks. My only fear that with this idea I miss a lot of new features and bugfixes mostly in the model. Maybe extend the new model from the old one and override only a few methods could help to maintain the code integrity when I update VirtueMart

Studio 42

Of course use product model as parent if you use most same function or vmmodel if not.