Bienvenue sur Geeklog France 26 mai 2017 - 07:37

Ticket No 3
Ivy

22 avril 2014 - 11:20 - Ivy

Remove mysql_data_seek and mysql_num_rows from phpblock_paypal_randomBlock()

phpblock_paypal_randomBlock() use mysql_data_seek and mysql_num_rows functions. Remove them in the next paypal plugin release

Ben

22 avril 2014 - 11:21 - Ben - Note #1

New phpblock_paypal_randomBlock function:

/**
* Create a random product block.
* Shows a single product selected from all actived products.
*
* @return HTML for the block
*/
function phpblock_paypal_randomBlock()
{
global $_CONF, $_TABLES, $_PAY_CONF;

$retval = '';
$T = COM_newTemplate($_CONF['path'] . 'plugins/paypal/templates/blocks');
$T->set_file('random_block', 'random_block.thtml');
// Get on random product from database
$sql = "SELECT p.*, i.pi_filename
FROM {$_TABLES['paypal_products']} AS p
LEFT JOIN {$_TABLES['paypal_images']} AS i
ON i.pi_pid = p.id AND i.pi_img_num IN (SELECT MIN(pi_img_num) FROM {$_TABLES['paypal_images']} WHERE pi_img_num >= 1 AND pi_pid = p.id)
WHERE p.active = 1 AND p.show_in_blocks = 1
ORDER BY RAND() LIMIT 1
";
$res = DB_query($sql);

$A = DB_fetchArray($res);

if (!isset($A['name'])) return;

if ($A['pi_filename'] == '') {
$T->set_var('small_pic', '');
} else {
$T->set_var('small_pic', '');
}

$T->set_var('site_url', $_PAY_CONF['site_url']);
$T->set_var('item_id', $A['id']);
//Todo make shorten name
$T->set_var('item_name', $A['name']);
$T->set_var('price', PAYPAL_productPrice($A) . $_PAY_CONF['currency']);
if ($A['price_ref'] != '' && ($A['price_ref'] > $A['price'])) $T->set_var('price', '' . number_format($A['price_ref'], $_CONF['decimal_count'], $_CONF['decimal_separator'], $_CONF['thousand_separator']) . '' . $_PAY_CONF['currency']);
$retval .= $T->parse('', 'random_block');

return $retval

Ce ticket est fermé.

Historique

Ivy le 22 avril 2014 - 11:20 a ouvert le ticket
Ben le 22 avril 2014 - 11:22 a fermé le ticket