News:

Looking for documentation? Take a look on our wiki

Main Menu

Recent posts

#1
Virtuemart Development and bug reports / [FIX] Use VirtueMart CSS + Boo...
Last post by iWim - August 27, 2025, 16:10:19 PM
I may have found a solution for a bug in VM where the setting for Use the VirtueMart CSS is ignored when selecting any Bootstrap version.

The solution is a small change to a core file. It would be great if someone can check it and than it could be added to core for the next update.

BEFORE THE FIX
1. Go to VirtueMart Configuration > tab Templates
2. Go to section Templates & Layouts
3. At Layout Bootstrap version select None (Use Legacy)

4. Go to section Core Css Styles & Javascripts (only for experts)
5. Set Use the VirtueMart CSS to Yes or No

Check the frontend code:
/components/com_virtuemart/assets/css/vm-ltr-common.css is loaded or not depending on setting Use the VirtueMart CSS to Yes or No.

6. Go back to #3 and select a Bootstrap version

Re-check the frontend code:
The setting for Use the VirtueMart CSS is ignored and
/components/com_virtuemart/assets/css/vm-bs#-common.css is always loaded.

THE FIX
Open the file ~/administrator/components/com_virtuemart/helpers/vmjsapi.php
(Note: this is a core file!)

At line 897 you'll findif (!VmConfig::get('css', TRUE)) {
  return FALSE;
}
Move these 3 lines up after if ($cssFile) return; on line 879(...)
static $cssSite;
if ($cssSite) return;

  if (!VmConfig::get('css', TRUE)) {
    return FALSE;
  }

  // we load one common css and put styles in there
  (...)

AFTER THE FIX
At Layout Bootstrap version select any option
Set Use the VirtueMart CSS to Yes or No

Re-check the frontend code:
The CSS from any layout is loaded or not depending on the Use the VirtueMart CSS setting.

B/C BREAK
Because before this fix the setting for Use the VirtueMart CSS was ignored, webshops using a Bootstrap layout and have Use the VirtueMart CSS set to No will loose styling after the update.

They will have to set Use the VirtueMart CSS to Yes.
#2
General Questions / Re: Display lowest price based...
Last post by modernmagic - August 24, 2025, 00:39:42 AM
I ran your code through Ai and got it to work:

// Make sure we have an array to work with.
$allPrices = (isset($this->product->allPrices) && is_array($this->product->allPrices))
    ? $this->product->allPrices
    : [];
// Polyfill for array_key_first for older PHP (<7.3).
if (!function_exists('array_key_first')) {
    function array_key_first(array $arr) {
        foreach ($arr as $k => $_) { return $k; }
        return null;
    }
}
echo "Lowest price:<br>";
if (!empty($allPrices)) {
    // Initialize with the first key.
    $lowestKey = array_key_first($allPrices);
    // Walk the array to find the lowest product_price.
    foreach ($allPrices as $k => $row) {
        if (!isset($row['product_price'])) {
            continue;
        }
        if (
            !isset($allPrices[$lowestKey]['product_price']) ||
            (float)$row['product_price'] < (float)$allPrices[$lowestKey]['product_price']
        ) {
            $lowestKey = $k;
        }
    }
    $lowestPrice = isset($allPrices[$lowestKey]['product_price'])
        ? (float)$allPrices[$lowestKey]['product_price']
        : null;
    echo $lowestPrice !== null ? number_format($lowestPrice, 2) : 'N/A';
} else {
    echo 'N/A';
}

THANK YOU for your help!
#3
General Questions / Re: Display lowest price based...
Last post by modernmagic - August 23, 2025, 21:52:50 PM
Thank you so much for the code!

Unfortunately, this is the result:
You cannot view this attachment.

This is the code:
You cannot view this attachment.

I'm hoping to display:  Lowest price: $184 
#4
General Questions / Re: Display lowest price based...
Last post by vmfyelloq19 - August 22, 2025, 12:01:35 PM
/templates/(your-template)/html/com_virtuemart/productdetails/default.php

$allPrices_key_found = array_reduce(
    array_keys($this->product->allPrices), // iterate over allPrices' keys
    function ($key_best_so_far, $key_current) {
        if($this->product->allPrices[$key_current]['product_price'] < $key_current[$key_best_so_far]['product_price']) {
            return $key_current;
        } else {
            return $key_best_so_far;
        }
    },
    array_key_first($this->product->allPrices) // start with first allPrices' keys
);
echo "Lowest price:<br>";
print_r($this->product->allPrices[$allPrices_key_found]);

Change the if-statement operator from < to > to get most expensive price's item.
#5
Administration & Configuration / Re: Testbenutzer blockiert mei...
Last post by Jumbo! - August 22, 2025, 10:57:54 AM
This is an English forum. Please post in English.

The German forum is here: https://forum.virtuemart.de
#6
Language/Translations / Re: Shopper Display Names begi...
Last post by Jumbo! - August 22, 2025, 10:56:26 AM
Which version of VirtueMart are you using?
#7
General Questions / Display lowest price based on ...
Last post by modernmagic - August 22, 2025, 01:07:20 AM
I want to display "As low as $184".  The 184 is the price for the highest quantity range. 

Something like this mockup:
You cannot view this attachment.
You cannot view this attachment.You cannot view this attachment.
Is there a setting, plugin, or custom solution?
#8
Plugins: Payment, Shipment and others / Re: Klarna Payment Error
Last post by NorrNext - August 21, 2025, 12:45:55 PM
Just in case if somebody needs Klarna for VirtueMart. There is a new plugin available:

Klarna Payments HPP for VirtueMart

#9
Just in case if somebody needs Klarna for VirtueMart. There is a new plugin available:

Klarna Payments HPP for VirtueMart

#10
Just in case if somebody needs Klarna for VirtueMart. There is a new plugin available:

Klarna Payments HPP for VirtueMart