[[!EditEISorders? &FullName=`[[GetFullname]]`]]
<?php
/* EditQuote Snippet */
/* Load our class */
$path = MODX_CORE_PATH . 'components/EIS/';
$result = $modx->addPackage('EIS',$path .
'model/','EIS_');
if (! $result) {
return 'Failed to add package';
}
/* Get the existing Quote */
$FullName = $scriptProperties['FullName'];
$order = $modx->getObject('Orders',
array('FullName'=>$FullName));
/* Show error message if quote is not found */
if (empty($order)) {
return ('Could not find Order with Full Name: ' . $FullName . 'end');
}
if (isset($_POST['submit']) &&
($_POST['submit'] == 'submit')) {
/* Form has been submitted */
$order->set('Order', $_POST['Order']); /*Primary Key*/
$order->set('FullName', $_POST['FullName']);
$order->set('CustomerName', $_POST['CustomerName']);
$order->set('InstallDate', $_POST['InstallDate']);
$order->set('ZIP', $_POST['ZIP']);
$order->set('PurchasePrice', $_POST['PurchasePrice']);
$order->set('BasicInstallationFee', $_POST['BasicInstallationFee']);
$order->set('DeliveryOption', $_POST['DeliveryOption']);
$order->set('AdditionalMiles', $_POST['AdditionalMiles']);
$order->set('AdditionalServices', $_POST['AdditionalServices']);
$order->set('AdditionalPainting', $_POST['AdditionalPainting']);
$order->set('ParkingToll', $_POST['ParkingToll']);
$order->set('RRPee', $_POST['RRPee']);
$order->set('OtherProducts', $_POST['OtherProducts']);
$order->set('OtherTip', $_POST['OtherTip']);
$order->set('Adjustment', $_POST['Adjustment']);
$order->set('Reason', $_POST['Reason']);
$order->set('Tax', $_POST['Tax']);
$order->set('TotalInstallationCharge ', $_POST['TotalInstallationCharge']);
if ( $order->save()) {
$output = "Order Saved" . $order->get('Order');
} else {
$output = "Error";
}
} else {
/* Not a repost, just display the form */
/* The second argument to getChunk() tells MODX
* to replace the placeholders with the existing
* quote's values
*/
$output = $modx->getChunk('EISaddOrder',$order->toArray() );
}
return $output;This question has been answered by BobRay. See the first response.
[[+show_post]]
$modx->setPlaceholder('show_post', print_r($_POST, true);