Ejemplo n.º 1
0
        ?>
 : <?php 
        echo DigiComSiteHelperPrice::getProductValidityPeriod($product);
        ?>
</small>
					</div>
					<?php 
    }
    ?>
				</td>
				<td><?php 
    echo ucfirst($product->package_type);
    ?>
</td>
				<td><?php 
    echo DigiComSiteHelperDigiCom::format_price($product->price, $configs->get('currency', 'USD'), true, $configs);
    ?>
</td>
			</tr>
			<?php 
}
?>
		</tbody>
	</table>


	<a href="<?php 
echo JRoute::_("index.php?option=com_digicom&view=downloads");
?>
" class="btn btn-success">
		<i class="icon-out"></i><?php 
Ejemplo n.º 2
0
    public function getOrderItems($order_id)
    {
        $configs = $this->configs;
        $customer = new DigiComSiteHelperSession();
        $db = JFactory::getDbo();
        $sql = 'SELECT `p`.*, `od`.quantity FROM
					`#__digicom_products` AS `p`
						INNER JOIN
					`#__digicom_orders_details` AS `od` ON (`od`.`productid` = `p`.`id`)
				WHERE `orderid` =' . $order_id;
        $db->setQuery($sql);
        $items = $db->loadObjectList();
        //change the price of items if needed
        for ($i = 0; $i < count($items); $i++) {
            $item =& $items[$i];
            $item->discount = 0;
            $item->currency = $configs->get('currency', 'USD');
            $item->price = DigiComSiteHelperDigiCom::format_price($item->price, $item->currency, false, $configs);
            //sprintf( $price_format, $item->product_price );
            $item->subtotal = DigiComSiteHelperDigiCom::format_price($item->price, $item->currency, false, $configs);
            //sprintf( $price_format, $item->subtotal );
            $item->price_formated = DigiComSiteHelperDigiCom::format_price2($item->price, $item->currency, false, $configs);
            //sprintf( $price_format, $item->product_price );
            $item->subtotal_formated = DigiComSiteHelperDigiCom::format_price2($item->subtotal, $item->currency, false, $configs);
            //sprintf( $price_format, $item->subtotal );
            $item->subtotal = $item->price * $item->quantity;
        }
        return $items;
    }
Ejemplo n.º 3
0
								<?php 
    }
    ?>

								<tr>
							   		<td style="font-weight:bold;text-align: right;" width="70%"><?php 
    echo JText::_("COM_DIGICOM_TOTAL");
    ?>
</td>
									<?php 
    if ($order->amount_paid != "" && $order->amount_paid != "-1" && $order->amount_paid != $total) {
        $total = $order->amount_paid;
    }
    ?>
									<td style="text-align: right;"><span style="white-space:nowrap;font-weight: bold;font-size: 18px;"><?php 
    echo DigiComSiteHelperDigiCom::format_price($total, $prod->currency, true, $configs);
    ?>
</span></td>
								</tr>

							</tbody>
						</table>

						<input type="hidden" name="option" value="com_digicom" />
						<input type="hidden" name="task" value="" />
						<input type="hidden" name="boxchecked" value="0" />
						<input type="hidden" name="controller" value="Orders" />
					</form>
					<?php 
}
?>
Ejemplo n.º 4
0
echo JText::_('PLG_DIGICOM_PAY_OFFLINE_ORDER_INFORMATION_LABEL');
?>
</label>
			<div class="controls">	<?php 
echo JText::sprintf('PLG_DIGICOM_PAY_OFFLINE_ORDER_INFO', $vars->custom_name);
?>
</div>
		</div>

		<div class="control-group">
			<label for="cardlname" class="control-label"><?php 
echo JText::_('PLG_DIGICOM_PAY_OFFLINE_PAYABLE_AMOUNT');
?>
</label>
			<div class="controls"><span class="label label-success"><?php 
echo DigiComSiteHelperDigiCom::format_price($vars->amount, $configs->get('currency', 'USD'), true, $configs);
?>
</span></div>
		</div>
	
		<div class="control-group">
			<label for="cardlname" class="control-label"><?php 
echo JText::_('PLG_DIGICOM_PAY_OFFLINE_COMMENT');
?>
</label>
			<div class="controls"><textarea id='comment' name='comment' class="inputbox required" rows='3' maxlength='135' size='28'></textarea></div>
		</div>

		<div class="control-group">
			<label for="cardaddress1" class="control-label"><?php 
echo JText::_('PLG_DIGICOM_PAY_OFFLINE_AFTER_PAYMENT_CONTACT_LABEL');
Ejemplo n.º 5
0
 function calc_price(&$items, $cust_info, $configs)
 {
     if (isset($items[-1]) && $items[-1] == "PayProcessed") {
         return $items[-2];
     }
     $db = JFactory::getDBO();
     $user = JFactory::getUser();
     if (is_object($cust_info)) {
         $sid = $cust_info->_sid;
     }
     if (is_array($cust_info)) {
         $sid = $cust_info['sid'];
     }
     $customer = $cust_info;
     if (null != $configs->get('totaldigits', '')) {
         $configs = $this->getInstance("Config", "digicomModel");
         $configs = $configs->getConfigs();
     }
     if (isset($cust_info->_customer) && !isset($cust_info->_customer->country)) {
         $cust_info->_customer->country = '';
     }
     if (isset($cust_info->_customer) && !isset($cust_info->_customer->state)) {
         $cust_info->_customer->state = '';
     }
     $pay_flag = false;
     $can_promo = true;
     $payprocess = array();
     $total = 0;
     $price_format = '%' . $configs->get('totaldigits', '') . '.' . $configs->get('decimaldigits', '2') . 'f';
     //$payprocess['licenses'] = 0;
     $payprocess['number_of_products'] = 0;
     $payprocess['shipping'] = 0;
     $payprocess['currency'] = $configs->get('currency', 'USD');
     //print_r($items);die;
     foreach ($items as $item) {
         //debug($item);
         $total += $item->subtotal;
         $payprocess['currency'] = $item->currency;
         $payprocess['number_of_products'] += $item->quantity;
         $shipping = 0;
     }
     $payprocess['payable_amount'] = $total;
     $promo = $this->get_promo($cust_info);
     if ($promo->id > 0) {
         $promoid = $promo->id;
         $promocode = $promo->code;
     } else {
         $promoid = '0';
         $promocode = '';
     }
     $promo_applied = -1;
     //no need for promo
     $payprocess['promo'] = 0;
     $payprocess['promo_order'] = 0;
     if ($promo->id > 0 && $can_promo) {
         //valid promocode was provided
         $payprocess['promoaftertax'] = $promo->aftertax;
         if ($promo->codelimit <= $promo->used && $promo->codelimit > 0) {
             //nothing to do now
         } else {
             if ($promo->aftertax == '0') {
                 //promo discount should be applied before taxation
                 $promo_applied = 1;
                 //all discounts are applied
                 $restricted_order = (int) $this->havePreviousOrderOfProduct($promo);
                 // If there are restrictions must check line per line in the products
                 if (count($promo->products) || count($promo->orders)) {
                     $payprocess['promo_order'] = 0;
                     foreach ($items as $item) {
                         $restricted_product = (int) $this->isRestrictedProduct($item, $promo->products);
                         $have_discount = 0;
                         $item->discount = 0;
                         if ($restricted_order && count($promo->orders) && $restricted_product && count($promo->products)) {
                             $have_discount = 1;
                         }
                         if ($restricted_product && count($promo->products) && count($promo->orders) == 0) {
                             $have_discount = 1;
                         }
                         if ($restricted_order && count($promo->orders) && count($promo->products) == 0) {
                             $have_discount = 1;
                         }
                         if (count($promo->products) == 0 && count($promo->orders) == 0) {
                             $have_discount = 1;
                         }
                         if ($have_discount) {
                             if ($promo->promotype == '0') {
                                 // Use absolute values
                                 $total -= $promo->amount;
                                 $payprocess['promo'] += $promo->amount;
                                 $item->discount += $promo->amount;
                                 $payprocess['discount_calculated'] = 1;
                             } else {
                                 // Use percentage
                                 $total -= $item->price * $promo->amount / 100;
                                 $payprocess['promo'] += $item->price * $promo->amount / 100;
                                 $item->discount = $item->price * $promo->amount / 100;
                                 $payprocess['discount_calculated'] = 1;
                             }
                         }
                     }
                 } else {
                     if ($promo->promotype == '0') {
                         //use absolute values
                         $total -= $promo->amount;
                         $payprocess['promo'] += $promo->amount;
                         $payprocess['promo_order'] = 1;
                     } else {
                         //use percentage
                         $payprocess['promo'] += $promo->amount * $total / 100;
                         $total -= $promo->amount * $total / 100;
                         $payprocess['promo_order'] = 1;
                     }
                 }
             } else {
                 //promo discount should be applied after tax
                 $promo_applied = 0;
                 //we should apply promo later
                 //nothing to do here - tax is not calculated yet
             }
         }
     }
     //final price calculations
     $tmp_customer = $customer;
     if (is_object($customer) && isset($customer->_customer) && !empty($customer->_customer)) {
         $tmp_customer = $customer->_customer;
     }
     if (is_array($customer)) {
         $tmp_customer = $customer;
     }
     $customer = $tmp_customer;
     //final calculations end here
     if (!isset($payprocess['value'])) {
         $payprocess['value'] = 0;
     }
     $sum_tax = $total + $payprocess['value'];
     //$vat_tax + $state_tax;//total tax
     //now lets apply promo discounts if there are any
     if ($promo_applied == 0) {
         if ($promo->promotype == '0') {
             //use absolute values
             $sum_tax -= $promo->amount;
             $payprocess['promo'] = $promo->amount;
         } else {
             //use percentage
             $payprocess['promo'] = $sum_tax * $promo->amount / 100;
             $sum_tax *= 1 - $promo->amount / 100;
         }
     }
     // Fixed PromoCode > Total Price
     if ($sum_tax < 0) {
         $sum_tax = 0;
     }
     $payprocess['promo_error'] = !$user->id && isset($promo->orders) && count($promo->orders) ? JText::_("DIGI_PROMO_LOGIN") : '';
     $payprocess['total'] = $total;
     $payprocess['taxed'] = $payprocess['shipping'] + $sum_tax;
     $payprocess['discount_calculated'] = isset($payprocess['discount_calculated']) ? $payprocess['discount_calculated'] : 0;
     $payprocess['shipping'] = DigiComSiteHelperDigiCom::format_price($payprocess['shipping'], $payprocess['currency'], false, $configs);
     //sprintf($price_format, $payprocess['shipping']);
     $payprocess['taxed'] = DigiComSiteHelperDigiCom::format_price($payprocess['taxed'], $payprocess['currency'], false, $configs);
     //sprintf($price_format, $payprocess['taxed']);//." ".$payprocess['currency'];
     $payprocess['type'] = 'TAX';
     $this->_tax = $payprocess;
     if (count($items) > 0) {
         $items[-1] = "PayProcessed";
         $items[-2] = $payprocess;
     }
     return $payprocess;
 }
Ejemplo n.º 6
0
    }
    ?>

			<tr>
				<td colspan="<?php 
    echo $discount ? '4' : '3';
    ?>
" valign="top" class="item_column_right" nowrap >
					<?php 
    echo JText::_("COM_DIGICOM_TOTAL");
    ?>
<br />
				</td>
				<td class="item_column_right" nowrap style="text-align:center; padding-top:10px;">
					<span class="label label-success"><?php 
    echo DigiComSiteHelperDigiCom::format_price($tax['taxed'], $tax['currency'], true, $configs);
    ?>
</span>
				</td>
			</tr>

			<tr>
				<td colspan="<?php 
    echo $discount ? '4' : '3';
    ?>
"><?php 
    echo JText::_("COM_DIGICOM_PAYMENT_METHOD");
    ?>
</td>
				<td style="text-align:center;"><span class="label label-info"><?php 
    echo ucfirst($processor);
Ejemplo n.º 7
0
 function getCartItem()
 {
     $cid = JRequest::getVar('cid', -1);
     $qty = JRequest::getVar('quantity' . $cid, 1);
     $db = JFactory::getDBO();
     if ($cid > 0) {
         $cart = $this->_model;
         $customer = $this->_customer;
         $configs = $this->_config;
         $sid = $this->_customer->_sid;
         $sql = "UPDATE #__digicom_cart SET quantity = " . $qty . " where cid=" . $cid;
         // sid = " . $sid . " and
         $db->setQuery($sql);
         $db->query();
         // get product id
         $sql = "select item_id from #__digicom_cart where cid = " . $cid . " and sid = " . $sid;
         $db->setQuery($sql);
         $pid = (int) $db->loadResult();
         $items = $cart->getCartItems($customer, $configs);
         $result = array();
         foreach ($items as $key => $item) {
             if ($key < 0) {
                 continue;
             }
             if ($item->cid == $cid) {
                 $result['cid'] = $cid;
                 $result['cart_item_qty' . $cid] = $item->quantity;
                 $result['cart_item_price' . $cid] = DigiComSiteHelperDigiCom::format_price($item->price, $item->currency, true, $configs);
                 $result['cart_item_discount' . $cid] = DigiComSiteHelperDigiCom::format_price($item->discount, $item->currency, true, $configs);
                 $result['cart_item_total' . $cid] = DigiComSiteHelperDigiCom::format_price($item->subtotal - $item->discount, $item->currency, true, $configs);
             }
         }
         //print_r($items);die;
         $total = DigiComSiteHelperDigiCom::format_price($items[-2]['taxed'], $items[-2]['currency'], true, $configs);
         $result['cart_total'] = $total;
         //"{$items[-2]['taxed']}";
         $cart = $this->_model;
         $cart_tax = $cart->calc_price($items, $customer, $configs);
         $result['cart_discount'] = DigiComSiteHelperDigiCom::format_price($cart_tax["promo"], $items[-2]['currency'], true, $configs);
         $result['cart_tax'] = DigiComSiteHelperDigiCom::format_price($cart_tax["value"], $items[-2]['currency'], true, $configs);
         echo json_encode($result);
     } else {
         echo json_encode(array());
     }
     exit;
 }
Ejemplo n.º 8
0
            $labelClass = 'label-success';
        } elseif (strtolower($order->status) === 'pending') {
            $labelClass = 'label-warning';
        }
        ?>
							<span class="label <?php 
        echo $labelClass;
        ?>
"><?php 
        echo $order->status;
        ?>
</span>
						</td>
						<td>
							<?php 
        echo DigiComSiteHelperDigiCom::format_price($order->amount, $order->currency, true, $configs);
        ?>
						</td>
						<td>
							<?php 
        echo $order_price;
        ?>
						</td>
						<td>
							<?php 
        echo $order_link . ' ' . $rec_link;
        ?>
						</td>
					</tr>
					<?php 
        $i++;