Esempio n. 1
0
    echo Yii::t("default", "Sorry but we cannot find what you are looking for.");
    ?>
</p>
     <?php 
    $order_ok = false;
    ?>
     <?php 
}
?>
     </div>
    </div> <!--main-->
</div> <!--page-->

<?php 
$data_raw = Yii::app()->functions->details['raw'];
$receipt = EmailTPL::salesReceipt($print, Yii::app()->functions->details['raw']);
$tpl = Yii::app()->functions->getOption("receipt_content", $merchant_id);
if (empty($tpl)) {
    $tpl = EmailTPL::receiptTPL();
}
$tpl = Yii::app()->functions->smarty('receipt', $receipt, $tpl);
$tpl = Yii::app()->functions->smarty('customer-name', $data['full_name'], $tpl);
$tpl = Yii::app()->functions->smarty('receipt-number', Yii::app()->functions->formatOrderNumber($data['order_id']), $tpl);
$receipt_sender = Yii::app()->functions->getOption("receipt_sender", $merchant_id);
$receipt_subject = Yii::app()->functions->getOption("receipt_subject", $merchant_id);
if (empty($receipt_subject)) {
    $receipt_subject = "Your Karenderia order is confirmed";
}
if (empty($receipt_sender)) {
    $receipt_sender = 'no-reply@' . $_SERVER['HTTP_HOST'];
}
Esempio n. 2
0
    public function receipt()
    {
        $data = '';
        $ok = false;
        if ($data = Yii::app()->functions->getOrder2($_GET['id'])) {
            $merchant_id = $data['merchant_id'];
            $json_details = !empty($data['json_details']) ? json_decode($data['json_details'], true) : false;
            if ($json_details != false) {
                Yii::app()->functions->displayOrderHTML(array('merchant_id' => $data['merchant_id']), $json_details, true);
                if (Yii::app()->functions->code == 1) {
                    $ok = true;
                }
            }
        }
        unset($_SESSION['kr_item']);
        unset($_SESSION['kr_merchant_id']);
        unset($_SESSION['voucher_code']);
        unset($_SESSION['less_voucher']);
        $print = '';
        ?>
<div class="page">
	<div class="main"> 
	<div class="inner">
     <?php 
        if ($ok == TRUE) {
            ?>
         <div class="receipt-main-wrap">
         <h3><?php 
            echo Yii::t("default", "Thank You");
            ?>
</h3>
         <p><?php 
            echo Yii::t("default", "Your order has been placed.");
            ?>
</p>
         
	     <div class="receipt-wrap order-list-wrap">
	       <h4><?php 
            echo Yii::t("default", "Order Details");
            ?>
</h4>
	       <div class="input-block">
	         <div class="label"><?php 
            echo Yii::t("default", "Name");
            ?>
 :</div>
	         <div class="value"><?php 
            echo $data['full_name'];
            ?>
</div>
	         <div class="clear"></div>
	       </div>
	       
	       <?php 
            $print[] = array('label' => Yii::t("default", "Name"), 'value' => $data['full_name']);
            ?>
	       
	       <div class="input-block">
	         <div class="label"><?php 
            echo Yii::t("default", "Merchant Name");
            ?>
 :</div>
	         <div class="value"><?php 
            echo $data['merchant_name'];
            ?>
</div>
	         <div class="clear"></div>
	       </div>
	       
	       <?php 
            $print[] = array('label' => Yii::t("default", "Merchant Name"), 'value' => $data['merchant_name']);
            ?>
	       
	       <div class="input-block">
	         <div class="label"><?php 
            echo Yii::t("default", "TRN Type");
            ?>
 :</div>
	         <div class="value"><?php 
            echo Yii::t("default", $data['trans_type']);
            ?>
</div>
	         <div class="clear"></div>
	       </div>
	       
	       <?php 
            $print[] = array('label' => Yii::t("default", "TRN Type"), 'value' => $data['trans_type']);
            ?>
	       
	       <div class="input-block">
	         <div class="label"><?php 
            echo Yii::t("default", "Payment Type");
            ?>
 :</div>
	         <div class="value"><?php 
            echo strtoupper(Yii::t("default", $data['payment_type']));
            ?>
</div>
	         <div class="clear"></div>
	       </div>
	       <?php 
            $print[] = array('label' => Yii::t("default", "Payment Type"), 'value' => strtoupper($data['payment_type']));
            ?>
	       	       
	       <?php 
            if ($data['payment_type'] == "pyp") {
                ?>
	       <?php 
                $paypal_info = Yii::app()->functions->getPaypalOrderPayment($data['order_id']);
                ?>
	       <div class="input-block">
	         <div class="label"><?php 
                echo Yii::t("default", "Paypal Transaction ID");
                ?>
 :</div>
	         <div class="value"><?php 
                echo isset($paypal_info['TRANSACTIONID']) ? $paypal_info['TRANSACTIONID'] : '';
                ?>
</div>
	         <div class="clear"></div>
	       </div>
	       <?php 
                $print[] = array('label' => Yii::t("default", "Paypal Transaction ID"), 'value' => isset($paypal_info['TRANSACTIONID']) ? $paypal_info['TRANSACTIONID'] : '');
                ?>
	       <?php 
            }
            ?>
	       
	       <div class="input-block">
	         <div class="label"><?php 
            echo Yii::t("default", "Reference #");
            ?>
 :</div>
	         <div class="value"><?php 
            echo Yii::app()->functions->formatOrderNumber($data['order_id']);
            ?>
</div>
	         <div class="clear"></div>
	       </div>
	       <?php 
            $print[] = array('label' => Yii::t("default", "Reference #"), 'value' => Yii::app()->functions->formatOrderNumber($data['order_id']));
            ?>
	       
	       <?php 
            if (!empty($data['payment_reference'])) {
                ?>
	       <div class="input-block">
	         <div class="label"><?php 
                echo Yii::t("default", "Payment Ref");
                ?>
 :</div>
	         <div class="value"><?php 
                echo $data['payment_reference'];
                ?>
</div>
	         <div class="clear"></div>
	       </div>
	       <?php 
                $print[] = array('label' => Yii::t("default", "Payment Ref"), 'value' => Yii::app()->functions->formatOrderNumber($data['order_id']));
                ?>
	       <?php 
            }
            ?>
	       	       
	       <?php 
            if ($data['payment_type'] == "ccr") {
                ?>
	       <div class="input-block">
	         <div class="label"><?php 
                echo Yii::t("default", "Card #");
                ?>
 :</div>
	         <div class="value"><?php 
                echo $card = Yii::app()->functions->maskCardnumber($data['credit_card_number']);
                ?>
</div>
	         <div class="clear"></div>
	       </div>
	       <?php 
                $print[] = array('label' => Yii::t("default", "Card #"), 'value' => $card);
                ?>
	       <?php 
            }
            ?>
	       
	       <div class="input-block">
	         <div class="label"><?php 
            echo Yii::t("default", "TRN Date");
            ?>
 :</div>
	         <div class="value"><?php 
            $trn_date = date('M d,Y G:i:s', strtotime($data['date_created']));
            echo Yii::app()->functions->translateDate($trn_date);
            ?>
</div>
	         <div class="clear"></div>
	       </div>
	       <?php 
            $print[] = array('label' => Yii::t("default", "TRN Date"), 'value' => $trn_date);
            ?>
	       
	       <?php 
            if ($data['trans_type'] == "delivery") {
                ?>
		       	       
		       <?php 
                if (isset($_SESSION['kr_delivery_options']['delivery_date'])) {
                    ?>
		       <div class="input-block">
		         <div class="label"><?php 
                    echo Yii::t("default", "Delivery Date");
                    ?>
 :</div>
		         <div class="value"><?php 
                    $deliver_date = prettyDate($_SESSION['kr_delivery_options']['delivery_date']);
                    echo Yii::app()->functions->translateDate($deliver_date);
                    ?>
</div>
		         <div class="clear"></div>
		       </div>
		       <?php 
                    $print[] = array('label' => Yii::t("default", "Delivery Date"), 'value' => $deliver_date);
                    ?>
		       <?php 
                }
                ?>
		       
		       <?php 
                if (isset($_SESSION['kr_delivery_options']['delivery_time'])) {
                    ?>
		       <?php 
                    if (!empty($_SESSION['kr_delivery_options']['delivery_time'])) {
                        ?>
		       <div class="input-block">
		         <div class="label"><?php 
                        echo Yii::t("default", "Delivery Time");
                        ?>
 :</div>
		         <div class="value"><?php 
                        echo $_SESSION['kr_delivery_options']['delivery_time'];
                        ?>
</div>
		         <div class="clear"></div>
		       </div>
		       <?php 
                    }
                    ?>
		       <?php 
                }
                ?>
		       
		       <?php 
                if (isset($_SESSION['kr_delivery_options']['delivery_asap'])) {
                    ?>
		       <?php 
                    if (!empty($_SESSION['kr_delivery_options']['delivery_asap'])) {
                        ?>
		       <div class="input-block">
		         <div class="label"><?php 
                        echo Yii::t("default", "Deliver ASAP");
                        ?>
 :</div>
		         <div class="value"><?php 
                        echo $delivery_asap = $_SESSION['kr_delivery_options']['delivery_asap'] == 1 ? "Yes" : '';
                        ?>
</div>
		         <div class="clear"></div>
		       </div>
			   <?php 
                        $print[] = array('label' => Yii::t("default", "Deliver ASAP"), 'value' => $delivery_asap);
                        ?>
		       <?php 
                    }
                    ?>
		       <?php 
                }
                ?>
		       
		       <div class="input-block">
		         <div class="label"><?php 
                echo Yii::t("default", "Deliver to");
                ?>
 :</div>
		         <div class="value"><?php 
                echo $data['full_address'];
                ?>
</div>
		         <div class="clear"></div>
		       </div>
				<?php 
                $print[] = array('label' => Yii::t("default", "Deliver to"), 'value' => $data['full_address']);
                ?>
		       
		       <div class="input-block">
		         <div class="label"><?php 
                echo Yii::t("default", "Delivery Instruction");
                ?>
 :</div>
		         <div class="value"><?php 
                echo $data['delivery_instruction'];
                ?>
</div>
		         <div class="clear"></div>
		       </div>
		       <?php 
                $print[] = array('label' => Yii::t("default", "Delivery Instruction"), 'value' => $data['delivery_instruction']);
                ?>
		       
		       <div class="input-block">
		         <div class="label"><?php 
                echo Yii::t("default", "Location Name");
                ?>
 :</div>
		         <div class="value"><?php 
                echo $data['location_name'];
                ?>
</div>
		         <div class="clear"></div>
		       </div>
		       <?php 
                $print[] = array('label' => Yii::t("default", "Location Name"), 'value' => $data['location_name']);
                ?>
				
		   <?php 
            } else {
                ?>
   
		   
		      <?php 
                if (isset($_SESSION['kr_delivery_options']['delivery_date'])) {
                    ?>
		       <div class="input-block">
		         <div class="label"><?php 
                    echo Yii::t("default", "Pickup Date");
                    ?>
 :</div>
		         <div class="value"><?php 
                    echo $_SESSION['kr_delivery_options']['delivery_date'];
                    ?>
</div>
		         <div class="clear"></div>
		       </div>
		       <?php 
                    $print[] = array('label' => Yii::t("default", "Pickup Date"), 'value' => $_SESSION['kr_delivery_options']['delivery_date']);
                    ?>
		       <?php 
                }
                ?>
		       
		       <?php 
                if (isset($_SESSION['kr_delivery_options']['delivery_time'])) {
                    ?>
		       <?php 
                    if (!empty($_SESSION['kr_delivery_options']['delivery_time'])) {
                        ?>
		       <div class="input-block">
		         <div class="label"><?php 
                        echo Yii::t("default", "Pickup Time");
                        ?>
 :</div>
		         <div class="value"><?php 
                        echo $_SESSION['kr_delivery_options']['delivery_time'];
                        ?>
</div>
		         <div class="clear"></div>
		       </div>
		       <?php 
                        $print[] = array('label' => Yii::t("default", "Pickup Time"), 'value' => $_SESSION['kr_delivery_options']['delivery_time']);
                        ?>
		       <?php 
                    }
                    ?>
		       <?php 
                }
                ?>
	       
	       <?php 
            }
            ?>
	       
	       <div class="spacer-small"></div>
	       
	       <?php 
            echo $item_details = Yii::app()->functions->details['html'];
            ?>
	     </div> <!--receipt-wrap-->
	     
	     <div class="print_wrap">
          <a class="print_element left" href="javascript:;"><i class="fa fa-print"></i> <?php 
            echo Yii::t("default", "Click here to print");
            ?>
</a>       
          <div class="clear"></div>
        </div>	    
        
        </div>
     <?php 
        } else {
            ?>
     <p class="uk-alert uk-alert-warning"><?php 
            echo Yii::t("default", "Sorry but we cannot find what you are looking for.");
            ?>
</p>
     <?php 
        }
        ?>
     </div>
    </div> <!--main-->
</div> <!--page-->

<?php 
        $receipt = EmailTPL::salesReceipt($print, Yii::app()->functions->details['raw']);
        $tpl = Yii::app()->functions->getOption("receipt_content", $merchant_id);
        if (empty($tpl)) {
            $tpl = EmailTPL::receiptTPL();
        }
        $tpl = Yii::app()->functions->smarty('receipt', $receipt, $tpl);
        $tpl = Yii::app()->functions->smarty('customer-name', $data['full_name'], $tpl);
        $tpl = Yii::app()->functions->smarty('receipt-number', Yii::app()->functions->formatOrderNumber($data['order_id']), $tpl);
        $receipt_sender = Yii::app()->functions->getOption("receipt_sender", $merchant_id);
        $receipt_subject = Yii::app()->functions->getOption("receipt_subject", $merchant_id);
        if (empty($receipt_subject)) {
            $receipt_subject = "Your Karenderia order is confirmed";
        }
        if (empty($receipt_sender)) {
            $receipt_sender = 'no-reply@' . $_SERVER['HTTP_HOST'];
        }
        $to = isset($data['email_address']) ? $data['email_address'] : '';
        if (!in_array($data['order_id'], (array) $_SESSION['kr_receipt'])) {
            sendEmail($to, $receipt_sender, $receipt_subject, $tpl);
            /*send email to merchant address*/
            $merchant_notify_email = Yii::app()->functions->getOption("merchant_notify_email", $merchant_id);
            $enabled_alert_notification = Yii::app()->functions->getOption("enabled_alert_notification", $merchant_id);
            /*dump($merchant_notify_email);
              dump($enabled_alert_notification);   */
            if ($enabled_alert_notification == "") {
                sendEmail($merchant_notify_email, $receipt_sender, Yii::t("default", "New Order From ") . $data['full_name'], $tpl);
            }
            // send SMS
            Yii::app()->functions->SMSnotificationMerchant($merchant_id, $data);
        }
        $_SESSION['kr_receipt'] = array($data['order_id']);
        die;
    }