Author Topic: Problem when using Multi Variant & VirtueMart Products  (Read 623 times)

Toni_Skuli

  • Beginner
  • *
  • Posts: 7
  • A beginner
Problem when using Multi Variant & VirtueMart Products
« on: April 15, 2019, 23:43:45 pm »
Hi,

I'm currently working on a website and my intention was to have related products show in the product-details page.
This works fine using the VirtueMart products module and putting it into a productdetails overwrite. This the piece of code I use:
Code: [Select]
?><div class="Related"><?php
    $modules 
JModuleHelper::getModules('product_related');        
    foreach(
$modules as $mod)
        {
            echo 
JModuleHelper::renderModule($mod);
        }
        
?>
</div>
The problem is that when I choose a variant from the Multi Variant it redirects to a page where I can see the product as in a category view. Which is surprising because when i disable the product module it works fine again.

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3765
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Problem when using Multi Variant & VirtueMart Products
« Reply #1 on: April 16, 2019, 00:03:00 am »
You have the customfield related products, you dont need any extra module.

Toni_Skuli

  • Beginner
  • *
  • Posts: 7
  • A beginner
Re: Problem when using Multi Variant & VirtueMart Products
« Reply #2 on: April 16, 2019, 00:05:25 am »
thank you for your reply. I know that this is possible and I have tried to do it. The issue is that I end up with the same problem.

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3765
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Problem when using Multi Variant & VirtueMart Products
« Reply #3 on: April 16, 2019, 00:17:47 am »
This is template related, because some dev use the same class for related products and product details.
Try to remove the product class ".productdetails-view" in your related products render and check if it work.
Else write in your console(when you display product details)
Virtuemart.containerSelector
And check if you have only 1 element using this class only elsethe script not work properly.
Another way to check is to write in  console.
jQuery(Virtuemart.containerSelector).length
this need to be always = 1 in product details.

Toni_Skuli

  • Beginner
  • *
  • Posts: 7
  • A beginner
Re: Problem when using Multi Variant & VirtueMart Products
« Reply #4 on: April 16, 2019, 01:01:03 am »
I ran Virtuemart.containerSelector in the console and it always gives ".productdetails-view" on the product detail page and also when i on click on a related product. For some reason when I choose a variant from the list it redirects to a ".product-container" which I assume should be ".productdetails-view" . I have also checked for jQuery(Virtuemart.containerSelector).length it constantly gives 1 as a response.

Jörgen

  • Global Moderator
  • Full Member
  • *
  • Posts: 2118
    • Kreativ Fotografi
  • VirtueMart Version: 3.2.12
Re: Problem when using Multi Variant & VirtueMart Products
« Reply #5 on: April 16, 2019, 06:06:30 am »
Outdated template perhaps? Try with protostar template. Product-container is the class to be used for products.
Jörgen @ Kreativ Fotografi
Joomla 3.9.1
Virtuemart 3.2.12
Olympiantheme Hera (customized)

Toni_Skuli

  • Beginner
  • *
  • Posts: 7
  • A beginner
Re: Problem when using Multi Variant & VirtueMart Products
« Reply #6 on: April 16, 2019, 11:08:07 am »
Thank you for your reply, i tried using the protostar template or a different one but the problem still occurs.

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3765
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Problem when using Multi Variant & VirtueMart Products
« Reply #7 on: April 16, 2019, 13:42:54 pm »
If the website is public, can you send a link to a product having the problem ?

Toni_Skuli

  • Beginner
  • *
  • Posts: 7
  • A beginner
Re: Problem when using Multi Variant & VirtueMart Products
« Reply #8 on: April 16, 2019, 19:26:17 pm »
Well I'm trying to reduce costs ::). Therefore it is on my localhost. I think that the problem is that the multiple variant redirects to the wrong layout but I have no idea why.

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3765
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Problem when using Multi Variant & VirtueMart Products
« Reply #9 on: April 16, 2019, 21:12:37 pm »
You can use https://www.planethoster.com/en/World-Lite
It's free, you only have to validate it each month.
When you have finish, you can subscribe or simply do not validate again.

Toni_Skuli

  • Beginner
  • *
  • Posts: 7
  • A beginner
Re: Problem when using Multi Variant & VirtueMart Products
« Reply #10 on: April 18, 2019, 15:35:44 pm »
I have been working on the code and I solved the problem.
In the customfield.php I removed the
Code: [Select]
unset($attribs['data-reload']); from
Code: [Select]
if(VmConfig::get ('jdynupdate', TRUE)){
      $view = vRequest::getCmd('view','productdetails');
if($view == 'productdetails' or ($customfield->browseajax and $view == 'category')){
$attribs['data-dynamic-update'] = '1';
unset($attribs['data-reload']);
} else {
$view = 'productdetails';
}
}
And now it works like a charm.

Studio 42

  • Contributing Developer
  • Sr. Member
  • *
  • Posts: 3765
  • Joomla & Virtuemart developper
    • Studio 42 - Virtuemart & Joomla extentions
  • VirtueMart Version: 2.6 & 3
Re: Problem when using Multi Variant & VirtueMart Products
« Reply #11 on: April 18, 2019, 15:44:21 pm »
If you have to modify this file, then your template is a little obsolete certainly.

Jörgen

  • Global Moderator
  • Full Member
  • *
  • Posts: 2118
    • Kreativ Fotografi
  • VirtueMart Version: 3.2.12
Re: Problem when using Multi Variant & VirtueMart Products
« Reply #12 on: April 18, 2019, 16:36:00 pm »
Funny solution ...
This is from VM 3.4.5.10045
Code: [Select]
$view = 'productdetails';
$attribs['data-reload'] = '1';
if(VmConfig::get ('jdynupdate', TRUE)){
$view = vRequest::getCmd('view','productdetails');
if($view == 'productdetails' or ($customfield->browseajax and $view == 'category')){
$attribs['data-dynamic-update'] = '1';
unset($attribs['data-reload']);
} else {
$view = 'productdetails';
}
}
To be compared with your code
Code: [Select]
...
 ...
if(VmConfig::get ('jdynupdate', TRUE)){
      $view = vRequest::getCmd('view','productdetails');
if($view == 'productdetails' or ($customfield->browseajax and $view == 'category')){
$attribs['data-dynamic-update'] = '1';
unset($attribs['data-reload']);
} else {
$view = 'productdetails';
}
}
The current code would be faulty to ?

Jörgen @ Kreativ Fotografi
Joomla 3.9.1
Virtuemart 3.2.12
Olympiantheme Hera (customized)

Toni_Skuli

  • Beginner
  • *
  • Posts: 7
  • A beginner
Re: Problem when using Multi Variant & VirtueMart Products
« Reply #13 on: April 19, 2019, 18:27:10 pm »
Well, like I stated everthing is kept the same but I removed the 
Code: [Select]
unset($attribs['data-reload']); line.