News:

Support the VirtueMart project and become a member

Main Menu

Recent posts

#1
General Questions / Re: Download links
Last post by artonweb - Today at 09:13:50 AM
Thank you
#2
Administration & Configuration / stop user registrations spam
Last post by 2cool - Today at 08:53:50 AM
Hi recently received many joomla user registrations.
If I disable user registration it also prevents virtuemart shoppers to register.
So I need to keep registration enabled because using virtuemart.
Is there a proper way to fix this?

Regards,
Pas
#3
Virtuemart Development and bug reports / Re: Sort by price bug
Last post by hazael - Yesterday at 16:47:53 PM
Ok, just don't add this code to any php file that is run publicly on your site, because every time you run the site, it will unnecessarily refresh those prices in the database - with a lot of traffic and a lot of products, you may crash your server :D
#4
Virtuemart Development and bug reports / Re: Sort by price bug
Last post by niosme - Yesterday at 14:34:58 PM
I runned your file once to inform all the final_price once and the i putted on the end of the store function in product.php this to infrom the new prices on save and not with a cron. Thanks a lot.

In 2878 line, on the end of the store function:

// Update final price on store
$customProduct = $this->getProduct($data['virtuemart_product_id'], true, true, true);
$customPrices = $this->getPrice($customProduct, [], 1);
$customFinalPrice = isset($customPrices['salesPrice']) ? (float)$customPrices['salesPrice'] : 0;

if (
    $customFinalPrice == 0
    && !empty($customProduct->product_parent_id)
    && (int)$customProduct->product_parent_id > 0
) {
    $customParentProduct = $this->getProduct($customProduct->product_parent_id, true, true, true);
    if ($customParentProduct) {
        $customPricesParent = $this->getPrice($customParentProduct, [], 1);
        if (!empty($customPricesParent['salesPrice'])) {
            $customFinalPrice = (float) $customPricesParent['salesPrice'];
        }
    }
}

$db = JFactory::getDbo();
$queryUpdate = $db->getQuery(true)
    ->update('#__virtuemart_products')
    ->set('final_price = ' . $customFinalPrice)
    ->where('virtuemart_product_id = ' . $data['virtuemart_product_id']);

$db->setQuery($queryUpdate);
$db->execute();
// End of Update final price on store
#5
When setting an ovveride for product from the category it doesnt always work and i dont know why.I added this to fix it

line:417
file:/public_html/components/com_virtuemart/views/productdetails/view.html.php
$layout = $this->category->category_product_layout!==$layout?$this->category->category_product_layout:$layout;
#6
Your Live Sites / Re: christinas-sales.gr - kids...
Last post by artonweb - March 27, 2025, 20:39:47 PM
Quote from: hazael on October 10, 2024, 23:48:00 PMSuch websites were fashionable over 5 years ago  :)

This template was created for Joomla 3 many years ago. It is very old and inefficient. Pages like this shouldn't be made anymore - there are too many bells and whistles - it's very heavy and slow.

The best thing about it all is that you used 3 frameworks on this overloaded website: Joomlaart T4, helix-ultimate and sppagebuilder

Hello.
Thank you for your comment.
Can you suggest a better template with a nice design such as Flatastic template?
#7
Thanks for the update. Do you know if I purchase for example "Bundle EU Vat ID checker + MOSS Tax Synchroniser" if I still get automatic access to it after purchase?
#8
Well, Milbo — being a true German — has joined the Foreign Legion and is now on the front lines, bravely fighting Russian invaders for a free Ukraine. He said once the war is over, he'll return to rescue his beloved VirtueMart. So let's all hope for peace — not just for the world, but maybe for some support too!  ::)
#9
Virtuemart Development and bug reports / Re: Sort by price bug
Last post by hazael - March 26, 2025, 21:11:39 PM
Hi,

This bug is quite logical. If a child product does not have a price, then this data cannot exist in the #__virtuemart_product_prices table. So we have to make a small change.
In the #__virtuemart_product_prices table, remove the 'final_price' column - it doesn't make sense for it to be there.

We need to add 'final_price' to the #__virtuemart_products column on an identical basis as before.

ALTER TABLE `#__virtuemart_products`
ADD COLUMN `final_price` decimal(15,5) NOT NULL DEFAULT 0 AFTER `product_mpn`;

In the file ( in 748 line), change the entire entry for case 'product_price':
administrator/components/com_virtuemart/models/product.php

case 'product_price':
$ff_select_price = ' , p.`final_price` AS product_price ';
$orderBy = ' ORDER BY p.`final_price` ' . $filterOrderDir . ', p.`virtuemart_product_id` ' . $filterOrderDir;
$joinPrice = FALSE;
break;


Now we are left with a minor modification to our file that activates updates to the final price for each published product. This means that if the sub-product does not have a price, it will copy that value from the parent product. Check it out, it should work :)


<?php
define
('_JEXEC'1);
require_once 
__DIR__ '/includes/app.php';
$app Joomla\CMS\Factory::getApplication('site');

if (!
class_exists('VmConfig')) {
    require(
JPATH_ADMINISTRATOR '/components/com_virtuemart/helpers/config.php');
}
VmConfig::loadConfig();
if (!
class_exists('VmModel')) {
    require(
JPATH_ADMINISTRATOR '/components/com_virtuemart/helpers/vmmodel.php');
}

$db JFactory::getDbo();
$query $db->getQuery(true)
    ->
select('virtuemart_product_id, product_parent_id')
    ->
from('#__virtuemart_products');

$db->setQuery($query);
$products $db->loadObjectList();
$productModel VmModel::getModel('product');

foreach (
$products as $prodObj) {
    
$product_id = (int) $prodObj->virtuemart_product_id;


    
$product $productModel->getProduct($product_idtruetruetrue);
    if (!
$product) {
        continue;
    }


    
$prices $productModel->getPrice($product, [], 1);
    
$finalPrice = isset($prices['salesPrice']) ? (float)$prices['salesPrice'] : 0;


    if (
        
$finalPrice == 0
        
&& !empty($prodObj->product_parent_id)
        && (int)
$prodObj->product_parent_id 0
    
) {
        
$parentProduct $productModel->getProduct($prodObj->product_parent_idtruetruetrue);
        if (
$parentProduct) {
            
$pricesParent $productModel->getPrice($parentProduct, [], 1);
            if (!empty(
$pricesParent['salesPrice'])) {
                
$finalPrice = (float) $pricesParent['salesPrice'];
            }
        }
    }

    
$queryUpdate $db->getQuery(true)
        ->
update('#__virtuemart_products')
        ->
set('final_price = ' $finalPrice)
        ->
where('virtuemart_product_id = ' $product_id);

    
$db->setQuery($queryUpdate);
    
$db->execute();
}

PS
The original price sorting in Virtuemart is a bit slower than the current one, because it required 2 tables. Now you have only one table. You can add an index to the 'final_price' column - this will make sorting even faster.
ALTER TABLE `#__virtuemart_products` ADD INDEX (`final_price`);
Just remember that after every price change ( for example, when you run discounts), it's a good idea to run this php code. Of course, it's best to add it to CRON and forget about these actions ;)
#10
I'm interested to buy but got some pre-purchase questions but no one replies.
Is iStraxx still in business?