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

VM3 - Calling the products sublayout cart problem & solution

Started by balai, November 28, 2014, 10:50:31 AM

Previous topic - Next topic

balai

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

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/

balai

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

Milbo

Should I fix your bug, please support the VirtueMart project and become a member
______________________________________
Extensions approved by the core team: http://extensions.virtuemart.net/