Potential backward compatibility issues in Joomla 4 https://docs.joomla.org/Potential_backward_compatibility_issues_in_Joomla_4#Plugins_.28Events.29
im trying to develop a plugin in php Joomla Virtuemart and i m stack how to call/execute it .
Php 8.2 Joomla 5.2 / VM 4.4
I m trying to get virtuemart ids and quantity from the order details page and parse values via link method to another page. I m trying to show the link below items of order and in shipping section
the following links does not show
i dont know if i use the correct class and or the event/trigger ?
<?php
defined('_JEXEC') or die('Restricted access');
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Factory;
class plgSystemSomething extends CMSPlugin
{
public function plgVmOnShowOrderBackend($virtuemart_order_id, $orderData)
{
// URL Order id
$orderLink = JRoute::_('index.php?option=com_virtuemart&view=orders&task=edit&virtuemart_order_id=' . $virtuemart_order_id, false);
// HTML show the link
$html = '<div style="margin-top:15px; padding:10px; border:1px solid #ddd; background:#f9f9f9;">
<strong>Here :</strong>
<a href="' . $orderLink . '" target="_blank">Links of order #' . $virtuemart_order_id . '</a>
</div>';
return $html;
}
}
I temporary use this method
$app = Factory::getApplication();
if ($app->isClient('administrator') &&
($app->input->get('option') == 'com_virtuemart') &&
($app->input->get('view') == 'orders') &&
($app->input->get('virtuemart_order_id'))) { do }
that worked for me
<?php
defined('_JEXEC') or die;
use Joomla\CMS\Factory;
use Joomla\CMS\Plugin\CMSPlugin;
use Joomla\CMS\Uri\Uri;
if (!class_exists('VmConfig')) {
require(JPATH_ROOT . '/administrator/components/com_virtuemart/helpers/config.php');
}
if (class_exists('VmConfig')) {
VmConfig::loadConfig();
}
// creating the plugin class
class plgVmShipmentProds2boxes extends vmPlugin
{
function __construct(&$subject, $config)
{
parent::__construct($subject, $config);
// Loading plugin Joomla parameters
$this->website = $this->params->get('value1', '');
$this->username = $this->params->get('value2', '');
$this->serial = $this->params->get('value3', '');
}
/**
* VirtueMart Call this function at backend οrder page.
*/
public function plgVmOnShowOrderBEShipment($orderId, $order)
{
$this->Prods2Boxes($orderId, $order);
}
/**
* Custom function for data process
*/
private function Prods2Boxes($orderId, $order)
{ ....