VirtueMart Forum

VirtueMart 2 + 3 + 4 => Administration & Configuration => Topic started by: iWim on April 13, 2021, 11:36:44 AM

Title: Open articles for tos and tos2 in popup
Post by: iWim on April 13, 2021, 11:36:44 AM
Hey, hey,

I want to open articles (com_content) for tos and tos2 (privacy statement) in a popup.

I copied tos.php and tos2.php to my template and changed the url to the article.

Here are my issues...
tos opens a popup with "Terms of service" but no other text or my tos article.
tos2 opens a new tab with my privacy article.

How do I get both my articles inside the popup?
Do I need to edit more?

Here's my link snippet from tos2.php<a href="<?php echo JRoute::('index.php?option=com_content&view=article&id=2'FALSE?>" class="terms-of-service" id="terms-of-service2" rel="facebox" target="_blank">
   <span class="vmicon vm2-termsofservice-icon"></span>
   <?php echo vmText::('COM_VIRTUEMART_CART_TOSTWO_READ_AND_ACCEPTED'?>
</a>


Thank you.
Wim
Title: Re: Open articles for tos and tos2 in popup
Post by: GJC Web Design on April 17, 2021, 21:51:37 PM
remove the target="_blank"  ?
Title: Re: Open articles for tos and tos2 in popup
Post by: iWim on April 18, 2021, 12:30:42 PM
No. (I had already tried that   ;) )

I don't Think the url is important for the popup to work.
The link is.

To show articles I decided to use Articles Anywhere.

In tos.php and tos2.php I changed lines 49-50 from <h2><?php echo vmText::('COM_VIRTUEMART_CART_TOS'?></h2>
<?php echo $cart->vendor->vendor_terms_of_service ?>
to{article id="123"}[text]{/article}

For tos.php my issue is now solved.

However tos2.php still does not popup.

And I believe that (part of) the issue lies in line 48 in tos2.php<div id="full-tos">
1. When both tos and tos2 are displayed on the same page there are 2 id="full-tos", which is incorrect. (ids need to be unique)
2. When I change that line to id="full-tos2" the container is no longer hidden. (#full-tos has an inline style="display:none;", #full-tos2 does not).

I feel that there is some code missing for tos2...

Regards,
Wim

PS...
When tos2.php is displayed in account maintenance (view-user taak-editaddresscart) #full-tos is not hidden either...
I do get a popup, but it displays the message
QuoteThe requested content cannot be loaded.
Please try again later.

PS2...
When tos.php is displayed in account maintenance #full-tos (of tos2) is (also) hidden...
Title: Re: Open articles for tos and tos2 in popup
Post by: pinochico on April 18, 2021, 13:19:55 PM
Is only one tos in core VM.

Your code for tos2 is only your custom, then you have to find your custom solutions:
- wait if someone write the right code there
- hire developer

Is not bug or mistake in VM.

We use two tos in one page, then I paid our developer to develop for me.
Title: Re: Open articles for tos and tos2 in popup
Post by: iWim on April 18, 2021, 16:09:27 PM
I'm sorry, but there is a tos2 in core VM.
/components/com_virtuemart/sublayouts/tos2.php

And from what I have read on the forum tos2.php can be used to add an extra checkbox on the cart for i.e. privacy consent.

http://forum.virtuemart.net/index.php?topic=139105.msg488736#msg488736

http://forum.virtuemart.net/index.php?topic=139004.0

Regards,
Wim
Title: Re: Open articles for tos and tos2 in popup
Post by: pinochico on April 19, 2021, 14:03:23 PM
ok, thanks for info :)
Title: Re: Open articles for tos and tos2 in popup
Post by: Otto0815 on March 08, 2024, 23:31:02 PM
if it should be an popup use the following code in row 15 in tos2.php:

?>
<script   id="box-js2" type="text/javascript" >//<![CDATA[
jQuery(document).ready(function($) {
   $('div#full-tos2').hide();
   var con = $('div#full-tos2').html();
   $('a#terms-of-service2').click(function(event) {
      event.preventDefault();
      $.fancybox ({ div: '#full-tos2', content: con });
   });
}); //]]>
</script>
<?php

and if it should be the vendor legal info you must change row 62 to:

<?php echo $cart->vendor->vendor_legal_info ?>


for me it's an bug whats never beenworked on.the Script in the orignal version is not loading...