<?php
// get the order summary
$orderSummary = $modx->runSnippet("checkout1ShowCartContents", array (sumariseOrder => 1));
$url = str_replace($modx->config['base_url'], "", $modx->config['site_url']) . $modx->makeUrl(intval(92));
$hash = md5($_SESSION['purchasers-details']['email']);
$_SESSION['hash'] = $hash;
$orderId = $_SESSION['orderId'];
?>
<?php // [[customerDetailsInToSESSION]] // or // [[customerDetailsInToSESSION? &loginEmail=`[email protected]`]] if ( empty($_GET['customer']) && empty($loginEmail) ) return "no customer account specified"; else { $where = (!empty($loginEmail)) ? "email='" . $loginEmail . "'" : "hash='" . $_GET['customer'] . "'"; $db_query = $modx->db->select("id, firstName, lastName, phone, email, address1, address2, suburb, city, region, postcode, country, comments, loyaltyPoints", $modx->getFullTableName('customer_details'), $where); if ($modx->db->getRecordCount($db_query) > 0) { while ($row = $modx->db->getRow($db_query)) { $_SESSION['purchasers-details'] = $row; } } else return false; } ?>
This question has been answered by BobRay. See the first response.
<?php
// [[orderDetailsInToSESSION]]
if ( empty($_GET['customer']) ) return "no customer account specified";
else {
// get the details from the orderId
$db_query = $modx->db->select("productId, quantity", $modx->getFullTableName('customer_order_details'), "orderId='" . $_GET['orderId'] . "'");
if ($modx->db->getRecordCount($db_query) > 0) {
while ($row = $modx->db->getRow($db_query)) {
// get the current prices and names of the products previously ordered
$document_tvs = $modx->getTemplateVars(array("pagetitle", "price", "specialPrice"), "name", $row['productId']);
// to put the returned array into a simpler/easier to use array use the following
foreach ($document_tvs as $document_TV) {
$docTVArray[$document_TV['name']] = $document_TV['value'];
}
// put these details into the session
$_SESSION['shoppingCartContents'][] = Array (
'productId' => $row['productId'],
'productTitle' => $docTVArray['pagetitle'],
'price' => ( !empty($docTVArray['specialPrice']) ) ? $docTVArray['specialPrice'] : $docTVArray['price'],
'quantity' => $row['quantity']
);
}
}
}
?>
foreach ($document_tvs as $document_TV) {
$docTVArray[$document_TV['name']] = $document_TV['value'];
}
I could be wrong, but I don't think getTemplateVars() considers "pagetitle" to be a TV.Hi Bob, yes, you are right.
<!--?php
// [[orderDetailsInToSESSION]]
if ( empty($_GET['customer']) ) return "no customer account specified";
else {
// get the details from the orderId
$db_query = $modx--->db->select("productId, quantity", $modx->getFullTableName('customer_order_details'), "orderId='" . $_GET['orderId'] . "'");
if ($modx->db->getRecordCount($db_query) > 0) {
while ($row = $modx->db->getRow($db_query)) {
// get the current prices and names of the products previously ordered
$document_tvs = $modx->getTemplateVars(array("pagetitle", "price", "specialPrice"), "name", $row['productId']);
// to put the returned array into a simpler/easier to use array use the following
foreach ($document_tvs as $document_TV) {
$docTVArray[$document_TV['name']] = $document_TV['value'];
}
// put these details into the session
$_SESSION['shoppingCartContents'][] = Array (
'productId' => $row['productId'],
'productTitle' => $docTVArray['pagetitle'],
'price' => ( !empty($docTVArray['specialPrice']) ) ? $docTVArray['specialPrice'] : $docTVArray['price'],
'quantity' => $row['quantity']
);
}
}
}
?>