[eluser]diasansley[/eluser]
the below is the _front_content_box.php which is the file from where i have given an anchor tag to show all coupons.
Code:
<li>
<p id="coupon_list_header">Exclusiv für Sie</p>
<?php foreach($coupons as $coupon): ?>
<div class="coupon_container">
<h3 id="coupon_text_<?=$coupon['coupon_id'];?>" class="coupon_content"><?=$coupon['name'];?>
<br /><?=$coupon['text'];?>
</h3>
<p class="coupon_valid_text">Gültig vom <?=$coupon['from'];?> bis <?=$coupon['to'];?>
</p>
<p><?=anchor('coupons/showCouponDetail/'.$coupon['coupon_id'], 'zu den Details', array('class' => 'coupon_link'));?></p>
</div>
<?php endforeach;?>
<p><?=anchor('coupons/showallcoupons','alle coupons',array('class' => 'colum_bottom_text'));?> </p>
</li>
the one below is the coupons/showallcoupons this is the controller file
Code:
function showallcoupons()
{
$this-> content['title'] = "all coupons";
$brands = $this->m_brands->selectAllOrderBy('name','ASC');
$products = $this->m_products->selectAllOrderBy('name','ASC');
$entries = $this->m_entries->selectAllOrderBy('name','ASC');
$coupons = $this ->m_coupons->selectAllOrderBy('name','ASC');
$this->content['content'] = $this->_renderFrontendOutput('home/_front_image_box.php',array('error' =>''));
$this->content['content'] .= $this->_renderFrontendOutput('home/_front_entries_search_box.php', array('entries'=>$entries,'brands'=>$brands,'products'=>$products));
$this->content['content'] .= $this->_renderFrontendOutput('coupons/_show_coupon_list.php',array('coupons' =>$coupons) );
$this->renderTemplate();
}
here is the model
Code:
class m_coupons extends WC_Model
{
function __construct()
{
parent::__construct();
$this->table = 'coupons';
}
this is the view file
Code:
<div id="coupons_detail_container">
<h3><?=$coupons['name']?></h3>
<p id="coupon_description"><?=$coupons['text']?></p>
<p id="coupon_description"><?=$coupons['from']?></p>
<p id="coupon_description"><?=$coupons['to']?></p>
</div>
where text 'from' and 'to' are supposed to be database fields which i want to display. But i get an error for those feilds as undefined