Hi!
How can I modify checkout so that Terms of Service will be shown only if user clicks link "I accept terms of service" text.
I know that I can remove the TOS from back-end but I need that users can read it easily if they want to read it.
What do I need to modify and how do I need to modify it?
Thanks!
I also have the problem, you have already a solution?
Greetz Ray
Quote from: 552288 on December 27, 2011, 11:23:21 AM
I also have the problem, you have already a solution?
No, sorry... I haven't find anything from the forums and haven't got time to solve it by my self.
I got it :D
If someone else is looking this you need to modify this file.
/public_html/components/com_virtuemart/views/cart/tmpl/default.html
I just insert few // -marks so that it only shows that check box and text that want it to show.
<span class="terms-of-service"><span class="vmicon vm2-termsofservice-icon"></span><?php //echo JText::_('COM_VIRTUEMART_CART_TOS'); ?></span>
//echo $this->cart->vendor->vendor_terms_of_service;?>
//echo '<span class="tos">'. JText::_('COM_VIRTUEMART_CART_TOS_READ_AND_ACCEPTED').'</span>';
and after adding these lines below above line and } mark
?>
<a onclick="void window.open('http://www.example.com', '_blank', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no');return false;"href="http://www.example.com">Accep terms of service</a>
<?php
I was able to open tos in new windows.
And here is full part of the code
<?php // Terms Of Service
if(VmConfig::get('oncheckout_show_legal_info',1)){
?>
<div class="terms-of-service">
<span class="terms-of-service"><span class="vmicon vm2-termsofservice-icon"></span><?php //echo JText::_('COM_VIRTUEMART_CART_TOS'); ?></span>
<div>
<?php
//echo $this->cart->vendor->vendor_terms_of_service;?>
</div>
</div>
<?php
} // Terms Of Service END ?>
<?php // Continue and Checkout Button ?>
<div class="checkout-button-top">
<?php // Terms Of Service Checkbox
if (!class_exists('VirtueMartModelUserfields')){
require(JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'userfields.php');
}
$userFieldsModel = new VirtueMartModelUserfields();
if($userFieldsModel->getIfRequired('agreed')){
if(!class_exists('VmHtml'))require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'html.php');
echo VmHtml::checkbox('tosAccepted',$this->cart->tosAccepted,1,0,'class="terms-of-service"');
//echo '<span class="tos">'. JText::_('COM_VIRTUEMART_CART_TOS_READ_AND_ACCEPTED').'</span>';
}
?>
<a onclick="void window.open('http://www.excample.com', '_blank', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no');return false;"href="http://www.excample.com">Hyväksyn palvelun ehdot</a>
<?php
echo $this->checkout_link_html;
$text = JText::_('COM_VIRTUEMART_ORDER_CONFIRM_MNU');
?>
</div>
good Morning .........
nice work, i think it´s the best solution at time.......
THX!
Here's something else you can do:
Wrap the terms of service in a div with a style='display: none;':
<?php // Terms Of Service
if(VmConfig::get('oncheckout_show_legal_info',1)){
?>
<div style='display:none;'>
<div id='terms-of-service' class="terms-of-service">
<span class="terms-of-service"><span class="vmicon vm2-termsofservice-icon"></span><?php echo JText::_('COM_VIRTUEMART_CART_TOS'); ?></span>
<div>
<?php
echo $this->cart->vendor->vendor_terms_of_service;?>
</div>
</div>
</div>
<?php
} // Terms Of Service END ?>
Then change the link to the terms of service to href="#terms-of-service" and class="modal":
echo '<a href="#terms-of-service" class="modal"><span class="tos">'. JText::_('COM_VIRTUEMART_CART_TOS_READ_AND_ACCEPTED').'</span></a>';
Make sure the terms display is enabled in the config.
Viola! Terms displayed as a modal dialog (works with pop-up blockers).
Style as desired.
Also, btw: don't modify /public_html/components/com_virtuemart/views/cart/tmpl/default.html directly. Copy it to /templates/<current template>/html/com_virtuemart/cart/default.php and modify it there.
--Jamin
Hello,
on what place you change the code for
echo '<a href="#terms-of-service" class="modal"><span class="tos">'. JText::_('COM_VIRTUEMART_CART_TOS_READ_AND_ACCEPTED').'</span></a>';
I have try it, the result is a blank site.
Greetings Ray
Did you add a DIV tag outside of the "terms-of-service" tag with style="display:none;", or did you give that style to the terms-of-service tag?
You have to add another tag that wraps around the terms-of-service tag. When you link to the terms-of-service tag, it disregards all containing tags and displays only the terms-of-service contents. This way, you can show the terms of service in a modal without having to display it on the page. If you set that terms-of-service tag to display: none, then it still doesn't show up, even in a modal.
Also make sure that you didn't give the display: none tag an id of "terms-of-service". It doesn't really need an id, but if you gave it one it should be unique and definitely not "terms-of-service".
Finally, make sure you didn't style "#terms-of-service", ".terms-of-service", or "div.terms-of-service" in CSS as "display: none;". That's not the default, so you would have had to done it explicitly.
--Jamin
Hi!
Just did it with the way jaminv mentioned.
thanks jaminv, it was easy to do and looks better than that one I used before.
This worked great, thanks!
Also, btw: don't modify /public_html/components/com_virtuemart/views/cart/tmpl/default.html directly. Copy it to /templates/<current template>/html/com_virtuemart/cart/default.php and modify it there.
Does this mean it won't get overrwritten with the next release of VM? or do I have to redo this everytime there is a new version of VM?
If you copy and modify it under your template folder, you don't have to redo it everytime vm2 has upgrade.
I recently updated VM to 2.0.2 and apparently this fix doesn't work anymore, anyone has a new fix yet? Would be much appreciated!
Thanks in advance,
Daan
Hi DeDhon, did you do like Jaminv suggested and modified in your template folder?
Also, btw: don't modify /public_html/components/com_virtuemart/views/cart/tmpl/default.html directly. Copy it to /templates/<current template>/html/com_virtuemart/cart/default.php and modify it there.
I upgraded to 2.0.2 yesterday and this still works great for me.
Hey,
Yes I tried, but I couldnt find a default.html. So I checked the default.php and found this:
<?php // Terms Of Service Checkbox
if (!class_exists('VirtueMartModelUserfields')){
require(JPATH_VM_ADMINISTRATOR . DS . 'models' . DS . 'userfields.php');
}
$userFieldsModel = VmModel::getModel('userfields');
if($userFieldsModel->getIfRequired('agreed')){
?>
<label for ="tosAccepted">
<?php
if(!class_exists('VmHtml'))require(JPATH_VM_ADMINISTRATOR.DS.'helpers'.DS.'html.php');
echo VmHtml::checkbox('tosAccepted',$this->cart->tosAccepted,1,0,'class="terms-of-service"');
if(VmConfig::get('oncheckout_show_legal_info',1)){
?>
<div class="terms-of-service">
<span class="terms-of-service" rel="facebox"><span class="vmicon vm2-termsofservice-icon"></span><?php echo JText::_('COM_VIRTUEMART_CART_TOS_READ_AND_ACCEPTED'); ?><span class="vm2-modallink"></span></span>
<div id="full-tos">
<h2><?php echo JText::_('COM_VIRTUEMART_CART_TOS'); ?></h2>
<?php echo $this->cart->vendor->vendor_terms_of_service;?>
</div>
</div>
I wasn't sure if it was still working as it is a different file and appears to be a somewhat different code. I tried to add it but it failed.. also, where should I add echo '<a href="#terms-of-service" class="modal"><span class="tos">'. JText::_('COM_VIRTUEMART_CART_TOS_READ_AND_ACCEPTED').'</span></a>';
?
In conclusion, I didnt really get the instructions of Jaminv ::)
Thanks, Daan
Hi Daan, I see the problem, it's not called default.html, it is default.php.
I didn't follow Jaminv instructions exactly but added the following link which worked for me
echo $this->cart->vendor->vendor_terms_of_service;?>
<a onclick="void window.open('http://www.mywebsite.com/myterms.htm', '_blank', 'status=no,toolbar=no,scrollbars=yes,titlebar=no,menubar=no,resizable=yes,width=640,height=480,directories=no,location=no');return false;"href="http://www.mywebsite.com/myterms.htm">Read the terms of service</a>
</div>
</div>
<?php
} // Terms Of Service END ?>
Hopefully you can work out where this goes in default.php.
It's a good point about this file changing. It's all seems to be working for me but I don't know if by using my old override if I'm missing some important new functionality. Anyone know if I need to do the override again?
Hey,
Sorry for the late response but it worked with your help, thanks a lot! About the override, I don't know that either.. to be honest I'm not sure if I even like the update yet
Cheers, Daan
anyone know the pathway to Open the Terms Of Service PoPuP in User Registration Area ?!
I'm trying to have the same solution than the VM1..... but i only can get one Blank Popup with no TOS Text .... because i dont know how to change this: <?php echo $this->cart->vendor->vendor_terms_of_service; ?> full post here: http://forum.virtuemart.net/index.php?topic=101254.0