I am developing an ecommerce site using a 3rd party php script. And, I'm going to use CMS MS to manage content on the non-shopping pages. In other words, pages that will not have product displayed, e.g., about us, contact, and other informational pages. But, I still need to display global blocks of content (header, menu, footer), a 'minicart' and other includes that are dependent upon the ecommerce database.
I have been able to do this successfully by including content using the smarty {php} {/php} tags. But, for some reason I am having problems with the ecommerce script's minicart. It works correctly on a test site without CMS MS.
Inside my CMS MS template, I have tried using an iframe embed, and a user defined tag, and I can not get it to work. The page will hang and then display a server 500 error. But without the minicart code, the page displays correctly with out problems.
[EDIT: I should probably provide some URLs.
Test site without CMS MS installed: http://www.bathtanicals[dot]com/new/cart/index.php
Test site with CMS MS installed: http://www.bathtanicals[dot]com/new/cart-cms/index.php
Replace [dot] with . (I don't want those pgs indexed... thanks ]
Here's the minicart code. Does anyone see any red flags? Is there anything that might conflict with CMS MS? Could it be the session variables?
I replaced the traditional{php}
if(trim(@$_POST['sessionid']) != '')
$thesessionid = trim(@$_POST['sessionid']);
else
$thesessionid = session_id();
$thesessionid = str_replace("'",'',$thesessionid);
$useEuro=false;
$mcgndtot=0;
$totquant=0;
$totmitems=0;
$shipping=0;
$mcdiscounts=0;
if(@$_SESSION['xscountrytax'] != '') $xscountrytax=$_SESSION['xscountrytax']; else $xscountrytax=0;
$optPriceDiff=0;
$mcpdtxt='';
if(@$incfunctionsdefined==TRUE){
$alreadygotadmin = getadminsettings();
}else{
$sSQL = "SELECT countryLCID,countryCurrency,adminStoreURL FROM admin INNER JOIN countries ON admin.adminCountry=countries.countryID WHERE adminID=1";
$result = mysql_query($sSQL) or print(mysql_error());
$rs = mysql_fetch_array($result);
$adminLocale = $rs["countryLCID"];
$useEuro = ($rs["countryCurrency"]=="EUR");
$storeurl = $rs["adminStoreURL"];
if((substr(strtolower($storeurl),0,7) != "http://") && (substr(strtolower($storeurl),0,8) != "https://"))
$storeurl = "http://" . $storeurl;
if(substr($storeurl,-1) != "/") $storeurl .= "/";
mysql_free_result($result);
}
if(@$_POST['mode']=='checkout'){
if(@$_POST['checktmplogin'] != ''){
$sSQL = "SELECT tmploginname FROM tmplogin WHERE tmploginid='" . mysql_escape_string(trim(@$_POST['sessionid'])) . "' AND tmploginchk='" . mysql_escape_string(@$_POST['checktmplogin']) . "'";
$result = mysql_query($sSQL) or print(mysql_error());
if($rs = mysql_fetch_assoc($result))
$_SESSION['clientID']=$rs['tmploginname'];
}else{
$_SESSION['clientID']=NULL; unset($_SESSION['clientID']);
}
}
$sSQL = "SELECT cartID,cartProdID,cartProdName,cartProdPrice,cartQuantity FROM cart WHERE cartCompleted=0 AND " . getsessionsql();
$result = mysql_query($sSQL) or print(mysql_error());
while($rs = mysql_fetch_assoc($result)){
$optPriceDiff=0;
$mcpdedit =" edit";
$mcpdtxt .= "(".$rs["cartQuantity"] .")". ' ' . $rs["cartProdName"]. " ... \$" .(($rs["cartProdPrice"]+$optPriceDiff)*(int)$rs["cartQuantity"]) .$mcpdedit.""."\n";
$result2 = mysql_query($sSQL) or print(mysql_error());
$rs2 = mysql_fetch_assoc($result2);
if(! is_null($rs2['sumDiff'])) $optPriceDiff=$rs2['sumDiff'];
mysql_free_result($result2);
$subtot = (($rs['cartProdPrice']+$optPriceDiff)*(int)$rs['cartQuantity']);
$totquant+=(int)$rs['cartQuantity'];
$totmitems=$totmitems+$rs["cartQuantity"];
$mcgndtot += $subtot;
}
mysql_free_result($result);
{/php}
{php}
// *** Start Mini Cart Display ***
// Determine if there are contents and display correct bg class
{/php}
{php} print $xxMCSC; {/php}
{php}
//Show Checkout title if has contents
if($totmitems!=''){
print "".$xxMCCO."";
// Display minicart contents if not empty
{/php}
{php} print "You currently have ".$totmitems . " " . $xxMCIIC."" {/php}
{php} if($mcpdtxt == '') $xscountrytax=0; {/php}
{php} $shipping = (double)$_SESSION['xsshipping'];
print "". $xxTotal . " " . FormatEuroCurrency(($mcgndtot+$shipping+$xscountrytax)-$mcdiscounts) .""{/php}
{php} //Begin JS slide effect {/php}
Show Details
Cart Contents
{php} if(@$_POST["mode"]=="update"){ {/php}
{php} print $xxMainWn{/php}
{php} }else{ {/php}
{php} print ""."\n".$mcpdtxt."";
if($mcpdtxt != '' && @$_SESSION['discounts'] != ''){
$mcdiscounts = (double)$_SESSION['discounts']; {/php}
{php} print "" .$xxDscnts . " " . FormatEuroCurrency($mcdiscounts).""{/php}
{php} }
if($mcpdtxt != '' && (string)@$_SESSION['xsshipping'] != ''){
$shipping = (double)$_SESSION['xsshipping'];
if($shipping==0) $showshipping=''.$xxFree.''; else $showshipping=FormatEuroCurrency($shipping); {/php}
{php} print "[ ".$xxMCShpE . " " . $showshipping." ]" {/php}
{php} }
if($mcpdtxt == '') $xscountrytax=0; {/php}
{php} print "". $xxTotal . " " . FormatEuroCurrency(($mcgndtot+$shipping+$xscountrytax)-$mcdiscounts) .""{/php}
{php} } {/php}
{php} print "CHECKOUT";{/php}
Hide Details
{php} } {/php}
Code: Select all
<?php and ?> with smarty php tags and enabled smarty php in config.phpAlso, the top of the template has:
Which is required for the ecommerce minicart functionality.session_cache_limiter('none');
session_start();
ob_start();
Thanks in advance for any suggestions!


