Works if just one item is being added:
require_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php');
$items = array();
$items['tracking_id'] = 123;
$data=array('item'=>$items);
JRequest::setVar('data',$data);
$class = hikashop::get('class.cart');
$class->update(23, 1);
Does not work if 2 items are being added (e.g. driven from a foreach() loop):
require_once(rtrim(JPATH_ADMINISTRATOR,DS).DS.'components'.DS.'com_hikashop'.DS.'helpers'.DS.'helper.php');
$items = array();
$items['tracking_id'] = 123;
$data=array('item'=>$items);
JRequest::setVar('data',$data);
$class = hikashop::get('class.cart');
$class->update(23, 1);
$items = array();
$items['tracking_id'] = 456;
$data=array('item'=>$items);
JRequest::setVar('data',$data);
$class = hikashop::get('class.cart');
$class->update(23, 1);
To get it to work with Hikashop v1.5.1 I found I had to comment out the following lines of code:
(a)
classes/field.php in
getInput() lines 234 and 236
(if(!isset($formData))
(b)
classes/cart.php in
updateEntry() line 356
$already_done2 = true;
I have not tested the rest of the shop functionality so I don't know what might get broken by these changes.
Is it possible to provide a proper long term fix for this please?
E.G. An optional
force parameter passed into
$class->update() which achieves the same result.