VirtueMart Forum

VirtueMart 2 + 3 + 4 => Virtuemart Development and bug reports => Topic started by: serge-web54 on September 23, 2018, 20:03:03 PM

Title: when < in shipping mode , not working
Post by: serge-web54 on September 23, 2018, 20:03:03 PM
Hello,

on a 3.2.14 (upgrading from 3.2.4) when i have < in shipping mode ( france < 3kg ) items does not display in pdf , either note as invoice.
Title: Re: when < in shipping mode , not working
Post by: Jörgen on September 23, 2018, 21:04:27 PM
Hello

Haven´t seen this before, where exactly do You have the text ? I tried in Name and description and it works as expected. Tested on 3.2.12 and 3.2.15. Does this only happen in pdf ?.
Have You tried with &lt;  ?

Jörgen

Title: Re: when < in shipping mode , not working
Post by: serge-web54 on September 24, 2018, 10:37:06 AM
so,
I see what is happening
It is insered in field shipment_name in table Shipment Weight Countries.
The code insered in this field is : <span class="vmshipment_name">FRANCE < 3 Kg</span><span class="vmshipment_description">Envoi en France métropolitaine jusqu'à 3Kg</span>
I see the problem, and if i clean that field for each entry it works, but I do not find what is the file who generate this and include it in the database.
Perharps it is a change made by the previous webmaster ...
Do you know how I will be able to find this file ?
Thanks
Title: Re: when < in shipping mode , not working
Post by: GJC Web Design on September 24, 2018, 12:28:17 PM
administrator\components\com_virtuemart\plugins\vmpsplugin.php

protected function renderPluginName ($plugin)

you can over ride this function in any plugin
Title: Re: when < in shipping mode , not working
Post by: serge-web54 on September 24, 2018, 13:51:25 PM
Ok, i see it :

protected function renderPluginName ($plugin) {

static $c = array();
$idN = 'virtuemart_'.$this->_psType.'method_id';

if(isset($c[$this->_psType][$plugin->$idN])){
return $c[$this->_psType][$plugin->$idN];
}

$return = '';
$plugin_name = $this->_psType . '_name';
$plugin_desc = $this->_psType . '_desc';
$description = '';
$logosFieldName = $this->_psType . '_logos';
$logos = property_exists($plugin,$logosFieldName)? $plugin->$logosFieldName:array();
if (!empty($logos)) {
$return = $this->displayLogos ($logos) . ' ';
}
if (!empty($plugin->$plugin_desc)) {
$description = '<span class="' . $this->_type . '_description">' . $plugin->$plugin_desc . '</span>';
}
$c[$this->_psType][$plugin->$idN] = $return . '<span class="' . $this->_type . '_name">' . $plugin->$plugin_name . '</span>' . $description;

return $c[$this->_psType][$plugin->$idN];
}


How can I do to not have < working has html element ? 
should I report this as a bug that should impact others sites ? or Is this just my site ??

thanks
Title: Re: when < in shipping mode , not working
Post by: jenkinhill on September 24, 2018, 16:45:00 PM
Quote from: serge-web54 on September 23, 2018, 20:03:03 PM
( france < 3kg )

What happens if that is entered as   ( france &lt; 3kg )  ?
Title: Re: when < in shipping mode , not working
Post by: serge-web54 on October 03, 2018, 06:01:53 AM
yes it works when entering that.
I have to change all my shipments in database.
I think this behaviour is not normal
Title: Re: when < in shipping mode , not working
Post by: kishoreonwork on October 03, 2018, 10:29:11 AM
you need to use php 'htmlentities' function . See below modified code for the same.



protected function renderPluginName ($plugin) {

static $c = array();
$idN = 'virtuemart_'.$this->_psType.'method_id';

if(isset($c[$this->_psType][$plugin->$idN])){
return $c[$this->_psType][$plugin->$idN];
}

$return = '';
$plugin_name = $this->_psType . '_name';
$plugin_desc = $this->_psType . '_desc';
$description = '';
$logosFieldName = $this->_psType . '_logos';
$logos = property_exists($plugin,$logosFieldName)? $plugin->$logosFieldName:array();
if (!empty($logos)) {
$return = $this->displayLogos ($logos) . ' ';
}
if (!empty($plugin->$plugin_desc)) {
$description = '<span class="' . $this->_type . '_description">' . htmlentities($plugin->$plugin_desc ). '</span>';
}
$c[$this->_psType][$plugin->$idN] = $return . '<span class="' . $this->_type . '_name">' . htmlentities($plugin->$plugin_name) . '</span>' . $description;

return $c[$this->_psType][$plugin->$idN];
}




Thanks
Kishore