Commit 466aae53 authored by Jonny Bradley's avatar Jonny Bradley

[FIX] cart: Notices due to various param defaults not being used

parent c355955f
......@@ -176,22 +176,17 @@ function wikiplugin_addtocart( $data, $params )
if ( ! isset( $params['code'], $params['description'], $params['price'] ) ) {
return WikiParser_PluginOutput::argumentError(array_diff(array( 'code', 'description', 'price'), array_keys($params)));
}
if ( ! isset( $params['href'] ) ) {
$params['href'] = null;
}
if (! isset($params['label'])) {
$params['label'] = tra('Add to cart');
}
if (! isset($params['forceanon'])) {
$params['forceanon'] = 'n';
$plugininfo = wikiplugin_addtocart_info();
foreach ($plugininfo['params'] as $key => $param) {
$default["$key"] = $param['default'];
}
$params = array_merge($default, $params);
// once forceanon is set it will have to affect the whole shopping cart otherwise it will be inconsistent
if ($params['forceanon'] == 'y') {
$_SESSION['forceanon'] = 'y';
}
if (! isset($params['ajaxaddtocart'])) {
$params['ajaxaddtocart'] = 'y';
}
foreach ($params as &$p) {
$p = trim($p); // remove some line ends picked up in pretty tracker
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment