Exemple #1
0
 function display($tpl = null)
 {
     $token = JRequest::getVar('token', null);
     $invtyName = JRequest::getVar('invtyName', null);
     $elementList = JModel::getInstance('couponElement', 'enmasseModel')->listAll();
     $bgImageUrl = JModel::getInstance('setting', 'enmasseModel')->getCouponBg();
     if ($invtyName != "") {
         $invty = JModel::getInstance('invty', 'enmasseModel')->getByName($invtyName);
         $orderItem = JModel::getInstance('orderItem', 'enmasseModel')->getById($invty->order_item_id ? $invty->order_item_id : 0);
         $order = JModel::getInstance('order', 'enmasseModel')->getById($orderItem->order_id ? $orderItem->order_id : 0);
         $deal = JModel::getInstance('deal', 'enmasseModel')->getById($invty->pdt_id ? $invty->pdt_id : 0);
         $merchant = JModel::getInstance('merchant', 'enmasseModel')->getById($deal->merchant_id ? $deal->merchant_id : 0);
         $merchant->branches = json_decode($merchant->branches);
         $deliveryDetail = json_decode($order->delivery_detail);
         $varList = array();
         $varList['dealName'] = $deal->name;
         $varList['serial'] = $invty->name;
         /** phuocndt
          * Get status value of Coupon
          */
         $varList['qr_code'] = $invty->name;
         $varList['detail'] = $deal->short_desc;
         $varList['merchantName'] = '';
         if ($merchant != null) {
             if (isset($merchant->branches->branch1)) {
                 $varList['merchantName'] .= $merchant->branches->branch1->name;
                 $varList['merchantName'] .= '<br />' . $merchant->branches->branch1->address;
                 $varList['merchantName'] .= '<br />' . $merchant->branches->branch1->telephone;
             }
         }
         $varList['highlight'] = $deal->highlight;
         $varList['personName'] = $deliveryDetail->name;
         $varList['term'] = $deal->terms;
     } else {
         $varList['serial'] = "";
         $varList['qr_code'] = "";
     }
     /** phuocndt
      * Debug QR code
      */
     //echo '<pre>'; print_r($varList); echo '</pre>'; die;
     if ($token != EnmasseHelper::generateCouponToken($varList['serial'])) {
         $msg = JText::_(INVALID_COUPON_TOKEN);
         $link = JRoute::_("/", false);
         JFactory::getApplication()->redirect($link, $msg);
     } else {
         $this->assignRef('varList', $varList);
         $this->assignRef('elementList', $elementList);
         $this->assignRef('bgImageUrl', $bgImageUrl);
         parent::display($tpl);
         exit(0);
     }
 }
Exemple #2
0
		<?php 
$count = 0;
?>
		<h3><?php 
echo JText::_('COUPON_MESSAGE');
?>
 "<?php 
echo $deal->name;
?>
":</h3>
		<table>
		<?php 
foreach ($invtyList as $invty) {
    ?>
			<?php 
    $link = "index.php?option=com_enmasse&controller=coupon&task=generate&invtyName=" . $invty->name . "&token=" . EnmasseHelper::generateCouponToken($invty->name);
    ?>
			<tr>
				<td><?php 
    echo JText::_('COUPON');
    ?>
: <?php 
    echo $invty->name;
    ?>
</td>
				<td>
					<a href="<?php 
    echo JRoute::_($link);
    ?>
" target="_blank"><?php 
    echo JText::_('COUPON_PRINT_LINK');
Exemple #3
0
?>
</th>
			<th width=""><?php 
echo JText::_('ORDER_COUPON_STATUS');
?>
</th>
			<th></th>
		</tr>
	</thead>
	<?php 
$invtyList = $order_row->orderItem->invtyList;
$base_url = 'http://';
$base_url .= $_SERVER["SERVER_NAME"] . $link_server;
for ($i = 0; $i < count($invtyList); $i++) {
    $k = $i % 2;
    $link = $base_url . "/index.php?option=com_enmasse&controller=coupon&task=generate&invtyName=" . $invtyList[$i]->name . "&token=" . EnmasseHelper::generateCouponToken($invtyList[$i]->name);
    ?>
	<tr class="<?php 
    echo "row{$k}";
    ?>
">
		<td align="center"><?php 
    echo $invtyList[$i]->name;
    ?>
</td>
		<td align="center"><?php 
    echo JTEXT::_('COUPON_' . strtoupper($invtyList[$i]->status));
    ?>
</td>
		<td align="center"><a href='<?php 
    echo $link;
Exemple #4
0
echo JText::_('COUPON_IMAGE_LINK');
?>
</a> <i style="float:left; padding-left: 5px"><?php 
echo JText::_('COUPON_REVIEW_MESAGE_2');
?>
</i>                    
		</td>

	</tr>
	<tr class="row1">
	    <td align="center">
            <iframe 
	    		width="100%" 
	    		height="1000px" 
	    		src="<?php 
echo $link . '/index.php?option=com_enmasse&controller=coupon&task=generate&editor=true&token=' . EnmasseHelper::generateCouponToken('');
?>
">
	    	</iframe>	    	
	    </td>
	</tr>
</table>
</fieldset>
<input type='hidden' name='jsondata' id='jsondata' value='' />
<input type="hidden" name="option" value="<?php 
echo $option;
?>
" />
<input type="hidden" name="controller" value="coupon" />
<input type="hidden" name="task" value="" />
<input type="hidden" name="boxchecked" value="0" />