VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: balai on November 28, 2014, 10:50:31 AM

Title: VM3 - Calling the products sublayout cart problem & solution
Post by: balai on November 28, 2014, 10:50:31 AM
Hi

I am calling the products sublayout, outside Virtuemart. Everything works fine except the add-to-cart button.

Checking it further, i can see that the problem resides in the action attribute of the add to cart form. The action is getting the url of the current page, if it is outside VM.

The solution is in the file: components\com_virtuemart\sublayouts\addtocart.php
in the line 50, there is that code:

<form method="post" class="product js-recalculate" action="<?php echo JRoute::('index.php',false); ?>">


replace it with:

<form method="post" class="product js-recalculate" action="<?php echo JRoute::('index.php?option=com_virtuemart',false); ?>">

This works both if called from the VM pages and modules and outside them
Title: Re: VM3 - Calling the products sublayout cart problem & solution
Post by: Milbo on November 28, 2014, 13:46:15 PM
Lets use this then
vmURI::getCleanUrl()
Title: Re: VM3 - Calling the products sublayout cart problem & solution
Post by: balai on December 02, 2014, 11:04:10 AM
I don't see any difference with the vmURI::getCleanUrl()

Still returns the url of the current page, even if it is not a VM page
Title: Re: VM3 - Calling the products sublayout cart problem & solution
Post by: Milbo on December 02, 2014, 20:20:03 PM
okey. got yah.