diff --git a/.gitignore b/.gitignore index 6d0851c9..40ffdd9b 100644 --- a/.gitignore +++ b/.gitignore @@ -66,3 +66,4 @@ selenium.log *.lock .phpintel package-lock.json +npm-shrinkwrap.json \ No newline at end of file diff --git a/src/com_digicom/admin/access.xml b/src/com_digicom/admin/access.xml index 24a00dad..6ee11123 100644 --- a/src/com_digicom/admin/access.xml +++ b/src/com_digicom/admin/access.xml @@ -7,6 +7,7 @@ + diff --git a/src/com_digicom/admin/helpers/digicom.php b/src/com_digicom/admin/helpers/digicom.php index 38750add..88259775 100644 --- a/src/com_digicom/admin/helpers/digicom.php +++ b/src/com_digicom/admin/helpers/digicom.php @@ -110,7 +110,7 @@ public static function renderSidebar(){ } - public static function format_price ($amount, $ccode, $add_sym = true, $configs, $decial = null) + public static function format_price ($amount, $ccode, bool $add_sym = true, $configs, $decial = null) { if($decial === NULL){ $decial = $configs->get('decimaldigits','2'); diff --git a/src/com_digicom/admin/language/en-GB/en-GB.com_digicom.ini b/src/com_digicom/admin/language/en-GB/en-GB.com_digicom.ini index 85c8c8cb..6e648d54 100644 --- a/src/com_digicom/admin/language/en-GB/en-GB.com_digicom.ini +++ b/src/com_digicom/admin/language/en-GB/en-GB.com_digicom.ini @@ -213,6 +213,8 @@ COM_DIGICOM_N_PRODUCTS_DUPLICATED = "%d items successfully duplicated." COM_DIGICOM_N_ITEMS_CHECKED_IN="%d Products successfully checked in." COM_DIGICOM_PRODUCTS_VALIDITY = "Validity" +COM_DIGICOM_PRODUCTS_TOOLBAR_ADD_VIDEO_PRODUCT = "Single Video" +COM_DIGICOM_PRODUCTS_TOOLBAR_ADD_VIDEO_PRODUCT_TIP = "Add single product is Video" ;-------------------------------------------- ; PRODUCT - New/Edit View ;-------------------------------------------- @@ -350,6 +352,8 @@ COM_DIGICOM_ORDERS_TYPE = "Purchase Type" COM_DIGICOM_ORDER_TYPE_FREE = "Free" COM_DIGICOM_ORDER_TYPE_PURCHASED = "Purchase" +COM_DIGICOM_ORDERS_SEARCH_NOTICE = "Quick Search Tips: Example: email:me@domain.com. Usable codes:
id: and write id of customer
user: and write username or full name of customer
email: and write email of customer
processor: and write payment processor name
promocode: and write promocode name. Then hit search" + ;-------------------------------------------- ; ORDER - Details View ;-------------------------------------------- @@ -447,6 +451,8 @@ COM_DIGICOM_ABOUT_LICENSES_USE_VIDEO = "Licenses video guide" COM_DIGICOM_LICENSE_EDIT = "Edit License" COM_DIGICOM_LICENSE_SEARCH_HINTS="Search by type:
1. License ID : Only Number
2. Customer : user:Id or user:Name
3. ID : id:Number" +COM_DIGICOM_LICENSE_SEARCH_NOTICE = "Quick Search Tips: Example: email:me@domain.com. Usable codes:
id: and write id of customer
user: and write username or full name of customer
email: and write email of customer.
Then hit search" + ;-------------------------------------------- ; ABOUT PAGE ;-------------------------------------------- diff --git a/src/com_digicom/admin/language/en-GB/en-GB.com_digicom.sys.ini b/src/com_digicom/admin/language/en-GB/en-GB.com_digicom.sys.ini index 7eec2d25..f9e1d91e 100644 --- a/src/com_digicom/admin/language/en-GB/en-GB.com_digicom.sys.ini +++ b/src/com_digicom/admin/language/en-GB/en-GB.com_digicom.sys.ini @@ -111,6 +111,9 @@ JGLOBAL_PRODUCT_ORDERING_DATE_DESC = "If products are ordered by date, which dat ;-------------------------------------------- ; Menu : Components > DigiCom ;-------------------------------------------- +COM_DIGICOM_ACCESS_DASHBOARD_TITLE = "Access Dashboard Interface" +COM_DIGICOM_ACCESS_DASHBOARD_DESC = "" + COM_DIGICOM_ACCESS_PRDUCTS_TITLE = "Access Products Interface" COM_DIGICOM_ACCESS_PRDUCTS_DESC = "" @@ -132,6 +135,14 @@ COM_DIGICOM_ACCESS_DISCOUNTS_DESC = "" COM_DIGICOM_ACCESS_REPORTS_TITLE = "Access Reports Interface" COM_DIGICOM_ACCESS_REPORTS_DESC = "" +;-------------------------------------------- +; Manager +;-------------------------------------------- + +COM_DIGICOM_MENU_ITEM_TYPE_MANAGER = "Manager Menu" +COM_DIGICOM_MENU_ITEM_TYPE_MANAGER_DESC = "Manager page to check orders, licenses from frontend." + + ;-------------------------------------------- ; Menu : Components > DigiCom ;-------------------------------------------- diff --git a/src/com_digicom/admin/layouts/edit/bundle.php b/src/com_digicom/admin/layouts/edit/bundle.php index d2adf59e..0248b5fc 100644 --- a/src/com_digicom/admin/layouts/edit/bundle.php +++ b/src/com_digicom/admin/layouts/edit/bundle.php @@ -50,7 +50,6 @@ function jRemveProduct(id){ jQuery(function ($) { jQuery('input[name=\"jform[bundle_source]\"]').on('change', function(){ var bundle_source = jQuery('#jform_bundle_source_option_select input:checked').val(); - jQuery(`.bundle_source_option:not(#bundle_source_` + bundle_source + `_option)`).hide(); jQuery(`#bundle_source_` + bundle_source + `_option`).show(); }); @@ -64,18 +63,17 @@ function jRemveProduct(id){ $bundle_source = $form_data->get('bundle_source'); ?> -
- +
+ +

renderField('bundle_source'); ?> +
- -
-
renderField('bundle_category'); ?>
diff --git a/src/com_digicom/admin/layouts/edit/files.php b/src/com_digicom/admin/layouts/edit/files.php index 46be1151..291f4a92 100644 --- a/src/com_digicom/admin/layouts/edit/files.php +++ b/src/com_digicom/admin/layouts/edit/files.php @@ -115,3 +115,8 @@
+ +trigger( 'onDigicomAdminAfterProductFiles', array()); +?> \ No newline at end of file diff --git a/src/com_digicom/admin/models/licenses.php b/src/com_digicom/admin/models/licenses.php index 8057f9d7..353d2a32 100644 --- a/src/com_digicom/admin/models/licenses.php +++ b/src/com_digicom/admin/models/licenses.php @@ -122,13 +122,17 @@ protected function getListQuery() ); $query->from($db->quoteName('#__digicom_licenses', 'a')); - // Join over the users + // Join over the customers $query->select($db->quoteName('dc.name', 'client')) ->join('LEFT', $db->quoteName('#__digicom_customers', 'dc') . ' ON dc.id = a.userid'); - // Join over the users + // Join over the products $query->select($db->quoteName('dp.name', 'productname')) ->join('LEFT', $db->quoteName('#__digicom_products', 'dp') . ' ON dp.id = a.productid'); + + // Join over the users + $query->select('ju.username') + ->join('LEFT', '#__users AS ju ON ju.id=a.userid'); // Filter by published state $published = $this->getState('filter.published'); @@ -155,17 +159,24 @@ protected function getListQuery() if (!empty($search)) { - if (stripos($search, 'user:') === 0) + if (stripos($search, 'id:') === 0){ + $query->where('dc.id = ' . (int) substr($search, 3)); + } + elseif (stripos($search, 'user:') === 0) { + $search = $db->quote('%' . $db->escape(substr($search, 5), true) . '%'); $query->where( - $db->quoteName('dc.id') . ' = ' . (int) substr($search, 5) - . ' OR ' . $db->quoteName('dc.name') . ' like "%' . substr($search, 5) . '%"' + . ' OR ' . + $db->quoteName('ju.username') . ' like "%' . substr($search, 5) . '%"' + . ' OR ' . + $db->quoteName('ju.name') . ' like "%' . substr($search, 5) . '%"' ); } - elseif (stripos($search, 'id:') === 0) + elseif (stripos($search, 'email:') === 0) { - $query->where($db->quoteName('a.id') . ' = ' . (int) substr($search, 3)); + $search = $db->quote('%' . $db->escape(substr($search, 6), true) . '%'); + $query->where('(dc.email LIKE ' . $search . ')'); } else { diff --git a/src/com_digicom/admin/models/orders.php b/src/com_digicom/admin/models/orders.php index f76ab981..fac3409d 100644 --- a/src/com_digicom/admin/models/orders.php +++ b/src/com_digicom/admin/models/orders.php @@ -181,7 +181,7 @@ protected function getListQuery() elseif (stripos($search, 'user:') === 0) { $search = $db->quote('%' . $db->escape(substr($search, 5), true) . '%'); - $query->where('(ju.username LIKE ' . $search . ' OR c.name LIKE ' . $search . ')'); + $query->where('(ju.username LIKE ' . $search . ' OR c.name LIKE ' . $search . ' OR ju.name LIKE ' . $search . ')'); } elseif (stripos($search, 'email:') === 0) { diff --git a/src/com_digicom/admin/views/categories/tmpl/default.php b/src/com_digicom/admin/views/categories/tmpl/default.php index edcf3078..ff0b1330 100644 --- a/src/com_digicom/admin/views/categories/tmpl/default.php +++ b/src/com_digicom/admin/views/categories/tmpl/default.php @@ -46,142 +46,144 @@ - - - - - - - - - assoc) : ?> - - - - - - - - items as $i => $item) : ?> - id, $this->ordering[$item->parent_id]); - $canEdit = $user->authorise('core.edit', $extension . '.category.' . $item->id); - $canCheckin = $user->authorise('core.admin', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0; - $canEditOwn = $user->authorise('core.edit.own', $extension . '.category.' . $item->id) && $item->created_user_id == $userId; - $canChange = $user->authorise('core.edit.state', $extension . '.category.' . $item->id) && $canCheckin; +
+
- - - - - - - - - - - - - state->get('list.direction'), $this->state->get('list.ordering')); ?> - - -
+ + + + + + + + assoc) : ?> + + + + + + + + items as $i => $item) : ?> + id, $this->ordering[$item->parent_id]); + $canEdit = $user->authorise('core.edit', $extension . '.category.' . $item->id); + $canCheckin = $user->authorise('core.admin', 'com_checkin') || $item->checked_out == $userId || $item->checked_out == 0; + $canEditOwn = $user->authorise('core.edit.own', $extension . '.category.' . $item->id) && $item->created_user_id == $userId; + $canChange = $user->authorise('core.edit.state', $extension . '.category.' . $item->id) && $canCheckin; - // Get the parents of item for sorting - if ($item->level > 1) - { - $parentsStr = ""; - $_currentParentId = $item->parent_id; - $parentsStr = " " . $_currentParentId; - for ($i2 = 0; $i2 < $item->level; $i2++) + // Get the parents of item for sorting + if ($item->level > 1) { - foreach ($this->ordering as $k => $v) + $parentsStr = ""; + $_currentParentId = $item->parent_id; + $parentsStr = " " . $_currentParentId; + for ($i2 = 0; $i2 < $item->level; $i2++) { - $v = implode("-", $v); - $v = "-" . $v . "-"; - if (strpos($v, "-" . $_currentParentId . "-") !== false) + foreach ($this->ordering as $k => $v) { - $parentsStr .= " " . $k; - $_currentParentId = $k; - break; + $v = implode("-", $v); + $v = "-" . $v . "-"; + if (strpos($v, "-" . $_currentParentId . "-") !== false) + { + $parentsStr .= " " . $k; + $_currentParentId = $k; + break; + } } } } - } - else - { - $parentsStr = ""; - } - ?> - - - - - + - - assoc) : ?> - + + + - - + assoc) : ?> + - - - - - -
+ + + + + + + + + + + + + state->get('list.direction'), $this->state->get('list.ordering')); ?> + + +
- - - - - - - - - id); ?> - - published, $i, 'categories.', $canChange); ?> - - —', $item->level - 1) ?> - checked_out) : ?> - editor, $item->checked_out_time, 'categories.', $canCheckin); ?> - - - - escape($item->title); ?> - - escape($item->title); ?> - - - note)) : ?> - escape($item->alias)); ?> - - escape($item->alias), $this->escape($item->note)); ?> + else + { + $parentsStr = ""; + } + ?> +
+ + + + + + - - - escape($item->access_level); ?> - - association): ?> - id, $extension); ?> + + id); ?> + + published, $i, 'categories.', $canChange); ?> + + —', $item->level - 1) ?> + checked_out) : ?> + editor, $item->checked_out_time, 'categories.', $canCheckin); ?> + + + + escape($item->title); ?> + + escape($item->title); ?> + + note)) : ?> + escape($item->alias)); ?> + + escape($item->alias), $this->escape($item->note)); ?> + + - language == '*') : ?> - - - language_title ? $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?> + + escape($item->access_level); ?> + + association): ?> + id, $extension); ?> + + - - id; ?> -
+ + language == '*') : ?> + + + language_title ? $this->escape($item->language_title) : JText::_('JUNDEFINED'); ?> + + + + + id; ?> + + + + + +
pagination->getListFooter(); ?>
diff --git a/src/com_digicom/admin/views/categories/view.html.php b/src/com_digicom/admin/views/categories/view.html.php index e31253b9..14ad03fb 100644 --- a/src/com_digicom/admin/views/categories/view.html.php +++ b/src/com_digicom/admin/views/categories/view.html.php @@ -33,6 +33,11 @@ class DigiComViewCategories extends JViewLegacy */ public function display($tpl = null) { + if (!JFactory::getUser()->authorise('core.categories', 'com_digicom')) + { + return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); + } + $this->state = $this->get('State'); $this->items = $this->get('Items'); $this->pagination = $this->get('Pagination'); diff --git a/src/com_digicom/admin/views/category/view.html.php b/src/com_digicom/admin/views/category/view.html.php index b25128e4..c941b741 100644 --- a/src/com_digicom/admin/views/category/view.html.php +++ b/src/com_digicom/admin/views/category/view.html.php @@ -33,6 +33,11 @@ class DigiComViewCategory extends JViewLegacy */ public function display($tpl = null) { + if (!JFactory::getUser()->authorise('core.categories', 'com_digicom')) + { + return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); + } + $this->form = $this->get('Form'); $this->item = $this->get('Item'); $this->state = $this->get('State'); diff --git a/src/com_digicom/admin/views/configs/view.html.php b/src/com_digicom/admin/views/configs/view.html.php index 45d5e5de..69871329 100644 --- a/src/com_digicom/admin/views/configs/view.html.php +++ b/src/com_digicom/admin/views/configs/view.html.php @@ -35,8 +35,9 @@ function display($tpl = null) return false; } - + // Bind the form to the data. + if ($form && $component->params) { $form->bind($component->params); diff --git a/src/com_digicom/admin/views/customer/view.html.php b/src/com_digicom/admin/views/customer/view.html.php index e7b692d4..0cdca107 100644 --- a/src/com_digicom/admin/views/customer/view.html.php +++ b/src/com_digicom/admin/views/customer/view.html.php @@ -15,6 +15,11 @@ class DigiComViewCustomer extends JViewLegacy { function display ($tpl = null ) { + if (!JFactory::getUser()->authorise('core.customers', 'com_digicom')) + { + return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); + } + $db = JFactory::getDBO(); $customer = $this->get('customer'); //print_r($customer);die; diff --git a/src/com_digicom/admin/views/customers/tmpl/default.php b/src/com_digicom/admin/views/customers/tmpl/default.php index c9740395..78390461 100644 --- a/src/com_digicom/admin/views/customers/tmpl/default.php +++ b/src/com_digicom/admin/views/customers/tmpl/default.php @@ -54,7 +54,7 @@ -
+
@@ -113,12 +113,13 @@
-
+ +
+ +
pagination->getListFooter(); ?>
-
- diff --git a/src/com_digicom/admin/views/customers/view.html.php b/src/com_digicom/admin/views/customers/view.html.php index 200d7c27..1f170ae0 100644 --- a/src/com_digicom/admin/views/customers/view.html.php +++ b/src/com_digicom/admin/views/customers/view.html.php @@ -18,7 +18,12 @@ class DigiComViewCustomers extends JViewLegacy { function display ($tpl = null ) { - + if (!JFactory::getUser()->authorise('core.customers', 'com_digicom')) + { + return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); + } + + $layout = JRequest::getVar('layout',''); if($layout){ $this->setLayout($layout); diff --git a/src/com_digicom/admin/views/digicom/view.html.php b/src/com_digicom/admin/views/digicom/view.html.php index 1392eeec..5c054441 100644 --- a/src/com_digicom/admin/views/digicom/view.html.php +++ b/src/com_digicom/admin/views/digicom/view.html.php @@ -31,6 +31,11 @@ class digicomViewdigicom extends JViewLegacy { */ function display ($tpl = null ) { + + if (!JFactory::getUser()->authorise('core.dashboard', 'com_digicom')) + { + return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); + } $this->latest_orders = DigiComHelperDigiCom::getOrders(5); $this->most_sold = DigiComHelperDigiCom::getMostSoldProducts(5); diff --git a/src/com_digicom/admin/views/discount/view.html.php b/src/com_digicom/admin/views/discount/view.html.php index 34ba7263..9e2f2241 100644 --- a/src/com_digicom/admin/views/discount/view.html.php +++ b/src/com_digicom/admin/views/discount/view.html.php @@ -19,7 +19,10 @@ class DigiComViewDiscount extends JViewLegacy function display( $tpl = null ) { - + if (!JFactory::getUser()->authorise('core.discounts', 'com_digicom')) + { + return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); + } $this->state = $this->get('State'); $this->item = $this->get('Item'); diff --git a/src/com_digicom/admin/views/discounts/tmpl/default.php b/src/com_digicom/admin/views/discounts/tmpl/default.php index 54995b53..af6597e6 100644 --- a/src/com_digicom/admin/views/discounts/tmpl/default.php +++ b/src/com_digicom/admin/views/discounts/tmpl/default.php @@ -79,7 +79,7 @@
-
+
@@ -199,10 +199,11 @@
-
+ +
+
pagination->getListFooter(); ?>
-
diff --git a/src/com_digicom/admin/views/discounts/view.html.php b/src/com_digicom/admin/views/discounts/view.html.php index e3a3ca77..862eea7e 100644 --- a/src/com_digicom/admin/views/discounts/view.html.php +++ b/src/com_digicom/admin/views/discounts/view.html.php @@ -14,7 +14,12 @@ class DigiComViewDiscounts extends JViewLegacy function display ($tpl = null ) { - + if (!JFactory::getUser()->authorise('core.discounts', 'com_digicom')) + { + return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); + } + + $condition = JRequest::getVar("condition", '1'); $this->assign ("condition", $condition); diff --git a/src/com_digicom/admin/views/filemanager/view.html.php b/src/com_digicom/admin/views/filemanager/view.html.php index e8d5baa5..d1260849 100644 --- a/src/com_digicom/admin/views/filemanager/view.html.php +++ b/src/com_digicom/admin/views/filemanager/view.html.php @@ -14,6 +14,11 @@ class DigiComViewFileManager extends JViewLegacy { function display($tpl = null){ + if (!JFactory::getUser()->authorise('core.filemanager', 'com_digicom')) + { + return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); + } + JToolBarHelper::title(JText::_('COM_DIGICOM_FILE_MANAGER_TOOLBAR_TITLE_SITE'), 'generic.png'); $bar = JToolBar::getInstance('toolbar'); diff --git a/src/com_digicom/admin/views/licenses/tmpl/default.php b/src/com_digicom/admin/views/licenses/tmpl/default.php index 8faf643e..9b2c1e47 100644 --- a/src/com_digicom/admin/views/licenses/tmpl/default.php +++ b/src/com_digicom/admin/views/licenses/tmpl/default.php @@ -31,7 +31,10 @@ +

+
@@ -61,7 +64,7 @@
-
+
@@ -194,10 +197,11 @@
-
+ +
+
pagination->getListFooter(); ?>
-
diff --git a/src/com_digicom/admin/views/order/tmpl/edit.php b/src/com_digicom/admin/views/order/tmpl/edit.php index 01814c0f..4098fd55 100644 --- a/src/com_digicom/admin/views/order/tmpl/edit.php +++ b/src/com_digicom/admin/views/order/tmpl/edit.php @@ -48,202 +48,216 @@ id,$date,$order->status); ?>

- - - - - +
+
# - -
+ + + + + + + + + + + - - - - - - + - + products as $key=>$prod): + if(!isset($prod->id)) break; + //print_r($prod);die; + $id = $order->id; + + if (!isset($prod->currency)) { + $prod->currency = $configs->get('currency','USD'); + } + + $licenseid = $prod->id; + //print_r($prod);die; + $refund = DigiComHelperDigiCom::getRefunds($order->id, $prod->id); + $chargeback = DigiComHelperDigiCom::getChargebacks($order->id, $prod->id); + $cancelled = DigiComHelperDigiCom::isProductDeleted($prod->id);?> + + + + + - products as $key=>$prod): - if(!isset($prod->id)) break; - //print_r($prod);die; - $id = $order->id; + - if (!isset($prod->currency)) { - $prod->currency = $configs->get('currency','USD'); - } + - $licenseid = $prod->id; - //print_r($prod);die; - $refund = DigiComHelperDigiCom::getRefunds($order->id, $prod->id); - $chargeback = DigiComHelperDigiCom::getChargebacks($order->id, $prod->id); - $cancelled = DigiComHelperDigiCom::isProductDeleted($prod->id);?> - - - + + - + + + + + + + + + + + + 0):?> + + + + + + + 0):?> + + + + + + + 0):?> + + + + + + + + + - + + + + - + - + + + + + + + + - - - - - - - - - - - - - - - - 0):?> - - - - - - - 0):?> - - - - - - - 0):?> - - - - - - - - - - - - - - - - - - - - - - - - - - - + -
# + + + + + +
- - - -
+ name;?> + + quantity;?> + amount_paid - $refund - $chargeback; + echo DigiComHelperDigiCom::format_price($prod->price, $prod->currency, true, $configs); + $oll_courses_total += $price; + if ($refund > 0) + { + echo ' ('.JText::_("LICENSE_REFUND")." - ".DigiComHelperDigiCom::format_price($refund, $prod->currency, true, $configs).')'; + } + if ($chargeback > 0) + { + echo ' ('.JText::_("LICENSE_CHARGEBACK")." - ".DigiComHelperDigiCom::format_price($chargeback, $prod->currency, true, $configs).')'; + } ?> +

- name;?> +
+ price, $order->currency, true, $configs); + ?> - quantity;?> +
(promocode; ?>)discount, $order->currency, true, $configs);?>
tax, $order->currency, true, $configs);?>
currency, true, $configs); ?>
currency, true, $configs); ?>
currency, true, $configs); ?>
+ amount; + echo DigiComHelperDigiCom::format_price($value, $order->currency, true, $configs); + ?> amount_paid - $refund - $chargeback; - echo DigiComHelperDigiCom::format_price($prod->price, $prod->currency, true, $configs); - $oll_courses_total += $price; - if ($refund > 0) - { - echo ' ('.JText::_("LICENSE_REFUND")." - ".DigiComHelperDigiCom::format_price($refund, $prod->currency, true, $configs).')'; - } - if ($chargeback > 0) - { - echo ' ('.JText::_("LICENSE_CHARGEBACK")." - ".DigiComHelperDigiCom::format_price($chargeback, $prod->currency, true, $configs).')'; - } ?> +
+ amount_paid; + $value = $value - $refunds - $chargebacks; + echo DigiComHelperDigiCom::format_price($value, $order->currency, true, $configs); + ?>


form->getLabel('status'); ?>form->getInput('status'); ?>
form->getLabel('amount_paid'); ?>form->getInput('amount_paid'); ?>
- price, $order->currency, true, $configs); - ?> -
(promocode; ?>)discount, $order->currency, true, $configs);?>
tax, $order->currency, true, $configs);?>
currency, true, $configs); ?>
currency, true, $configs); ?>
currency, true, $configs); ?>
- amount; - echo DigiComHelperDigiCom::format_price($value, $order->currency, true, $configs); - ?> -
- amount_paid; - $value = $value - $refunds - $chargebacks; - echo DigiComHelperDigiCom::format_price($value, $order->currency, true, $configs); - ?> -

form->getLabel('status'); ?>form->getInput('status'); ?>
form->getLabel('amount_paid'); ?>form->getInput('amount_paid'); ?>
+ +
- - - - - - - - - - - - - - logs as $key=>$log): ?> - - - - - - - - - - - -
- - - - - - - - - - - -
- id;?> - - type;?> - - message;?> - - status;?> - - created;?> - - ip;?> -
+
+ + + + + + + + + + + + + + logs as $key=>$log): ?> + + + + + + + + + + + + + + + +
+ + + + + + + + + + + + + +
+ id;?> + + type;?> + + message;?> + + status;?> + + created;?> + + ip;?> + + Show Logs +
+
diff --git a/src/com_digicom/admin/views/order/view.html.php b/src/com_digicom/admin/views/order/view.html.php index 3c4370e7..68d68a24 100644 --- a/src/com_digicom/admin/views/order/view.html.php +++ b/src/com_digicom/admin/views/order/view.html.php @@ -22,6 +22,12 @@ class DigiComViewOrder extends JViewLegacy function display( $tpl = null ) { + if (!JFactory::getUser()->authorise('core.orders', 'com_digicom')) + { + return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); + } + + $app = JFactory::getApplication(); $this->state = $this->get('State'); diff --git a/src/com_digicom/admin/views/ordernew/view.html.php b/src/com_digicom/admin/views/ordernew/view.html.php index e78b20d1..677b33d3 100644 --- a/src/com_digicom/admin/views/ordernew/view.html.php +++ b/src/com_digicom/admin/views/ordernew/view.html.php @@ -22,7 +22,11 @@ class DigiComViewOrderNew extends JViewLegacy function display( $tpl = null ) { - + if (!JFactory::getUser()->authorise('core.orders', 'com_digicom')) + { + return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); + } + $this->state = $this->get('State'); $this->item = $this->get('Item'); diff --git a/src/com_digicom/admin/views/orders/tmpl/default.php b/src/com_digicom/admin/views/orders/tmpl/default.php index e91109ca..ffb009b1 100644 --- a/src/com_digicom/admin/views/orders/tmpl/default.php +++ b/src/com_digicom/admin/views/orders/tmpl/default.php @@ -71,13 +71,15 @@ function OrderlistItemTask(id) { +

$this)); ?> - +
@@ -132,6 +134,7 @@ function OrderlistItemTask(id) { $published = JHTML::_( 'grid.published', $order, $i ); $orderstatuslink = JRoute::_( "index.php?option=com_digicom&view=orders&task=orders.cycleStatus&id=" . $id ); $userlink = "index.php?option=com_users&view=users&filter_search=".$order->email; + if(!$order->name) $order->name = $order->userid; ?> @@ -230,6 +233,7 @@ function OrderlistItemTask(id) { ?>
+
pagination->getListFooter(); ?>
diff --git a/src/com_digicom/admin/views/orders/view.html.php b/src/com_digicom/admin/views/orders/view.html.php index 3c7990a0..8a73d15c 100644 --- a/src/com_digicom/admin/views/orders/view.html.php +++ b/src/com_digicom/admin/views/orders/view.html.php @@ -16,6 +16,11 @@ class DigiComViewOrders extends JViewLegacy function display( $tpl = null ) { + if (!JFactory::getUser()->authorise('core.orders', 'com_digicom')) + { + return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); + } + $this->app = JFactory::getApplication(); $document = JFactory::getDocument(); diff --git a/src/com_digicom/admin/views/product/tmpl/edit.php b/src/com_digicom/admin/views/product/tmpl/edit.php index 34e46e91..b872a109 100644 --- a/src/com_digicom/admin/views/product/tmpl/edit.php +++ b/src/com_digicom/admin/views/product/tmpl/edit.php @@ -93,17 +93,19 @@ 'general')); ?> +
+ + - - -
- form->getLabel('introtext'); ?> - form->getInput('introtext'); ?> -
+
+ form->getLabel('introtext'); ?> + form->getInput('introtext'); ?> +
-
- form->getLabel('fulltext'); ?> - form->getInput('fulltext'); ?> +
+ form->getLabel('fulltext'); ?> + form->getInput('fulltext'); ?> +
@@ -135,8 +137,16 @@
- - 'thumb-image')); ?> +
+
+ form->getControlGroup('image_intro'); ?> +
+
+
+ form->getControlGroup('image_full'); ?> +
+
+ diff --git a/src/com_digicom/admin/views/product/view.html.php b/src/com_digicom/admin/views/product/view.html.php index 87f143ee..c32df8eb 100644 --- a/src/com_digicom/admin/views/product/view.html.php +++ b/src/com_digicom/admin/views/product/view.html.php @@ -29,6 +29,11 @@ class DigiComViewProduct extends JViewLegacy */ public function display($tpl = null) { + if (!JFactory::getUser()->authorise('core.products', 'com_digicom')) + { + return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); + } + $this->state = $this->get('State'); $this->item = $this->get('Item'); $this->form = $this->get('Form'); diff --git a/src/com_digicom/admin/views/products/tmpl/default.php b/src/com_digicom/admin/views/products/tmpl/default.php index 8eb3e72c..ded1b1d1 100644 --- a/src/com_digicom/admin/views/products/tmpl/default.php +++ b/src/com_digicom/admin/views/products/tmpl/default.php @@ -80,7 +80,7 @@ echo JLayoutHelper::render('joomla.searchtools.default', array('view' => $this)); ?> -
+
@@ -213,6 +213,7 @@
escape($item->category_title); ?> + Preview
@@ -253,10 +254,12 @@
-
+ +
+ +
pagination->getListFooter(); ?>
-
diff --git a/src/com_digicom/admin/views/products/view.html.php b/src/com_digicom/admin/views/products/view.html.php index d30fc8d2..d070c78c 100644 --- a/src/com_digicom/admin/views/products/view.html.php +++ b/src/com_digicom/admin/views/products/view.html.php @@ -22,6 +22,12 @@ class DigiComViewProducts extends JViewLegacy function display( $tpl = null ) { + if (!JFactory::getUser()->authorise('core.products', 'com_digicom')) + { + return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); + } + + if ($this->getLayout() !== 'modal') { DigiComHelperDigiCom::addSubmenu('products'); @@ -87,7 +93,7 @@ protected function addToolbar() // Get the toolbar object instance $bar = JToolBar::getInstance('toolbar'); JToolbarHelper::title(JText::_('COM_DIGICOM_PRODUCTS_TOOLBAR_TITLE_SITE'), 'stack product'); - + if ($canDo->get('core.create') || (count($user->getAuthorisedCategories('com_digicom', 'core.create'))) > 0 ) { //JToolbarHelper::addNew('product.add'); @@ -95,7 +101,6 @@ protected function addToolbar() $bar->appendButton('Custom', $layout->render(array()), 'products'); } - if ($canDo->get('core.edit.state')) { JToolbarHelper::publish('products.publish', 'JTOOLBAR_PUBLISH', true); @@ -114,7 +119,7 @@ protected function addToolbar() { JToolbarHelper::trash('products.trash'); } - + // Instantiate a new JLayoutFile instance and render the layout $layout = new JLayoutFile('toolbar.title'); $title=array( diff --git a/src/com_digicom/admin/views/reports/view.html.php b/src/com_digicom/admin/views/reports/view.html.php index e530c4c1..057abe32 100644 --- a/src/com_digicom/admin/views/reports/view.html.php +++ b/src/com_digicom/admin/views/reports/view.html.php @@ -37,6 +37,11 @@ class DigiComViewReports extends JViewLegacy { function display ($tpl = null ) { + if (!JFactory::getUser()->authorise('core.reports', 'com_digicom')) + { + return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); + } + $this->latest_orders = DigiComHelperDigiCom::getOrders(5); $this->most_sold = DigiComHelperDigiCom::getMostSoldProducts(5); diff --git a/src/com_digicom/media/css/digicom-admin.css b/src/com_digicom/media/css/digicom-admin.css index 5ebdcb5f..a24889b2 100644 --- a/src/com_digicom/media/css/digicom-admin.css +++ b/src/com_digicom/media/css/digicom-admin.css @@ -149,6 +149,7 @@ ul.usergroups li { margin-top: 18px; } .js-stools { + height: 30px; margin-bottom: 10px; } .js-stools .clearfix:after { @@ -202,8 +203,8 @@ body.com_digicom #adminForm { } body.com_digicom .chzn-container-single .chzn-single { padding: 0 0 0 0.875rem; - height: 1.8rem; - line-height: 1.8rem; + height: 2rem; + line-height: 2rem; border: 1px solid #dfdfdf; border-radius: 3px; background: #ffffff; @@ -429,13 +430,14 @@ body.com_digicom .subhead #toolbar .btn-success { width: auto; } body.com_digicom #digicom { - background: #253238; + background: #f9f9fb; } body.com_digicom #j-sidebar-container { - background: #253238; + background: #ffffff; + border-right: 1px solid #eaeaea; margin-left: 0; - width: 238px; - color: #c9d1dd; + width: 280px; + color: #333333; overflow: hidden; border: 0; -webkit-backface-visibility: hidden; @@ -447,14 +449,14 @@ body.com_digicom #j-sidebar-container #sidebar { padding: 15px 0; } body.com_digicom #j-sidebar-container #sidebar #submenu { - width: 200px; + width: 220px; box-sizing: border-box; padding-left: 0px; padding-right: 0px; } body.com_digicom #j-sidebar-container #sidebar .sidebar-nav .nav-list > li > a { - padding: 5px 12px; - color: #c9d1dd; + padding: 8px 12px; + color: #333333; font-size: 14px; line-height: 24px; text-shadow: none; @@ -464,29 +466,28 @@ body.com_digicom #j-sidebar-container #sidebar .sidebar-nav .nav-list > li > a > display: inline-block; } body.com_digicom #j-sidebar-container #sidebar .sidebar-nav .nav-list > li > a.dglogo { - background: url(../images/dglogo-white-176x48.png) no-repeat 16px 0; + background: url(../images/dglogo-250x68.png) no-repeat 16px 0; background-size: 80%; font-size: 0; text-indent: -9999px; height: 43px; - border-bottom: 1px solid rgba(255, 255, 255, 0.1); - box-shadow: 0 2px 1px rgba(0, 0, 0, 0.15); + border-bottom: 1px solid #f6f7f9; margin-bottom: 5px; } body.com_digicom #j-sidebar-container #sidebar .sidebar-nav .nav-list > li > a:hover, body.com_digicom #j-sidebar-container #sidebar .sidebar-nav .nav-list > li > a:focus { background-color: inherit; - color: #fefefe; + color: #1976d2; } body.com_digicom #j-sidebar-container #sidebar .sidebar-nav .nav-list > li > a:hover [class^="icon-"], body.com_digicom #j-sidebar-container #sidebar .sidebar-nav .nav-list > li > a:focus [class^="icon-"], body.com_digicom #j-sidebar-container #sidebar .sidebar-nav .nav-list > li > a:hover [class*=" icon-"], body.com_digicom #j-sidebar-container #sidebar .sidebar-nav .nav-list > li > a:focus [class*=" icon-"] { - color: #fefefe; + color: #1976d2; } body.com_digicom #j-sidebar-container #sidebar .sidebar-nav .nav-list [class^="icon-"], body.com_digicom #j-sidebar-container #sidebar .sidebar-nav .nav-list [class*=" icon-"] { - color: #c9d1dd; + color: #333333; margin-right: 15px; width: auto; height: auto; @@ -505,10 +506,10 @@ body.com_digicom #j-sidebar-container #sidebar .sidebar-nav .nav-list > li.activ display: block; position: absolute; right: 0px; - top: 7px; + top: 0px; border-style: solid; - border-width: 10px; - border-color: transparent #f5f5f5 transparent transparent; + border-width: 20px; + border-color: transparent #fff transparent transparent; } body.com_digicom.sidebar-collapse #j-sidebar-container, body.com_digicom.layout-dgform #j-sidebar-container { @@ -522,18 +523,18 @@ body.com_digicom.layout-dgform #j-sidebar-container #sidebar .sidebar-nav #subme } body.com_digicom.sidebar-collapse #j-sidebar-container #sidebar .sidebar-nav #submenu.nav-list > li > a.dglogo, body.com_digicom.layout-dgform #j-sidebar-container #sidebar .sidebar-nav #submenu.nav-list > li > a.dglogo { - background: url(../images/dglogo-white-36x36.png) no-repeat 6px 0px; - background-size: 50%; + background-size: 120px auto; + background-position: 5px 0px; height: 28px; - width: 30px; } body.com_digicom.sidebar-collapse #j-sidebar-container #sidebar .sidebar-nav #submenu.nav-list > li > a > span + span, body.com_digicom.layout-dgform #j-sidebar-container #sidebar .sidebar-nav #submenu.nav-list > li > a > span + span { display: none; } -body.com_digicom.sidebar-collapse #j-main-container, -body.com_digicom.layout-dgform #j-main-container { - margin-left: 0; +body.com_digicom.sidebar-collapse #j-sidebar-container #sidebar .sidebar-nav #submenu.nav-list > li.active > a:after, +body.com_digicom.layout-dgform #j-sidebar-container #sidebar .sidebar-nav #submenu.nav-list > li.active > a:after { + top: 10px; + border-width: 10px; } body.com_digicom.sidebar-collapse div#system-debug, body.com_digicom.layout-dgform div#system-debug, @@ -712,6 +713,26 @@ body.com_digicom .tabs-left .nav-tabs > li:hover a { background: #eee; border: 0; } +body.com_digicom #digicom .panel { + box-shadow: rgba(102, 119, 136, 0.03) 0px 6px 8px, rgba(102, 119, 136, 0.3) 0px 1px 2px; + background: #ffffff; + border-width: 0px; + border-style: initial; + border-color: initial; + border-image: initial; +} +body.com_digicom #digicom .panel > .panel-heading { + font-size: 15px; + font-weight: bold; + padding: 15px; +} +body.com_digicom #digicom .panel .panel-heading, +body.com_digicom #digicom .panel-default .panel-footer { + color: #667788; + text-shadow: rgba(255, 255, 255, 0.5) 0px 1px; + background: #f6f7f9; + border-color: #eaeaea; +} body.com_digicom .container-main { padding: 0; } @@ -723,10 +744,14 @@ body.com_digicom #j-main-container { background-color: #f9f9fb; padding: 20px; width: 100%; - margin-left: 0px; box-sizing: border-box; - margin-right: 0; float: left; + color: #667788; + text-shadow: rgba(255, 255, 255, 0.5) 0px 1px; + background: #f6f7f9; + border-color: #eaeaea; + box-shadow: rgba(102, 119, 136, 0.03) 0px 6px 8px, rgba(102, 119, 136, 0.3) 0px 1px 2px; + margin: 20px; } body.com_digicom #j-sidebar-container, body.com_digicom #j-main-container { @@ -810,9 +835,6 @@ body.layout-dgform #j-main-container .form-inline .controls { body.com_digicom #j-sidebar-container { display: none; } - body.com_digicom.sidebar-collapse #j-main-container { - margin-left: 0px; - } body.com_digicom header.header { display: block; } @@ -840,7 +862,7 @@ body.layout-dgform #j-main-container .form-inline .controls { /* Sidebar right styling */ #toggle_settings_wrap { background: rgba(25, 118, 210, 0.9); - color: #c9d1dd; + color: #333333; padding: 20px; position: fixed; top: 0; diff --git a/src/com_digicom/media/css/options.css b/src/com_digicom/media/css/options.css new file mode 100644 index 00000000..0cc12e21 --- /dev/null +++ b/src/com_digicom/media/css/options.css @@ -0,0 +1,20 @@ +#digicom .panel { + box-shadow: rgba(102, 119, 136, 0.03) 0px 6px 8px, rgba(102, 119, 136, 0.3) 0px 1px 2px; + background: #ffffff; + border-width: 0px; + border-style: initial; + border-color: initial; + border-image: initial; +} +#digicom .panel > .panel-heading { + font-size: 15px; + font-weight: bold; + padding: 15px; +} +#digicom .panel .panel-heading, +#digicom .panel-default .panel-footer { + color: #667788; + text-shadow: rgba(255, 255, 255, 0.5) 0px 1px; + background: #f6f7f9; + border-color: #eaeaea; +} diff --git a/src/com_digicom/media/less/components/chosen.less b/src/com_digicom/media/less/components/chosen.less index 4f283c21..1e1df32c 100644 --- a/src/com_digicom/media/less/components/chosen.less +++ b/src/com_digicom/media/less/components/chosen.less @@ -1,7 +1,7 @@ .chzn-container-single .chzn-single { padding: 0 0 0 0.875rem; - height: 1.8rem; - line-height: 1.8rem; + height: 2rem; + line-height: 2rem; border: 1px solid #dfdfdf; border-radius: 3px; background: #ffffff; diff --git a/src/com_digicom/media/less/components/options.less b/src/com_digicom/media/less/components/options.less new file mode 100644 index 00000000..f90185cb --- /dev/null +++ b/src/com_digicom/media/less/components/options.less @@ -0,0 +1,20 @@ +#digicom .panel { + box-shadow: rgba(102, 119, 136, 0.03) 0px 6px 8px, rgba(102, 119, 136, 0.3) 0px 1px 2px; + background: rgb(255, 255, 255); + border-width: 0px; + border-style: initial; + border-color: initial; + border-image: initial; +} +#digicom .panel > .panel-heading { + font-size: 15px; + font-weight: bold; + padding: 15px; +} +#digicom .panel .panel-heading, +#digicom .panel-default .panel-footer { + color: rgb(102, 119, 136); + text-shadow: rgba(255, 255, 255, 0.5) 0px 1px; + background: rgb(246, 247, 249); + border-color: rgb(234, 234, 234); +} \ No newline at end of file diff --git a/src/com_digicom/media/less/components/sidebar.less b/src/com_digicom/media/less/components/sidebar.less index e75f7fa7..2c6b8fdc 100644 --- a/src/com_digicom/media/less/components/sidebar.less +++ b/src/com_digicom/media/less/components/sidebar.less @@ -1,10 +1,12 @@ #digicom{ - background: @sidebar-background; + background: @body-background; } #j-sidebar-container { background: @sidebar-background; + border-right: 1px solid rgb(234, 234, 234); + margin-left: 0; - width: 238px; + width: 280px; float: left; color: @sidebar-text-color; // position: fixed; @@ -19,16 +21,15 @@ float: left; #sidebar { padding: 15px 0; - #submenu { - width: 200px; + width: 220px; box-sizing: border-box; padding-left: 0px; padding-right: 0px; } .sidebar-nav .nav-list { > li > a { - padding: 5px 12px; + padding: 8px 12px; color: @sidebar-text-color; font-size: 14px; line-height: 24px; @@ -37,20 +38,19 @@ > span + span {display: inline-block;} &.dglogo { - background: url(../images/dglogo-white-176x48.png) no-repeat 16px 0; + background: url(../images/dglogo-250x68.png) no-repeat 16px 0; background-size: 80%; font-size: 0; text-indent: -9999px; height: 43px; - border-bottom: 1px solid rgba(255, 255, 255, 0.1); - box-shadow: 0 2px 1px rgba(0, 0, 0, 0.15); + border-bottom: 1px solid rgb(246, 247, 249); margin-bottom: 5px; } &:hover,&:focus { background-color: inherit; - color: @sidebar-active-text-color; - [class^="icon-"], [class*=" icon-"] {color: @sidebar-active-text-color;} + color: @primary-blue; + [class^="icon-"], [class*=" icon-"] {color: @primary-blue;} } } [class^="icon-"], [class*=" icon-"] { @@ -71,10 +71,10 @@ display: block; position: absolute; right: 0px; - top: 7px; + top: 0px; border-style: solid; - border-width: 10px; - border-color: transparent #f5f5f5 transparent transparent; + border-width: 20px; + border-color: transparent #fff transparent transparent; } } } @@ -94,14 +94,22 @@ > li { width: @sidebar-collapse-width; > a.dglogo { - background: url(../images/dglogo-white-36x36.png) no-repeat 6px 0px; - background-size: 50%; + background-size: 120px auto; + background-position: 5px 0px; + // background: url(../images/dglogo-white-36x36.png) no-repeat 6px 0px; + // background-size: 50%; height: 28px; - width: 30px; + // width: 30px; } > a > span + span { display: none; } + &.active > a{ + &:after { + top: 10px; + border-width: 10px; + } + } } } } @@ -110,7 +118,7 @@ } #j-main-container { - margin-left: 0; + // margin-left: 0; // margin-left: @sidebar-collapse-width; } div#system-debug, diff --git a/src/com_digicom/media/less/digicom-admin.less b/src/com_digicom/media/less/digicom-admin.less index fefe71f0..1a19a8e9 100644 --- a/src/com_digicom/media/less/digicom-admin.less +++ b/src/com_digicom/media/less/digicom-admin.less @@ -15,12 +15,12 @@ @secondary-blue : #489be0; @dark-blue : #1E4973; -@gray : #f9f9fb ; +@gray : #f9f9fb ; @body-background: @gray; -@sidebar-background: #253238; +@sidebar-background: rgb(255, 255, 255); @sidebar-active-background: @primary-blue; -@sidebar-text-color: #c9d1dd; +@sidebar-text-color: rgb(51, 51, 51); @sidebar-active-text-color: #fefefe; @sidebar-collapse-width: 38px; @@ -158,8 +158,9 @@ ul.usergroups li { margin-right: 52px; margin-top: 18px; } -// Search tools +// Search tools. .js-stools{ + height: 30px; margin-bottom: 10px; .clearfix:after{ clear: none; @@ -251,6 +252,7 @@ body.com_digicom { @import "components/sidebar.less"; @import "components/form.less"; @import "components/tabs.less"; + @import "components/options.less"; .container-main { padding: 0; } @@ -262,10 +264,17 @@ body.com_digicom { background-color: @body-background; padding: 20px; width: 100%; - margin-left: 0px; + // margin-left: 0px; box-sizing: border-box; - margin-right: 0; + // margin-right: 0; float: left; + + color: rgb(102, 119, 136); + text-shadow: rgba(255, 255, 255, 0.5) 0px 1px; + background: rgb(246, 247, 249); + border-color: rgb(234, 234, 234); + box-shadow: rgba(102, 119, 136, 0.03) 0px 6px 8px, rgba(102, 119, 136, 0.3) 0px 1px 2px; + margin: 20px; } #j-sidebar-container, @@ -363,7 +372,7 @@ body.layout-dgform { display: none; } &.sidebar-collapse #j-main-container{ - margin-left: 0px; + // margin-left: 0px; } header.header{ display: block; diff --git a/src/com_digicom/site/controllers/cart.php b/src/com_digicom/site/controllers/cart.php index 182cf68d..dfd0a7af 100644 --- a/src/com_digicom/site/controllers/cart.php +++ b/src/com_digicom/site/controllers/cart.php @@ -507,6 +507,7 @@ function validateInput() */ function processPayment() { + $session = JFactory::getSession(); $app = JFactory::getApplication(); $input = $app->input; @@ -518,11 +519,11 @@ function processPayment() if($processor == '') { - $app->redirect(JRoute::_('index.php?option=com_digicom&view=orders', false),JText::_('COM_DIGICOM_PAYMENT_NO_PROCESSOR_SELECTED')); + $app->redirect(JRoute::_('index.php?option=com_digicom&view=orders', false), JText::_('COM_DIGICOM_PAYMENT_NO_PROCESSOR_SELECTED')); return false; } - $post = $input->post->getArray(); + $post = $input->post->getArray(); // $rawDataPost = $input->post->getArray(); // $rawDataGet = $input->get->getArray(); // $post = array_merge($rawDataGet, $rawDataPost); @@ -534,8 +535,7 @@ function processPayment() if( !count($post) ) $post = @file_get_contents('php://input'); $data = $dispatcher->trigger('onDigicom_PayProcesspayment', array($post)); - $data = reset($data); - + $data = $data[0]; $order_id = $input->get('order_id', '', 'int'); $sid = $input->get('sid', '', 'int'); @@ -552,14 +552,30 @@ function processPayment() } } - $param = array(); - $param['params'] = JPluginHelper::getPlugin('digicom_pay', $processor)->params; - // $param['handle'] = &$this; - $configs = $this->_config; $cart = $this->_model; $items = $cart->getOrderItems($order_id); + /* + * new security layer + * since 25th dec 2019 + * make sure order exist + */ + $orderTable = $cart->getTable('Order'); + $orderTable->load($order_id); + if(!$orderTable->id){ + JFactory::getApplication()->enqueueMessage(JText::_('COM_DIGICOM_PAYMENT_NO_ORDER_PASSED'), 'error'); + $app->redirect('index.php'); + return; + } + + /************************************/ + + + $param = array(); + $param['params'] = JPluginHelper::getPlugin('digicom_pay', $processor)->params; + // $param['handle'] = &$this; + $products = array(); if(isset($items) && count($items) > 0){ foreach($items as $key=>$product){ diff --git a/src/com_digicom/site/controllers/downloads.php b/src/com_digicom/site/controllers/downloads.php index cd0698de..e6a97b01 100644 --- a/src/com_digicom/site/controllers/downloads.php +++ b/src/com_digicom/site/controllers/downloads.php @@ -51,9 +51,14 @@ function go() } $fileInfo = $model->getfileinfo(); - - $access = DigiComSiteHelperDigiCom::checkUserAccessToFile($fileInfo, $customer->_user->id); - $result = $dispatcher->trigger('onDigicomDownloadCheckAccess',array('com_digicom.download', $fileInfo, $customer->_user)); + + if(!isset($fileInfo->product_id) or !$fileInfo->product_id){ + $access = false; + $result = [false]; + }else{ + $access = DigiComSiteHelperDigiCom::checkUserAccessToFile($fileInfo, $customer->_user->id); + $result = $dispatcher->trigger('onDigicomDownloadCheckAccess',array('com_digicom.download', $fileInfo, $customer->_user)); + } if( ( @@ -79,7 +84,6 @@ function go() JFactory::getApplication()->close(); } - if(empty($fileInfo->url)){ $itemid = JFactory::getApplication()->input->get('itemid',0); $msg = JText::sprintf('COM_DIGICOM_DOWNLOADS_FILE_DONT_EXIST_DETAILS',$fileInfo->name); diff --git a/src/com_digicom/site/controllers/orders.php b/src/com_digicom/site/controllers/orders.php new file mode 100644 index 00000000..03238041 --- /dev/null +++ b/src/com_digicom/site/controllers/orders.php @@ -0,0 +1,44 @@ +_model = $this->getModel( "Orders" ); + } + + + function cycleStatus() + { + $app = JFactory::getApplication(); + $res = $this->_model->cycleStatus(); + $msg = ""; + if(!$res){ + $msg = JText::_('COM_DIGICOM_ORDERS_NOTICE_ORDER_STATUS_CHANGE_ERR'); + }else{ + $msg = JText::_('COM_DIGICOM_ORDERS_NOTICE_ORDER_STATUS_CHANGED'); + } + + $app->enqueueMessage($msg); + + $link_orders = "index.php?option=com_digicom&view=manager"; + $this->setRedirect($link_orders, $msg); + } + +} diff --git a/src/com_digicom/site/helpers/log.php b/src/com_digicom/site/helpers/log.php index 87b25034..3c4b46e7 100644 --- a/src/com_digicom/site/helpers/log.php +++ b/src/com_digicom/site/helpers/log.php @@ -29,7 +29,7 @@ class DigiComSiteHelperLog { * @info = log details or extra info encoded by json formet * setLog($type, $hook, $message, $info, $status = 'complete'); * */ - public static function setLog($type, $hook, $callbackid, $message, $info, $status = 'complete', $refid = 0) + public static function setLog($type, $hook, $callbackid = '', $message = '', $info = '', $status = 'complete', $refid = 0) { $dispatcher = JDispatcher::getInstance(); $config = JComponentHelper::getParams('com_digicom'); diff --git a/src/com_digicom/site/helpers/price.php b/src/com_digicom/site/helpers/price.php index cf0c497b..3672142d 100644 --- a/src/com_digicom/site/helpers/price.php +++ b/src/com_digicom/site/helpers/price.php @@ -16,7 +16,7 @@ class DigiComSiteHelperPrice { /** * price formet helper */ - public static function format_price( $amount, $ccode, $add_sym = false, $configs ) + public static function format_price( $amount, $ccode, bool $add_sym = false, $configs ) { $currency_use = $configs->get('currency_use','symbol'); @@ -115,7 +115,7 @@ public static function get_tax_rate($configs, $country = false, $state = false ) } if( ! empty( $country ) ) { - $tax_rates = $configs->get('tax_rates',array()); + $tax_rates = $configs->get('tax_rates', ''); $json = json_decode($tax_rates, true); if(is_array($json)){ $tax_rates = self::group_by_key($json); diff --git a/src/com_digicom/site/language/en-GB/en-GB.com_digicom.ini b/src/com_digicom/site/language/en-GB/en-GB.com_digicom.ini index 89ad0677..482ce4d2 100644 --- a/src/com_digicom/site/language/en-GB/en-GB.com_digicom.ini +++ b/src/com_digicom/site/language/en-GB/en-GB.com_digicom.ini @@ -56,12 +56,14 @@ COM_DIGICOM_DOWNLOAD = "Download" COM_DIGICOM_FILE_DOESNT_EXIST = "File dosen't exist" COM_DIGICOM_FILE_DOWNLOAD_FAILED = "The File Download faild %s. May be file dosent exist of something went wrong. please contact support!" COM_DIGICOM_FILE_SIZE_EMPTY = "Sorry! file size empty!! Please contact support" +COM_DIGICOM_CUSTOMER = "Customer" COM_DIGICOM_CUSTOMER_ID = "Customer ID" COM_DIGICOM_CUSTOMER_USERNAME = "Customer Username" COM_DIGICOM_CUSTOMER_SINCE = "Customer since" COM_DIGICOM_IMAGE = "Image" COM_DIGICOM_TYPE = "Type" COM_DIGICOM_TAGS = "Tags" +COM_DIGICOM_IP = "IP" COM_DIGICOM_NAME = "Your Name" COM_DIGICOM_COMPANY = "Company" @@ -198,6 +200,21 @@ COM_DIGICOM_ORDERS_PAGE_TITLE = "My Orders" COM_DIGICOM_ORDERS_NO_ORDER_FOUND_NOTICE = "No Order found!" COM_DIGICOM_SEARCH_ORDER_LABEL = "Order Number" +;-------------------------------------------- +; MANAGER PAGE +;-------------------------------------------- +COM_DIGICOM_MANAGER_PAGE_TITLE = "Manager Page" +COM_DIGICOM_ORDERS_SEARCH_NOTICE = "Quick Search Tips: Example: email:me@domain.com. Usable codes:
id: and write id of customer
user: and write username or full name of customer
email: and write email of customer. Then hit search" + +COM_DIGICOM_ORDER_STATUS_ACTIVE = "Active" +COM_DIGICOM_ORDER_STATUS_PENDING = "Pending" +COM_DIGICOM_ORDER_STATUS_CANCEL = "Cancel" +COM_DIGICOM_ORDER_MAKE_PAID = "Paid & Active" +COM_DIGICOM_ORDER_MAKE_REFUND = "Refund" + +COM_DIGICOM_ORDERS_NOTICE_ORDER_STATUS_CHANGED = "Success! Order status has changed." +COM_DIGICOM_ORDERS_NOTICE_ORDER_STATUS_CHANGE_ERR = "Fail! Order status has faild to change." + ;-------------------------------------------- ; ORDER PAGE ;-------------------------------------------- diff --git a/src/com_digicom/site/models/cart.php b/src/com_digicom/site/models/cart.php index b0e18b48..c71320c4 100644 --- a/src/com_digicom/site/models/cart.php +++ b/src/com_digicom/site/models/cart.php @@ -216,7 +216,7 @@ function getCartItems($customer, $configs) { $dispatcher = JEventDispatcher::getInstance(); - if(!is_null($this->_items)){ + if(!is_null($this->_items) && count($this->_items)){ return $this->_items; } @@ -858,9 +858,10 @@ function checkSuccess( $sid ) function proccessSuccess($post, $pay_plugin, $order_id, $sid, $data, $items) { - $app = JFactory::getApplication(); + $app = JFactory::getApplication(); $session = JFactory::getSession(); $customer = $this->loadCustomer($sid); + if(!$customer) { $order = $this->getOrder($order_id); @@ -935,11 +936,12 @@ function proccessSuccess($post, $pay_plugin, $order_id, $sid, $data, $items) // redirect after payment complete $afterpurchase = $configs->get('afterpurchase', 2); + switch ($afterpurchase) { case '2': if('Active' == $status){ - $session->set('com_digicom', array('action' => 'payment_complete', 'id' => $order_id)); - $link = JRoute::_('index.php?option=com_digicom&view=thankyou', false); + $session->set('com_digicom', array('action' => 'payment_complete', 'id' => $order_id)); + $link = JRoute::_('index.php?option=com_digicom&view=thankyou&order_id='.$order_id, false); }else{ $app->enqueueMessage($msg, 'message'); $link = JRoute::_('index.php?option=com_digicom&view=order&id='.$order_id, false); @@ -958,7 +960,7 @@ function proccessSuccess($post, $pay_plugin, $order_id, $sid, $data, $items) } - $app->redirect($link); + $app->redirect($link, 200); return true; } diff --git a/src/com_digicom/site/models/checkout.php b/src/com_digicom/site/models/checkout.php index 5a6db9d3..a1f1ceb4 100644 --- a/src/com_digicom/site/models/checkout.php +++ b/src/com_digicom/site/models/checkout.php @@ -26,4 +26,40 @@ public function getOrder(){ return $this->orders[$order_id]; } + public function getOrderItems(){ + $input = JFactory::getApplication()->input; + $order_id = $input->get('id','0'); + + $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(); + // print_r($items);die; + + $configs = $this->getConfigs(); + //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 = DigiComSiteHelperPrice::format_price( $item->price, $item->currency, false, $configs ); //sprintf( $price_format, $item->product_price ); + $item->price_formated = $item->price; + $item->subtotal = $item->price * $item->quantity; + } + + return $items ; + + } + + function getConfigs() { + $comInfo = JComponentHelper::getComponent('com_digicom'); + return $comInfo->params; + } + } diff --git a/src/com_digicom/site/models/downloads.php b/src/com_digicom/site/models/downloads.php index 0749f844..35b96e68 100644 --- a/src/com_digicom/site/models/downloads.php +++ b/src/com_digicom/site/models/downloads.php @@ -123,7 +123,7 @@ protected function _buildItemOrderBy() */ public function getItems() { - $db = $this->getDbo(); + $db = $this->getDbo(); // Invoke the parent getItems method to get the main list $items = parent::getItems(); @@ -144,13 +144,12 @@ public function getItems() $params->loadString($active->params); } } - - // trigger events - $dispatcher = JEventDispatcher::getInstance(); - JPluginHelper::importPlugin('digicom'); - $dispatcher->trigger('onDigicomDownloadItems', array ('com_digicom.downloads', &$items)); - - + + // trigger events + $dispatcher = JEventDispatcher::getInstance(); + JPluginHelper::importPlugin('digicom'); + $dispatcher->trigger('onDigicomDownloadItems', array ('com_digicom.downloads', &$items)); + //products if ($items) { @@ -226,7 +225,7 @@ public function getItems() //print_r($items);die; // check and add products files $configs = JComponentHelper::getComponent('com_digicom')->params; - $pagination = $configs->get('download_pagination', 0); + $pagination = $configs->get('download_page', 0); if(!$pagination){ $productAdded = array(); @@ -393,7 +392,7 @@ function getfileinfo() $jinput = JFactory::getApplication()->input; $fileid = $jinput->get('downloadid', '0'); - + if($fileid == '0') { $fileid = $jinput->get('token', '0'); diff --git a/src/com_digicom/site/models/manager.php b/src/com_digicom/site/models/manager.php new file mode 100644 index 00000000..06b6cdff --- /dev/null +++ b/src/com_digicom/site/models/manager.php @@ -0,0 +1,119 @@ +input->get('search', '', 'nohtml'); + $this->setState('filter.search', $search); + + $user = JFactory::getUser(); + $this->setState('filter.userid', $user->id); + + $params = $app->getParams(); + $this->setState('params', $params); + + parent::populateState($ordering, $direction); + } + /** + * Get the master query for retrieving a list of products subject to the model state. + * + * @return JDatabaseQuery + * + * @since 1.6 + */ + protected function getListQuery() + { + // Create a new query object. + $db = $this->getDbo(); + $query = $db->getQuery(true); + + // Select the required fields from the table. + $query->select('a.*') + ->from('#__digicom_orders as a'); + // ->where('a.userid = ' . $db->quote($this->getState('filter.userid'))); + + // Join over the users for the checked out user. + $query->select(array('c.name','c.email')) + ->join('LEFT', '#__digicom_customers AS c ON c.id=a.userid'); + + // Join over the users for the checked out user. + $query->select('ju.username') + ->join('LEFT', '#__users AS ju ON ju.id=a.userid'); + + + // Filter by search + if ($this->getState('filter.search')) + { + // $query->where('a.id = ' . $db->quote($this->getState('filter.search'))); + $search = $this->getState('filter.search'); + // print_r($search);die; + if (!empty($search)) + { + if (stripos($search, 'id:') === 0) + { + $query->where('a.id = ' . (int) substr($search, 3)); + } + elseif (stripos($search, 'user:') === 0) + { + $search = $db->quote('%' . $db->escape(substr($search, 5), true) . '%'); + $query->where('(ju.username LIKE ' . $search . ' OR c.name LIKE ' . $search . ' OR ju.name LIKE ' . $search . ')'); + } + elseif (stripos($search, 'email:') === 0) + { + $search = $db->quote('%' . $db->escape(substr($search, 6), true) . '%'); + $query->where('(c.email LIKE ' . $search . ')'); + } + elseif (stripos($search, 'processor:') === 0) + { + $search = $db->quote('%' . $db->escape(substr($search, 10), true) . '%'); + $query->where('(a.processor LIKE ' . $search . ')'); + } + elseif (stripos($search, 'promocode:') === 0) + { + $search = $db->quote('%' . $db->escape(substr($search, 10), true) . '%'); + $query->where('(a.promocode LIKE ' . $search . ')'); + } + else + { + $query->where('a.id = ' . (int) $search); + } + + } + } + + $query->order('id desc'); + + // echo $query->__toString();die; + return $query; + } + +} diff --git a/src/com_digicom/site/models/order.php b/src/com_digicom/site/models/order.php index 23e8f0f4..98847bae 100644 --- a/src/com_digicom/site/models/order.php +++ b/src/com_digicom/site/models/order.php @@ -81,6 +81,8 @@ public function getItem($pk = null) // print_r($prods);die; $data->products = $prods; + $data->logs = $this->getLogs($data->id); + $this->_item[$pk] = $data; } catch (Exception $e) @@ -102,4 +104,45 @@ public function getItem($pk = null) } + public function getOrderItems( $order_id ){ + + $configs = $this->getConfigs(); + $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 = DigiComSiteHelperPrice::format_price( $item->price, $item->currency, false, $configs ); //sprintf( $price_format, $item->product_price ); + $item->subtotal = $item->price * $item->quantity; + } + + return $items ; + + } + + public function getLogs($order) + { + $db = JFactory::getDBO(); + $sql = "SELECT * FROM #__digicom_log WHERE callbackid='". $order ."'"; + $db->setQuery($sql); + return $db->loadObjectList(); + } + + function getConfigs() { + $comInfo = JComponentHelper::getComponent('com_digicom'); + return $comInfo->params; + } + } diff --git a/src/com_digicom/site/models/orders.php b/src/com_digicom/site/models/orders.php index 843bb919..db6f165f 100644 --- a/src/com_digicom/site/models/orders.php +++ b/src/com_digicom/site/models/orders.php @@ -11,64 +11,168 @@ class DigiComModelOrders extends JModelList { - /** - * Method to auto-populate the model state. - * - * This method should only be called once per instantiation and is designed - * to be called on the first call to the getState() method unless the model - * configuration flag to ignore the request is set. - * - * Note. Calling getState in this method will result in recursion. - * - * @param string $ordering An optional ordering field. - * @param string $direction An optional direction (asc|desc). - * - * @return void - * - * @since 12.2 - */ - protected function populateState($ordering = 'ordering', $direction = 'ASC') - { - $app = JFactory::getApplication(); - - // Get the parent id if defined. - $search = $app->input->get('search', ''); - $this->setState('filter.search', $search); - - $user = JFactory::getUser(); - $this->setState('filter.userid', $user->id); - - $params = $app->getParams(); - $this->setState('params', $params); - - parent::populateState($ordering, $direction); - } - /** - * Get the master query for retrieving a list of products subject to the model state. - * - * @return JDatabaseQuery - * - * @since 1.6 - */ - protected function getListQuery() - { - // Create a new query object. - $db = $this->getDbo(); - $query = $db->getQuery(true); - - // Select the required fields from the table. - $query->select('a.*') - ->from('#__digicom_orders as a') - ->where('a.userid = ' . $db->quote($this->getState('filter.userid'))); - - // Filter by search - if ($this->getState('filter.search')) - { - $query->where('a.id = ' . $db->quote($this->getState('filter.search'))); - } - - // echo $query->__toString();die; - return $query; - } - + /** + * Method to auto-populate the model state. + * + * This method should only be called once per instantiation and is designed + * to be called on the first call to the getState() method unless the model + * configuration flag to ignore the request is set. + * + * Note. Calling getState in this method will result in recursion. + * + * @param string $ordering An optional ordering field. + * @param string $direction An optional direction (asc|desc). + * + * @return void + * + * @since 12.2 + */ + protected function populateState($ordering = 'ordering', $direction = 'ASC') + { + $app = JFactory::getApplication(); + + // Get the parent id if defined. + $search = $app->input->get('search', ''); + $this->setState('filter.search', $search); + + $user = JFactory::getUser(); + $this->setState('filter.userid', $user->id); + + $params = $app->getParams(); + $this->setState('params', $params); + + parent::populateState($ordering, $direction); + } + + /** + * Get the master query for retrieving a list of products subject to the model state. + * + * @return JDatabaseQuery + * + * @since 1.6 + */ + protected function getListQuery() + { + // Create a new query object. + $db = $this->getDbo(); + $query = $db->getQuery(true); + + // Select the required fields from the table. + $query->select('a.*') + ->from('#__digicom_orders as a') + ->where('a.userid = ' . $db->quote($this->getState('filter.userid'))); + + // Filter by search + if ($this->getState('filter.search')) { + $query->where('a.id = ' . $db->quote($this->getState('filter.search'))); + } + + // Add the list ordering clause. + $query->order('a.id DESC'); + + // echo $query->__toString();die; + return $query; + } + + /** + * method to cycleStatus + * quick action to change order status + */ + public function cycleStatus() + { + $db = JFactory::getDBO(); + $input = JFactory::getApplication()->input; + //orderstatus + //print_r($_POST);die; + $orderids = $input->get('cid', null, null); + $statuses = $input->post->get('orderstatus', null, null); + $status = $statuses['0']; + $id = $orderids['0']; + + $table = $this->getTable('order'); + $table->load($id); + $table->status = $status; + + if (empty($table->transaction_number)) { + $table->transaction_number = DigiComSiteHelperDigicom::getUniqueTransactionId($table->id); + } + + if ($status == 'Paid') { + $table->amount_paid = $table->amount; + $table->status = 'Active'; + } elseif ($status == 'Refund') { + $table->amount_paid = 0; + } + + if (!$table->store()) { + return JFactory::getApplication()->enqueueMessage(JText::_('COM_DIGICOM_ORDER_STATUS_CHANGED_FAILED', $table->getErrorMsg()), 'error'); + } + + if ($status == 'Pending') { + $sql = "update #__digicom_orders_details set published=0 where orderid in ('" . $id . "')"; + $type = 'process_order'; + } elseif ($status == 'Active' or $status == 'Paid') { + $sql = "update #__digicom_orders_details set published=1 where orderid in ('" . $id . "')"; + $type = 'complete_order'; + } elseif ($status == 'Cancel') { + $sql = "update #__digicom_orders_details set published='-1' where orderid in ('" . $id . "')"; + $type = 'cancel_order'; + } elseif ($status == 'Refund') { + $sql = "update #__digicom_orders_details set published='-2' where orderid in ('" . $id . "')"; + $type = 'refund_order'; + } + + $db->setQuery($sql); + $db->execute(); + + // based on order status changes, we need to update license too :) + $this->updateLicensesStatus($id, $type); + + // sent email as order status has changed + DigiComHelperEmail::sendApprovedEmail($id, $type, $status); + + $dispatcher = JDispatcher::getInstance(); + if ($status == 'Active' or $status == 'Paid') { + $orders = $this->getInstance('Order', 'DigiComModel'); + $items = $orders->getOrderItems($id); + + $dispatcher->trigger('onDigicomAfterPaymentComplete', [$id, $info = [], $table->processor, $items, $table->userid]); + } else { + $dispatcher->trigger('onDigicomAdminAfterOrderStatusChange', [$table]); + } + + return true; + } + + /* + * create license as we are changng the status + * $orderid = id of order + * $type = order status; like: complete_order; + */ + public function updateLicensesStatus($orderid, $type) + { + $order = $this->getOrder($orderid); + $items = $order->products; + $customer_id = $order->userid; + $number_of_products = count($items); + DigiComSiteHelperLicense::updateLicenses($orderid, $number_of_products, $items, $customer_id, $type); + } + + public function getOrder($id = 0) + { + $db = JFactory::getDBO(); + $sql = 'SELECT o.*' + . ' FROM #__digicom_orders o' + . " WHERE o.id='" . intval($id) . "' AND o.published='1'"; + $db->setQuery($sql); + $order = $db->loadObject(); + + $sql = "SELECT p.id, p.name, p.price,p.catid, od.package_type,od.quantity, od.amount_paid FROM #__digicom_products as p, #__digicom_orders_details as od WHERE p.id=od.productid AND od.orderid='" . $order->id . "'"; + $db->setQuery($sql); + $prods = $db->loadObjectList(); + + $order->products = $prods; + + return $order; + } } diff --git a/src/com_digicom/site/router.php b/src/com_digicom/site/router.php index a991357d..cec4904c 100644 --- a/src/com_digicom/site/router.php +++ b/src/com_digicom/site/router.php @@ -59,8 +59,8 @@ public function build(&$query) { // there are no menu Itemid found, lets dive into menu finder $menuItem = $menu->getItems('link', 'index.php?option=com_digicom&view='.$view, true); - //print_r($menuItem);die; - if(!is_null($menuItem) && count($menuItem)){ + $total = count((array)$menuItem); + if($total){ $query['Itemid'] = $menuItem->id; $menuItemGiven = true; }else{ @@ -91,11 +91,14 @@ public function build(&$query) && $menuItem->query['view'] != $query['view'] ){ + // there are no exact menu Itemid found, lets dive into menu finder $checkmenu = JMenu::getInstance('site'); - $checkmenuItem = $checkmenu->getItem('link', 'index.php?option=com_digicom&view='.$view, true); + $checkmenuItem = $checkmenu->getItems('link', 'index.php?option=com_digicom&view='.$view, true); + - if(!is_null($checkmenuItem)){ + $total = count((array)$checkmenuItem); + if($total){ $menu = $checkmenu; $menuItem = $checkmenuItem; $query['Itemid'] = $menuItem->id; @@ -144,7 +147,8 @@ public function build(&$query) $menu = JMenu::getInstance('site'); $menuItem = $menu->getItems('link', 'index.php?option=com_digicom&view=orders', true); - if(!is_null($menuItem)){ + $total = count((array)$menuItem); + if($total){ $query['Itemid'] = $menuItem->id; $menuItemGiven = true; }else{ @@ -167,21 +171,19 @@ public function build(&$query) } } - elseif ($view == 'dashboard' or $view == 'downloads' or $view == 'download' or $view == 'profile' or $view == 'login' or $view == 'register' or $view == 'billing' or $view == 'thankyou') + elseif ($view == 'dashboard' or $view == 'downloads' or $view == 'download' or $view == 'profile' or $view == 'login' or $view == 'register' or $view == 'billing' or $view == 'thankyou' or $view == 'manager') { // now check if its downloads details view - if($view == 'download' or $view == 'downloads'){ + if($view == 'download'){ // check for downloads menu $menuItem = $menu->getItems('link', 'index.php?option=com_digicom&view=downloads', true); - - if(!is_null($menuItem)) { + $total = count((array)$menuItem); + if($total){ $query['Itemid'] = $menuItem->id; $menuItemGiven = true; - if($view == 'download'){ - $segments[] = $query['id']; - unset($query['id']); - } + $segments[] = $query['id']; + unset($query['id']); } } @@ -201,8 +203,8 @@ public function build(&$query) $menu = JMenu::getInstance('site'); $menuItem = $menu->getItems('link', 'index.php?option=com_digicom&view=cart', true); - //print_r($menuItem);die; - if(!is_null($menuItem)){ + $total = count((array)$menuItem); + if($total){ $query['Itemid'] = $menuItem->id; $menuItemGiven = true; }else{ @@ -219,25 +221,14 @@ public function build(&$query) } unset($query['view']); - } - elseif($view == 'cart') + }elseif($view == 'cart') { - $menu = JMenu::getInstance('site'); - $menuItem = $menu->getItems('link', 'index.php?option=com_digicom&view=cart', true); - if (!$menuItemGiven) { - if(!is_null($menuItem)){ - $query['Itemid'] = $menuItem->id; - $menuItemGiven = true; - unset($query['view']); - }else{ - $segments[] = $view; - } - }else{ - unset($query['view']); + $segments[] = $view; } + unset($query['view']); } // echo $view;die; // Handle product or category @@ -321,15 +312,14 @@ public function build(&$query) $menuItem = $menu->getItems('link', 'index.php?option=com_digicom&view=category&id='.$catid, true); //print_r($menuItem);die; - if(!is_null($menuItem) && count($menuItem)) - { + $total = count((array)$menuItem); + if($total){ $query['Itemid'] = $menuItem->id; $menuItemGiven = true; }else{ $menuItem = $menu->getItems('link', 'index.php?option=com_digicom&view=category&id=0', true); - //print_r($menuItem);die; - if(!is_null($menuItem) && count($menuItem)) - { + $total = count((array)$menuItem); + if($total){ $query['Itemid'] = $menuItem->id; $menuItemGiven = true; } @@ -377,7 +367,7 @@ public function build(&$query) // print_r($array);die; $array = array_reverse($array); - if (!$advanced && !is_null($array)) + if (!$advanced && count($array)) { $array[0] = (int) $catid . ':' . $array[0]; } @@ -462,7 +452,7 @@ public function build(&$query) } } - $total = !is_null($segments) ? count($segments) : 0; + $total = count($segments); for ($i = 0; $i < $total; $i++) { @@ -484,7 +474,7 @@ public function build(&$query) public function parse(&$segments) { $menu = JMenu::getInstance('site'); - $total = !is_null($segments) ? count($segments) : 0; + $total = count($segments); $vars = array(); for ($i = 0; $i < $total; $i++) @@ -502,7 +492,7 @@ public function parse(&$segments) $db = JFactory::getDbo(); // Count route segments - $count = !is_null($segments) ? count($segments) : 0; + $count = count($segments); // we have menu item, Check again if its com_digicom /* @@ -542,6 +532,7 @@ public function parse(&$segments) case "register": case "billing": case "thankyou": + case "manager": $vars['view'] = $item->query['view']; return $vars; @@ -736,17 +727,7 @@ public function parse(&$segments) } $vars['id'] = $cid; - -// if ($item->query['view'] == 'archive' && $count != 1) -// { -// $vars['year'] = $count >= 2 ? $segments[$count - 2] : null; -// $vars['month'] = $segments[$count - 1]; -// $vars['view'] = 'archive'; -// } -// else -// { - $vars['view'] = 'product'; - //} + $vars['view'] = 'product'; } $found = 0; diff --git a/src/com_digicom/site/templates/default/.gitignore b/src/com_digicom/site/templates/default/.gitignore deleted file mode 100644 index 75ce18e9..00000000 --- a/src/com_digicom/site/templates/default/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/bower_components -/node_modules diff --git a/src/com_digicom/site/templates/default/attribs.xml b/src/com_digicom/site/templates/default/attribs.sample.xml similarity index 100% rename from src/com_digicom/site/templates/default/attribs.xml rename to src/com_digicom/site/templates/default/attribs.sample.xml diff --git a/src/com_digicom/site/templates/default/downloads.php b/src/com_digicom/site/templates/default/downloads.php index 8c6968d2..6fbac4b6 100644 --- a/src/com_digicom/site/templates/default/downloads.php +++ b/src/com_digicom/site/templates/default/downloads.php @@ -33,7 +33,7 @@ params; - $pagination = $configs->get('download_pagination', 0); + $pagination = $configs->get('download_page', 0); $this->itemList = $items; diff --git a/src/com_digicom/site/templates/default/manager.php b/src/com_digicom/site/templates/default/manager.php new file mode 100644 index 00000000..2791a39f --- /dev/null +++ b/src/com_digicom/site/templates/default/manager.php @@ -0,0 +1,240 @@ +input; +$configs = $this->configs; + +$n = !is_null($this->orders) ? count($this->orders) : 0; +$k = 0; + +JFactory::getDocument()->addScriptDeclaration(' + Joomla.submitbutton = function(task) + { + if (task == "orders.cycleStatus") + { + var c = confirm("You are going to change Order status, Are you sure you want to proceed?"); + if(c) {Joomla.submitform(task);} + else {jQuery("#manager-order-list").removeClass("hide");jQuery("#manager-order-list").addClass("hide");} + } + }; +'); + +?> + +
+ + + +

+ + trigger('onDigicomManagerAfterTitle',array('com_digicom.manager')); ?> + +
+ + params->get('filter_field', 1) || $this->params->get('show_pagination_limit', 1)) : ?> +
+ params->get('filter_field', 1)) :?> +
+ + + + + +
+ + + params->get('show_pagination_limit', 1)) : ?> +
+ + + pagination->getLimitBox(); ?> +
+ + + + + + +
+
+ + + + + + + + +
+ + + + + + + + + + + + + + + + 0){ + foreach($this->orders as $key=>$order){ + // print_r($order);die; + $id = $order->id; + $order_link = JRoute::_("index.php?option=com_digicom&view=order&id=".$id); + $rec_link = JRoute::_("index.php?option=com_digicom&view=order&layout=invoice&id=".$id."&tmpl=component"); + + // Price + $order_price = DigiComSiteHelperPrice::format_price($order->amount_paid, $order->currency, true, $configs); + ?> + + + + + + + + + + + + + + + + + + +
+ + + #id; ?> + processor; ?> + + name ?> + + order_date;?> + + status) === 'active') $labelClass = 'label-success'; + elseif ( strtolower($order->status) === 'pending') $labelClass = 'label-warning'; + ?> + status; ?> + + number_of_products; ?> + $orderitem) { + ?> + + name; ?> + + + + + amount, $order->currency, true, $configs); ?> + + + + status, $i, $order); ?> +
+ +
+
+ + + trigger('onDigicomManagerAfterList',array('com_digicom.manager')); ?> + + + + + + +
diff --git a/src/com_digicom/site/templates/default/order.php b/src/com_digicom/site/templates/default/order.php index 27b5002f..f9461c1e 100644 --- a/src/com_digicom/site/templates/default/order.php +++ b/src/com_digicom/site/templates/default/order.php @@ -171,6 +171,14 @@ + authorise('core.manage', 'com_digicom')) + { + // Load item template + echo $this->loadTemplate('logs'); + } + ?> + diff --git a/src/com_digicom/site/templates/default/order_logs.php b/src/com_digicom/site/templates/default/order_logs.php new file mode 100644 index 00000000..1e46839c --- /dev/null +++ b/src/com_digicom/site/templates/default/order_logs.php @@ -0,0 +1,63 @@ + +
+

Logs

+ + + + + + + + + + + + + order->logs as $key=>$log): ?> + + + + + + + + + + + +
+ + + + + + + + + + + +
+ id;?> + + type;?> + + message;?> + + status;?> + + created;?> + + ip;?> +
+
diff --git a/src/com_digicom/site/views/category/view.html.php b/src/com_digicom/site/views/category/view.html.php index 88a35bf2..cefba654 100644 --- a/src/com_digicom/site/views/category/view.html.php +++ b/src/com_digicom/site/views/category/view.html.php @@ -99,7 +99,8 @@ public function display($tpl = null) $this->category->event->afterDisplayContent = trim(implode("\n", $results)); // Compute the product slugs and prepare introtext (runs content plugins). - if(count($this->items)) + $total = !is_null($this->items) ? count($this->items) : 0; + if($total) { foreach ($this->items as $item) { @@ -369,7 +370,7 @@ public function commonCategoryDisplay() $children = array($category->id => $children); // Escape strings for HTML output - $this->pageclass_sfx = htmlspecialchars($params->get('pageclass_sfx')); + $this->pageclass_sfx = htmlspecialchars((string)$params->get('pageclass_sfx')); $maxLevel = $params->get('maxLevel', -1); $this->maxLevel = &$maxLevel; diff --git a/src/com_digicom/site/views/checkout/view.html.php b/src/com_digicom/site/views/checkout/view.html.php index d81cf267..2c6c489c 100644 --- a/src/com_digicom/site/views/checkout/view.html.php +++ b/src/com_digicom/site/views/checkout/view.html.php @@ -50,8 +50,20 @@ function display($tpl = null) if(!isset($order->id) or $order->id <= 0){ $app->redirect(JRoute::_('index.php?option=com_digicom&view=cart')); } + if(empty($order->params)) + { + $orderItems = $this->get('OrderItems'); + // print_r($orderItems);die; + $params = new stdClass; + $params->order_id = $order->id; + $params->order_amount = $order->amount; + $params->products = $orderItems; + } + else + { + $params = json_decode($order->params);//print_r($params);die; + } - $params = json_decode($order->params);//print_r($params);die; $items = $params->products;//print_r($items);die; $vars = new stdClass(); diff --git a/src/com_digicom/site/views/manager/index.html b/src/com_digicom/site/views/manager/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/src/com_digicom/site/views/manager/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/com_digicom/site/views/manager/metadata.xml b/src/com_digicom/site/views/manager/metadata.xml new file mode 100644 index 00000000..68e18fa2 --- /dev/null +++ b/src/com_digicom/site/views/manager/metadata.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/src/com_digicom/site/views/manager/tmpl/default.php b/src/com_digicom/site/views/manager/tmpl/default.php new file mode 100644 index 00000000..9d3f186f --- /dev/null +++ b/src/com_digicom/site/views/manager/tmpl/default.php @@ -0,0 +1,10 @@ + + + + + + + + diff --git a/src/com_digicom/site/views/manager/tmpl/index.html b/src/com_digicom/site/views/manager/tmpl/index.html new file mode 100644 index 00000000..fa6d84e8 --- /dev/null +++ b/src/com_digicom/site/views/manager/tmpl/index.html @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/src/com_digicom/site/views/manager/view.html.php b/src/com_digicom/site/views/manager/view.html.php new file mode 100644 index 00000000..ff4e853b --- /dev/null +++ b/src/com_digicom/site/views/manager/view.html.php @@ -0,0 +1,103 @@ +authorise('core.manage', 'com_digicom')) + { + return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR')); + } + + $app = JFactory::getApplication(); + $input = $app->input; + $customer = new DigiComSiteHelperSession(); + + $this->orders = $this->get('Items'); + + $this->pagination = $this->get('pagination'); + $this->state = $this->get('State'); + $this->params = $this->state->get('params'); + $this->configs = JComponentHelper::getComponent('com_digicom')->params; + + + $template = new DigiComSiteHelperTemplate($this); + $template->rander('manager'); + + $this->_prepareDocument(); + parent::display($tpl); + } + + /** + * Prepares the document. + * + * @return void. + */ + protected function _prepareDocument() + { + $app = JFactory::getApplication(); + $menus = $app->getMenu(); + $pathway = $app->getPathway(); + $title = null; + + // Because the application sets a default page title, + // we need to get it from the menu item itself + $menu = $menus->getActive(); + + if ($menu) + { + $this->params->def('page_heading', $this->params->get('page_title', $menu->title)); + } + else + { + $this->params->def('page_heading', JText::_('COM_DIGICOM_MANAGER_PAGE_TITLE')); + } + + $title = $this->params->get('page_title', ''); + + // Check for empty title and add site name if param is set + if (empty($title)) + { + $title = $app->get('sitename'); + } + elseif ($app->get('sitename_pagetitles', 0) == 1) + { + $title = JText::sprintf('JPAGETITLE', $app->get('sitename'), $title); + } + elseif ($app->get('sitename_pagetitles', 0) == 2) + { + $title = JText::sprintf('JPAGETITLE', $title, $app->get('sitename')); + } + + $this->document->setTitle($title); + + if ($this->params->get('menu-meta_description')) + { + $this->document->setDescription($this->params->get('menu-meta_description')); + } + + if ($this->params->get('menu-meta_keywords')) + { + $this->document->setMetadata('keywords', $this->params->get('menu-meta_keywords')); + } + + if ($this->params->get('robots')) + { + $this->document->setMetadata('robots', $this->params->get('robots')); + } + + } +} diff --git a/src/com_digicom/site/views/order/view.html.php b/src/com_digicom/site/views/order/view.html.php index 5b31c31c..9f2af0c5 100644 --- a/src/com_digicom/site/views/order/view.html.php +++ b/src/com_digicom/site/views/order/view.html.php @@ -37,7 +37,10 @@ function display($tpl = null) } elseif($this->order->userid != $this->customer->_customer->id) { - return JError::raiseError(203, JText::_('COM_DIGICOM_ORDER_NOT_OWN')); + if (!JFactory::getUser()->authorise('core.manage', 'com_digicom')) + { + return JError::raiseError(203, JText::_('COM_DIGICOM_ORDER_NOT_OWN')); + } } $layout = $input->get('layout','order'); diff --git a/src/com_digicom/site/views/product/view.html.php b/src/com_digicom/site/views/product/view.html.php index e48fa481..2f2ff392 100644 --- a/src/com_digicom/site/views/product/view.html.php +++ b/src/com_digicom/site/views/product/view.html.php @@ -148,7 +148,7 @@ public function display($tpl = null) } // Escape strings for HTML output - $this->pageclass_sfx = htmlspecialchars($this->item->params->get('pageclass_sfx')); + $this->pageclass_sfx = htmlspecialchars((string)$this->item->params->get('pageclass_sfx')); $this->_prepareDocument(); $this->category->params = $this->category->getParams(); diff --git a/src/com_digicom/site/views/thankyou/view.html.php b/src/com_digicom/site/views/thankyou/view.html.php index 6116ae94..147eba04 100644 --- a/src/com_digicom/site/views/thankyou/view.html.php +++ b/src/com_digicom/site/views/thankyou/view.html.php @@ -17,10 +17,16 @@ class DigiComViewThankYou extends JViewLegacy function display($tpl = null) { - $app = JFactory::getApplication(); + $app = JFactory::getApplication(); $session = JFactory::getSession(); - $digicom_session = $session->get('com_digicom', array()); $this->state = $this->get('State'); + $digicom_session = $session->get('com_digicom'); + + if(!$digicom_session && $app->input->get('order_id')){ + $session->set('com_digicom', array('action' => 'payment_complete', 'id' => $app->input->get('order_id'))); + $digicom_session = $session->get('com_digicom'); + } + if(isset($digicom_session['action']) && $digicom_session['action'] == 'payment_complete' && $digicom_session['id']) { diff --git a/src/mod_digicom_menu/language/en-GB/en-GB.mod_digicom_menu.ini b/src/mod_digicom_menu/language/en-GB/en-GB.mod_digicom_menu.ini index 566c7d2e..321d55bb 100644 --- a/src/mod_digicom_menu/language/en-GB/en-GB.mod_digicom_menu.ini +++ b/src/mod_digicom_menu/language/en-GB/en-GB.mod_digicom_menu.ini @@ -3,6 +3,7 @@ ; License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php ; Note : All ini files need to be saved as UTF-8 - No BOM +COM_DIGICOM = "Digicom" MOD_DIGICOM_MENU="Administrator DigiCom Menu" MOD_DIGICOM_MENU_FIELD_SHOW_DIGICOM_MENU_LABEL="Show DigiCom Menu" MOD_DIGICOM_MENU_FIELD_SHOW_DIGICOM_MENU_DESC="Show or hide the DigiCom Menu on top while in editing sections" diff --git a/src/mod_digicom_menu/language/en-GB/en-GB.mod_digicom_menu.sys.ini b/src/mod_digicom_menu/language/en-GB/en-GB.mod_digicom_menu.sys.ini index edb6815e..18f8bf84 100644 --- a/src/mod_digicom_menu/language/en-GB/en-GB.mod_digicom_menu.sys.ini +++ b/src/mod_digicom_menu/language/en-GB/en-GB.mod_digicom_menu.sys.ini @@ -3,5 +3,6 @@ ; License http://www.gnu.org/licenses/gpl-2.0.html GNU/GPL, see LICENSE.php ; Note : All ini files need to be saved as UTF-8 - No BOM +COM_DIGICOM = "Digicom" MOD_DIGICOM_MENU="Administrator DigiCom Menu" MOD_DIGICOM_MENU_XML_DESCRIPTION="DigiCom Administrator Menu Module"