public static function storeShippingMethods($shippingsArray, $id, $table = 'payment')
{
if ($table == 'payment') {
$t = '#__phocacart_payment_method_shipping';
$c = 'payment_id';
}
if ((int) $id > 0) {
$db = Factory::getDBO();
$query = ' DELETE ' . ' FROM ' . $t . ' WHERE ' . $c . ' = ' . (int) $id;
$db->setQuery($query);
$db->execute();
if (!empty($shippingsArray)) {
$values = array();
$valuesString = '';
foreach ($shippingsArray as $k => $v) {
$values[] = ' (' . (int) $id . ', ' . (int) $v[0] . ')';
}
if (!empty($values)) {
$valuesString = implode(',', $values);
$query = ' INSERT INTO ' . $t . ' (' . $c . ', shipping_id)' . ' VALUES ' . (string) $valuesString;
$db->setQuery($query);
$db->execute();
}
}
}
}