<?php
// Contact search
// \Components\Customers\Contacts::search('foo');
function onCartSubmit($arrFormValues)
{
\Components\Commerce\Carts\Current::clear();
for($i = 0; $i < count($arrFormValues['product_id']); $i++)
{
if ($arrFormValues['product_quantity'][$i])
{
// Get the full product data
$arrProduct = \Components\Commerce\Products::get($arrFormValues['product_id'][$i]);
$iPackagedQty = $arrProduct['product_packaged_quantity'];
if (!$iPackagedQty)
{
$iPackagedQty = 1;
}
// Add to cart
\Components\Commerce\Carts\Current::orderProduct($arrFormValues['product_id'][$i], $arrFormValues['product_quantity'][$i] / $iPackagedQty);
}
}
/*
$arrContact = [
'contact_id' => 11109,
'contact_email' => 'bruce@foo2.com'
];
\Components\Customers\Contacts::save($arrContact);
// \Components\Customers\Contacts::saveColumn(9148, 'contact_email', 'foo@bar.net');
*/
}
?>
<?php
// Contact search
// \Components\Customers\Contacts::search('foo');
function onCartSubmit($arrFormValues)
{
\Components\Commerce\Carts\Current::clear();
for($i = 0; $i < count($arrFormValues['product_id']); $i++)
{
if ($arrFormValues['product_quantity'][$i])
{
// Get the full product data
$arrProduct = \Components\Commerce\Products::get($arrFormValues['product_id'][$i]);
$iPackagedQty = $arrProduct['product_packaged_quantity'];
if (!$iPackagedQty)
{
$iPackagedQty = 1;
}
// Add to cart
\Components\Commerce\Carts\Current::orderProduct($arrFormValues['product_id'][$i], $arrFormValues['product_quantity'][$i] / $iPackagedQty);
}
}
/*
$arrContact = [
'contact_id' => 11109,
'contact_email' => 'bruce@foo2.com'
];
\Components\Customers\Contacts::save($arrContact);
// \Components\Customers\Contacts::saveColumn(9148, 'contact_email', 'foo@bar.net');
*/
}
?>