dongtan7998
2014-11-17 23:28 阅读 22
已采纳

如果声明没有显示正确的数据,则需要帮助

I have a "if" statement that is working, it is just not displaying correct data.

This code is on a popup page that you can click when a item is out of stock, it will add them to the db and emails will be sent when item comes back in stock.

Right now when clicked it looks and works fine. It will read "Requesting e-mail availability notification for the following product:, blah blah blah"

But when you fill out the form, it will refresh and state

"You will be notified - Thank you" but below that will will still show the "Requesting e-mail availability notification for the following product:, blah blah blah"

I just want it to show the thank you and nothing more. Any ideas what I am doing wrong?

Thanks in advance for the help.

<?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();
?>
  • 点赞
  • 写回答
  • 关注问题
  • 收藏
  • 复制链接分享

1条回答 默认 最新

  • 已采纳
    dougan1465 dougan1465 2014-11-18 00:23

    It just looks like:

    <p class="floatLeft">
    Requesting e-mail availability notification for the following product:
    </p>
    

    Is not inside of any if or if/else. I think you want something like this:

    <? 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; ?>
    
    点赞 评论 复制链接分享

相关推荐