News:

Looking for documentation? Take a look on our wiki

Main Menu

Recent posts

#81
Virtuemart Development and bug reports / List of countries in the form
Last post by hazael - November 05, 2024, 00:36:22 AM
I noticed that countries that are unpublished nevertheless show up on the registration form list or on the shopping cart page when filling out the shipping address

VirtueMart 4.2.18
#82
Virtuemart Development and bug reports / Re: Bug with the constant VM_V...
Last post by hazael - November 04, 2024, 20:12:59 PM
Ok, now I understand. But after all, you don't have to put the direct rule name in the front-end user interface.  You can just put the tax value, and next to it an independent variable with a string that will translate the name of the tax to you in any language.

Hmmm. if you added more than one tax rule (VatTax) for a single product, it might look weird. :)

Where does the shopping cart module come from? Surely it can be changed directly in its template
#83
Virtuemart Development and bug reports / Re: Bug with the constant VM_V...
Last post by ViPeS - November 04, 2024, 15:16:15 PM
To @hazael
The name of the calculation rule is displayed in the header of the cart table.
In Fig. 2 there are three images of the same product in different languages. And it should be displayed in its own language.
You are lucky that Poland switched to the English abbreviation VAT (Value Added Tax) instead of the Polish PTU (Podatek od Towarów i Usług). But other countries have their own abbreviation. For example, in Lithuania it is PVM, in Norway - МВА. It is a pity that VM did not provide for this for multilingual sites.
#84
Virtuemart Development and bug reports / Re: I cannot create two custom...
Last post by Milbo - November 04, 2024, 13:19:41 PM
Usually it is enough to install VirtueMart again, because it should recreate the keys. Or to use the database tools.

You must check your database and check the table f0r61_virtuemart_customs for the key field_type_searchable_published, which should be just a key, in your case it seems to have the "unique" property set.

#85
Virtuemart Development and bug reports / Re: Bug with the constant VM_V...
Last post by hazael - November 04, 2024, 12:15:15 PM
This is just the name of the calculation rule - it is not displayed anywhere. Why do you want to translate it into another language?
#86
Virtuemart Development and bug reports / Bug with the constant VM_VALUE...
Last post by ViPeS - November 04, 2024, 11:29:56 AM
I have a multilingual site. I override the VM_VALUE_ADDED_TAX constant for the Site and Administrator so that the cart displays the VAT according to the language. This works fine with the cart. But the name of the constant is displayed in the Products Admin Panel, not its value.
#87
Virtuemart Development and bug reports / Re: VM creates multiple plugin...
Last post by hazael - November 04, 2024, 09:45:26 AM
Maybe this will change something?

<?php

use Joomla\Event\Dispatcher as EventDispatcher;

class 
vDispatcher {

    static 
$dispatcher null;

    static function 
trigger ($name$params) {

        if (
self::$dispatcher === null) {
            if (
JVM_VERSION 4) {
                
self::$dispatcher JEventDispatcher::getInstance();
            } else {
                
self::$dispatcher JFactory::getApplication();
            }
        }

        if (
JVM_VERSION 4) {
            return 
self::$dispatcher->trigger($name$params);
        } else {
            return 
self::$dispatcher->triggerEvent($name$params);
        }
    }

    static function 
setDispatcher() {
        
// Implementation for setting a custom dispatcher, if needed.
    
}

    
/**
    * Triggers Joomla 5 plugins directly, backward compatible for J3, J4.
    * @param $plg
    * @param $trigger
    * @param $args
    * @param $ret
    * @return array|mixed|void|null
    * @throws ReflectionException
    */
    
static function triggerJ5($plg$trigger$args, &$ret) {

        if (
is_object($plg)) {
            
$className get_class($plg);
            if (
method_exists($className'getSubscribedEvents')) {
                
$evts $className::getSubscribedEvents();
                if (!empty(
$evts[$trigger])) {
                    
$fn $evts[$trigger];
                    
$reflector = new ReflectionClass($plg);
                    
$parameters $reflector->getMethod($fn)->getParameters();
                    
$EventClass '\Joomla\Event\Event';
                    foreach (
$parameters as $param) {
                        
$cTest $param->getType();
                        if (
$cTest instanceof ReflectionNamedType && strpos($cTest->getName(), 'Event') !== false) {
                            
$EventClass $cTest->getName();
                            break;
                        }
                    }

                    
$event = new $EventClass($trigger$args);
                    if (
is_array($args)) {
                        foreach (
$args as $named => $value) {
                            
$event->setArgument($named$value);
                        }
                    }
                    if (
is_array($ret)) {
                        
$ret[] = call_user_func_array([$plg$fn], [$event]);
                    } else {
                        return 
call_user_func_array([$plg$fn], [$event]);
                    }
                }
            } elseif (
method_exists($plg$trigger)) {
                if (
is_array($ret)) {
                    
$ret[] = call_user_func_array([$plg$trigger], $args);
                } else {
                    return 
call_user_func_array([$plg$trigger], $args);
                }
            }
            return 
$ret;
        }
        return 
null;
    }

    static public function 
directTrigger($type$element$trigger$args$enabled true) {
        
JPluginHelper::importPlugin($type);
        
$app JFactory::getApplication();
        
$plg $app->bootPlugin($element$type);
        
        if (
$plg) {
            
$ret false;
            return 
self::triggerJ5($plg$trigger$args$ret);
        }
        return 
null;
    }

    static function 
importVMPlugins($ptype) {
        static 
$types = ['vmextended' => true'vmuserfield' => true'vmcalculation' => true'vmcustom' => true'vmcoupon' => true'vmshipment' => true'vmpayment' => true];
        if (!isset(
$types[$ptype])) return;

        foreach (
$types as $type => $v) {
            
JPluginHelper::importPlugin($type);
            unset(
$types[$type]);
            if (
$type == $ptype) {
                break;
            }
        }
    }

    static public function 
createPlugin($type$element$enabled true) {
        if (empty(
$type) || empty($element)) {
            
vmdebug('Developer error, class vmpluglin function createPlugin: empty type or element');
        }

        
$plugin self::getPlugin($type$element$enabled);
        if (!isset(
$plugin->type) || !isset($plugin->name)) {
            
vmdebug('VmPlugin function createPlugin, plugin not found or unpublished'$type$element);
            return 
false;
        }

        
$app JFactory::getApplication();
        
$pluginObject $app->bootPlugin($element$type);

        if (
$pluginObject) {
            return 
$pluginObject;
        }

        
$className 'Plg' str_replace('-'''$type) . $element;
        if (
class_exists($className)) {
            if (
JVM_VERSION 4) {
                if (
self::$dispatcher === null) {
                    
self::$dispatcher JEventDispatcher::getInstance();
                }
                return new 
$className(self::$dispatcher, (array) $plugin);
            } else {
                
$dummy = new EventDispatcher();
                return new 
$className($dummy, (array) $plugin);
            }
        } else {
            
vmdebug('VmPlugin function createPlugin, class does not exist'$className$type$element);
            return 
false;
        }
    }

    static function 
getPlugin($type$element$enabled true) {
        
$db JFactory::getDbo();
        
$query $db->getQuery(true)
            ->
select($db->quoteName(['extension_id''folder''element''params''state']))
            ->
from($db->quoteName('#__extensions'))
            ->
where($db->quoteName('type') . ' = ' $db->quote('plugin'))
            ->
where($db->quoteName('folder') . ' = ' $db->quote($type))
            ->
where($db->quoteName('element') . ' = ' $db->quote($element));

        if (
$enabled) {
            
$query->where($db->quoteName('enabled') . ' = 1')
                  ->
where($db->quoteName('state') . ' = 0');
        }

        
$db->setQuery($query);

        try {
            return 
$db->loadObject();
        } catch (
Exception $e) {
            
vmError('Could not load Plugin ' $type ' ' $element ': ' $e->getMessage(), 'Plugin Load Error');
            return 
null;
        }
    }
}
#88
General Questions / Re: All of Sudden Getting Lots...
Last post by hazael - November 04, 2024, 09:21:30 AM
Blocking a single IP address makes no sense, but you can block an entire class or the entire server from which this spam comes to you. If you are concerned about blocking potential customers, block IP only for POST connections.

No one spams me, even though they i don't use any captchas. Just look at the server logs, catch the spam IP address and effectively block the entire server from which spam is sent. You only block POST connections.

<Limit POST>
   Order Allow,Deny
   Allow from all
   Deny from xxx.xxx.xxx.
</Limit>

practically this way you can cut off the entire shitty Soviet Union and not worry about anything
#89
General Questions / Re: All of Sudden Getting Lots...
Last post by fotonio - October 31, 2024, 23:39:02 PM
I dont think that this will work because it doesnt matter what menu link you make the registration is always accessible through domain/index.php?option=com_users&view=registration

Blocking ip's also is not an option because they change all the time. Spammers dont use static ips.

I have the same problem in two sites in two different servers.
#90
Templating & Layouts / Re: How to remove ADD TO CART ...
Last post by iWim - October 31, 2024, 11:04:58 AM
You can create an override of ~/components/com_virtuemart/sublayouts/(bs*-)product.php and see if you can remove/hide the addtocart stuff.

For me the code looked too complicated. (Still does.)
I decided  (a long time ago) it was much easier to "just" use css.
.product .addtocart-area { display: none; }