A
Anonymous
Guest
Здравейте , захванах се с подобряването на един сайт от типа на онлайн търговете. Сайта е http://www.nowoz.com/
Той работи на принципа , всеки потребител си купува точки чрез SmS .С тези точки той надава за обределения продукт.
Това става чрез бутона BID . Идеята ми е следната :
Изкам да изпращам e-mail на всички потребители играли за дадения продукт , но не спечелили търга.
В момента изпраща само на спечелилия дадения търг.
Давам ви кода на view фаила ( т.е това http://www.nowoz.com/auctions/view/188 )
Таблицата където се записват се казва "loss-id"
Той работи на принципа , всеки потребител си купува точки чрез SmS .С тези точки той надава за обределения продукт.
Това става чрез бутона BID . Идеята ми е следната :
Изкам да изпращам e-mail на всички потребители играли за дадения продукт , но не спечелили търга.
В момента изпраща само на спечелилия дадения търг.
Давам ви кода на view фаила ( т.е това http://www.nowoz.com/auctions/view/188 )
Код:
<?php $id = $auction['Auction']['id'];
// I included this from the getstatus_functions.php file, so we can nicely format our bidding times.
function niceShort($dateString = null, $userOffset = null) {
global $config;
$date = $dateString ? _fromString($dateString, $userOffset) : time();
$y = _isThisYear($date) ? '' : ' Y';
if(!empty($config['App']['timeFormat'])){
$timeFormat = $config['App']['timeFormat'];
if($timeFormat == 12){
$timeFormat = "h:i:s A";
}else{
$timeFormat = "H:i:s";
}
}else{
$timeFormat = "H:i:s";
}
if (_isToday($date)) {
$ret = "Today, " . date($timeFormat, $date);
} elseif (_wasYesterday($date)) {
$ret = "Yesterday, " . date($timeFormat, $date);
} else {
$ret = date("M jS{$y}, ".$timeFormat, $date);
}
return $ret;
}
function _isThisYear($dateString, $userOffset = null) {
$date = _fromString($dateString, $userOffset);
return date('Y', $date) == date('Y', time());
}
function _isToday($dateString, $userOffset = null) {
$date = _fromString($dateString, $userOffset);
return date('Y-m-d', $date) == date('Y-m-d', time());
}
function _wasYesterday($dateString, $userOffset = null) {
$date = _fromString($dateString, $userOffset);
return date('Y-m-d', $date) == date('Y-m-d', strtotime('yesterday'));
}
function _fromString($dateString, $userOffset = null) {
if (is_integer($dateString) || is_numeric($dateString)) {
$date = intval($dateString);
} else {
$date = strtotime($dateString);
}
return $date;
}
?>
<div id="container">
<div id="maincontent" class="clearfix">
<div id="auction-details" class="box">
<div class="f-top-o clearfix" style="height:84px;">
<div class="detail_head">
<div class="detail_head_l">
<h2><?php echo $auction['Product']['title']; ?></h2>
</div>
<div class="detail_head_r">
<?php if(!empty($auction['Auction']['featured'])) : ?>
<span class="popup_time">
<a href="#">
<span class="tips">
<pre><label><strong class="orange2">Most popular auctions</strong> are displayed on the homepage,<br>meaning that you should <strong class="orange2">start here if you're new!</strong></label></pre>
</span><img src="/img/badge/featured_icon.png" width="50" height="50" border="0" alt="Featured auctions" title="Featured auction"></a></span>
<?php endif;?>
<?php if(!empty($auction['Auction']['penny'])):?>
<span class="popup_time">
<a href="#">
<span class="tips">
<pre><label>One bid will increase the auction price<strong class="orange2"> by ONE penny (cent).<br></strong>These are sometimes called cent auctions. Get a bargain!</label></pre>
</span><img src="/img/badge/penny_icon.png" width="50" height="50" border="0" alt="penny auction" title="penny auction"></a></span>
<?php endif;?>
<?php if(!empty($auction['Auction']['peak_only'])):?>
<span class="popup_time">
<a href="#">
<span class="tips">
<pre><label>The auction time is limited <strong class="orange2">meaning a greater<br>chance of winning! </strong>Bidding can only be placed<br><strong class="orange2">during peak hours (10AM to 11PM)</strong></label></pre>
</span><img src="/img/badge/peak_only_icon.png" width="50" height="50" border="0" alt="Peak only auction" title="Peak only auctions"></a></span>
<?php endif;?>
<?php if(!empty($auction['Auction']['nail_bitter'])):?>
<span class="popup_time">
<a href="#">
<span class="tips">
<pre><label>Nailbiter auctions are <strong class="orange2">those where Bid Butlers<br>are not allowed</strong> which gives you a greater chance<br>of winning!</label></pre>
</span><img src="/img/badge/nail_icon.png" width="50" height="50" border="0" alt="Nailbiter auctions" title="Nailbiter auctions"></a></span>
<?php endif;?>
<?php if(!empty($auction['Product']['free'])):?>
<span class="popup_time">
<a href="#">
<span class="tips">
<pre><label>Free auctions are <strong class="orange2">those where bids don't count.<br></strong>You'll only pay the delivery of the product!</label></pre>
</span><img src="/img/badge/free_icon.png" width="50" height="50" border="0" alt="Free auctions" title="Free auctions"></a></span>
<?php endif;?>
<?php if(!empty($auction['Product']['fixed'])):?>
<span class="popup_time">
<a href="#">
<span class="tips">
<pre><label>Fixed auctions are <strong class="orange2">those where bids don't count.<br></strong>You'll only pay the defined value of the product!</label></pre>
</span><img src="/img/badge/fixed_icon.png" width="50" height="50" border="0" alt="Free auctions" title="Free auctions"></a></span>
<?php endif;?>
<br class="clear_br"></div>
</div>
</div>
<div class="f-repeat clearfix" style="padding-bottom:20px;">
<div class="content" style="padding:20px !important;">
<div class="col1">
<div class="content">
<div class="auction-image">
<?php if(!empty($auction['Auction']['image'])):?>
<?php echo $html->image($auction['Auction']['image'], array('class'=>'productImageMax', 'alt' => $auction['Product']['title'], 'title' => $auction['Product']['title']));?>
<?php else:?>
<?php echo $html->image('product_images/max/no-image.gif', array('alt' => $auction['Product']['title'], 'title' => $auction['Product']['title']));?>
<?php endif; ?>
</div>
<div class="thumbs">
<?php if(!empty($auction['Product']['Image']) && count($auction['Product']['Image']) > 1):?>
<?php foreach($auction['Product']['Image'] as $image):?>
<?php if(!empty($image['ImageDefault'])) : ?>
<span><?php echo $html->link($html->image('default_images/'.$appConfigurations['serverName'].'/thumbs/'.$image['ImageDefault']['image']), '/img/'.$appConfigurations['currency'].'/default_images/max/'.$image['ImageDefault']['image'], array('class' => 'productImageThumb'), null, false);?></span>
<?php else: ?>
<span><?php echo $html->link($html->image('product_images/thumbs/'.$image['image']), '/img/product_images/max/'.$image['image'], array('class' => 'productImageThumb'), null, false);?></span>
<?php endif; ?>
<?php endforeach;?>
<?php endif;?>
</div>
<br class="clear_br">
<div class="align-center" style="margin-bottom:0px;">
<p style="margin:5px 0 13px; padding:0;"><label></label></p>
<?php if($session->check('Auth.User')):?>
<?php if(!empty($watchlist)):?>
<div class="bid-addwatchlist"><?php echo $html->link(__('Remove from Watchlist', true), array('controller' => 'watchlists', 'action'=>'delete', $watchlist['Watchlist']['id']), null, sprintf(__('Tem a certeza que deseja remover este leilгo da sua lista de observaзгo?', true), $watchlist['Watchlist']['id'])); ?></div>
<?php else:?>
<div class="bid-addwatchlist"><?php echo $html->link(__('Add to Watchlist', true), array('controller' => 'watchlists', 'action' => 'add', $auction['Auction']['id']));?></div>
<?php endif;?>
<?php else:?>
<div style="margin:-3px 0 0 -11px;">
<a href="/users/register">
<img border="0" src="/img/register.png"></a></div>
<?php endif;?>
</div>
</div>
</div>
<div class="col2">
<div class="content auction-item" title="<?php echo $auction['Auction']['id'];?>" id="auction_<?php echo $auction['Auction']['id'];?>" style="padding:0;">
<div class="sub-col1">
<?php if(!empty($auction['Auction']['isClosed'])):?> <div class="congrats orange2">
<?php if(!empty($auction['Loss']['id'])):?>
<?php echo sprintf(__('Test 123 to %s', false), $auction['Loss']['username']);?><br />
<?php else:?>
<?php __('There was no winner');?><br />
<?php endif;?>
</div>
<?php endif;?>
<dl class="clearfix" style="padding:10px 10px 0;">
<dt>Current price :</dt>
<dd class="price">
<?php if(!empty($auctionItem['Product']['fixed'])):?>
<?php echo $number->currency($auctionItem['Product']['fixed_price'], $appConfigurations['currency']); ?>
<span class="bid-price-fixed"><?php echo $number->currency($auction['Auction']['price'], $appConfigurations['currency']); ?></span>
<?php else: ?>
<span class="bid-price"><?php echo $number->currency($auction['Auction']['price'], $appConfigurations['currency']); ?></span><?php endif; ?><br /><span class="vat">Including Tax</span>
</dd>
<dt>Latest bidder :</dt>
<dd class="username"><span class="bid-bidder">Highest Bidder</span></dd>
</dl>
<div style="padding-bottom:0px;">
<span class="popup_time">
<a href="#">
<span class="tips">
<pre>With each bid, the time remaining will increase by <strong class="orange2"><?php echo $data['time_increment'] = $this->requestAction('/settings/get/time_increment/'.$id.'/0'); ?> seconds</strong>.</pre>
</span>
<img src="/img/increment/time<?php echo $data['time_increment'];?>.png" class="timeincrement"></a>
</span>
<div id="timer_<?php echo $auction['Auction']['id'];?>" class="timer countdown" title="<?php echo $auction['Auction']['end_time'];?>">--:--:--</div>
</div>
<div class="bid-now">
<?php if(!empty($auction['Auction']['isFuture'])) : ?>
<div><?php echo $html->image('b-soon-big.gif');?></div>
<?php elseif(!empty($auction['Auction']['isClosed'])) : ?>
<div><?php echo $html->image('b-sold-big.gif');?></div>
<?php else:?>
<?php if($session->check('Auth.User')):?>
<div class="bid-loading" style="display: none"><?php echo $html->image('ajax-arrows.gif');?></div>
<div class="bid-button"><?php echo $html->link($html->image('b-bid-big.gif'), '/bid.php?id='.$auction['Auction']['id'], array('class' => 'bid-button-link button-big', 'title' => $auction['Auction']['id']), null, false);?></div>
<?php else:?>
<div class="bid-button"><?php echo $html->link($html->image('b-login.gif'), array('controller' => 'users', 'action' => 'login'), array('class' =>'b-login-big'), null, null, false);?></div>
<?php endif;?>
<?php endif; ?>
</div>
<div class="bid-msg">
<div class="bid-message" style="display: none"></div>
</div>
<div class="note">
It costs <strong><?php echo $data['bid_debit'] = $this->requestAction('/settings/get/bid_debit/'.$id.'/0');?> credit</strong> to bid on this auction.<br>With each bid, the auction price increases by <span class="side_2px bold blk">Ђ<?php echo $data['price_increment'] = $this->requestAction('/settings/get/price_increment/'.$id.'/0');?></span><br></div>
</div>
<div class="count-saving">
<dl class="saving">
<dt class="saving">Normal price :</dt>
<dd class="saving"><?php echo $number->currency($auction['Product']['rrp'], $appConfigurations['currency']); ?></dd>
<dt class="saving" style="border:0px;">Current price :</dt>
<dd class="bid-price saving" style="border:0px;"><?php echo $number->currency($auction['Auction']['price'], $appConfigurations['currency']); ?></dd>
</dl><br class="clear_br">
<div class="total-savings align-center"><br>SAVINGS: <span class="bid-savings-price side_5px"><?php echo $number->currency($auction['Auction']['savings']['price'], $appConfigurations['currency']);?></span><br><br>You save <span class="bid-savings side_5px"><span class="orange2"><?php echo $number->toPercentage($auction['Auction']['savings']['percentage']); ?></span></span> from the normal retail price! </div>
</div>
</div>
</div>
<div class="col3">
<div class="sub-col">
<ul class="tabs">
<li><a><strong>Bid History</strong></a></li>
</ul>
<div class="panel" >
<div class="bid-history bid-histories" id="bidHistoryTable<?php echo $auction['Auction']['id'];?>">
<table width="100%" cellpadding="0" cellspacing="0" border="0">
<thead>
<tr>
<th><label>Time</label></th>
<th><label>Bidder</label></th>
<th><label>Type</label></th>
</tr>
</thead>
<tbody>
<?php if(!empty($bidHistories)): ?>
<?php foreach($bidHistories as $bid):?>
<tr>
<td><?php echo niceShort($bid['Bid']['created']);?></td>
<td><?php echo $bid['User']['username'];?></td>
<td><?php echo $bid['Bid']['description'];?></td>
</tr>
<?php endforeach;?>
<?php endif;?>
</tbody>
</table>
</div>
</div>
<?php if($session->check('Auth.User')):?>
<?php if(empty($auction['Auction']['isClosed'])):?>
<?php $can_bid = $this->requestAction('/limits/canbid/'.$auction['Auction']['id'].'/'.$session->read('Auth.User.id')); ?>
<?php if($can_bid == true) : ?>
<?php if(empty($auction['Auction']['nail_bitter'])) : ?>
<div class="col3">
<div class="sub-col">
<ul class="tabs">
<li><a><strong>BidButler</strong></a></li>
</ul>
<div class="panel" >
<div class="bid-history bid-histories">
<?php echo $form->create('Bidbutler', array('url' => '/bidbutlers/add/'.$auction['Auction']['id']));?> <fieldset class="auto">
<label for="BidbutlerMinimumPrice">Starting Bid</label><?php echo $form->input('minimum_price', array('div' => false, 'label' => false, 'class' => 'textbox one')); ?>
<label for="BidbutlerMaximumPrice">Maximum Bid</label><?php echo $form->input('maximum_price', array('div' => false, 'label' => false, 'class' => 'textbox two')); ?>
<label for="BidbutlerBids">Total Bids</label><?php echo $form->input('bids', array('div' => false, 'label' => false, 'class' => 'textbox three')); ?>
</fieldset><br>
<span class="submit"><?php echo $form->submit('b-add-bid-butler.gif', array('div' => false, 'label' => false, 'value' => ('Send Bids'))); ?></span><br><br>
<p class="bold"><a href="/bidbutlers">Your Bid Butler settings</a></p>
<?php echo $form->end();?>
</div>
</div>
</div>
</div>
<?php endif; ?>
<?php endif; ?>
<?php endif;?>
<?php endif; ?>
</div>
</div> </div>
</div>
<div id="payment-info" class="box">
<div id="payment-info" class="f-repeat clearfix">
<div class="content" style="padding:10px 25px; margin-bottom:10px;">
<div class="col1">
<dl>
<dt>Auction ID :</dt>
<dd><?php echo $auction['Auction']['id'];?></dd>
<dt>Auction Name :</dt>
<dd><?php echo $html->link($auction['Product']['title'], array('action' => 'view', $auction['Auction']['id']));?></dd>
<dt>Payment :</dt>
<dd>Google Checkout</dd>
</dl>
</div>
<div class="col2">
<dl>
<dt>Market Price :</dt>
<dd><span class="side_5px"><?php echo $number->currency($auction['Product']['rrp'], $appConfigurations['currency']); ?></span></dd>
<dt>Start time :</dt>
<dd><?php echo $time->nice($auction['Auction']['start_time']);?></dd>
<dt>End time :</dt>
<dd><?php echo $time->nice($auction['Auction']['end_time']);?></dd>
</dl>
</div>
<div class="col3">
<dl>
<dt>Shipping Fee :</dt>
<dd><?php echo $number->currency($auction['Product']['delivery_cost'], $appConfigurations['currency']);?></dd>
<dt>Shipping Info:</dt>
<dd><?php echo $auction['Product']['delivery_information'];?></dd>
<dt>Need Help?</dt>
<dd><a href="/contact">» Contact us</a></dd></dl><br class="clear_br">
</div>
</div>
</div>
<div class="f-bottom clearfix"> </div>
</div>
</div>
<div id="product-desc" class="box">
<div class="f-top-w clearfix" style="height:75px !important;"><h2 style="font-size:20px;">Product Description</h2></div>
<div class="f-repeat clearfix">
<div class="content">
<?php echo $auction['Product']['description'];?>
</div>
</div>
<div class="f-bottom-top clearfix"><p class="page_top"><a href="#" id="link_to_top">TOP OF PAGE</a></p></div>
</div>
Таблицата където се записват се казва "loss-id"