我有一个" if"有效的陈述,它只是没有显示正确的数据。
此代码位于弹出页面上,您可以在商品缺货时单击该代码,它会将它们添加到数据库中,并且当商品有库存时会发送电子邮件。
现在点击它看起来很好。 它将读取"请求以下产品的电子邮件可用性通知:,等等等等等等等等等。
但是当你填写表格时,它会刷新并说明
"您将收到通知 - 谢谢"但是在下面,它仍然会显示以下产品的“请求电子邮件可用性通知:”,等等等等等等等等。
我只是希望它能够表达谢谢,仅此而已。我有什么想法吗?
提前感谢您的帮助。
<?php
ob_start();
require_once('Ambiance/Environment/envi.php');
require_once('Ambiance/Modules/Product.php');
Environment::InitializeVDDB(Environment::dsn());
$product_id = strtoupper($_REQUEST['product_id']);
if (!$db->getOneEx(SQL::checkProductExists($product_id))):
die('Invalid Product ID');
endif;
// Select product info
$product = $db->getRowEx(SQL::getProductInfo($product_id));
$prod = new Product($product);
$image_path = Environment::main_docroot() . '/images/' . $product['as_sub_category_id'] . '/' . $product_id;
$prod_details = get_cart_info($prod);
Environment::LoadForms(array('AvailabilityNotification'));
require_once(Environment::include_path() . '/common/common_page_top.php');
?>
<title>Request Availability Notification</title>
<?php
require_once(Environment::include_path() . '/common/common_css.php');
require_once(Environment::include_path() . '/common/common_js.php');
?>
</head>
<body style="background:#D9DADA;">
<div class="commonPopup">
<div class="popupHead">Request Availability Notification</div>
<div class="floatLeft paddingLft20 paddingRgt20">
<? if ($availabilitynotification->isProcessed()): ?>
<p class="bold">You will be notified - Thank you</p>
<? endif;?>
<p class="floatLeft">
Requesting e-mail availability notification for the following product:
</p>
<span class="floatLeft w90p">
<span class="floatLeft">
<? if ($thumb = VDFileAccess::get_item_header_img($image_path)): ?>
<a href="<?=Environment::webroot()?>/product/item.php?product-id=<?=$product_id?>" title=""> <span class="displayPic"><img class="css3" alt="" src="<?=Environment::webroot()?>/images/product/<?=$product['as_sub_category_id']?>/<?=$product_id?>/thumbs/<?=$thumb?>" ></span></a>
<? else: ?>
<a href="<?=Environment::webroot()?>/product/item.php?product-id=<?=$product_id?>" title=""><span class="displayPic"><img class="css3" alt="" src="<?=Environment::webroot()?>/images/product/no_image/thumbs/noimage.jpg" ></span></a>
<? endif;?>
</span>
<span class="floatLeft w70p paddingTop10 marginLft15">
<p class="bold floatLeft nobtmMargin"><?=Environment::encode_char($product['name'])?> <?=iif(strlen($product['description']), '- ' . Environment::encode_char($product['description']), '')?></p>
<div class="clear"></div>
<p class="bold floatLeft notopMargin">Item #<?=$product_id?></p>
</span>
</span>
<section class="commonform marginTop15">
<p class="bold">Enter your email address in the form below</p>
<form method="post" id="email_product_availability" name="email_product_availability" action="<?=$_SERVER['PHP_SELF']?>">
<?=$availabilitynotification->process->getElement()?>
<?=$availabilitynotification->name->getElement()?>
<?=$availabilitynotification->product_id->getElement()?>
<span class="floatLeft">
<span class="inputLeft-Style3 "></span>
<input type="text" name="email" onBlur="if (this.value == '') {this.value = 'E-mail address';}" onFocus="if(this.value == 'E-mail address') {this.value = '';}" value="E-mail address" class="inputMiddle-Style3 width305px"/>
<span class="inputRight-Style3"></span>
<?
if ($availabilitynotification->hasErrors()):
foreach ($availabilitynotification->getErrors() as $error) {
?>
<label class="error cartError width305px"><?=$error->getMessage()?></label>
<?
}
endif;
?>
</span>
</form>
</section>
<p class="clear"></p>
<p class="floatLeft w100p">
<span class="floatLeft paddingTop10">
<a class="textGrey" href="#" onClick="parent.$.fn.colorbox.close();">
<span class="greyBtnLft-Big font12">Cancel</span> <span class="greyBtnRgt-Big"></span>
</a>
</span>
<span class="floatLeft marginLft30 paddingTop10">
<a class="textGrey" href="#" onClick="$('#email_product_availability').submit();">
<span class="blueBtnLft-Sml font12">Submit</span>
<span class="blueBtnRgt-Sml"></span>
</a>
</span>
<span class="popupLogo floatRight"></span>
</p>
</div>
</div>
</div>
<script>
$(document).ready(function(){
var x = $(document).height() + 30;
var y = $(document).width();
parent.$.fn.colorbox.resize({width:y, height:x});
});
</script>
</body>
</html>
<?php
ob_end_flush();
?>
答案 0 :(得分:0)
它看起来像:
<p class="floatLeft">
Requesting e-mail availability notification for the following product:
</p>
不在if或if之内。我想你想要这样的东西:
<? if ($availabilitynotification->isProcessed()): ?>
<p class="bold">You will be notified - Thank you</p>
<? else: ?>
<p class="floatLeft">
Requesting e-mail availability notification for the following product:
</p>
<? endif; ?>