Exemplo n.º 1
0
">
		         <a href="javascript:;" rel="<?php 
                        echo $val_item['item_id'];
                        ?>
" class="menu-item"
		           data-single="<?php 
                        echo $val_item['single_item'];
                        ?>
" 
		           <?php 
                        echo $atts;
                        ?>
		         >
		          <div class="left">
		             <?php 
                        echo qTranslate($val_item['item_name'], 'item_name', $val_item);
                        ?>
		             <?php 
                        //echo Widgets::displaySpicyIcon($val_item['spicydish'],'',$merchant_id);
                        ?>
             
		             <?php 
                        echo Widgets::displaySpicyIconNew($val_item['dish']);
                        ?>
             
		          </div>
		          <div class="right food-price-wrap">
		             <?php 
                        if (is_array($val_item['prices']) && count($val_item['prices']) >= 1) {
                            ?>
		              <?php 
Exemplo n.º 2
0
    public function displayMenu($menu = '', $mode = '', $mtid = '')
    {
        ?>
		<?php 
        if ($mode == 2 || $mode == 1) {
            ?>
		<div class="<?php 
            echo $mode == 2 ? "active-menu-2" : "active-menu-{$mode}";
            ?>
">
				
		<div class="categories-wrap-mobile">
		<div data-uk-dropdown="{mode:'click'}" class="uk-button-dropdown">
	    <button class="uk-button"><?php 
            echo Yii::t("default", "Categories");
            ?>
 <span class="sortby_text"></span><i class="uk-icon-caret-down"></i></button>
	    <div class="uk-dropdown" >
	        <ul class="uk-nav uk-nav-dropdown">
	        <?php 
            foreach ($menu as $val) {
                ?>
	        <li>
	        <a href="javascript:;" data-id="cat-<?php 
                echo $val['category_id'];
                ?>
" class="goto-category">
	        <?php 
                echo ucwords($val['category_name']);
                ?>
	        </a>
	       </li>
	        <?php 
            }
            ?>
    
	        </ul>
	    </div>
	    </div>	  
	    </div> <!--categories-wrap-->  
	    <!--<div class="clear"></div>-->
		
		<?php 
            foreach ($menu as $val) {
                //dump($val);
                ?>
		  <h2 class="cat-<?php 
                echo $val['category_id'];
                ?>
">
		  <?php 
                echo qTranslate($val['category_name'], 'category_name', $val);
                ?>
		  <?php 
                //echo Widgets::displayCatSpicyIconByID($val['category_id'])
                ?>
		  <?php 
                echo Widgets::displaySpicyIconNew($val['dish']);
                ?>
		  </h2>
		  
		  <?php 
                if (!empty($val['category_description'])) {
                    ?>
		  <p><?php 
                    echo qTranslate($val['category_description'], 'category_description', $val);
                    ?>
</p>
		  <?php 
                }
                ?>
		  
		  <p style="margin-top:-10px;" class="uk-text-small uk-text-muted"><?php 
                echo Widgets::categorySpicyNotes($val['category_id']);
                ?>
</span>
		  <?php 
                if (is_array($val['item']) && count($val['item']) >= 1) {
                    ?>
		  
		  <?php 
                    $x = 1;
                    ?>
		  		 
		  <?php 
                    foreach ($val['item'] as $item) {
                        //dump($item);
                        ?>
		 
		  <?php 
                        $atts = '';
                        if ($item['single_item'] == 2) {
                            $atts .= 'data-price="' . $item['single_details']['price'] . '"';
                            $atts .= " ";
                            $atts .= 'data-size="' . $item['single_details']['size'] . '"';
                        }
                        ?>
           <a href="javascript:;" rel="<?php 
                        echo $item['item_id'];
                        ?>
" class="menu-item" 
		   data-single="<?php 
                        echo $item['single_item'];
                        ?>
" 		   
		   <?php 
                        echo $atts;
                        ?>
		   >

		  <div class="table-div <?php 
                        echo count($val['item']) == $x ? "last" : '';
                        ?>
">
		    <div class="table-col-1"><?php 
                        Widgets::displayMenuPic($item['photo']);
                        ?>
</div>
		    <div class="table-col-2">
		        <div class="ux-price">
		         <samp></samp>
		         <h4>
		         <?php 
                        echo qTranslate($item['item_name'], 'item_name', $item);
                        ?>
		         <?php 
                        echo Widgets::displaySpicyIconNew($item['dish']);
                        ?>
 
		         </h4>
		         <?php 
                        //echo Widgets::displaySpicyIcon($item['spicydish'],'',$mtid);
                        ?>
 		         
		         
		         <h5 class="hide-food-price">
		         <?php 
                        if (!empty($item['discount'])) {
                            ?>
		           <span class="strike-tru">
		           <?php 
                            echo displayPrice(getCurrencyCode(), prettyFormat($item['prices'][0]['price']));
                            ?>
		           </span>
                  <?php 
                            echo displayPrice(getCurrencyCode(), prettyFormat($item['prices'][0]['price'] - $item['discount']));
                            ?>
		         <?php 
                        } else {
                            ?>
		         <?php 
                            echo displayPrice(getCurrencyCode(), prettyFormat($item['prices'][0]['price']));
                            ?>
		         <?php 
                        }
                        ?>
		         
		         </h5>
		        </div>
		        <p><?php 
                        echo qTranslate($item['item_description'], 'item_description', $item);
                        ?>
</p>
		    </div>
		  </div>
		  </a>
		  <?php 
                        $x++;
                        ?>
		  <?php 
                    }
                    ?>
		  
		  <?php 
                } else {
                    ?>
		  <p class="uk-text-muted"><?php 
                    echo t("No food item");
                    ?>
</p>
		  <?php 
                }
                ?>
		<?php 
            }
            ?>
		</div> <!--active-menu-2-->
		<?php 
        }
        ?>
		
		<?php 
    }
Exemplo n.º 3
0
                       }
                   }
               }
               /** two flavors */
               /*if ($data['two_flavors']==2){            	
                 	$val['multi_option']='one';
                 }*/
               if ($val['multi_option'] == "custom" || $val['multi_option'] == "multiple") {
                   echo CHtml::checkBox($sub_item_name, in_array($sub_item_id, (array) $sub_addon_selected_id) ? true : false, array('value' => $val_addon['sub_item_id'] . "|" . $val_addon['price'] . "|" . $val_addon['sub_item_name'] . "|" . $val['two_flavor_position'], 'data-id' => $val['subcat_id'], 'data-option' => $val['multi_option_val'], 'rel' => $val['multi_option'], 'class' => 'sub_item_name sub_item_name_' . $val['subcat_id']));
               } else {
                   //dump($val['two_flavor_position']);
                   echo CHtml::radioButton($sub_item_name, in_array($sub_item_id, (array) $sub_addon_selected_id) ? true : false, array('value' => $val_addon['sub_item_id'] . "|" . $val_addon['price'] . "|" . $val_addon['sub_item_name'] . "|" . $val['two_flavor_position'], 'class' => 'sub_item sub_item_name_' . $val['subcat_id']));
               }
               ?>
   <?php 
               echo qTranslate($val_addon['sub_item_name'], 'sub_item_name', $val_addon);
               ?>
 </div>
 <div class="uk-width-1-3">
   <?php 
               if ($val['multi_option'] == "multiple") {
                   ?>
   
   <?php 
                   $qty_selected = 1;
                   if (array_key_exists($subcat_id, (array) $item_data['addon_qty'])) {
                       $qty_selected = $item_data['addon_qty'][$subcat_id][$x];
                   }
                   ?>
   
   <div class="quantity-wrap quantity-wrap-small" >
Exemplo n.º 4
0
    public function displayOrderHTML($data = '', $cart_item = '', $receipt = false, $new_order_id = '')
    {
        $item_array = '';
        $this->code = 2;
        $htm = '';
        $subtotal = 0;
        $mid = isset($data['merchant_id']) ? $data['merchant_id'] : '';
        if (empty($mid)) {
            $this->msg = Yii::t("default", "Merchant ID is empty");
            return;
        }
        Yii::app()->functions->data = "list";
        $food_item = Yii::app()->functions->getFoodItemLists($mid);
        $subcat_list = Yii::app()->functions->getAddOnLists($mid);
        //dump($cart_item);
        //dump($food_item);
        if (isset($cart_item)) {
            if (is_array($cart_item) && count($cart_item) >= 1) {
                $x = 0;
                foreach ($cart_item as $key => $val) {
                    $val['notes'] = isset($val['notes']) ? $val['notes'] : "";
                    $size_words = '';
                    $t = !empty($val['price']) ? explode("|", $val['price']) : '';
                    if (is_array($t) && count($t) >= 1) {
                        $val['price'] = $t[0];
                        $size_words = $t[1];
                    }
                    $price = cleanNumber(unPrettyPrice($val['price']));
                    if (!empty($val['discount'])) {
                        $val['discount'] = unPrettyPrice($val['discount']);
                        $price = $price - $val['discount'];
                    }
                    $qty = $val['qty'];
                    /** fixed addon qty */
                    $total_price = $val['qty'] * $price;
                    /** check if item is taxable*/
                    //dump($val);
                    $food_taxable = true;
                    if (isset($val['non_taxable'])) {
                        if ($val['non_taxable'] == 2) {
                            $food_taxable = false;
                        }
                    }
                    $subtotal = $subtotal + $total_price;
                    if ($food_taxable == false) {
                        $subtotal_non = $subtotal_non + $total_price;
                    }
                    /*$size_words='';
                    		if ( $price_size=explodeData($val['price'])){	    					
                    			if (isset($price_size[1])){
                    			    $size_words=$price_size[1];
                    			}
                    		}	*/
                    /** Translation */
                    $food_infos = '';
                    $size_info_trans = '';
                    $cooking_ref_trans = '';
                    if ($this->getOptionAdmin("enabled_multiple_translation") == 2) {
                        $food_info = $this->getFoodItem($val['item_id']);
                        $food_infos['item_name_trans'] = !empty($food_info['item_name_trans']) ? json_decode($food_info['item_name_trans'], true) : '';
                        if (!empty($size_words)) {
                            $size_info_trans = $this->getSizeTranslation($size_words, $mid);
                        }
                        if (!empty($val['cooking_ref'])) {
                            $cooking_ref_trans = $this->getCookingTranslation($val['cooking_ref'], $mid);
                        }
                    }
                    $htm .= '<div class="item-order-list item-row">';
                    $htm .= '<div class="a">' . $val['qty'] . '</div>';
                    $htm .= '<div class="b">' . qTranslate($food_item[$val['item_id']], 'item_name', $food_infos);
                    if (!empty($size_words)) {
                        $htm .= "(" . ucwords(qTranslate($size_words, 'size_name', $size_info_trans)) . ")";
                    }
                    // array value
                    $item_array[$key] = array('item_id' => $val['item_id'], 'item_name' => $food_item[$val['item_id']], 'size_words' => $size_words, 'qty' => $val['qty'], 'normal_price' => prettyFormat($val['price']), 'discounted_price' => $price, 'order_notes' => isset($val['notes']) ? $val['notes'] : '', 'cooking_ref' => isset($val['cooking_ref']) ? $val['cooking_ref'] : '', 'ingredients' => isset($val['ingredients']) ? $val['ingredients'] : '', 'non_taxable' => isset($val['non_taxable']) ? $val['non_taxable'] : 1);
                    $htm .= Widgets::displaySpicyIconByID($val['item_id']);
                    if (!empty($val['discount'])) {
                        $htm .= "<p class=\"uk-text-small\">" . "<span class=\"normal-price\">" . displayPrice(baseCurrency(), prettyFormat($val['price'])) . " </span>" . "<span class=\"sale-price\">" . displayPrice(baseCurrency(), prettyFormat($price)) . "</span>" . "</p>";
                    } else {
                        $htm .= "<p class=\"uk-text-small\">" . "<span class=\"base-price\">" . displayPrice(baseCurrency(), prettyFormat($val['price'])) . "</span>" . "</p>";
                    }
                    if (!empty($val['cooking_ref'])) {
                        $htm .= "<p class=\"uk-text-small\">" . qTranslate($val['cooking_ref'], 'cooking_name', $cooking_ref_trans) . "</p>";
                    }
                    if (!empty($val['notes'])) {
                        $htm .= "<p class=\"uk-text-small\">" . $val['notes'] . "</p>";
                    }
                    /*ingredients*/
                    if (isset($val['ingredients'])) {
                        if (!empty($val['ingredients'])) {
                            if (is_array($val['ingredients']) && count($val['ingredients']) >= 1) {
                                $htm .= "<p class=\"uk-text-small ingredients-label\">" . t("Ingredients") . ":</p>";
                                foreach ($val['ingredients'] as $val_ingred) {
                                    $htm .= "<p class=\"uk-text-small\">" . $val_ingred . "</p>";
                                }
                            }
                        }
                    }
                    $htm .= '</div>';
                    $htm .= '<div class="manage">';
                    $htm .= '<div class="c">';
                    if ($receipt == false) {
                        $htm .= '<a href="javascript:;" class="edit_item" data-row="' . $key . '" rel="' . $val['item_id'] . '" >
			                        <i class="fa fa-pencil-square-o"></i>
			                     </a>';
                        $htm .= '<a href="javascript:;" class="delete_item" data-row="' . $key . '" rel="' . $val['item_id'] . '" >
			                       <i class="fa fa-trash-o"></i>
			                    </a>';
                    }
                    $htm .= '</div>';
                    $htm .= '<div class="d">' . displayPrice(baseCurrency(), prettyFormat($total_price, $mid)) . '</div>';
                    $htm .= '</div>';
                    $htm .= '<div class="clear"></div>';
                    /*SUB ITEM*/
                    //dump($val);
                    //$item_array[$key]['sub_item']=$val['sub_item'];
                    $val['sub_item'] = isset($val['sub_item']) ? $val['sub_item'] : '';
                    if (is_array($val['sub_item']) && count($val['sub_item']) >= 1) {
                        foreach ($val['sub_item'] as $cat_id => $val_sub) {
                            if (array_key_exists($cat_id, (array) $subcat_list)) {
                                //** Translation */
                                $subcategory_trans = '';
                                if ($this->getOptionAdmin("enabled_multiple_translation") == 2) {
                                    if ($subcategory_tran = $this->getAddonCategory($cat_id)) {
                                        $subcategory_trans['subcategory_name_trans'] = !empty($subcategory_tran['subcategory_name_trans']) ? json_decode($subcategory_tran['subcategory_name_trans'], true) : '';
                                    }
                                }
                                $htm .= '<div class="a"></div>';
                                $htm .= '<div class="b uk-text-success">' . ucwords(qTranslate($subcat_list[$cat_id], 'subcategory_name', $subcategory_trans)) . '</div>';
                                $htm .= '<div class="clear"></div>';
                            }
                            $addon_qty = 1;
                            foreach ($val_sub as $addon_row => $val_subs) {
                                if (isset($val['addon_qty'][$cat_id])) {
                                    $addon_qty = $val['addon_qty'][$cat_id][$addon_row];
                                } else {
                                    $addon_qty = $addon_qty * $qty;
                                    /** fixed addon qty */
                                    /*if ( in_array($val['item_id'],(array)$added_item)){
                                    	    $addon_qty=0;
                                    	 }*/
                                }
                                $val_subs = explodeData($val_subs);
                                //dump($val_subs);
                                $addon_raw_price = prettyFormat($val_subs[1]);
                                $addon_item_price = unPrettyPrice($val_subs[1]);
                                $addon_item_price = $addon_qty * $addon_item_price;
                                /** two flavor */
                                if ($val['two_flavors'] == 2) {
                                    if ($val_subs[3] == "") {
                                        $subtotal += $addon_item_price;
                                        if ($food_taxable == false) {
                                            $subtotal_non += $addon_item_price;
                                        }
                                    }
                                } else {
                                    /** check if item is taxable*/
                                    $subtotal += $addon_item_price;
                                    if ($food_taxable == false) {
                                        $subtotal_non += $addon_item_price;
                                    }
                                }
                                $item_array[$key]['sub_item'][] = array('addon_name' => $val_subs[2], 'addon_category' => $subcat_list[$cat_id], 'addon_qty' => $addon_qty, 'addon_price' => unPrettyPrice($val_subs[1]));
                                /**translation */
                                $addon_name_trans = '';
                                if ($this->getOptionAdmin("enabled_multiple_translation") == 2) {
                                    $addon_name_trans = $this->getAddonTranslation($val_subs[2], $mid);
                                }
                                $htm .= '<div class="a">' . $addon_qty . 'x</div>';
                                $htm .= '<div class="b uk-text-muted">' . "{$addon_raw_price} " . ucwords(qTranslate($val_subs[2], 'sub_item_name', $addon_name_trans)) . '</div>';
                                $htm .= '<div class="manage">';
                                if ($addon_item_price != 0) {
                                    $htm .= '<div class="d">' . displayPrice(baseCurrency(), prettyFormat($addon_item_price)) . '</div>';
                                } else {
                                    $htm .= '<div class="d">-</div>';
                                }
                                $htm .= '</div>';
                                $htm .= '<div class="clear"></div>';
                            }
                        }
                    }
                    $htm .= '</div>';
                    $x++;
                    $added_item[] = $val['item_id'];
                    /** fixed addon qty */
                }
                $taxable_subtotal = 0;
                $tax_amt = 0;
                $tax = Yii::app()->functions->getOption('merchant_tax', $mid);
                //dump($tax);
                /*if transaction is pickup*/
                /*if ($data['delivery_type']=="pickup"){
                			$tax=0;
                		}*/
                $tax_amt = $tax;
                $delivery_charges = Yii::app()->functions->getOption('merchant_delivery_charges', $mid);
                //shipping rates
                if (isset($_SESSION['shipping_fee'])) {
                    if (is_numeric($_SESSION['shipping_fee'])) {
                        $delivery_charges = $_SESSION['shipping_fee'];
                    }
                }
                //if (isset($data['delivery_charge']) && $data['delivery_charge']>=1){
                if (isset($data['delivery_charge'])) {
                    $delivery_charges = $data['delivery_charge'];
                }
                //end shipping rates
                $merchant_packaging_charge = Yii::app()->functions->getOption('merchant_packaging_charge', $mid);
                //fixed packaging charge
                if (isset($data['packaging'])) {
                    if ($data['packaging'] > 0) {
                        $merchant_packaging_charge = $data['packaging'];
                    }
                }
                if (!empty($delivery_charges)) {
                    $delivery_charges = unPrettyPrice($delivery_charges);
                } else {
                    $delivery_charges = 0;
                }
                /*if transaction is pickup*/
                //dump($data);
                if ($data['delivery_type'] == "pickup") {
                    $delivery_charges = 0;
                }
                /*VOUCHER*/
                $has_voucher = false;
                $less_voucher = 0;
                $voucher_type = "";
                if (isset($_SESSION['voucher_code'])) {
                    if (is_array($_SESSION['voucher_code'])) {
                        $has_voucher = true;
                        //dump($_SESSION['voucher_code']);
                        $_SESSION['voucher_code']['amount'] = unPrettyPrice($_SESSION['voucher_code']['amount']);
                        if ($_SESSION['voucher_code']['voucher_type'] == "fixed amount") {
                            $less_voucher = $_SESSION['voucher_code']['amount'];
                        } else {
                            $less_voucher = $subtotal * ($_SESSION['voucher_code']['amount'] / 100);
                            $voucher_type = normalPrettyPrice($_SESSION['voucher_code']['amount']) . "%";
                        }
                        $_SESSION['less_voucher'] = $less_voucher;
                    }
                }
                if ($receipt == TRUE) {
                    $order_ids = isset($data['order_id']) ? $data['order_id'] : '';
                    if (isset($_GET['id'])) {
                        $order_ids = $_GET['id'];
                    }
                    $order_infos = $this->getOrderInfo($order_ids);
                    //dump($order_infos);
                    if (!empty($order_infos['voucher_code'])) {
                        $has_voucher = true;
                        if ($order_infos['voucher_type'] == "fixed amount") {
                            $less_voucher = $order_infos['voucher_amount'];
                        } else {
                            $voucher_type = normalPrettyPrice((int) $order_infos['voucher_amount']) . "%";
                            $less_voucher = $subtotal * ($order_infos['voucher_amount'] / 100);
                        }
                    }
                }
                if ($less_voucher == TRUE) {
                    $subtotal = $subtotal - $less_voucher;
                    /** check if item is taxable*/
                    if ($food_taxable == false) {
                        $subtotal_non = $subtotal_non - $less_voucher;
                    }
                }
                /*PROMO STARTS HERE*/
                $show_discount = false;
                $discounted_amount = 0;
                $merchant_discount_amount = 0;
                if ($receipt == TRUE) {
                    $_GET['id'] = isset($_GET['id']) ? $_GET['id'] : $new_order_id;
                    if ($promo_res = $this->getOrderDiscount($_GET['id'])) {
                        if ($promo_res['discounted_amount'] >= 0.1) {
                            $show_discount = true;
                            $merchant_discount_amount = number_format($promo_res['discount_percentage'], 0);
                            $discounted_amount = $promo_res['discounted_amount'];
                            $subtotal = $subtotal - $discounted_amount;
                            /** check if item is taxable*/
                            if ($food_taxable == false) {
                                $subtotal_non = $subtotal_non - $discounted_amount;
                            }
                        }
                    }
                } else {
                    if ($promo_res = Yii::app()->functions->getMerchantOffersActive($mid)) {
                        $merchant_spend_amount = $promo_res['offer_price'];
                        $merchant_discount_amount = number_format($promo_res['offer_percentage'], 0);
                        if ($subtotal >= $merchant_spend_amount) {
                            $show_discount = true;
                            $merchant_discount_amount1 = $merchant_discount_amount / 100;
                            $discounted_amount = $subtotal * $merchant_discount_amount1;
                            $subtotal = $subtotal - $discounted_amount;
                            /** check if item is taxable*/
                            if ($food_taxable == false) {
                                $subtotal_non = $subtotal_non - $discounted_amount;
                            }
                        }
                    }
                }
                /**above sub total free delivery*/
                $free_delivery = false;
                if ($data['delivery_type'] == "delivery") {
                    $free_delivery_above_price = Yii::app()->functions->getOption("free_delivery_above_price", $mid);
                    if (!empty($free_delivery_above_price)) {
                        if ($subtotal >= $free_delivery_above_price) {
                            $delivery_charges = 0;
                            $free_delivery = true;
                        }
                    }
                }
                /**above sub total free delivery*/
                /** packaging incremental*/
                if (Yii::app()->functions->getOption("merchant_packaging_increment", $mid) == 2) {
                    if (!isset($data['packaging'])) {
                        $total_cart_item = 0;
                        foreach ($cart_item as $cart_item_x) {
                            $total_cart_item += $cart_item_x['qty'];
                        }
                        $merchant_packaging_charge = $total_cart_item * $merchant_packaging_charge;
                    }
                }
                if (!empty($tax)) {
                    $tax = $tax / 100;
                    /** check if item is taxable*/
                    $temp_delivery_charges = $delivery_charges;
                    if (Yii::app()->functions->getOption("merchant_tax_charges", $merchant_id) == 2) {
                        $temp_delivery_charges = 0;
                    }
                    if ($receipt == true) {
                        if (isset($data['donot_apply_tax_delivery'])) {
                            if ($data['donot_apply_tax_delivery'] == 2) {
                                $temp_delivery_charges = 0;
                            }
                        }
                    }
                    if ($subtotal_non >= 1) {
                        $temp_subtotal = $subtotal - $subtotal_non;
                        $taxable_subtotal = ($temp_subtotal + $temp_delivery_charges + $merchant_packaging_charge) * $tax;
                    } else {
                        $taxable_subtotal = ($subtotal + $delivery_charges + $merchant_packaging_charge) * $tax;
                    }
                    /*dump($subtotal);
                    		dump($subtotal_non);
                    		dump("taxable_subtotal=>".$taxable_subtotal);*/
                }
                $total = $subtotal + $taxable_subtotal + $delivery_charges + $merchant_packaging_charge;
                $htm .= '<div class="summary-wrap">';
                if ($has_voucher == TRUE) {
                    if ($show_discount == true) {
                        $htm .= '<div class="a">' . t("Discount") . " {$merchant_discount_amount}%" . ':</div>';
                        $htm .= '<div class="manage manage-ux">';
                        $htm .= '<div class="b">(' . displayPrice(baseCurrency(), prettyFormat($discounted_amount, $mid)) . ')</div>';
                        $htm .= '</div>';
                    }
                    /*$cart_subtotal_raw=$subtotal+$less_voucher;
                      $htm.="<span class=\"cart_subtotal_raw\" data-value=\"$cart_subtotal_raw\" ></span>";*/
                    $htm .= '<div class="a">' . Yii::t("default", "Sub Total") . ':</div>';
                    $htm .= '<div class="manage">';
                    $htm .= '<div class="b cart_subtotal">' . displayPrice(baseCurrency(), prettyFormat($subtotal + $less_voucher, $mid)) . '</div>';
                    $htm .= '</div>';
                    if ($receipt == TRUE) {
                        $voucher_code = " - " . $order_infos['voucher_code'] . "";
                    } else {
                        $voucher_code = '';
                    }
                    $htm .= '<div class="a">' . Yii::t("default", "Less Voucher") . " " . $voucher_type . ':</div>';
                    $htm .= '<div class="manage">';
                    $htm .= '<div class="b">-' . displayPrice(baseCurrency(), prettyFormat($less_voucher, $mid)) . '</div>';
                    $htm .= '</div>';
                    $htm .= '<div class="a">' . Yii::t("default", "Sub Total") . ':</div>';
                    $htm .= '<div class="manage">';
                    $htm .= '<div class="b">' . displayPrice(baseCurrency(), prettyFormat($subtotal, $mid)) . '</div>';
                    $htm .= '</div>';
                } else {
                    if ($show_discount == true) {
                        $htm .= '<div class="a">' . t("Discount") . " {$merchant_discount_amount}%" . ':</div>';
                        $htm .= '<div class="manage manage-ux">';
                        $htm .= '<div class="b">(' . displayPrice(baseCurrency(), prettyFormat($discounted_amount, $mid)) . ')</div>';
                        $htm .= '</div>';
                    }
                    /*$cart_subtotal_raw=$subtotal;
                      $htm.="<span class=\"cart_subtotal_raw\" data-value=\"$cart_subtotal_raw\" ></span>";*/
                    $htm .= '<div class="a">' . Yii::t("default", "Sub Total") . ':</div>';
                    $htm .= '<div class="manage">';
                    $htm .= '<div class="b cart_subtotal">' . displayPrice(baseCurrency(), prettyFormat($subtotal, $mid)) . '</div>';
                    $htm .= '</div>';
                }
                if (!empty($delivery_charges)) {
                    $htm .= '<div class="a">' . Yii::t("default", "Delivery Fee") . ':</div>';
                    $htm .= '<div class="manage">';
                    $htm .= '<div class="b">' . displayPrice(baseCurrency(), prettyFormat($delivery_charges, $mid)) . '</div>';
                    $htm .= '</div>';
                }
                if ($free_delivery == true) {
                    $htm .= '<div class="a">' . Yii::t("default", "Delivery Fee") . ':</div>';
                    $htm .= '<div class="manage">';
                    $htm .= '<div class="b">' . t("Free") . '</div>';
                    $htm .= '</div>';
                }
                if (!empty($merchant_packaging_charge)) {
                    $htm .= '<div class="a">' . Yii::t("default", "Packaging") . ':</div>';
                    $htm .= '<div class="manage">';
                    $htm .= '<div class="b">' . displayPrice(baseCurrency(), prettyFormat($merchant_packaging_charge, $mid)) . '</div>';
                    $htm .= '</div>';
                }
                if (!empty($tax)) {
                    $htm .= '<div class="a">' . Yii::t("default", "Tax") . ' ' . $tax_amt . '% :</div>';
                    $htm .= '<div class="manage">';
                    $htm .= '<div class="b">' . displayPrice(baseCurrency(), prettyFormat($taxable_subtotal, $mid)) . '</div>';
                    $htm .= '</div>';
                }
                if (isset($data['cart_tip_value'])) {
                    if ($data['cart_tip_value'] >= 0.1) {
                        $htm .= '<div class="a">' . Yii::t("default", "Tips") . ' ' . number_format($data['cart_tip_percentage'], 0) . '% :</div>';
                        $htm .= '<div class="manage">';
                        $htm .= '<div class="b">' . displayPrice(baseCurrency(), prettyFormat($data['cart_tip_value'], $mid)) . '</div>';
                        $htm .= '</div>';
                        $total += $data['cart_tip_value'];
                    }
                }
                if (isset($data['card_fee'])) {
                    if ($data['card_fee'] >= 0.1) {
                        $htm .= '<div class="a">' . Yii::t("default", "Card Fee") . ':</div>';
                        $htm .= '<div class="manage">';
                        $htm .= '<div class="b">' . displayPrice(baseCurrency(), prettyFormat($data['card_fee'], $mid)) . '</div>';
                        $htm .= '</div>';
                        $total += $data['card_fee'];
                    }
                }
                $htm .= '<div class="a bold cart_total_wrap">' . Yii::t("default", "Total") . ':</div>';
                $htm .= '<div class="manage">';
                $htm .= '<div class="b bold cart_total">' . displayPrice(baseCurrency(), prettyFormat($total, $mid)) . '</div>';
                $htm .= '</div>';
                $htm .= '<div class="clear"></div>';
                $htm .= '</div>';
                $htm .= CHtml::hiddenField("subtotal_order", unPrettyPrice($subtotal + $less_voucher));
                $htm .= CHtml::hiddenField("subtotal_order2", unPrettyPrice($subtotal));
                $htm .= CHtml::hiddenField("subtotal_extra_charge", unPrettyPrice($delivery_charges + $merchant_packaging_charge + $taxable_subtotal));
                // array value
                $item_array_total = array('subtotal' => $subtotal, 'taxable_total' => $taxable_subtotal, 'delivery_charges' => $delivery_charges, 'total' => $total, 'tax' => $tax, 'tax_amt' => $tax_amt, 'curr' => baseCurrency(), 'mid' => $mid, 'discounted_amount' => $discounted_amount, 'merchant_discount_amount' => $merchant_discount_amount, 'merchant_packaging_charge' => $merchant_packaging_charge);
                /*dump($data);
                  dump($htm);*/
                $this->code = 1;
                $this->msg = "OK";
                $this->details = array('item-count' => $x, 'html' => $htm, 'raw' => array('item' => $item_array, 'total' => $item_array_total));
            } else {
                $this->msg = Yii::t("default", "No Item added yet!");
            }
        } else {
            $this->msg = Yii::t("default", "No Item added yet!");
        }
    }