简体   繁体   中英

Display Terms of service in any place (Joomla/Virtuemart 2.x)

I have some toruble with displaying terms of service.

At the cart page all works fine: http://mtxt.ibroken.ru/component/virtuemart/cart.html?Itemid=0 (bottom link) opens popup with text, generated by

<?php echo $this->cart->vendor->vendor_terms_of_service; ?>

code.

But i have button on the shop page http://mtxt.ibroken.ru/magazin.html (top button at right side), which must display same text...

At present moment text written in /modules/mod_virtuemart_cart/tmpl/default.php file. But how to get it in this file from shop interface by using PHP?

pps. Ugly English, sorry for that :)

You need to modify /modules/mod_virtuemart_cart/tmpl/default.php (or your override) and add this code just after line 3:

vmJsApi::js ('facebox');
vmJsApi::css ('facebox');
$document = JFactory::getDocument ();
$document->addScriptDeclaration ("

    jQuery(document).ready(function($) {
        $('div#full-tos').hide();
        $('a#terms-of-service').click(function(event) {
            event.preventDefault();
            $.facebox( { div: '#full-tos' }, 'my-groovy-style');
        });
    });

");

And add this code just after line 53

<div class="show_cart">
<?php
    if(!class_exists('VirtueMartModelVendor'))
        require(JPATH_VM_ADMINISTRATOR.DS.'models'.DS.'vendor.php');

    $vendor = VmModel::getModel('vendor');
   $vendor = $vendor->getVendor();
?>
    <br />
    <span style="z-index: 0;">
      <a href="<?php JRoute::_ ('index.php?option=com_virtuemart&view=vendor&layout=tos&virtuemart_vendor_id=1') ?>" class="terms-of-service" id="terms-of-service" rel="facebox" target="_blank">
        <?php echo JText::_ ('COM_VIRTUEMART_CART_TOS_READ_AND_ACCEPTED'); ?>
      </a>
    </span>
    <div id="full-tos">
      <h2><?php echo JText::_ ('COM_VIRTUEMART_CART_TOS'); ?></h2>
      <?php echo $vendor->vendor_terms_of_service; ?>
    </div>
</div>

That shoud do the trick!

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM