VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: slammy on September 13, 2014, 19:40:40 PM

Title: three small things with vm 2.6.10
Post by: slammy on September 13, 2014, 19:40:40 PM
Hello vm-community,

I am since today on Jml 2.5.24 and vm 2.6.10sr, coming from vm 2.6.6 and jml 2.5.22. Three small things I noticed with the new version:

1. the user-adressdata (edited while registration) isn´t included anymore in the email to user and admin. Only the lable displayed there for the JTXT::_('COM_VIRTUEMART_YOUR_ADDRESS') in your choosen language. Taking a look into components/com_virtuemart/views/user/tmpl/mail_html_reguser I found this

    foreach ($this->userFields['fields'] as $userField) {
if (!empty($userField['value']) && $userField['type'] != 'delimiter' && $userField['type'] != 'BT' && $userField['type'] != 'hidden') {
    echo $userField['title'] . ': ' . $userField['value'] . $li;

}
    }


what looks absolut ok for me. I don´t get whats wrong here ...


2. if you like to see the latest-products-module on your FrontPage you will notice that the choosen products are static now, therefore I used to replace this code in /administrator/components/com_virtuemart/models/product.php

case 'latest':
$date = JFactory::getDate (time () - (60 * 60 * 24 * $latest_products_days));
$dateSql = $date->toMySQL ();
//$where[] = 'p.`' . $latest_products_orderBy . '` > "' . $dateSql . '" ';
$orderBy = 'ORDER BY p.`' . $latest_products_orderBy . '`';
$this->filter_order_Dir = 'DESC';
break;


with this RAND()-code

        case 'latest':
                                                $date = JFactory::getDate (time () - (60 * 60 * 24 * $latest_products_days));
                                                $dateSql = $date->toMySQL ();
                                                $where[] = 'p.`' . $latest_products_orderBy . '` > "' . $dateSql . '" ';
                                                //$orderBy = 'ORDER BY p.`' . $latest_products_orderBy . '`';
                                                $orderBy = 'ORDER BY RAND() ';

$this->filter_order_Dir = 'DESC';
                                                break;



3. this issue is still present: http://forum.virtuemart.net/index.php?topic=125572.0
greetings jens

Title: Re: three small things with vm 2.6.10
Post by: daanvanberkel on September 29, 2014, 16:19:29 PM
Is there already a solution for the first problem you are writing about? Because I have the same problem and I would like to fix it.
Title: Re: three small things with vm 2.6.10
Post by: slammy on September 29, 2014, 22:02:11 PM
Hi, I noticed more threads concerning user data fields, for example here http://forum.virtuemart.net/index.php?topic=125708.0
i don't have a solution yet but will post when find one. Or anyone else knows? Regards jens
Title: Re: three small things with vm 2.6.10
Post by: seyi on October 08, 2014, 18:21:04 PM
Ok, here is how I solved it.

in www/components/com_virtuemart/views/user/view.html.php, around line 423 is this:
<?php
$this->userFields $userFieldsModel->getUserFieldsFilled($userFields$this->user);
?>


I changed it to this:
<?php
//$this->userFields = $userFieldsModel->getUserFieldsFilled($userFields, $this->user);
# seyi_code
$usermodel VmModel::getModel('user');
$vmuser $usermodel->getUser();
$vmuser current($vmuser->userInfo);
$this->userFields $userFieldsModel->getUserFieldsFilled($userFields$vmuser);
}

?>


This can be added into the mail template file itself so it cannot be overriden on updates, but figured this is something that will be fixed anyway so should not really need that.
Title: Re: three small things with vm 2.6.10
Post by: Milbo on October 10, 2014, 00:38:52 AM
Quote from: slammy on September 13, 2014, 19:40:40 PM
2. if you like to see the latest-products-module on your FrontPage you will notice that the choosen products are static now, therefore I used to replace this code in /administrator/components/com_virtuemart/models/product.php

case 'latest':
$date = JFactory::getDate (time () - (60 * 60 * 24 * $latest_products_days));
$dateSql = $date->toMySQL ();
//$where[] = 'p.`' . $latest_products_orderBy . '` > "' . $dateSql . '" ';
$orderBy = 'ORDER BY p.`' . $latest_products_orderBy . '`';
$this->filter_order_Dir = 'DESC';
break;


with this RAND()-code

        case 'latest':
                                                $date = JFactory::getDate (time () - (60 * 60 * 24 * $latest_products_days));
                                                $dateSql = $date->toMySQL ();
                                                $where[] = 'p.`' . $latest_products_orderBy . '` > "' . $dateSql . '" ';
                                                //$orderBy = 'ORDER BY p.`' . $latest_products_orderBy . '`';
                                                $orderBy = 'ORDER BY RAND() ';

$this->filter_order_Dir = 'DESC';
                                                break;



We have now just


$orderBy = 'ORDER BY p.`' . $latest_products_orderBy . '`';
$this->filter_order_Dir = 'DESC';


The shuffle is a good idea, but I fear we must do it with the result.
Title: Re: three small things with vm 2.6.10
Post by: Milbo on October 10, 2014, 01:00:20 AM
Thank you Seyi,

I take your suggestion, sounds good. Thx.
Title: Re: three small things with vm 2.6.10
Post by: seyi on October 10, 2014, 14:50:49 PM
You are welcome Max, any time.
Title: Re: three small things with vm 2.6.10
Post by: al1 on October 13, 2014, 12:13:01 PM
Hi seyi,
Thanks for sharing, i've tried your solution but it seems that the adressdata in the email isn't the userdata but the admindata... do you have the same issue ?

Don't know if it helps but i saw the problem before the update when i change only the security part's code in" /administrator/components/com_virtuemart/models/user.php "

Replace if (!$user->bind($data)) { with

if(!$user->authorise('core.admin','com_virtuemart')){
   $whiteDataToBind = array();
   $whiteDataToBind['name'] = $data['name'];
   $whiteDataToBind['username'] = $data['username'];
   $whiteDataToBind['email'] = $data['email'];
   if(isset($data['password'])) $whiteDataToBind['password'] = $data['password'];
   if(isset($data['password2'])) $whiteDataToBind['password2'] = $data['password2'];
   } else {
      $whiteDataToBind = $data;
   }
// Bind Joomla userdata
if (!$user->bind($whiteDataToBind)) {


That's the change that made the adress disappears.

Title: Re: three small things with vm 2.6.10
Post by: Milbo on October 14, 2014, 21:12:12 PM
The solution was wrong, because a user is not allowed to take the data of another user. But it looks like we found the fix.
Title: Re: three small things with vm 2.6.10
Post by: antonino78 on October 15, 2014, 10:24:36 AM
Hello Milbo,
please you can have the file with the fix?
Title: Re: three small things with vm 2.6.10
Post by: Milbo on October 15, 2014, 15:33:45 PM
Is in the svn, will be released soon.