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

Recent posts

#41
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!
#42
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 
#43
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.
#44
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
#45
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?
#46
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?
#47
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

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

Klarna Payments HPP for VirtueMart

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

Klarna Payments HPP for VirtueMart

#50
Installation, Migration & Upgrade / Re: 3rd party payment plugins
Last post by NorrNext - August 21, 2025, 12:40:13 PM
Just in case if somebody needs Klarna for VirtueMart. There is a new plugin available:

Klarna Payments HPP for VirtueMart