Product Description
- Installation and setup
The plugin is installed by default according to the Joomla CMS rules. In the settings you can change the price tracking time and date format for the chart.
- Initial data fill
For the system to work properly you need to perform initial populate in the plugin settings on the Initial populate tab. When you click on the button Start populating db table, the db will create the prices of products without discounts and with current discount. The price without discount is taken as the base price and the discount amount and lowest price information is calculated from it.
- Modifying the product price view
Duplicate the template: copy the Virtuemart price template from /components/com_virtuemart/views/sublayouts/prices.php to /templates/YOUR TEMPLATE/html/components/com_virtuemart/views/sublayouts/prices.php.
A sample of the changes to the original file is attached to the plugin in the **SAMPLE** folder ( Virtuemart 3.4.2 ).
- Basic price history trigger call
You need to specify a place to display the price, discount and chart. This location can change based on the project, so we will determine it by calling the trigger see php code.
$dispatcher = JDispatcher::getInstance();
$historyPrice = $dispatcher->trigger('getProductHistoryPrice', array($product->virtuemart_product_id))[0];
- Discount - ideally used in the conditions to display the original price etc.
(float)$historyPrice['discount_price']
- Original price - html structure may differ from your site
if ( (float)$historyPrice['priceWithoutDiscount'] > 0 ) {
$html = '';
$html .= '
';
$html .= '' . JText::sprintf( 'PLG_SYSTEM_VMPRICEHISTORY_MINIMUM_PRICE', (int)$historyPrice['lastDays'] ) . '';
$html .= '' . $currency->priceDisplay( (float)$historyPrice['priceWithoutDiscount'] ) . '';
$html .= '
';
echo $html;
}
- Discount - html structure may differ from your site
if ( (float)$historyPrice['discount_price'] > 0 ) {
$html = '';
$html .= '
';
$html .= '' . JText::_( 'COM_VIRTUEMART_CART_SUBTOTAL_DISCOUNT_AMOUNT' ) . '';
$html .= '' . $currency->priceDisplay( (float)$historyPrice['discount_price'] ) . '';
$html .= '
';
echo $html;
}
- Listing chart on product detail
We recommend adding it to the desired location in /components/com_virtuemart/views/productdetails/tmpl/default.php if you don't have a product detail override in your store template.
$dispatcher = JDispatcher::getInstance();
$historyPrice = $dispatcher->trigger('getProductPriceHistoryGraf', array($this->product->virtuemart_product_id))[0];
Product download
Virtual products for sale
Price history for VirtueMart 3.0.5
Subscription 6 months
Total amount of downloads 12
Download link when order confirmed