News:

You may pay someone to create your store, or you visit our seminar and become a professional yourself with the silver certification

Main Menu

Calculate data once, use site wide

Started by sandomatyas, November 10, 2018, 21:49:57 PM

Previous topic - Next topic

sandomatyas

There is a VirtueMart based site where I need some information about the products which are collected from VM's tables and other external tables/files aswell. These are some pieces of related metadata information and not just the products. E.g: date interval of weekly sales, categories/products which are included in the sale, discount percentage, etc etc. Some of them are not directly connected to VM but I need to display it.
I need these information site-wide like in category view, productdetails view, cart, order emails, some modules or vmcustom plugins, etc.

So the question: What is the best way to collect the information once per pageload (or perhaps per session) but use it in several parts of the site? I want to do this mainly for performance reasons and of course for a more clear code.

GJC Web Design

something like your own plugin with its own table then fetch/call these values and display
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

Studio 42

You can use Joomla cache as base, you can use it to cache HTML or code(json object, db results for eg.) or use a file cache.
If you need it per pageload, then you can use a static value or array in a class using an instance Id.