News:

Support the VirtueMart project and become a member

Main Menu

page redirect

Started by stuart.prevos, May 17, 2012, 16:55:22 PM

Previous topic - Next topic

stuart.prevos

Hi
VM2.0.6
J2.6
I have modified the category view to add an "add to cart" button, now I am am trying to setup the cart so that when you click the add to cart button, it redirects to the current page. For instance if customer is in the category view and clicks "add to cart" it redirects back to the category view or if they are on the product page it redirects back to the same product page. I have modified components/com_virtuemart/controllers/cart.php I am usin gthe system messages to debug ----->
   public function add() {
...
...
...
         $uri = & JFactory::getURI();
         $pageURL = $uri->toString();
         $mainframe->enqueueMessage($pageURL, $type);

         $mainframe->enqueueMessage($msg, $type);
         $params =& $mainframe->getParams();
   
         
         $mainframe->redirect(JRoute::_('index.php?option=com_virtuemart&view=cart' ,false));
         //         }
      } else {
         $mainframe->enqueueMessage('Cart does not exist?', 'error');
      }
   }

The idea is that I would then pass the URL variable in to the redirect statement. But it just returns the URL "http://domain.com/index.php" and strips off the "?option=com_virtuemart&view=category&virtuemart_category_id=8".

Any advise would be appreciated.
Thanks

Can any