Esempio n. 1
0
 public function setDefaultUserCurrency()
 {
     $currency_id = $this->input->get('currency_id', 0, 'int');
     $response = array('errors' => 0);
     if (!KSMPrice::setDefaultUserCurrency($currency_id)) {
         $response['errors']++;
     }
     JFactory::getApplication()->close(json_encode($response, true));
 }
Esempio n. 2
0
 public function getInput()
 {
     $db = JFactory::getDbo();
     $query = $db->getQuery(true);
     $query->select($db->qn(array('c.id', 'c.title'), array('value', 'text')))->from($db->qn('#__ksenmart_currencies', 'c'));
     $db->setQuery($query);
     $currencies = $db->loadObjectList();
     if (!$this->value) {
         $this->value = KSMPrice::_getDefaultCurrency();
     }
     return JHTML::_('select.genericlist', $currencies, $this->name, array('class' => 'sel', 'id' => $this->name, 'style' => 'width:40px;'), 'value', 'text', $this->value);
 }
Esempio n. 3
0
 function onAfterExecuteKSMOrdersGetorder($model, $order = null)
 {
     if (empty($order)) {
         return;
     }
     $discount_value = 0;
     foreach ($order->items as $item) {
         if (isset($item->discounts)) {
             foreach ($item->discounts as $discount_id => $discount) {
                 $discount_value += $discount->discount_value;
             }
         }
     }
     $order->costs['discount_cost'] = $discount_value;
     $order->costs['discount_cost_val'] = KSMPrice::showPriceWithTransform($order->costs['discount_cost']);
     $order->costs['total_cost'] -= $order->costs['discount_cost'];
     if ($order->costs['total_cost'] < 0) {
         $order->costs['total_cost'] = 0;
     }
     $order->costs['total_cost_val'] = KSMPrice::showPriceWithTransform($order->costs['total_cost']);
     return;
 }
Esempio n. 4
0
 public static function getOrder($oid)
 {
     self::onExecuteBefore(array(&$oid));
     if (!empty($oid)) {
         $db = JFactory::getDBO();
         $query = $db->getQuery(true);
         $query->select('
                 o.id,
                 o.cost,
                 o.discounts,
                 o.user_id,
                 o.region_id,
                 o.shipping_id,
                 o.shipping_coords,
                 o.customer_fields,
                 o.address_fields, 
                 o.payment_id,
                 o.note,
                 o.status_id,
                 o.date_add,
                 os.title AS status_name
             ')->from('#__ksenmart_orders AS o')->leftjoin('#__ksenmart_order_statuses AS os ON o.status_id=os.id')->where('o.id=' . $db->escape($oid));
         $db->setQuery($query);
         $order = $db->loadObject();
         self::setUserInfoField2Order($order);
         $query = $db->getQuery(true);
         $query->select('*')->from('#__ksenmart_order_items')->where('order_id=' . $oid);
         $db->setQuery($query);
         $order->items = $db->loadObjectList();
         $order->costs = array('cost' => KSMPrice::getPriceInDefaultCurrency($order->cost), 'cost_val' => KSMPrice::showPriceWithTransform($order->cost), 'discount_cost' => 0, 'discount_cost_val' => KSMPrice::showPriceWithTransform(0), 'shipping_cost' => 0, 'shipping_cost_val' => KSMPrice::showPriceWithTransform(0), 'total_cost' => KSMPrice::getPriceInDefaultCurrency($order->cost), 'total_cost_val' => KSMPrice::showPriceWithTransform($order->cost));
         $dispatcher = JDispatcher::getInstance();
         $dispatcher->trigger('onAfterGetOrder', array(&$order));
         self::onExecuteAfter(array(&$order));
         return $order;
     }
     return new stdClass();
 }
Esempio n. 5
0
        ?>
                    <?php 
    }
    ?>
    			</td>
			<td align="center"><?php 
    echo $item->count;
    ?>
</td>
			<td align="center"><?php 
    echo KSMPrice::showPriceWithTransform($item->price);
    ?>
</td>
			<td align="center" nowrap="nowrap">
				<?php 
    echo KSMPrice::showPriceWithTransform($item->count * $item->price);
    ?>
			</td>
		</tr>
    <?php 
}
?>
	<tr>
		<td id="cart_total_label">
			<?php 
echo JText::_('KSM_ORDER_MAIL_PRODUCTS_SUM');
?>
		</td>
		<td align="center">
		</td>
		<td></td>
		<div class="img">
			<img src="<?php 
echo $this->item->img;
?>
">
		</div>
		<div class="descr">
			<a class="product_title"><?php 
echo $this->item->title;
?>
</a>
		</div>
	</td>
	<td class="price">
		<span><?php 
echo KSMPrice::showPriceWithoutTransform($this->item->price, $this->item->price_type);
?>
</span>
	</td>
	<td class="storage">
		<span><?php 
echo $this->item->in_stock;
?>
</span>
	</td>
	<td class="storage">
		<span><?php 
echo $this->item->favorites;
?>
</span>
	</td>
Esempio n. 7
0
    } else {
        ?>
			  <dt><?php 
        echo $item_property->title;
        ?>
</dt>
			  <dd></dd>
			<?php 
    }
    ?>
		<?php 
}
?>
		</dl>
	</div>
</td>
<td class="quantt">
	<?php 
echo $this->order_item->count;
?>
</td>
<td class="pricee">
	<?php 
echo $this->order_item->product->val_price;
?>
</td>
<td class="totall">
	<?php 
echo KSMPrice::showPriceWithTransform($this->order_item->price * $this->order_item->count);
?>
</td>
Esempio n. 8
0
 function get_transform_price()
 {
     $price = JRequest::getVar('price', 0);
     echo KSMPrice::showPriceWithTransform($price);
 }
Esempio n. 9
0
 /**
  * KsenMartModelProfile::getOrders()
  * 
  * @return
  */
 public function getOrders()
 {
     $this->onExecuteBefore('getOrders');
     $user = JFactory::getUser();
     $query = $this->_db->getQuery(true);
     $query->select('
             o.id, 
             o.cost
         ')->from('#__ksenmart_orders AS o')->where('o.user_id=' . $user->id)->order('o.date_add DESC');
     $this->_db->setQuery($query);
     $orders = $this->_db->loadObjectList();
     for ($k = 0; $k < count($orders); $k++) {
         $orders[$k] = $this->getOrder($orders[$k]->id);
         $orders[$k]->cost_val = KSMPrice::showPriceWithTransform($orders[$k]->cost);
     }
     $this->onExecuteAfter('getOrders', array(&$orders));
     return $orders;
 }
Esempio n. 10
0
    echo JText::_('ksm_catalog_add_to_set');
    ?>
</a>
				<?php 
}
?>
			</p>
		</div>
	</td>
	<td class="price changeble">
		<span><?php 
echo KSMPrice::showPriceWithoutTransform($this->item->price, $this->item->price_type);
?>
</span>
		<p><?php 
echo KSMPrice::showPriceWithoutTransform('<input type="text" name="items[' . $this->item->id . '][price]" class="inputbox" value="' . $this->item->price . '">', $this->item->price_type);
?>
</p>
	</td>
	<td class="storage changeble">
		<span><?php 
echo $this->item->in_stock;
?>
</span>
		<p><input type="text" class="inputbox" name="items[<?php 
echo $this->item->id;
?>
][in_stock]" value="<?php 
echo $this->item->in_stock;
?>
"></p>
	<td class="order_name name">
		<div class="img">
			<img class="min_img" rel="<?php 
echo $this->item->id;
?>
" src="<?php 
echo $this->item->user->small_img;
?>
" title="<?php 
echo $this->item->user->name;
?>
">
		</div>
		<?php 
echo $this->item->customer_info;
?>
	</td>
	<td class="order_cost" align="center"><?php 
echo KSMPrice::showPriceWithTransform($this->item->cost);
?>
</td>
	<td class="order_date" align="center"><?php 
echo KSFunctions::formatDate($this->item->date_add);
?>
</td>
	<td class="order_status" align="center"><?php 
echo $this->item->status_name;
?>
</td>
</tr>
Esempio n. 12
0
 public static function sendOrderIndoAdmin($order_id)
 {
     $dispatcher = JDispatcher::getInstance();
     $db = JFactory::getDBO();
     $Itemid = KSSystem::getShopItemid();
     $query = "select * from #__ksenmart_orders where id='{$order_id}'";
     $db->setQuery($query);
     $order = $db->loadObject();
     $content = '';
     $content .= '
         <table class="cellpadding">
             <tr>
                 <td colspan="2">Информация</td>
             </tr>
             <tr>
                 <td>Имя:</td>
                 <td>' . $order->name . '</td>
             </tr>                           
             <tr>
                 <td>E-mail:</td>
                 <td>' . $order->email . '</td>
             </tr>
             <tr>
                 <td>Адрес доставки:</td>
                 <td>' . $order->address . '</td>
             </tr>
         </table>    
         <h2>Заказ</h2>
         <table id="cart_content_tbl" cellspacing="0">
             <colgroup>
                 <col width="50%" />
                 <col width="15%" />
                 <col width="20%" />
                 <col width="5%" />
             </colgroup>
             <tr id="cart_content_header">
                 <td><b>Продукт</b></td>
                 <td align="center"><b>Кол-во</b></td>
                 <td align="center"><b>Цена</b></td>
                 <td align="center"><b>Стоимость</b></td>
             </tr>
     ';
     $query = "select * from #__ksenmart_order_items where order_id='{$order_id}'";
     $db->setQuery($query);
     $order->items = $db->loadObjectList();
     foreach ($order->items as &$item) {
         $item_properties = array();
         $properties = explode(';', $item->properties);
         foreach ($properties as $property) {
             $property = explode(':', $property);
             $query = "select * from #__ksenmart_properties where id='{$property['0']}'";
             $this->_db->setQuery($query);
             $prop = $this->_db->loadObject();
             if (count($prop) > 0) {
                 $item_properties[] = new stdClass();
                 $item_properties[count($item_properties) - 1]->title = $prop->title;
                 if ($prop->type == 'select' || $prop->type == 'radio') {
                     $query = "select * from #__ksenmart_property_values where id='{$property['1']}'";
                     $this->_db->setQuery($query);
                     $val = $this->_db->loadObject();
                     if (count($val) > 0) {
                         $item_properties[count($item_properties) - 1]->value = $val->title . ' ' . $prop->finishing;
                     }
                 }
             }
         }
         $query = "select * from #__ksenmart_products where id='{$item->product_id}'";
         $db->setQuery($query);
         $item->product = $db->loadObject();
         $link = JURI::root() . JRoute::_('index.php?option=com_ksenmart&view=product&id=' . $item->product->id . ":" . $item->product->alias . '&Itemid=' . $Itemid);
         $content .= '        
         <tr class="row_odd">
             <td class="vid_produkt">
                 <a class="title_lookp" href="' . $link . '" >' . $item->product->title . '</a>
         ';
         if ($item->product->product_code != '') {
             $content .= ' <i>Арт. ' . $item->product->product_code . '</i>';
         }
         foreach ($item_properties as $item_property) {
             if (!empty($item_property->value)) {
                 $content .= '<br><span>' . $item_property->title . ':</span> ' . $item_property->value;
             } else {
                 $content .= '<br><span>' . $item_property->title . '</span>';
             }
         }
         $content .= '                            
                 <div class="cart_product_brief_description">
                     <p>' . $item->product->introcontent . '</p>
                 </div>
             </td>
             <td align="center">' . $item->count . '</td>
             <td align="center">' . KSMPrice::showPriceWithTransform($item->price) . '</td>
             <td align="center" nowrap="nowrap">
                 ' . KSMPrice::showPriceWithTransform($item->count * $item->price) . '
             </td>
         </tr>';
     }
     $order->total_cost = $order->cost;
     $dispatcher->trigger('onAfterGetOrder', array(&$order));
     $results = $dispatcher->trigger('onDisplayAfterLetterContent', array(&$order));
     $order->onDisplayAfterLetterContent = trim(implode("\n", $results));
     $content .= '
         <tr>
             <td id="cart_total_label">
                 Общая стоимость товаров
             </td>
             <td align="center"></td>
             <td></td>
             <td id="cart_total" align="center">' . KSMPrice::showPriceWithTransform($order->cost) . '</td>
         </tr>
     ';
     $content .= $order->onDisplayAfterLetterContent;
     $content .= '            
         <tr>
             <td id="cart_total_label">
                 Стоимость доставки:
             </td>
             <td align="center">
             </td>
             <td></td>
             <td id="cart_total" align="center">' . KSMPrice::showPriceWithTransform($order->delivery_cost) . '</td>
         </tr>
         <tr>
             <td id="cart_total_label">
                 Итого
             </td>
             <td align="center"></td>
             <td></td>
             <td id="cart_total" align="center">' . KSMPrice::showPriceWithTransform($order->total_cost + $order->delivery_cost) . '</td>
         </tr>
     </table>';
     $mail =& JFactory::getMailer();
     $mail->isHTML(true);
     $params = JComponentHelper::getParams('com_ksenmart');
     $sender = array($params->get('shop_email'), $params->get('shop_name'));
     $mail->setSender($sender);
     $mail->Subject = 'Новый заказ №' . $order_id;
     $mail->Body = $content;
     $mail->AddAddress($params->get('shop_email'), $params->get('shop_name'));
     $mail->Send();
 }
Esempio n. 13
0
 function getUserOrders($user_id)
 {
     $this->onExecuteBefore('getUserOrders', array(&$user_id));
     $query = $this->_db->getQuery(true);
     $query->select('*')->from('#__ksenmart_orders')->where('user_id=' . $user_id)->order('date_add desc');
     $this->_db->setQuery($query);
     $orders = $this->_db->loadObjectList();
     foreach ($orders as &$order) {
         $order->cost_val = KSMPrice::showPriceWithTransform($order->cost);
         $order->date = date('d.m.Y', strtotime($order->date_add));
         $order->status_name = '';
         $query = $this->_db->getQuery(true);
         $query->select('*')->from('#__ksenmart_order_statuses')->where('id=' . $order->status_id);
         $this->_db->setQuery($query);
         $status = $this->_db->loadObject();
         if (!empty($status)) {
             $order->status_name = $status->system ? JText::_('ksm_orders_' . $status->title) : $status->title;
         }
     }
     $this->onExecuteAfter('getUserOrders', array(&$orders));
     return $orders;
 }
Esempio n. 14
0
 public function onAfterExecuteHelperKSMOrdersGetOrder($order = null)
 {
     if (empty($order)) {
         return;
     }
     if (empty($order->shipping_id)) {
         return;
     }
     $db = JFactory::getDBO();
     $query = $db->getQuery(true);
     $query->select('id,params,regions')->from('#__ksenmart_shippings')->where('id=' . $order->shipping_id)->where('type=' . $db->quote($this->_name))->where('published=1');
     $db->setQuery($query);
     $shipping = $db->loadObject();
     if (empty($shipping)) {
         return;
     }
     if (empty($order->region_id)) {
         return;
     }
     if (!$this->checkRegion($shipping->regions, $order->region_id)) {
         return;
     }
     $shipping->params = json_decode($shipping->params, true);
     if (!isset($shipping->params[$order->region_id])) {
         return;
     }
     $order->costs['shipping_cost'] = $shipping->params[$order->region_id];
     $order->costs['shipping_cost_val'] = KSMPrice::showPriceWithTransform($order->costs['shipping_cost']);
     $order->costs['total_cost'] += $order->costs['shipping_cost'];
     $order->costs['total_cost_val'] = KSMPrice::showPriceWithTransform($order->costs['total_cost']);
     return;
 }
Esempio n. 15
0
</td>
		<td class="b_left b_top rightAlign nobr"><?php 
    echo KSMPrice::showPriceWithoutTransform($item->price * $item->count * (100 - $this->params->get('printforms_nds')) / 100);
    ?>
</td>
		<td class="b_left b_top rightAlign">0,00</td>
		<td class="b_left b_top rightAlign"><?php 
    echo $this->params->get('printforms_nds');
    ?>
%</td>
		<td class="b_left b_top rightAlign"><?php 
    echo KSMPrice::showPriceWithoutTransform($item->price * $item->count * $this->params->get('printforms_nds') / 100);
    ?>
</td>
		<td class="b_left b_top rightAlign nobr"><?php 
    echo KSMPrice::showPriceWithoutTransform($item->price * $item->count);
    ?>
</td>
		<td class="b_left b_top inline_edit">&nbsp;</td>
		<td class="b_left b_top inline_edit">&nbsp;</td>
		<td class="b_top b_left b_right inline_edit">&nbsp;</td>
	</tr>
	<?php 
    $total_count += $item->count;
    ?>
	<?php 
    $k++;
    ?>
	<?php 
}
?>
Esempio n. 16
0
 public static function getPriceWithProperties($product_id, $properties = array(), $price = null)
 {
     $db = JFactory::getDBO();
     if (empty($price)) {
         $product = KSSystem::loadDbItem($product_id, 'products');
         $price = KSMPrice::getPriceInCurrentCurrency($product->price, $product->price_type);
     }
     foreach ($properties as $property_id => $values) {
         $query = $db->getQuery(true);
         $query->select('edit_price')->from('#__ksenmart_properties');
         $query->where('id=' . $property_id);
         $db->setQuery($query);
         $edit_price = $db->loadResult();
         if ($edit_price == 1) {
             foreach ($values as $value_id) {
                 $query = $db->getQuery(true);
                 $query->select('price')->from('#__ksenmart_product_properties_values');
                 $query->where('property_id=' . $property_id)->where('value_id=' . $value_id)->where('product_id=' . $product_id);
                 $db->setQuery($query);
                 $under_price = $db->loadResult();
                 if ($under_price && !empty($under_price)) {
                     $under_price_act = substr($under_price, 0, 1);
                     switch ($under_price_act) {
                         case '+':
                             $price += substr($under_price, 1, strlen($under_price) - 1);
                             break;
                         case '-':
                             $price -= substr($under_price, 1, strlen($under_price) - 1);
                             break;
                         case '/':
                             $price = $price / substr($under_price, 1, strlen($under_price) - 1);
                             break;
                         case '*':
                             $price = $price * substr($under_price, 1, strlen($under_price) - 1);
                             break;
                         default:
                             $price += $under_price;
                     }
                 }
             }
         }
     }
     return $price;
 }
Esempio n. 17
0
 function getOrder($vars = array())
 {
     $this->onExecuteBefore('getOrder', array(&$value));
     $id = JRequest::getInt('id');
     $order = KSSystem::loadDbItem($id, 'orders');
     if (isset($vars['user_id'])) {
         $order->user_id = $vars['user_id'];
     }
     if (isset($vars['region_id'])) {
         $order->region_id = $vars['region_id'];
     }
     if (isset($vars['shipping_id'])) {
         $order->shipping_id = $vars['shipping_id'];
     }
     if (isset($vars['payment_id'])) {
         $order->payment_id = $vars['payment_id'];
     }
     $order->cost = 0;
     $order->discounts = property_exists($order, 'discounts') ? $order->discounts : '[]';
     $order->customer_fields = json_decode($order->customer_fields, true);
     $order->address_fields = json_decode($order->address_fields, true);
     if (!isset($vars['items'])) {
         $query = $this->_db->getQuery(true);
         $query->select('*')->from('#__ksenmart_order_items')->where('order_id=' . $id);
         $this->_db->setQuery($query);
         $order->items = $this->_db->loadObjectList();
     } else {
         $items = array();
         if (count($vars['items']) == 1 && !is_array($vars['items'][0])) {
             $vars['items'] = array();
         }
         foreach ($vars['items'] as $item) {
             $item['properties'] = isset($item['properties']) ? $item['properties'] : array();
             $item = (object) $item;
             $item->price = KSMProducts::getPriceWithProperties($item->product_id, $item->properties, $item->basic_price);
             $item->properties = json_encode($item->properties);
             $items[] = $item;
         }
         $order->items = $items;
     }
     foreach ($order->items as &$item) {
         $query = $this->_db->getQuery(true);
         $query->select('p.*')->from('#__ksenmart_products as p')->where('p.id=' . $item->product_id);
         $query = KSMedia::setItemMainImageToQuery($query);
         $this->_db->setQuery($query);
         $product = $this->_db->loadObject();
         if (count($product)) {
             $item->title = $product->title;
             $item->alias = $product->alias;
             $item->product_code = $product->product_code;
             $item->product_packaging = $product->product_packaging;
             $item->properties = json_decode($item->properties, true);
             $query = $this->_db->getQuery(true);
             $query->select('kp.*')->from('#__ksenmart_properties as kp')->innerjoin('#__ksenmart_product_properties_values as kppv on kp.id=kppv.property_id')->where('kppv.product_id=' . $item->product_id)->where('kp.type=' . $this->_db->quote('select'))->order('kp.ordering')->group('kp.id');
             $this->_db->setQuery($query);
             $properties = $this->_db->loadObjectList('id');
             foreach ($properties as &$property) {
                 $query = $this->_db->getQuery(true);
                 $query->select('kpv.*')->from('#__ksenmart_property_values as kpv')->innerjoin('#__ksenmart_product_properties_values as kppv on kpv.id=kppv.value_id')->where('kppv.product_id=' . $item->product_id)->where('kpv.property_id=' . $property->id)->order('kpv.ordering')->group('kpv.id');
                 $this->_db->setQuery($query);
                 $property->values = $this->_db->loadObjectList('id');
                 foreach ($property->values as $value) {
                     if (isset($item->properties[$property->id]) && is_array($item->properties[$property->id]) && in_array($value->id, $item->properties[$property->id])) {
                         $value->selected = true;
                     } else {
                         $value->selected = false;
                     }
                 }
             }
             $item->properties = $properties;
             $item->small_img = KSMedia::resizeImage($product->filename, 'products', $this->params->get('admin_product_medium_image_width', 36), $this->params->get('admin_product_medium_image_heigth', 36), json_decode($product->params, true));
         } else {
             $item->title = JText::_('ksm_orders_order_deleteditem_title');
             $item->alias = '';
             $item->product_code = '';
             $item->product_packaging = 1;
             $item->properties = array();
             $item->small_img = KSMedia::resizeImage('', 'products', $this->params->get('admin_product_medium_image_width', 36), $this->params->get('admin_product_medium_image_heigth', 36));
         }
         $item->val_price = KSMPrice::showPriceWithTransform($item->price);
         $item->val_total_price = KSMPrice::showPriceWithTransform($item->price * $item->count);
         $order->cost += $item->price * $item->count;
     }
     $order->costs = array('cost' => $order->cost, 'cost_val' => KSMPrice::showPriceWithTransform($order->cost), 'discount_cost' => 0, 'discount_cost_val' => KSMPrice::showPriceWithTransform(0), 'shipping_cost' => 0, 'shipping_cost_val' => KSMPrice::showPriceWithTransform(0), 'total_cost' => $order->cost, 'total_cost_val' => KSMPrice::showPriceWithTransform($order->cost));
     $this->onExecuteAfter('getOrder', array(&$order));
     return $order;
 }
Esempio n. 18
0
 public function getCart()
 {
     $this->onExecuteBefore('getCart');
     $Itemid = KSSystem::getShopItemid();
     if (!empty($this->order_id)) {
         $cart = KSMOrders::getOrder($this->order_id);
         $this->setDefaultCartValues($cart);
         $cart->items = KSMOrders::getOrderItems($this->order_id);
         for ($k = 0; $k < count($cart->items); $k++) {
             $cart->items[$k]->del_link = JRoute::_('index.php?option=com_ksenmart&view=cart&task=cart.update_cart&item_id=' . $cart->items[$k]->id . '&count=0&Itemid=' . $Itemid);
             $cart->total_prds += $cart->items[$k]->count;
             $cart->products_sum += $cart->items[$k]->count * $cart->items[$k]->price;
         }
     } else {
         $this->setDefaultCartValues($cart);
     }
     $cart->products_sum_val = KSMPrice::showPriceWithTransform($cart->products_sum);
     $cart->total_sum = $cart->products_sum;
     $cart->total_sum_val = KSMPrice::showPriceWithTransform($cart->total_sum);
     $this->onExecuteAfter('getCart', array(&$cart));
     return $cart;
 }
Esempio n. 19
0
		<div class="lists">
			<div class="row-fluid">	
				<ul>
					<?php 
if (count($currencies) > 0) {
    ?>
					<?php 
    foreach ($currencies as $currency) {
        ?>
					<li>
						<label>
							<?php 
        echo KSMPrice::showPriceWithoutTransform(1);
        ?>
 = <?php 
        echo KSMPrice::showPriceWithoutTransform('<input type="text" name="items[' . $currency->id . '][rate]" class="inputbox" value="' . $currency->rate . '">', $currency->id);
        ?>
						</label>
						<input type="hidden" name="items[<?php 
        echo $currency->id;
        ?>
][id]" value="<?php 
        echo $currency->id;
        ?>
">
					</li>
					<?php 
    }
    ?>
					<?php 
} else {
Esempio n. 20
0
</a>
	</div>
</div>	
<div class="total_info" style="margin-top:-50px;margin-bottom:10px;float:left">
	<span class="grey-span"><b><?php 
echo JText::_('ksm_reports_orders_count_orders');
?>
</b></span> - <?php 
echo $this->total;
?>
	<br>
	<span class="grey-span"><b><?php 
echo JText::_('ksm_reports_orders_total_price');
?>
</b></span> - <?php 
echo KSMPrice::showPriceWithoutTransform($this->total_cost);
?>
	<br>
</div>
<table class="cat" width="100%" cellspacing="0">	
	<thead>
		<tr>
			<th class="order_number"><span class="sort_field" rel="id">№</span></th>
			<th class="order_name stretch" align="left"><span class="sort_field" rel="name"><?php 
echo JText::_('ksm_reports_order_user_name');
?>
</span></th>
			<th class="order_cost"><span class="sort_field" rel="cost"><?php 
echo JText::_('ksm_reports_order_cost');
?>
</span></th>
Esempio n. 21
0
 function getOrders()
 {
     $this->onExecuteBefore('getOrders');
     $order_dir = $this->getState('order_dir');
     $order_type = $this->getState('order_type');
     $from_date = $this->getState('from_date');
     $to_date = $this->getState('to_date');
     $from_date = date('Y-m-d', strtotime($from_date)) . ' 00:00:00';
     $to_date = date('Y-m-d', strtotime($to_date)) . ' 23:59:59';
     $query = $this->_db->getQuery(true);
     $query->select('*')->from('#__ksenmart_orders')->where('date_add>' . $this->_db->quote($from_date))->where('date_add<' . $this->_db->quote($to_date));
     $this->_db->setQuery($query);
     $total_orders = $this->_db->loadObjectList();
     $this->total = count($total_orders);
     $total_cost = 0;
     for ($i = 0; $i < count($total_orders); $i++) {
         $total_cost += $total_orders[$i]->cost;
     }
     $query = $this->_db->getQuery(true);
     $query->select('o.*,(select title from #__ksenmart_order_statuses where id=o.status_id) as status_name')->from('#__ksenmart_orders as o')->where('o.date_add>' . $this->_db->quote($from_date))->where('o.date_add<' . $this->_db->quote($to_date))->order('o.' . $order_type . ' ' . $order_dir);
     $this->_db->setQuery($query, $this->getState('list.start'), $this->getState('list.limit'));
     $orders = $this->_db->loadObjectList();
     foreach ($orders as &$order) {
         $order->user = KSUsers::getUser($order->user_id);
         $order->cost_val = KSMPrice::showPriceWithTransform($order->cost);
         $order->date = date('d.m.Y', strtotime($order->date_add));
         $order->status_name = '';
         $order->customer_info = '';
         $query = $this->_db->getQuery(true);
         $query->select('*')->from('#__ksenmart_order_statuses')->where('id=' . $order->status_id);
         $this->_db->setQuery($query);
         $status = $this->_db->loadObject();
         if (!empty($status)) {
             $order->status_name = $status->system ? JText::_('ksm_orders_' . $status->title) : $status->title;
         }
         $order->customer_fields = json_decode($order->customer_fields, true);
         if (isset($order->customer_fields['lastname']) && !empty($order->customer_fields['lastname'])) {
             $order->customer_info .= $order->customer_fields['lastname'] . ' ';
         }
         if (isset($order->customer_fields['name']) && !empty($order->customer_fields['name'])) {
             $order->customer_info .= $order->customer_fields['name'] . ' ';
         }
         if (isset($order->customer_fields['surname']) && !empty($order->customer_fields['surname'])) {
             $order->customer_info .= $order->customer_fields['surname'];
         }
         if (isset($order->customer_fields['email']) && !empty($order->customer_fields['email'])) {
             $order->customer_info .= '<br>' . $order->customer_fields['email'];
         }
         if (isset($order->customer_fields['phone']) && !empty($order->customer_fields['phone'])) {
             $order->customer_info .= '<br>' . $order->customer_fields['phone'];
         }
         if (empty($order->customer_info)) {
             $order->customer_info = JText::_('ksm_orders_default_customer_info');
         }
     }
     $this->total_cost = $total_cost;
     $this->onExecuteAfter('getOrders', array(&$orders));
     return $orders;
 }
Esempio n. 22
0
 public function onAfterExecuteHelperKSMOrdersGetOrder($order = null)
 {
     if (empty($order)) {
         return;
     }
     if (empty($order->shipping_id)) {
         return;
     }
     $app = JFactory::getApplication();
     $db = JFactory::getDBO();
     $query = $db->getQuery(true);
     $query->select('id,params,regions')->from('#__ksenmart_shippings')->where('id=' . $order->shipping_id)->where('type=' . $db->quote($this->_name))->where('published=1');
     $db->setQuery($query);
     $shipping = $db->loadObject();
     if (empty($shipping)) {
         return;
     }
     if (empty($order->region_id)) {
         return;
     }
     if (!$this->checkRegion($shipping->regions, $order->region_id)) {
         return;
     }
     $shipping->params = json_decode($shipping->params, true);
     $distance = (int) $app->getUserStateFromRequest('com_ksenmart.distance', 'distance', 0);
     $order->costs['shipping_cost'] = $shipping->params['city'] + $shipping->params['area'] * $distance;
     $order->costs['shipping_cost_val'] = KSMPrice::showPriceWithTransform($order->costs['shipping_cost']);
     $order->costs['total_cost'] += $order->costs['shipping_cost'];
     $order->costs['total_cost_val'] = KSMPrice::showPriceWithTransform($order->costs['total_cost']);
     return;
 }
Esempio n. 23
0
		<td class="b_left b_bottom rightAlign"><?php 
echo $total_count;
?>
</td>
		<td class="b_left b_bottom normalFont">X</td>
		<td class="b_left b_bottom rightAlign nobr"><?php 
echo KSMPrice::showPriceWithoutTransform($this->order->cost * (100 - $this->params->get('printforms_nds')) / 100);
?>
</td>
		<td class="b_left b_bottom normalFont">X</td>
		<td class="b_left b_bottom rightAlign"><?php 
echo KSMPrice::showPriceWithoutTransform($this->order->cost * $this->params->get('printforms_nds') / 100);
?>
</td>
		<td class="b_left b_bottom b_right rightAlign nobr"><?php 
echo KSMPrice::showPriceWithoutTransform($this->order->cost);
?>
</td>
	</tr>
</table>

<table width="100%" border="0" cellpadding=0 cellspacing=0
	class="mainTable">
	<tr>
		<td class=separatorCell>&nbsp;</td>
	</tr>
</table>

<table width="100%" border="0" cellpadding=0 cellspacing=0
	class="mainTable">
	<tr>
Esempio n. 24
0
        ?>
"><img src="<?php 
        echo $product->small_img;
        ?>
" alt="<?php 
        echo $product->title;
        ?>
" width="32px" height="32px" /></a>
                </div>
                <div class="title span9">
                    <a href="<?php 
        echo $link;
        ?>
" title="<?php 
        echo $product->title;
        ?>
"><?php 
        echo $product->title;
        ?>
</a>
                </div>
                <div class="price span2 pull-right"><?php 
        echo KSMPrice::showPriceWithTransform($product->price);
        ?>
</div>
            </div>
     <?php 
    }
} else {
    echo $this->loadTemplate('no_products', 'default');
}
Esempio n. 25
0
</div>
	</div>
	<div class="col3">
		<div class="quants">
			<span class="minus"></span>
			<input name="jform[items][-<?php 
echo $this->item->id;
?>
][count]" class="inputbox pos-count" value="<?php 
echo $this->item->product_packaging;
?>
">
			<span class="plus"></span>
		</div>
		<div class="total"><?php 
echo JText::_('ksm_orders_order_item_total_price') . KSMPrice::showPriceWithTransform($this->item->val_price_wou * $this->item->product_packaging);
?>
</div>
	</div>
	<a class="del" href="#"></a>
	<input type="hidden" class="product_packaging" value="<?php 
echo $this->item->product_packaging;
?>
">
	<input type="hidden" name="jform[items][-<?php 
echo $this->item->id;
?>
][basic_price]" class="pos-prd-basic-price" value="<?php 
echo $this->item->val_price_wou;
?>
">