News:

Looking for documentation? Take a look on our wiki

Main Menu

TOS has link in cart, but not in userfields

Started by jjk, April 07, 2012, 16:37:29 PM

Previous topic - Next topic

jjk

Hi Lipes,
from your previous post I don't understand your problem with the Terms of Service. If you enable "Show Terms of Service on the cart/checkout?" in the 'Configuration - Checkout' tab, VM2 should display a "Click here to read terms of service and check the box to accept them." along with a checkbox and a TOS icon right next to the "Check Out Now" button. And if you click on the text or on the TOS icon, a popup window should display your TOS (provided you typed something into the TOS Form)
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

lipes

#1
jjk: sorry if i said wrong, it isnt on cart/checkout.
It's here: index.php?option=com_virtuemart&view=user
http://virtuemart.cloudaccess.net/my-account   (I agree to the Terms of Service) no link to read....
on User Registration Area like we already got in the VM1 ( http://demo.virtuemart.net/index.php?page=checkout.index&option=com_virtuemart&Itemid=2&redirected=1&Itemid=2 ). "Send Registration
I agree to the Terms of Service (Terms of Service) *"

If fact users have that box to click/check if they agree or not in Registration Area ... but they couldnt see what they click because there is nothing to read or agree with.
For example: My 1st step is to users register their account but they need to know the Terms and Conditions by the Law in that area ...
I got a link in Index to "Registration" not to Users do checkout (they cant do it)... and then Register later :-/

VM1 vs VM 2 (USER FIELDS Registration)
VM V. online: J2.5.14 | VM 2.0.20a | SQL 5.1.70 | PHP 5.3.25

jjk

Quote from: lipes on April 07, 2012, 16:56:25 PM
http://virtuemart.cloudaccess.net/my-account   (I agree to the Terms of Service) no link to read....
Ah...,ok. They placed the Terms of Service in the footer for some reason.
Non-English Shops: Are your language files up to date?
http://virtuemart.net/community/translations

lipes

#3
POPUP LINK WORKS...
but dont have the Text of Terms of Service (TOS)...
echo VmHtml::checkbox('tosAccepted',$this->cart->tosAccepted,1,0,'class="terms-of-service"');
<?php echo $this->cart->vendor->vendor_terms_of_service; ?>

To be possible call the TOS text in User Registration Area (index.php?option=com_virtuemart&view=user&layout=edit) what we need to do to?
I have this code in file com_virtuemart/user/edit.php:
<?php
// Check to ensure this file is included in Joomla!
defined('_JEXEC') or die('Restricted access');

//AdminMenuHelper::startAdminArea();
// vmdebug('User edit',$this);
// Implement Joomla's form validation
JHTML::_('behavior.formvalidation');
$document JFactory::getDocument();
$document->addScriptDeclaration("
jQuery(document).ready(function($) {
$('div#full-tos').hide();
$('span.terms-of-service').click( function(){
//$.facebox({ span: '#full-tos' });
$.facebox( { div: '#full-tos' }, 'my-groovy-style');
});
});
"
);
$document->addStyleDeclaration('#facebox .content {display: block !important; height: 480px !important; overflow: auto; width: 560px !important; }');
JHTML::stylesheet('vmpanels.css'JURI::root().'components/com_virtuemart/assets/css/'); // VM_THEMEURL
JHTML::stylesheet('facebox.css''components/com_virtuemart/assets/css/'false);
JHTML::script('facebox.js''components/com_virtuemart/assets/js/'false);
?>

<style type="text/css">
.invalid {
border-color: #f00;
background-color: #ffd;
color: #000;
}
label.invalid {
background-color: #fff;
color: #f00;
}
</style>
<script language="javascript">
function myValidator(f, t)
{
f.task.value=t;

if (f.task.value=='cancel') {
//f.submit();
return true;
}
if (document.formvalidator.isValid(f)) {
f.submit();
return true;
} else {
var msg = '<?php echo addslashesJText::_('COM_VIRTUEMART_USER_FORM_MISSING_REQUIRED_JS') ); ?>';
alert (msg);
}
return false;
}
</script>
<h2><?php if($this->userDetails->virtuemart_user_id==0) {
echo JText::_('COM_VIRTUEMART_YOUR_ACCOUNT_REG');
}
?>
</h2>

<form method="post" id="adminForm" name="userForm" action="<?php echo JRoute::_('index.php?view=user',$this->useXHTML,$this->useSSL?>" class="form-validate">
<?php // Loading Templates in Tabs
if($this->userDetails->virtuemart_user_id!=0) {
    
$tabarray = array();
    if(
$this->userDetails->user_is_vendor){
    $tabarray['vendor'] = 'COM_VIRTUEMART_VENDOR';
    }
    
$tabarray['shopper'] = 'COM_VIRTUEMART_SHOPPER_FORM_LBL';
    
//$tabarray['user'] = 'COM_VIRTUEMART_USER_FORM_TAB_GENERALINFO';
    
if (!empty($this->shipto)) {
    $tabarray['shipto'] = 'COM_VIRTUEMART_USER_FORM_ADD_SHIPTO_LBL';
    }
    if ((
$_ordcnt count($this->orderlist)) > 0) {
    $tabarray['orderlist'] = 'COM_VIRTUEMART_YOUR_ORDERS';
    }


    
shopFunctionsF::buildTabs ($tabarray);

 } else {
    echo 
$this->loadTemplate 'shopper' );
 }

/*
 * TODO this Stuff should be converted in a payment module. But the idea to show already saved payment information to the user is a good one
 * So maybe we should place here a method (joomla plugin hook) which loads all published plugins, which already used by the user and display
 * them.
 */
// echo $this->pane->startPanel( JText::_('COM_VIRTUEMART_SHOPPER_PAYMENT_FORM_LBL'), 'edit_payment' );
// echo $this->loadTemplate('payment');
// echo $this->pane->endPanel();

// echo $this->pane->startPanel( JText::_('COM_VIRTUEMART_SHOPPER_SHIPMENT_FORM_LBL'), 'edit_shipto' );
// echo $this->loadTemplate('shipto');
// echo $this->pane->endPanel();
// if ($this->shipto !== 0) {
// // Note:
// // Of the order of the tabs change here, change the startOffset value for
// // JPane::getInstance() as well in view.html.php!
// echo $this->pane->startPanel( JText::_('COM_VIRTUEMART_USER_FORM_ADD_SHIPTO_LBL'), 'edit_shipto' );
// echo $this->loadTemplate('shipto');
// echo $this->pane->endPanel();
// }

//  if (($_ordcnt = count($this->orderlist)) > 0) {
//  echo $this->pane->startPanel( JText::_('COM_VIRTUEMART_ORDER_LIST_LBL') . ' (' . $_ordcnt . ')', 'edit_orderlist' );
//  echo $this->loadTemplate('orderlist');
//  echo $this->pane->endPanel();
//  }

//  if (!empty($this->userDetails->user_is_vendor)) {
//  echo $this->pane->startPanel( JText::_('COM_VIRTUEMART_VENDOR_MOD'), 'edit_vendor' );
//  echo $this->loadTemplate('vendor');
//  echo $this->pane->endPanel();
//  }

//  echo $this->pane->endPane();
?>

<input type="hidden" name="option" value="com_virtuemart" />
<input type="hidden" name="controller" value="user" />
<input type="hidden" name="task" value="" />
<?php if($this->userDetails->user_is_vendor){ ?>
    <div class="buttonBar-right">
<button class="button" type="submit" onclick="javascript:return myValidator(userForm, 'saveuser');" ><?php echo $this->button_lbl ?></button>
    <?php ?>
<?php echo JHTML::_'form.token' ); ?>

</form>
</div>


<?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">
                        <?php echo $this->user->vendor->vendor_terms_of_service?>
                        </div>
          </label>
          <?php }} ?>


some situations that i already tested to add TOS in User Registration:
<?php echo $this->cart->vendor->vendor_terms_of_service; ?> Dont Work
<?php echo $this->vendor->vendor_terms_of_service; ?> Dont Work
<?php echo $this->vendor_terms_of_service; ?> Dont Work
<?php echo $vendor_terms_of_service; ?> Dont Work
<?php echo $this->user->vendor->vendor_terms_of_service; ?> Dont Work
<?php echo $this->user->vendor_terms_of_service; ?> Dont Work
<?php echo $user->vendor_terms_of_service; ?> Dont Work
VM V. online: J2.5.14 | VM 2.0.20a | SQL 5.1.70 | PHP 5.3.25

lipes

VM V. online: J2.5.14 | VM 2.0.20a | SQL 5.1.70 | PHP 5.3.25

littlefish


razor7

Hi, still no TOS link on TOS field at registration page, can it be added? so at registration page, a link to the TOS is available?

Thanks!
MGS Creativa - VirtueMart Payment Plugin Experts
http://www.mgscreativa.com

Take a look at our downloads section for VirtueMart payment plugins and mouch more!
http://www.mgscreativa.com/en/online-store

razor7

#7
Well Just added by myself.

To achieve link to TOS popup like in vm1 edit file /components/com_virtuemart/views/user/tmpl/edit_address_userfields.php (or your template override) and in line 20, change this

defined('_JEXEC') or die('Restricted access');

to this:

defined('_JEXEC') or die('Restricted access');

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 line 90 change this:


<td class="key" title="<?php echo $field['description'?>" >
<label class="<?php echo $field['name'?>" for="<?php echo $field['name'?>_field">
<?php echo $field['title'] . ($field['required'] ? ' *' ''?>
</label>


to this and you are done!:

<td class="key" title="<?php echo $field['description'?>" >
<label class="<?php echo $field['name'?>" for="<?php echo $field['name'?>_field">
<?php echo $field['title'] . ($field['required'] ? ' *' ''?>
</label>
<?php

if($field['name'] === 'agreed') {
                          if(!
class_exists('VirtueMartModelVendor'))
                            require(
JPATH_VM_ADMINISTRATOR.DS.'models'.DS.'vendor.php');

                          
//$vendor_id = VirtueMartModelVendor::getLoggedVendor();

                          
$vendor VmModel::getModel('vendor');
                          
$vendor $vendor->getVendor();

?>

<br />
<span style="z-index: 0;">
  <a style="font-weight: normal; font-size: 10px;" 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>
<?php ?>


Wow, about a year for a single popup!
MGS Creativa - VirtueMart Payment Plugin Experts
http://www.mgscreativa.com

Take a look at our downloads section for VirtueMart payment plugins and mouch more!
http://www.mgscreativa.com/en/online-store

t68

Hi!
Tried this fix since I also think TOS should be readable on the registration page. But the fix didn´t work. Maybe since I run an older VM-version (2.0.10) due to compability issues with a payment module. The code on the php page /components/com_virtuemart/views/user/tmpl/edit_address_userfields.php lloks tje same on line 20 but the code on line 90 looks different with a lot of "echo" parameters in my code wich is not present in the instructions here. My code around line  90 looks like this:
      echo '   <table  class="adminForm user-details">' . "\n";
      $_table = true;
       }
       echo '      <tr>' . "\n";
       echo '         <td class="key" title="'.$_field['description'].'" >' . "\n";
       echo '            <label class="' . $_field['name'] . '" for="' . $_field['name'] . '_field">' . "\n";
       echo '               ' . $_field['title'] . ($_field['required'] ? ' *' : '') . "\n";
       echo '            </label>' . "\n";
       echo '         </td>' . "\n";
       echo '         <td>' . "\n";
       echo '            ' . $_field['formcode'] . "\n";
       echo '         </td>' . "\n";
       echo '      </tr>' . "\n";
   }
    }
    if ($_table) {
   echo '   </table>' . "\n";
Tried to paste the fix code here but it broke the page. Unfortunately i´m not that good at php coding to manage this myself. Thank´s for any help!