how to SEF cart URLs in vm3.0.12

If you are runnig Joomla 3.x and Virtuemart 3.x please post to this forum your questions or support tickets about One Page Checkout

how to SEF cart URLs in vm3.0.12

Postby admin » Thu Feb 25, 2016 1:50 pm

hello friends, we just found that core VM does not SEF cart URLs by default and if you needed to sef the cart URL we suggest to:

1. create Virtuemart cart link per EVERY LANGUAGE
2. modify your (or create new) padded.php
\templates\YOUR JOOMLA TEMPLATE\html\com_virtuemart\cart\padded.php

Code: Select all
<?php
/**
*
* Layout for the add to cart popup
*
* @package   VirtueMart
* @subpackage Cart
* @author Max Milbers
*
* @link http://www.virtuemart.net
* @copyright Copyright (c) 2013 VirtueMart Team. All rights reserved.
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL, see LICENSE.php
* VirtueMart is free software. This version may have been modified pursuant
* to the GNU General Public License, and as distributed it includes or
* is derivative of works licensed under the GNU General Public License or
* other free or open source software licenses.
* @version $Id: cart.php 2551 2010-09-30 18:52:40Z milbo $
*/

// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');
?>
<script>
function closeFancybox(el)
{
   if (typeof jQuery.fancybox !== 'undefined')
   {
    jQuery.fancybox.close();
    return false;
   }
   else
   {
      document.location = jQuery(el).attr('hrefrel');
      return false;
   }
}
</script>
<?php
$root = Juri::root();
$z = stripos($this->cart_link, $root);
if ( $z ===0 )
{
   $this->cart_link = JRoute::_(substr($this->cart_link, strlen($root)), true, VmConfig::get('useSSL', false));
}

echo '<a class="continue_link" hrefrel="' . $this->continue_link . '" href="#" onclick="return closeFancybox(this);" >' . vmText::_('COM_VIRTUEMART_CONTINUE_SHOPPING') . '</a>';
echo '<a class="showcart floatright" href="' . $this->cart_link . '">' . vmText::_('COM_VIRTUEMART_CART_SHOW') . '</a>';
if($this->products){
   foreach($this->products as $product){
      if($product->quantity>0){
         echo '<h4>'.vmText::sprintf('COM_VIRTUEMART_CART_PRODUCT_ADDED',$product->product_name,$product->quantity).'</h4>';
      } else {
         if(!empty($product->errorMsg)){
            echo '<div>'.$product->errorMsg.'</div>';
         }
      }

   }
}


if(VmConfig::get('popup_rel',1)){
   //VmConfig::$echoDebug=true;
   if ($this->products and is_array($this->products) and count($this->products)>0 ) {

      $product = reset($this->products);

      $customFieldsModel = VmModel::getModel('customfields');
      $product->customfields = $customFieldsModel->getCustomEmbeddedProductCustomFields($product->allIds,'R');

      $customFieldsModel->displayProductCustomfieldFE($product,$product->customfields);
      if(!empty($product->customfields)){
         ?>
         <div class="product-related-products">
         <h4><?php echo vmText::_('COM_VIRTUEMART_RELATED_PRODUCTS'); ?></h4>
         <?php
      }
      foreach($product->customfields as $rFields){

            if(!empty($rFields->display)){
            ?><div class="product-field product-field-type-<?php echo $rFields->field_type ?>">
            <div class="product-field-display"><?php echo $rFields->display ?></div>
            </div>
         <?php }
      } ?>
      </div>
   <?php
   }
}

?><br style="clear:both">




this modification solves two issues:
1. seffing the URLs within the add to cart popup
2. instead of using return link, the add to cart window is just closed regarless of the URL being used

best regards, stan
admin
Site Admin
 
Posts: 2708
Joined: Wed Jan 06, 2010 11:43 pm

Return to One Page Checkout for Virtuemart 3 on Joomla 3.x