diff --git a/src/com_digicom/admin/helpers/digicom.php b/src/com_digicom/admin/helpers/digicom.php index 38750add..a25df998 100644 --- a/src/com_digicom/admin/helpers/digicom.php +++ b/src/com_digicom/admin/helpers/digicom.php @@ -110,8 +110,12 @@ public static function renderSidebar(){ } - public static function format_price ($amount, $ccode, $add_sym = true, $configs, $decial = null) + public static function format_price ($amount, $ccode, $add_sym, $configs, $decial = null) { + if(empty($add_sym)){ + $add_sym = true; + } + if($decial === NULL){ $decial = $configs->get('decimaldigits','2'); } diff --git a/src/com_digicom/site/helpers/price.php b/src/com_digicom/site/helpers/price.php index cf0c497b..2495df02 100644 --- a/src/com_digicom/site/helpers/price.php +++ b/src/com_digicom/site/helpers/price.php @@ -16,8 +16,11 @@ class DigiComSiteHelperPrice { /** * price formet helper */ - public static function format_price( $amount, $ccode, $add_sym = false, $configs ) + public static function format_price( $amount, $ccode, $add_sym, $configs ) { + if(empty($add_sym)){ + $add_sym = false; + } $currency_use = $configs->get('currency_use','symbol'); $currency_symbol = $configs->get('currency_symbol','$'); diff --git a/src/com_digicom/site/models/cart.php b/src/com_digicom/site/models/cart.php index b0e18b48..73499a0b 100644 --- a/src/com_digicom/site/models/cart.php +++ b/src/com_digicom/site/models/cart.php @@ -972,7 +972,10 @@ function updateOrder($order_id, $result, $data, $pay_plugin, $status, $items, $c $type = 'process_order'; if($status != 'Refund') { - $orderTable->amount_paid = $orderTable->amount_paid + $data['total_paid_amt']; + if((float)$data['total_paid_amt']>0){ + $orderTable->amount_paid = (float)$orderTable->amount_paid + (float)$data['total_paid_amt']; + } + $orderTable->amount_paid = (float)$orderTable->amount_paid; } else{ // as refund, check if has refund amout else all @@ -1114,8 +1117,15 @@ function goToSuccessURL( $sid, $msg = '', $orderid = 0 , $type = 'new_order') } - function getFinalize( $sid, $msg = '', $orderid = 0 , $type, $status) + function getFinalize( $sid, $msg, $orderid, $type, $status) { + if(empty($orderid)){ + $orderid = 0; + } + + if(empty($msg)){ + $msg = ""; + } global $Itemid; $conf = $this->getInstance( "config", "digicomModel" ); diff --git a/src/com_digicom/site/models/categories.php b/src/com_digicom/site/models/categories.php index d6065ee7..4cc837bc 100644 --- a/src/com_digicom/site/models/categories.php +++ b/src/com_digicom/site/models/categories.php @@ -87,7 +87,8 @@ protected function getStoreId($id = '') */ public function getItems() { - if (!count($this->_items)) + // dd($this->_items); + if (empty($this->_items)) { $app = JFactory::getApplication(); $menu = $app->getMenu(); diff --git a/src/com_digicom/site/router.php b/src/com_digicom/site/router.php index a991357d..ff0c024a 100644 --- a/src/com_digicom/site/router.php +++ b/src/com_digicom/site/router.php @@ -59,8 +59,9 @@ 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)){ + // dd($menuItem); + + if(!is_null($menuItem)){ $query['Itemid'] = $menuItem->id; $menuItemGiven = true; }else{ diff --git a/src/com_digicom/site/views/category/view.html.php b/src/com_digicom/site/views/category/view.html.php index 88a35bf2..01cf64f3 100644 --- a/src/com_digicom/site/views/category/view.html.php +++ b/src/com_digicom/site/views/category/view.html.php @@ -99,7 +99,7 @@ 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)) + if(!empty($this->items) && count($this->items)) { foreach ($this->items as $item) { @@ -267,12 +267,13 @@ protected function prepareDocument() $path = array(array('title' => $this->category->title, 'link' => '')); $category = $this->category->getParent(); if(!empty($category)){ - while (($menu->query['option'] != 'com_digicom' || $menu->query['view'] == 'product' || $id != $category->id) && $category->id > 1) + + + while (($menu->query['option'] != 'com_digicom' || $menu->query['view'] == 'product' || !empty($category->id) && $id != $category->id) && $category->id > 1) { $path[] = array('title' => $category->title, 'link' => DigiComSiteHelperRoute::getCategoryRoute($category->id)); $category = $category->getParent(); } - } $path = array_reverse($path); diff --git a/src/com_digicom/site/views/product/view.html.php b/src/com_digicom/site/views/product/view.html.php index e48fa481..a1b93dc7 100644 --- a/src/com_digicom/site/views/product/view.html.php +++ b/src/com_digicom/site/views/product/view.html.php @@ -229,9 +229,8 @@ protected function _prepareDocument() $category = $category->getParent(); if($currentTemplate) continue; - $catParams = new Registry; - $catParams->loadString($category->getParams()); + $catParams->loadString($category->params ?? '{}'); $category_layout = $catParams->get('category_layout',''); if(!empty($category_layout)){ diff --git a/src/plg_digicom_pay_paypal/paypal/helper.php b/src/plg_digicom_pay_paypal/paypal/helper.php index 3bd72a3c..c2c162b0 100644 --- a/src/plg_digicom_pay_paypal/paypal/helper.php +++ b/src/plg_digicom_pay_paypal/paypal/helper.php @@ -25,8 +25,16 @@ class plgDigiCom_PayPaypalHelper * @secure_post = if you want https * @sandbox = if you use sandbox or demo or dev mode */ - public static function buildPaymentSubmitUrl($secure_post = true, $sandbox = false) + public static function buildPaymentSubmitUrl($secure_post, $sandbox) { + if(empty($secure_post)){ + $secure_post = true; + } + + if(empty($sandbox)){ + $sandbox = false; + } + $url = $sandbox ? 'www.sandbox.paypal.com' : 'www.paypal.com'; if ($secure_post) { $url = 'https://'.$url.'/cgi-bin/webscr'; @@ -106,8 +114,13 @@ public static function Storelog($name, $data) * * @since 1.0.0 */ - public static function validateIPN($data, $sandbox = false, $params, $componentName = 'digicom') + public static function validateIPN($data, $sandbox, $params, $componentName = 'digicom') { + if(empty($sandbox)){ + $sandbox = false; + } + + $url = plgDigiCom_PayPaypalHelper::buildIPNPaymentUrl(true, $sandbox); // STEP 1: read POST data @@ -216,8 +229,12 @@ public static function validateIPN($data, $sandbox = false, $params, $componentN * * @since 1.0.0 */ - public function validateIPN_x($data, $sandbox = false, $params, $componentName = 'digicom') + public function validateIPN_x($data, $sandbox, $params, $componentName = 'digicom') { + if(empty($sandbox)){ + $sandbox = false; + } + $version = new \JVersion; $httpOption = new \Joomla\Registry\Registry; $status = true;