VM redirection cart

GK User
Sat Feb 02, 2013 12:23 pm
Hi,
I have a problem.
When I go to do an order at Main Menú HAZ TU PEDIDO, when I select the "continue shopping" button (Continuar Comprando) it's redirecting me to another page.
How could I stay at the same page??
Thanks a lot.
User avatar
Gold Boarder

teitbite
Mon Feb 04, 2013 12:28 pm
Hi

I believe in VM this can be confgured, I'm not a VM expert so I cannot tell exactly where. If You will not be able to find it please check on VM forum. If they will not be able to help please send me an ftp access so I'll find where this can be change in code.
User avatar
Moderator

teitbite
Sun Mar 10, 2013 2:21 pm
Hi

This button link is comming from VM settings I believe, but since I'm not a VM expert I think You can override it. I've skanned files and looks like this view is used in /html/com_virtuemart/cart/default.php
Try override the url in this part:

Code: Select all
      if ($this->continue_link_html != '') {
         echo $this->continue_link_html;
      } ?>


simply by replacing it to:

Code: Select all
$this->continue_link_html = 'LINK TO THE PAGE';


but as I said I'm guessing this can be it. Please also check vm configuration file and see if there is a "continue_link_html" there, so it would be a better solution to change it there.
User avatar
Moderator

GK User
Sun Mar 10, 2013 2:35 pm
Hi have in public_html/components/com_virtuemart/controllers/cart.php

// Get a continue link */
$virtuemart_category_id = shopFunctionsF::getLastVisitedCategoryId();
if ($virtuemart_category_id) {
$categoryLink = '&view=category&virtuemart_category_id=' . $virtuemart_category_id;
} else
$categoryLink = '';
$continue_link = JRoute::_('index.php?option=com_virtuemart' . $categoryLink);
$virtuemart_product_ids = JRequest::getVar('virtuemart_product_id', array(), 'default', 'array');
$errorMsg = JText::_('COM_VIRTUEMART_CART_PRODUCT_ADDED');
if ($cart->add($virtuemart_product_ids, $errorMsg )) {

$this->json->msg = '<a class="continue" href="' . $continue_link . '" >' . JText::_('COM_VIRTUEMART_CONTINUE_SHOPPING') . '</a>';
$this->json->msg .= '<a class="showcart floatright" href="' . JRoute::_("index.php?option=com_virtuemart&view=cart") . '">' . JText::_('COM_VIRTUEMART_CART_SHOW_MODAL') . '</a>';
if ($errorMsg) $this->json->msg .= '<div>'.$errorMsg.'</div>';
$this->json->stat = '1';
} else {
// $this->json->msg = '<p>' . $cart->getError() . '</p>';
$this->json->msg = '<a class="continue" href="' . $continue_link . '" >' . JText::_('COM_VIRTUEMART_CONTINUE_SHOPPING') . '</a>';
$this->json->msg .= '<div>'.$errorMsg.'</div>';
$this->json->stat = '2';
}
} else {
$this->json->msg = '<a href="' . JRoute::_('index.php?option=com_virtuemart') . '" >' . JText::_('COM_VIRTUEMART_CONTINUE_SHOPPING') . '</a>';
$this->json->msg .= '<p>' . JText::_('COM_VIRTUEMART_MINICART_ERROR') . '</p>';
$this->json->stat = '0';
}
echo json_encode($this->json);
jExit();
}

/**
* Add the product to the cart, with JS
*
* @author Max Milbers
* @access public
*/
public function viewJS() {

if (!class_exists('VirtueMartCart'))
require(JPATH_VM_SITE . DS . 'helpers' . DS . 'cart.php');
$cart = VirtueMartCart::getCart(false);
$this->data = $cart->prepareAjaxData();
$lang = JFactory::getLanguage();
$extension = 'com_virtuemart';
$lang->load($extension); // when AJAX it needs to be loaded manually here >> in case you are outside virtuemart !!!
if ($this->data->totalProduct > 1)
$this->data->totalProductTxt = JText::sprintf('COM_VIRTUEMART_CART_X_PRODUCTS', $this->data->totalProduct);
else if ($this->data->totalProduct == 1)
$this->data->totalProductTxt = JText::_('COM_VIRTUEMART_CART_ONE_PRODUCT');
else
$this->data->totalProductTxt = JText::_('COM_VIRTUEMART_EMPTY_CART');
if ($this->data->dataValidated == true) {
$taskRoute = '&task=confirm';
$linkName = JText::_('COM_VIRTUEMART_CART_CONFIRM');
} else {
$taskRoute = '';
$linkName = JText::_('COM_VIRTUEMART_CART_SHOW');
}
$this->data->cart_show = '<a class="floatright" href="' . JRoute::_("index.php?option=com_virtuemart&view=cart" . $taskRoute, $this->useXHTML, $this->useSSL) . '">' . $linkName . '</a>';
$this->data->billTotal = $lang->_('COM_VIRTUEMART_CART_TOTAL') . ' : <strong>' . $this->data->billTotal . '</strong>';
echo json_encode($this->data);
Jexit();
}

Is there where I must change the code?? which code??

Thanks a lot.
User avatar
Gold Boarder

teitbite
Mon Mar 11, 2013 3:50 pm
Hi

No. It's not right file. I've mentioned the file above: /html/com_virtuemart/cart/default.php it's in template's folder. Anyway this is just to test, becuase I'm not 100% sure. I'm not a VM expert.
User avatar
Moderator

GK User
Sun Mar 17, 2013 11:45 am
Ok, i'll try it and say you something.
tHANKS A LOT.
User avatar
Gold Boarder

teitbite
Mon Mar 18, 2013 1:04 am
Hi

Glad I could help :)
User avatar
Moderator

GK User
Tue Mar 19, 2013 7:59 pm
Oh, don't work
I change the code for:
// Continue Shopping Button
$this->continue_link_html = '/index.php/pedido.html';
</div>
<div class="clear"></div>
</div>
<?php echo shopFunctionsF::getLoginForm($this->cart,false);

BUT NOTHING HAPPENS...

Do you know why??
Thanks a lot
User avatar
Gold Boarder

teitbite
Wed Mar 20, 2013 1:30 pm
Hi

It's probably wrong file. Please ask on VM developers forum, they will know where to look for sure. I'm not VM expert :(
User avatar
Moderator


cron