在任何地方显示服务条款(Joomla/Virtuelmart2.x)


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

我有一些显示服务条款的麻烦。

在购物车页面上,一切正常:http://mtxt.ibroken.ru/component/virtuemart/cart.html?Itemid=0(底部链接)打开由生成的带有文本的弹出窗口

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

代码。

但我在商店页面上有按钮http://mtxt.ibroken.ru/magazin.html(右侧顶部按钮),必须显示相同的文本。。。

目前,文本写在/modules/mod_virtuemart_cart/tmpl/default.php文件中。但是,如何使用PHP从商店界面将其保存在该文件中呢?

pps。丑陋的英语,很抱歉:)

您需要修改/modules/mod_virtuemart_cart/tmpl/default.php(或您的覆盖),并在第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');
        });
    });
");

在第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>

那就行了!