Explorar o código

Ticket #259 - Grid based Shopping Cart.

AntonLV %!s(int64=10) %!d(string=hai) anos
pai
achega
ea862e5692

+ 52 - 20
modules/boonex/payment/classes/BxPaymentCart.php

@@ -11,42 +11,66 @@
 
 class BxPaymentCart extends BxBaseModPaymentCart
 {
-    protected $_sLangsPrefix;
-
     function __construct()
     {
     	$this->MODULE = 'bx_payment';
 
     	parent::__construct();
-
-        $this->_sLangsPrefix = $this->_oModule->_oConfig->getPrefix('langs');
     }
 
     /*
      * Service methods
      */
-	public function serviceGetBlockCart($iVendor = BX_PAYMENT_EMPTY_ID)
+	public function serviceGetBlockCarts()
+    {
+    	$CNF = &$this->_oModule->_oConfig->CNF;
+
+    	if(bx_get('seller_id') !== false)
+    		return '';
+
+    	$iUserId = $this->_oModule->getProfileId();
+        if(empty($iUserId))
+            return MsgBox(_t($CNF['T']['ERR_REQUIRED_LOGIN']));
+
+        return array(
+        	'content' => $this->_oModule->_oTemplate->displayBlockCarts($iUserId),
+        	'menu' => $this->_oModule->_oConfig->getObject('menu_cart_submenu')
+        );
+    }
+
+	public function serviceGetBlockCart()
     {
-    	$iVendor = (int)$iVendor;
+    	// Don't show the block at all if 'seller_id' not exists.
+    	if(bx_get('seller_id') === false)
+    		return '';
+
+    	$CNF = &$this->_oModule->_oConfig->CNF;
 
     	$iUserId = $this->_oModule->getProfileId();
         if(empty($iUserId))
-            return MsgBox(_t($this->_sLangsPrefix . 'err_required_login'));
+            return MsgBox(_t($CNF['T']['ERR_REQUIRED_LOGIN']));
+
+    	$iSellerId = bx_process_input(bx_get('seller_id'), BX_DATA_INT);
+    	if(empty($iSellerId))
+    		return MsgBox(_t($CNF['T']['ERR_UNKNOWN_VENDOR']));
 
-        $aCartInfo = $this->getInfo(BX_PAYMENT_TYPE_SINGLE, $iUserId, $iVendor);
+		$aSeller = $this->_oModule->getProfileInfo();
         return array(
-        	'content' => $this->_oModule->_oTemplate->displayBlockCart($aCartInfo, $iVendor),
+        	'title' => _t($CNF['T']['BLOCK_TITLE_CART'], $aSeller['name']),
+        	'content' => $this->_oModule->_oTemplate->displayBlockCart($iUserId, $iSellerId),
         	'menu' => $this->_oModule->_oConfig->getObject('menu_cart_submenu')
         );
     }
 
     public function serviceGetBlockCartHistory()
     {
+    	$CNF = &$this->_oModule->_oConfig->CNF;
+
 		$iVendorId = bx_get('vendor') !== false ? (int)bx_get('vendor') : 0;
 
     	$iUserId = $this->_oModule->getProfileId();
         if(empty($iUserId))
-            return MsgBox(_t($this->_sLangsPrefix . 'err_required_login'));
+            return MsgBox(_t($CNF['T']['ERR_REQUIRED_LOGIN']));
 
         return array(
         	'content' => $this->_oModule->_oTemplate->displayBlockHistory($iUserId, $iVendorId),
@@ -56,6 +80,8 @@ class BxPaymentCart extends BxBaseModPaymentCart
 
     public function serviceAddToCart($iVendorId, $iModuleId, $iItemId, $iItemCount)
     {
+    	$CNF = &$this->_oModule->_oConfig->CNF;
+
     	$iClientId = $this->_oModule->getProfileId();
 
     	$mixedResult = $this->_checkData($iClientId, $iVendorId, $iModuleId, $iItemId, $iItemCount);
@@ -64,7 +90,7 @@ class BxPaymentCart extends BxBaseModPaymentCart
 
         $aVendorProviders = $this->_oModule->_oDb->getVendorInfoProvidersCart($iVendorId);
         if(empty($aVendorProviders))
-            return array('code' => 5, 'message' => _t($this->_sLangsPrefix . 'err_not_accept_payments'));
+            return array('code' => 5, 'message' => _t($CNF['T']['ERR_NOT_ACCEPT_PAYMENTS']));
 
         $sCartItem = $this->_oModule->_oConfig->descriptorA2S(array($iVendorId, $iModuleId, $iItemId, $iItemCount));
         $sCartItems = $this->_oModule->_oDb->getCartItems($iClientId);
@@ -87,7 +113,7 @@ class BxPaymentCart extends BxBaseModPaymentCart
 
         return array(
         	'code' => 0, 
-        	'message' => _t($this->_sLangsPrefix . 'msg_successfully_added'), 
+        	'message' => _t($CNF['T']['MSG_ITEM_ADDED']), 
         	'total_quantity' => $iTotalQuantity,
 	        //TODO: Update account submenu if it's needed.  
         	'content' => '' //$this->_oModule->_oTemplate->displayToolbarSubmenu($aInfo)
@@ -96,12 +122,14 @@ class BxPaymentCart extends BxBaseModPaymentCart
 
     public function serviceDeleteFromCart($iVendorId, $iModuleId = 0, $iItemId = 0)
     {
+    	$CNF = &$this->_oModule->_oConfig->CNF;
+
         if($iVendorId == BX_PAYMENT_EMPTY_ID)
-            return array('code' => 1, 'message' => _t($this->_sLangsPrefix . 'err_wrong_data'));
+            return array('code' => 1, 'message' => _t($CNF['T']['ERR_WRONG_DATA']));
 
 		$iClientId = $this->_oModule->getProfileId();
         if(empty($iClientId))
-            return array('code' => 2, 'message' => _t($this->_sLangsPrefix . 'err_required_login'));
+            return array('code' => 2, 'message' => _t($CNF['T']['ERR_REQUIRED_LOGIN']));
 
         if(!empty($iModuleId) && !empty($iItemId))
             $sPattern = "'" . $iVendorId . "_" . $iModuleId . "_" . $iItemId . "_[0-9]+:?'";
@@ -112,11 +140,13 @@ class BxPaymentCart extends BxBaseModPaymentCart
         $sCartItems = trim(preg_replace($sPattern, "", $sCartItems), ":");
         $this->_oModule->_oDb->setCartItems($iClientId, $sCartItems);
 
-        return array('code' => 0, 'message' => _t($this->_sLangsPrefix . 'inf_successfully_deleted'));
+        return array('code' => 0, 'message' => _t($CNF['T']['MSG_ITEM_DELETED']));
     }
 
 	public function serviceSubscribe($iVendorId, $iModuleId, $iItemId, $iItemCount)
     {
+    	$CNF = &$this->_oModule->_oConfig->CNF;
+
     	$iClientId = $this->_oModule->getProfileId();
 
     	$mixedResult = $this->_checkData($iClientId, $iVendorId, $iModuleId, $iItemId, $iItemCount);
@@ -125,7 +155,7 @@ class BxPaymentCart extends BxBaseModPaymentCart
 
         $aVendorProviders = $this->_oModule->_oDb->getVendorInfoProvidersSubscription($iVendorId);
         if(empty($aVendorProviders))
-            return array('code' => 5, 'message' => _t($this->_sLangsPrefix . 'err_not_accept_payments'));
+            return array('code' => 5, 'message' => _t($CNF['T']['ERR_NOT_ACCEPT_PAYMENTS']));
 
         $sCartItem = $this->_oModule->_oConfig->descriptorA2S(array($iVendorId, $iModuleId, $iItemId, $iItemCount));
 
@@ -145,19 +175,21 @@ class BxPaymentCart extends BxBaseModPaymentCart
 
     protected function _checkData($iClientId, $iVendorId, $iModuleId, $iItemId, $iItemCount)
     {
+    	$CNF = &$this->_oModule->_oConfig->CNF;
+
 		if($iVendorId == BX_PAYMENT_EMPTY_ID || empty($iModuleId) || empty($iItemId) || empty($iItemCount))
-            return array('code' => 1, 'message' => _t($this->_sLangsPrefix . 'err_wrong_data'));
+            return array('code' => 1, 'message' => _t($CNF['T']['ERR_WRONG_DATA']));
 
 		$iClientId = $this->_oModule->getProfileId();
         if(empty($iClientId))
-            return array('code' => 2, 'message' => _t($this->_sLangsPrefix . 'err_required_login'));
+            return array('code' => 2, 'message' => _t($CNF['T']['ERR_REQUIRED_LOGIN']));
 
         if($iClientId == $iVendorId)
-            return array('code' => 3, 'message' => _t($this->_sLangsPrefix . 'err_purchase_from_yourself'));
+            return array('code' => 3, 'message' => _t($CNF['T']['ERR_SELF_PURCHASE']));
 
         $aVendor = $this->_oModule->getVendorInfo($iVendorId);
         if(!$aVendor['active'])
-            return array('code' => 4, 'message' => _t($this->_sLangsPrefix . 'err_inactive_vendor'));
+            return array('code' => 4, 'message' => _t($CNF['T']['ERR_INACTIVE_VENDOR']));
 
 		return true;
     }

+ 22 - 2
modules/boonex/payment/classes/BxPaymentConfig.php

@@ -15,18 +15,38 @@ class BxPaymentConfig extends BxBaseModPaymentConfig
     {
         parent::__construct($aModule);
 
+        $sBaseUrl = BX_DOL_URL_ROOT . $this->getBaseUri();
+
         $this->CNF = array_merge($this->CNF, array(
         	'URL_JOIN' => 'page.php?i=payment-join',
+        	'URL_CARTS' => 'page.php?i=payment-carts',
         	'URL_CART' => 'page.php?i=payment-cart',
+        	'URL_CART_CHECKOUT' => $sBaseUrl . 'initialize_checkout/' . BX_PAYMENT_TYPE_SINGLE . '/',
         	'URL_HISTORY' => 'page.php?i=payment-history',
         	'URL_ORDERS' => 'page.php?i=payment-orders',
         	'URL_DETAILS' => 'page.php?i=payment-details',
         	'URL_RETURN' => 'page.php?i=payment-cart',
-        	'URL_RETURN_DATA' => BX_DOL_URL_ROOT . $this->getBaseUri() . 'finalize_checkout/',
-        	'URL_NOTIFY' => BX_DOL_URL_ROOT . $this->getBaseUri() . 'notify/',
+        	'URL_RETURN_DATA' => $sBaseUrl . 'finalize_checkout/',
+        	'URL_NOTIFY' => $sBaseUrl . 'notify/',
 
         	'KEY_ARRAY_PRICE_SINGLE' => 'price_single',
         	'KEY_ARRAY_PRICE_RECURRING' => 'price_recurring',
+        
+	        // some language keys
+        	'T' => array(
+        		'MSG_ITEM_ADDED' => '_bx_payment_msg_item_added',
+        		'MSG_ITEM_DELETED' => '_bx_payment_msg_item_deleted',
+        		'ERR_WRONG_DATA' => '_bx_payment_err_wrong_data',
+        		'ERR_REQUIRED_LOGIN' => '_bx_payment_err_required_login',
+        		'ERR_NOT_ACCEPT_PAYMENTS' => '_bx_payment_err_not_accept_payments',
+        		'ERR_SELF_PURCHASE' => '_bx_payment_err_self_purchase',
+        		'ERR_INACTIVE_VENDOR' => '_bx_payment_err_inactive_vendor',
+        		'ERR_UNKNOWN_VENDOR' => '_bx_payment_err_unknown_vendor',
+
+				'BLOCK_TITLE_CART' => '_bx_payment_page_block_title_cart',
+        
+        		'TXT_CART_PROVIDER' => '_bx_payment_txt_cart_'
+        	)
         ));
 
         $this->_aHtmlIds = array(

+ 116 - 0
modules/boonex/payment/classes/BxPaymentGridCart.php

@@ -0,0 +1,116 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    Payment Payment
+ * @ingroup     TridentModules
+ * 
+ * @{
+ */
+
+
+class BxPaymentGridCart extends BxBaseModPaymentGridCarts
+{
+    public function __construct ($aOptions, $oTemplate = false)
+    {
+    	$this->MODULE = 'bx_payment';
+
+        parent::__construct ($aOptions, $oTemplate);
+
+        $this->_bSelectAll = true;
+    }
+
+    public function performActionCheckout()
+    {
+    	$aParams = array(
+			'seller_id' => bx_process_input(bx_get('seller_id'), BX_DATA_INT), 
+			'provider' => bx_process_input(bx_get('proviter')), 
+			'items' => bx_process_input(bx_get('ids'))    		
+    	);
+    	if(empty($aParams['seller_id']) || empty($aParams['provider']))
+    		return echoJson(array());
+
+        if(empty($aParams['items']) || !is_array($aParams['items'])) 
+        	return echoJson(array('msg' => _t('_bx_payment_err_nothing_selected')));
+
+		$sLink = $this->_oModule->_oConfig->getUrl('URL_CART_CHECKOUT');
+		$sLink = $sLink . (strpos($sLink, '?') === false ? '?' : '&') . http_build_query($aParams);
+
+		echoJson(array(
+			'eval' => $this->_oModule->_oConfig->getJsObject('cart') . '.onCartCheckout(oData);', 
+			'link' => $sLink
+		));
+    }
+
+    protected function _getCellTitle($mixedValue, $sKey, $aField, $aRow)
+    {
+    	return parent::_getCellDefault($this->_oModule->_oTemplate->displayLink('link', array(
+    		'href' => $aRow['url'],
+    		'title' => $aRow['title'],
+    		'content' => $aRow['title']
+    	)), $sKey, $aField, $aRow);
+    }
+
+	protected function _getCellPriceSingle($mixedValue, $sKey, $aField, $aRow)
+    {
+        return parent::_getCellDefault($this->_sCurrencySign . $mixedValue, $sKey, $aField, $aRow);
+    }
+
+    protected function _getActions ($sType, $sActionData = false, $isSmall = false, $isDisabled = false, $isPermanentState = false, $aRow = array())
+    {
+    	$CNF = &$this->_oModule->_oConfig->CNF;
+    	
+    	$sActionsCustom = '';
+    	if($sType == 'bulk' && !empty($this->_aQueryAppend['seller_id'])) {
+    		$sActionName = 'checkout';
+
+    		$aProviders = $this->_oModule->_oDb->getVendorInfoProvidersCart($this->_aQueryAppend['seller_id']);
+    		foreach($aProviders as $aProvider) {
+				$aAction = array(
+					'title'=> _t($CNF['T']['TXT_CART_PROVIDER'] . $aProvider['name']),
+	    			'icon' => '',
+					'icon_only' => 0,
+	    			'confirm' => 0,
+					'attr' => array(
+						'bx_grid_action_' . $sType => $sActionName,
+						'bx_grid_action_append' => json_encode(array('proviter' => $aProvider['name'])),
+						'bx_grid_action_confirm' => 0,
+						'bx_grid_action_reset_paginate' => 0,
+					)
+				);
+
+    			$sActionsCustom .= $this->_getActionDefault($sType, $sActionName, $aAction, $isSmall, $isDisabled, $aRow);
+    		}
+    	}
+
+    	return $sActionsCustom . parent::_getActions ($sType, $sActionData, $isSmall, $isDisabled, $isPermanentState, $aRow);
+    }
+
+	protected function _getDataArray($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage)
+    {
+		if(empty($this->_aQueryAppend['client_id']) || empty($this->_aQueryAppend['seller_id']))
+			return array();
+
+		$aCart = $this->_oCart->getInfo(BX_PAYMENT_TYPE_SINGLE, $this->_aQueryAppend['client_id'], $this->_aQueryAppend['seller_id']);
+		foreach($aCart['items'] as $aCartItem) {
+			$aCartItem['descriptor'] = $this->_oModule->_oConfig->descriptorA2S(array($aCart['vendor_id'], $aCartItem['module_id'], $aCartItem['id'], $aCartItem['quantity']));
+			$aCartItem['description'] = strip_tags($aCartItem['description']);
+
+			$this->_aOptions['source'][] = $aCartItem;
+		}
+
+        return parent::_getDataArray($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage);
+    }
+
+    protected function _delete($mixedId)
+    {
+    	list($iVendorId, $iModuleId, $iItemId) = $this->_oModule->_oConfig->descriptorS2A($mixedId);
+    	if((int)$iVendorId != (int)$this->_aQueryAppend['seller_id'])
+    		return false;
+
+    	return $this->_oCart->serviceDeleteFromCart($iVendorId, $iModuleId, $iItemId);
+    }
+}
+
+/** @} */

+ 67 - 0
modules/boonex/payment/classes/BxPaymentGridCarts.php

@@ -0,0 +1,67 @@
+<?php defined('BX_DOL') or die('hack attempt');
+/**
+ * Copyright (c) BoonEx Pty Limited - http://www.boonex.com/
+ * CC-BY License - http://creativecommons.org/licenses/by/3.0/
+ *
+ * @defgroup    Payment Payment
+ * @ingroup     TridentModules
+ * 
+ * @{
+ */
+
+
+class BxPaymentGridCarts extends BxBaseModPaymentGridCarts
+{
+    public function __construct ($aOptions, $oTemplate = false)
+    {
+    	$this->MODULE = 'bx_payment';
+
+        parent::__construct ($aOptions, $oTemplate);
+    }
+
+    public function performActionContinue()
+    {
+    	$aIds = bx_get('ids');
+        if(!$aIds || !is_array($aIds)) 
+        	return echoJson(array());
+
+		$iId = array_shift($aIds);
+
+		echoJson(array(
+			'eval' => $this->_oModule->_oConfig->getJsObject('cart') . '.onCartContinue(oData);', 
+			'link' => bx_append_url_params($this->_oModule->_oConfig->getUrl('URL_CART'), array('seller_id' => $iId)) 
+		));
+    }
+
+	protected function _getCellVendorId($mixedValue, $sKey, $aField, $aRow)
+    {
+    	return parent::_getCellDefault($this->_oModule->_oTemplate->displayProfileLink(array(
+    		'id' => $mixedValue,
+    		'name' => $aRow['vendor_name'],
+    		'title' => _t('_bx_payment_txt_checkout_to', $aRow['vendor_name']),
+    		'link' => bx_append_url_params($this->_oModule->_oConfig->getUrl('URL_CART'), array('seller_id' => (int)$mixedValue))
+    	)), $sKey, $aField, $aRow);
+    }
+
+	protected function _getCellItemsPrice($mixedValue, $sKey, $aField, $aRow)
+    {
+        return parent::_getCellDefault($this->_sCurrencySign . $mixedValue, $sKey, $aField, $aRow);
+    }
+
+	protected function _getDataArray($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage)
+    {
+		if(empty($this->_aQueryAppend['client_id']))
+			return array();
+
+		$this->_aOptions['source'] = $this->_oModule->getObjectCart()->getInfo(BX_PAYMENT_TYPE_SINGLE, $this->_aQueryAppend['client_id']);
+
+        return parent::_getDataArray($sFilter, $sOrderField, $sOrderDir, $iStart, $iPerPage);
+    }
+
+    protected function _delete($mixedId)
+    {
+		return $this->_oCart->serviceDeleteFromCart($mixedId);
+    }
+}
+
+/** @} */

+ 1 - 1
modules/boonex/payment/classes/BxPaymentGridPending.php

@@ -64,7 +64,7 @@ class BxPaymentGridPending extends BxBaseModPaymentGridOrders
 
         $sKey = 'order_' . $this->_sOrdersType . '_process';
         $sId = $this->_oModule->_oConfig->getHtmlIds($sKey);
-    	$sTitle = _t($this->_sLangsPrefix . 'grid_orders_popup_' . $sKey);
+    	$sTitle = _t($this->_sLangsPrefix . 'grid_popup_title_ods_' . $sKey);
 
 		$sContent = BxTemplStudioFunctions::getInstance()->popupBox($sId, $sTitle, $this->_oModule->_oTemplate->parseHtmlByName('order_pending_process.html', array(
 			'form_id' => $oForm->aFormAttrs['id'],

+ 1 - 1
modules/boonex/payment/classes/BxPaymentGridProcessed.php

@@ -98,7 +98,7 @@ class BxPaymentGridProcessed extends BxBaseModPaymentGridOrders
 
         $sKey = 'order_' . $this->_sOrdersType . '_add';
         $sId = $this->_oModule->_oConfig->getHtmlIds($sKey);
-    	$sTitle = _t($this->_sLangsPrefix . 'grid_orders_popup_' . $sKey);
+    	$sTitle = _t($this->_sLangsPrefix . 'grid_popup_title_ods_' . $sKey);
 
 		$sContent = BxTemplStudioFunctions::getInstance()->popupBox($sId, $sTitle, $this->_oModule->_oTemplate->parseHtmlByName('order_processed_add.html', array(
 			'js_object' => $sJsObject,

+ 20 - 27
modules/boonex/payment/classes/BxPaymentModule.php

@@ -32,7 +32,7 @@ define('BX_PAYMENT_RESULT_SUCCESS', 0);
  * 1. Get 'Add To Cart' button using serviceGetAddToCartLink service.
  * 2. Add info about your module in the 'bx_pmt_modules' table.
  * 3. Realize the following service methods in your Module class.
- *   a. serviceGetItems($iVendorId) - Is used in Orders Administration to get all products of the requested seller(vendor).
+ *   a. serviceGetItems($iSellerId) - Is used in Orders Administration to get all products of the requested seller(vendor).
  *   b. serviceGetCartItem($iClientId, $iItemId) - Is used in Shopping Cart to get one product by specified id.
  *   c. serviceRegisterCartItem($iClientId, $iSellerId, $iItemId, $iItemCount, $sOrderId) - Register purchased product.
  *   d. serviceUnregisterCartItem($iClientId, $iSellerId, $iItemId, $iItemCount, $sOrderId) - Unregister the product purchased earlier.
@@ -58,7 +58,7 @@ define('BX_PAYMENT_RESULT_SUCCESS', 0);
  *
  * Is used to get "Add to cart" link for some item(s) in your module.
  * @see BxPmtModule::serviceGetAddToCartLink
- * BxDolService::call('payment', 'get_add_to_cart_link', array($iVendorId, $mixedModuleId, $iItemId, $iItemCount));
+ * BxDolService::call('payment', 'get_add_to_cart_link', array($iSellerId, $mixedModuleId, $iItemId, $iItemCount));
  *
  * Check transaction(s) in database which satisty all conditions.
  * @see BxPmtModule::serviceGetTransactionsInfo
@@ -168,24 +168,17 @@ class BxPaymentModule extends BxBaseModPaymentModule
     /**
      * Cart Processing Methods
      */
-    public function actionCartSubmit()
+    public function actionInitializeCheckout($sType)
     {
     	if(!$this->isLogged())
             return $this->_oTemplate->displayPageCodeError($this->_sLangsPrefix . 'err_required_login');
 
-        if(bx_get('bx-payment-delete') !== false && bx_get('items') !== false){
-        	$aItems = bx_get('items');
-            foreach($aItems as $sItem) {
-                list($iVendorId, $iModuleId, $iItemId, $iItemCount) = $this->_oConfig->descriptorS2A($sItem);
-                $this->getObjectCart()->serviceDeleteFromCart($iVendorId, $iModuleId, $iItemId);
-            }
-        }
-		else if(bx_get('bx-payment-checkout') !== false && bx_get('items') !== false) {
-			$iVendorId = (int)bx_get('vendor_id');
+		if(bx_get('seller_id') !== false && bx_get('provider') !== false && bx_get('items') !== false) {
+			$iSellerId = bx_process_input(bx_get('seller_id'), BX_DATA_INT);
 			$sProvider = bx_process_input(bx_get('provider'));
-			$aItems = bx_get('items');
+			$aItems = bx_process_input(bx_get('items'));
 
-			$mixedResult = $this->serviceInitializeCheckout(BX_PAYMENT_TYPE_SINGLE, $iVendorId, $sProvider, $aItems);
+			$mixedResult = $this->serviceInitializeCheckout(BX_PAYMENT_TYPE_SINGLE, $iSellerId, $sProvider, $aItems);
 			if($mixedResult !== true)
 	    		return $this->_oTemplate->displayPageCodeError($mixedResult);
 		}
@@ -194,33 +187,33 @@ class BxPaymentModule extends BxBaseModPaymentModule
         exit;
     }
 
-    public function actionAddToCart($iVendorId, $iModuleId, $iItemId, $iItemCount)
+    public function actionAddToCart($iSellerId, $iModuleId, $iItemId, $iItemCount)
     {
-        $aResult = $this->getObjectCart()->serviceAddToCart($iVendorId, $iModuleId, $iItemId, $iItemCount);
+        $aResult = $this->getObjectCart()->serviceAddToCart($iSellerId, $iModuleId, $iItemId, $iItemCount);
 		echoJson($aResult);
     }
 
     /**
      * Isn't used yet.
      */
-    public function actionDeleteFromCart($iVendorId, $iModuleId, $iItemId)
+    public function actionDeleteFromCart($iSellerId, $iModuleId, $iItemId)
     {
-        $aResult = $this->getObjectCart()->serviceDeleteFromCart($iVendorId, $iModuleId, $iItemId);
+        $aResult = $this->getObjectCart()->serviceDeleteFromCart($iSellerId, $iModuleId, $iItemId);
         echoJson($aResult);
     }
 
     /**
      * Isn't used yet.
      */
-    public function actionEmptyCart($iVendorId)
+    public function actionEmptyCart($iSellerId)
     {
-        $aResult = $this->getObjectCart()->serviceDeleteFromCart($this->_iUserId, $iVendorId);
+        $aResult = $this->getObjectCart()->serviceDeleteFromCart($iSellerId);
 		echoJson($aResult);
     }
 
-    public function actionSubscribe($iVendorId, $iModuleId, $iItemId, $iItemCount = 1)
+    public function actionSubscribe($iSellerId, $iModuleId, $iItemId, $iItemCount = 1)
     {
-        $aResult = $this->getObjectCart()->serviceSubscribe($iVendorId, $iModuleId, $iItemId, $iItemCount);
+        $aResult = $this->getObjectCart()->serviceSubscribe($iSellerId, $iModuleId, $iItemId, $iItemCount);
 		echoJson($aResult);
     }
 
@@ -228,20 +221,20 @@ class BxPaymentModule extends BxBaseModPaymentModule
     /**
      * Payment Processing Methods
      */
-	public function serviceInitializeCheckout($sType, $iVendorId, $sProvider, $aItems = array())
+	public function serviceInitializeCheckout($sType, $iSellerId, $sProvider, $aItems = array())
 	{
 		if(!is_array($aItems))
 			$aItems = array($aItems);
 
-		$iVendorId = (int)$iVendorId;
-        if($iVendorId == BX_PAYMENT_EMPTY_ID)
+		$iSellerId = (int)$iSellerId;
+        if($iSellerId == BX_PAYMENT_EMPTY_ID)
             return $this->_sLangsPrefix . 'err_unknown_vendor';
 
-		$oProvider = $this->getObjectProvider($sProvider, $iVendorId);
+		$oProvider = $this->getObjectProvider($sProvider, $iSellerId);
         if($oProvider === false || !$oProvider->isActive())
         	return $this->_sLangsPrefix . 'err_incorrect_provider';
 
-        $aInfo = $this->getObjectCart()->getInfo($sType, $this->_iUserId, $iVendorId, $aItems);
+        $aInfo = $this->getObjectCart()->getInfo($sType, $this->_iUserId, $iSellerId, $aItems);
         if(empty($aInfo) || $aInfo['vendor_id'] == BX_PAYMENT_EMPTY_ID || empty($aInfo['items']))
             return $this->_sLangsPrefix . 'err_empty_order';
 

+ 1 - 1
modules/boonex/payment/classes/BxPaymentOrders.php

@@ -45,7 +45,7 @@ class BxPaymentOrders extends BxBaseModPaymentOrders
     {
         $iSellerId = isset($aData['seller_id']) ? (int)$aData['seller_id'] : $this->_oModule->getProfileId();
         if($iSellerId == $aData['client_id'])
-            return array('msg' => $this->_sLangsPrefix . 'err_purchase_from_yourself');
+            return array('msg' => $this->_sLangsPrefix . 'err_self_purchase');
 
         $sOrder = trim($aData['order']);
         if(empty($sOrder))

+ 29 - 0
modules/boonex/payment/classes/BxPaymentTemplate.php

@@ -15,6 +15,8 @@ class BxPaymentTemplate extends BxBaseModPaymentTemplate
 
     function __construct(&$oConfig, &$oDb)
     {
+    	$this->MODULE = 'bx_payment';
+
         parent::__construct($oConfig, $oDb);
 
         $this->_sLangsPrefix = $this->_oConfig->getPrefix('langs');
@@ -105,6 +107,7 @@ class BxPaymentTemplate extends BxBaseModPaymentTemplate
         ));
     }
 
+    /*
 	public function displayBlockCart($aCartInfo, $iVendorId = BX_PAYMENT_EMPTY_ID)
     {
     	if(empty($aCartInfo))
@@ -205,6 +208,32 @@ class BxPaymentTemplate extends BxBaseModPaymentTemplate
         	'bx_repeat:vendors' => $aVendors
         ));
     }
+	*/
+
+	public function displayBlockCarts($iClientId)
+    {
+    	$oGrid = BxDolGrid::getObjectInstance($this->_oConfig->getObject('grid_carts'));
+        if(!$oGrid)
+            return MsgBox(_t($this->_sLangsPrefix . 'msg_no_results'));
+
+		$oGrid->addQueryParam('client_id', $iClientId);
+
+		$this->addJsCssCart();
+        return $this->displayJsCode('cart') . $oGrid->getCode();
+    }
+
+	public function displayBlockCart($iClientId, $iSellerId = 0)
+    {
+    	$oGrid = BxDolGrid::getObjectInstance($this->_oConfig->getObject('grid_cart'));
+        if(!$oGrid || empty($iSellerId))
+            return MsgBox(_t($this->_sLangsPrefix . 'msg_no_results'));
+
+		$oGrid->addQueryParam('client_id', $iClientId);
+		$oGrid->addQueryParam('seller_id', $iSellerId);
+
+		$this->addJsCssCart();
+        return $this->displayJsCode('cart') . $oGrid->getCode();
+    }
 
     public function displayBlockHistory($iClientId, $iSellerId)
     {

+ 38 - 21
modules/boonex/payment/install/langs/en.xml

@@ -10,9 +10,12 @@
 	<string name="_bx_payment_option_site_admin"><![CDATA[Site administrator]]></string>
 
 	<!-- PAGES and BLOCKS -->
+	<string name="_bx_payment_page_title_sys_carts"><![CDATA[Shopping Carts]]></string>
+	<string name="_bx_payment_page_title_carts"><![CDATA[Shopping Carts]]></string>
 	<string name="_bx_payment_page_title_sys_cart"><![CDATA[Shopping Cart]]></string>
 	<string name="_bx_payment_page_title_cart"><![CDATA[Shopping Cart]]></string>
-	<string name="_bx_payment_page_block_title_cart"><![CDATA[Shopping Cart]]></string>
+	<string name="_bx_payment_page_block_title_carts"><![CDATA[Shopping Carts]]></string>
+	<string name="_bx_payment_page_block_title_cart"><![CDATA[{0}'s Shopping Cart]]></string>
 
 	<string name="_bx_payment_page_title_sys_history"><![CDATA[Shopping History]]></string>
 	<string name="_bx_payment_page_title_history"><![CDATA[Shopping History]]></string>
@@ -72,23 +75,38 @@
 	<string name="_bx_payment_form_details_input_do_submit"><![CDATA[Save]]></string>
 
 	<!-- GRIDS -->
-	<string name="_bx_payment_grid_orders_field_client_id"><![CDATA[Client]]></string>
-	<string name="_bx_payment_grid_orders_field_seller_id"><![CDATA[Seller]]></string>
-	<string name="_bx_payment_grid_orders_field_transaction"><![CDATA[Transaction]]></string>
-	<string name="_bx_payment_grid_orders_field_license"><![CDATA[License]]></string>
-	<string name="_bx_payment_grid_orders_field_amount"><![CDATA[Amount]]></string>
-	<string name="_bx_payment_grid_orders_field_date"><![CDATA[Date]]></string>
+	<string name="_bx_payment_grid_column_title_ods_client_id"><![CDATA[Client]]></string>
+	<string name="_bx_payment_grid_column_title_ods_seller_id"><![CDATA[Seller]]></string>
+	<string name="_bx_payment_grid_column_title_ods_transaction"><![CDATA[Transaction]]></string>
+	<string name="_bx_payment_grid_column_title_ods_license"><![CDATA[License]]></string>
+	<string name="_bx_payment_grid_column_title_ods_amount"><![CDATA[Amount]]></string>
+	<string name="_bx_payment_grid_column_title_ods_date"><![CDATA[Date]]></string>
+	<string name="_bx_payment_grid_column_title_crts_vendor_id"><![CDATA[Vendor]]></string>
+	<string name="_bx_payment_grid_column_title_crts_items_count"><![CDATA[Count]]></string>
+	<string name="_bx_payment_grid_column_title_crts_items_price"><![CDATA[Price]]></string>
+	<string name="_bx_payment_grid_column_title_crt_title"><![CDATA[Product]]></string>
+	<string name="_bx_payment_grid_column_title_crt_description"><![CDATA[Description]]></string>
+	<string name="_bx_payment_grid_column_title_crt_quantity"><![CDATA[Quantity]]></string>
+	<string name="_bx_payment_grid_column_title_crt_price"><![CDATA[Price]]></string>
+	<string name=""><![CDATA[]]></string>
+	<string name=""><![CDATA[]]></string>
 
-	<string name="_bx_payment_grid_orders_action_add"><![CDATA[Manual Order]]></string>
-	<string name="_bx_payment_grid_orders_action_cancel"><![CDATA[Cancel]]></string>
-	<string name="_bx_payment_grid_orders_action_process"><![CDATA[Process]]></string>
-	<string name="_bx_payment_grid_orders_action_view_order"><![CDATA[View]]></string>
+	<string name="_bx_payment_grid_action_title_ods_add"><![CDATA[Manual Order]]></string>
+	<string name="_bx_payment_grid_action_title_ods_cancel"><![CDATA[Cancel]]></string>
+	<string name="_bx_payment_grid_action_title_ods_process"><![CDATA[Process]]></string>
+	<string name="_bx_payment_grid_action_title_ods_view_order"><![CDATA[View]]></string>
+	<string name="_bx_payment_grid_action_title_crts_delete"><![CDATA[Delete]]></string>
+	<string name="_bx_payment_grid_action_title_crts_continue"><![CDATA[Continue]]></string>
+	<string name="_bx_payment_grid_action_title_crt_delete"><![CDATA[Delete]]></string>
+	<string name=""><![CDATA[]]></string>
+	<string name=""><![CDATA[]]></string>
 
-	<string name="_bx_payment_grid_orders_popup_order_history_view"><![CDATA[Order]]></string>
-	<string name="_bx_payment_grid_orders_popup_order_pending_view"><![CDATA[Pending Order]]></string>
-	<string name="_bx_payment_grid_orders_popup_order_pending_process"><![CDATA[Process Pending Order]]></string>
-	<string name="_bx_payment_grid_orders_popup_order_processed_view"><![CDATA[Processed Order]]></string>
-	<string name="_bx_payment_grid_orders_popup_order_processed_add"><![CDATA[Manual Order]]></string>
+	<string name="_bx_payment_grid_popup_title_ods_order_history_view"><![CDATA[Order]]></string>
+	<string name="_bx_payment_grid_popup_title_ods_order_pending_view"><![CDATA[Pending Order]]></string>
+	<string name="_bx_payment_grid_popup_title_ods_order_pending_process"><![CDATA[Process Pending Order]]></string>
+	<string name="_bx_payment_grid_popup_title_ods_order_processed_view"><![CDATA[Processed Order]]></string>
+	<string name="_bx_payment_grid_popup_title_ods_order_processed_add"><![CDATA[Manual Order]]></string>
+	<string name=""><![CDATA[]]></string>
 	<string name=""><![CDATA[]]></string>
 	<string name=""><![CDATA[]]></string>
 
@@ -149,7 +167,8 @@
 	<!-- MESSAGES, WARNINGS and ERRORS -->
 	<string name="_bx_payment_msg_no_results"><![CDATA[Empty]]></string>
 	<string name="_bx_payment_msg_redirecting"><![CDATA[Redirecting... Please wait.]]></string>
-	<string name="_bx_payment_msg_successfully_added"><![CDATA[The item was successfully added to your shopping cart.]]></string>
+	<string name="_bx_payment_msg_item_added"><![CDATA[The item was successfully added to your shopping cart.]]></string>
+	<string name="_bx_payment_msg_item_deleted"><![CDATA[The item was successfully deleted from your shopping cart.]]></string>
 	<string name="_bx_payment_msg_successfully_processed_free"><![CDATA[Free item was successfully processed]]></string>
 	<string name="_bx_payment_err_access_db"><![CDATA[Database access error.]]></string>
 	<string name="_bx_payment_err_cannot_validate"><![CDATA[Can't connect to remote host for validation.]]></string>
@@ -159,7 +178,7 @@
 	<string name="_bx_payment_err_incorrect_provider"><![CDATA[Incorrect or unavailable payment provider.]]></string>
 	<string name="_bx_payment_err_not_accept_payments"><![CDATA[The vendor does not accept payments.]]></string>
 	<string name="_bx_payment_err_nothing_selected"><![CDATA[You need to select at least one item.]]></string>
-	<string name="_bx_payment_err_purchase_from_yourself"><![CDATA[You cannot purchase your own item. It's just a bad luck thing, you know.]]></string>
+	<string name="_bx_payment_err_self_purchase"><![CDATA[You cannot purchase your own item. It's just a bad luck thing, you know.]]></string>
 	<string name="_bx_payment_err_required_login"><![CDATA[You need to login.]]></string>
 	<string name="_bx_payment_err_unknown_vendor"><![CDATA[Unknown vendor.]]></string>
 	<string name="_bx_payment_err_wrong_data"><![CDATA[Incorrect input data.]]></string>
@@ -167,13 +186,11 @@
 	<string name="_bx_payment_err_cannot_perform"><![CDATA[Cannot perform the action. Please report.]]></string>
 	<string name="_bx_payment_err_wrong_quantity"><![CDATA[Incorrect quantity specified.]]></string>
 	<string name=""><![CDATA[]]></string>
-	<string name=""><![CDATA[]]></string>
 
 
 	<!-- Other -->
 	<string name="_bx_payment_txt_add_to_cart"><![CDATA[Add to Cart]]></string>
 	<string name="_bx_payment_txt_subscribe"><![CDATA[Subscribe]]></string>
-	<string name="_bx_payment_txt_shopping_cart"><![CDATA[{0}'s cart]]></string>
 	<string name="_bx_payment_txt_payment_to"><![CDATA[Payment to {0} for:]]></string>
 	<string name="_bx_payment_txt_client"><![CDATA[Client]]></string>
 	<string name="_bx_payment_txt_seller"><![CDATA[Seller]]></string>
@@ -182,6 +199,7 @@
 	<string name="_bx_payment_txt_message"><![CDATA[Result]]></string>
 	<string name="_bx_payment_txt_date"><![CDATA[Date]]></string>
 	<string name="_bx_payment_txt_products"><![CDATA[Products]]></string>
+	<string name="_bx_payment_txt_checkout_to"><![CDATA[Checkout to {0}]]></string>
 	
 	
 	<string name=""><![CDATA[]]></string>
@@ -197,7 +215,6 @@
 	<string name=""><![CDATA[]]></string>
 	<string name=""><![CDATA[]]></string>
 	<string name=""><![CDATA[]]></string>
-	<string name=""><![CDATA[]]></string>
 
 	<!-- PayPal payment provider -->
 	<string name="_bx_payment_pp_cpt"><![CDATA[PayPal]]></string>

+ 6 - 0
modules/boonex/payment/install/sql/disable.sql

@@ -31,6 +31,12 @@ DELETE `sys_acl_actions`, `sys_acl_matrix` FROM `sys_acl_actions`, `sys_acl_matr
 DELETE FROM `sys_acl_actions` WHERE `Module` = @sName;
 
 
+-- GRIDS
+DELETE FROM `sys_objects_grid` WHERE `object` IN ('bx_payment_grid_carts', 'bx_payment_grid_cart');
+DELETE FROM `sys_grid_fields` WHERE `object` IN ('bx_payment_grid_carts', 'bx_payment_grid_cart');
+DELETE FROM `sys_grid_actions` WHERE `object` IN ('bx_payment_grid_carts', 'bx_payment_grid_cart');
+
+
 -- EMAIL TEMPLATES
 DELETE FROM `sys_email_templates` WHERE `Module` = @sName;
 

+ 32 - 1
modules/boonex/payment/install/sql/enable.sql

@@ -20,6 +20,7 @@ INSERT INTO `sys_options` (`name`, `value`, `category_id`, `caption`, `type`, `c
 -- PAGES & BLOCKS
 INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `layout_id`, `visible_for_levels`, `visible_for_levels_editable`, `uri`, `url`, `meta_description`, `meta_keywords`, `meta_robots`, `cache_lifetime`, `cache_editable`, `deletable`, `override_class_name`, `override_class_file`) VALUES
 ('bx_payment_join', '_bx_payment_page_title_sys_join', '_bx_payment_page_title_join', @sName, 5, 2147483647, 1, 'payment-join', 'page.php?i=payment-join', '', '', '', 0, 1, 0, 'BxPaymentPageJoin', 'modules/boonex/payment/classes/BxPaymentPageJoin.php'),
+('bx_payment_carts', '_bx_payment_page_title_sys_carts', '_bx_payment_page_title_carts', @sName, 5, 2147483647, 1, 'payment-carts', 'page.php?i=payment-carts', '', '', '', 0, 1, 0, 'BxPaymentPageCart', 'modules/boonex/payment/classes/BxPaymentPageCart.php'),
 ('bx_payment_cart', '_bx_payment_page_title_sys_cart', '_bx_payment_page_title_cart', @sName, 5, 2147483647, 1, 'payment-cart', 'page.php?i=payment-cart', '', '', '', 0, 1, 0, 'BxPaymentPageCart', 'modules/boonex/payment/classes/BxPaymentPageCart.php'),
 ('bx_payment_history', '_bx_payment_page_title_sys_history', '_bx_payment_page_title_history', @sName, 5, 2147483647, 1, 'payment-history', 'page.php?i=payment-history', '', '', '', 0, 1, 0, 'BxPaymentPageHistory', 'modules/boonex/payment/classes/BxPaymentPageHistory.php'),
 ('bx_payment_orders', '_bx_payment_page_title_sys_orders', '_bx_payment_page_title_orders', @sName, 5, 2147483647, 1, 'payment-orders', 'page.php?i=payment-orders', '', '', '', 0, 1, 0, 'BxPaymentPageOrders', 'modules/boonex/payment/classes/BxPaymentPageOrders.php'),
@@ -28,6 +29,8 @@ INSERT INTO `sys_objects_page`(`object`, `title_system`, `title`, `module`, `lay
 INSERT INTO `sys_pages_blocks` (`object`, `cell_id`, `module`, `title`, `designbox_id`, `visible_for_levels`, `type`, `content`, `deletable`, `copyable`, `order`) VALUES
 ('bx_payment_join', 1, @sName, '_bx_payment_page_block_title_join', 11, 2147483647, 'service', 'a:4:{s:6:"module";s:10:"bx_payment";s:6:"method";s:14:"get_block_join";s:6:"params";a:0:{}s:5:"class";s:4:"Join";}', 0, 0, 1),
 
+('bx_payment_carts', 1, @sName, '_bx_payment_page_block_title_carts', 11, 2147483647, 'service', 'a:4:{s:6:"module";s:10:"bx_payment";s:6:"method";s:15:"get_block_carts";s:6:"params";a:0:{}s:5:"class";s:4:"Cart";}', 0, 0, 1),
+
 ('bx_payment_cart', 1, @sName, '_bx_payment_page_block_title_cart', 11, 2147483647, 'service', 'a:4:{s:6:"module";s:10:"bx_payment";s:6:"method";s:14:"get_block_cart";s:6:"params";a:0:{}s:5:"class";s:4:"Cart";}', 0, 0, 1),
 
 ('bx_payment_history', 1, @sName, '_bx_payment_page_block_title_history', 11, 2147483647, 'service', 'a:4:{s:6:"module";s:10:"bx_payment";s:6:"method";s:22:"get_block_cart_history";s:6:"params";a:0:{}s:5:"class";s:4:"Cart";}', 0, 0, 1),
@@ -45,7 +48,7 @@ INSERT INTO `sys_menu_sets`(`set_name`, `module`, `title`, `deletable`) VALUES
 ('bx_payment_menu_cart_submenu', 'bx_payment', '_bx_payment_menu_set_title_cart_submenu', 0);
 
 INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `title`, `link`, `onclick`, `target`, `icon`, `addon`, `submenu_object`, `visible_for_levels`, `active`, `copyable`, `editable`, `order`) VALUES 
-('bx_payment_menu_cart_submenu', 'bx_payment', 'cart', '_bx_payment_menu_item_title_system_cart', '_bx_payment_menu_item_title_cart', 'page.php?i=payment-cart', '', '_self', '', '', '', 2147483647, 1, 0, 1, 1),
+('bx_payment_menu_cart_submenu', 'bx_payment', 'cart', '_bx_payment_menu_item_title_system_cart', '_bx_payment_menu_item_title_cart', 'page.php?i=payment-carts', '', '_self', '', '', '', 2147483647, 1, 0, 1, 1),
 ('bx_payment_menu_cart_submenu', 'bx_payment', 'cart-history', '_bx_payment_menu_item_title_system_cart_history', '_bx_payment_menu_item_title_cart_history', 'page.php?i=payment-history', '', '_self', '', '', '', 2147483647, 1, 0, 1, 2);
 
 
@@ -105,6 +108,34 @@ INSERT INTO `sys_acl_matrix` (`IDLevel`, `IDAction`) VALUES
 (@iPremium, @iIdActionSell);
 
 
+-- GRIDS: Carts
+INSERT INTO `sys_objects_grid` (`object`, `source_type`, `source`, `table`, `field_id`, `field_order`, `field_active`, `paginate_url`, `paginate_per_page`, `paginate_simple`, `paginate_get_start`, `paginate_get_per_page`, `filter_fields`, `filter_fields_translatable`, `filter_mode`, `sorting_fields`, `sorting_fields_translatable`, `override_class_name`, `override_class_file`) VALUES
+('bx_payment_grid_carts', 'Array', '', '', 'vendor_id', '', '', '', 20, NULL, 'start', '', 'vendor', '', 'like', '', '', 'BxPaymentGridCarts', 'modules/boonex/payment/classes/BxPaymentGridCarts.php'),
+('bx_payment_grid_cart', 'Array', '', '', 'descriptor', '', '', '', 20, NULL, 'start', '', 'title,description', '', 'like', '', '', 'BxPaymentGridCart', 'modules/boonex/payment/classes/BxPaymentGridCart.php');
+
+INSERT INTO `sys_grid_fields` (`object`, `name`, `title`, `width`, `translatable`, `chars_limit`, `params`, `order`) VALUES
+('bx_payment_grid_carts', 'checkbox', '', '2%', 0, '', '', 1),
+('bx_payment_grid_carts', 'vendor_id', '_bx_payment_grid_column_title_crts_vendor_id', '40%', 0, '36', '', 2),
+('bx_payment_grid_carts', 'items_count', '_bx_payment_grid_column_title_crts_items_count', '20%', 0, '16', '', 3),
+('bx_payment_grid_carts', 'items_price', '_bx_payment_grid_column_title_crts_items_price', '20%', 0, '16', '', 4),
+('bx_payment_grid_carts', 'actions', '', '18%', 0, '', '', 5),
+
+('bx_payment_grid_cart', 'checkbox', '', '2%', 0, '', '', 1),
+('bx_payment_grid_cart', 'title', '_bx_payment_grid_column_title_crt_title', '25%', 0, '24', '', 2),
+('bx_payment_grid_cart', 'description', '_bx_payment_grid_column_title_crt_description', '35%', 0, '48', '', 3),
+('bx_payment_grid_cart', 'quantity', '_bx_payment_grid_column_title_crt_quantity', '10%', 0, '16', '', 4),
+('bx_payment_grid_cart', 'price_single', '_bx_payment_grid_column_title_crt_price', '10%', 0, '16', '', 5),
+('bx_payment_grid_cart', 'actions', '', '18%', 0, '', '', 6);
+
+INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `icon_only`, `confirm`, `order`) VALUES
+('bx_payment_grid_carts', 'bulk', 'delete', '_bx_payment_grid_action_title_crts_delete', '', 0, 1, 1),
+('bx_payment_grid_carts', 'single', 'continue', '_bx_payment_grid_action_title_crts_continue', 'money', 1, 0, 1),
+('bx_payment_grid_carts', 'single', 'delete', '_bx_payment_grid_action_title_crts_delete', 'remove', 1, 1, 2),
+
+('bx_payment_grid_cart', 'bulk', 'delete', '_bx_payment_grid_action_title_crt_delete', '', 0, 1, 1),
+('bx_payment_grid_cart', 'single', 'delete', '_bx_payment_grid_action_title_crt_delete', 'remove', 1, 1, 1);
+
+
 -- EMAIL TEMPLATES
 INSERT INTO `sys_email_templates` (`Module`, `NameSystem`, `Name`, `Subject`, `Body`) VALUES 
 (@sName, '_bx_payment_et_txt_name_paid_need_join', 'bx_payment_paid_need_join', '_bx_payment_et_txt_subject_paid_need_join', '_bx_payment_et_txt_body_paid_need_join');

+ 23 - 23
modules/boonex/payment/install/sql/install.sql

@@ -147,40 +147,40 @@ INSERT INTO `sys_objects_grid` (`object`, `source_type`, `source`, `table`, `fie
 ('bx_payment_grid_orders_pending', 'Sql', 'SELECT `tt`.`id` AS `id`, `tt`.`client_id` AS `client_id`, `tt`.`seller_id` AS `seller_id`, `tt`.`items` AS `items`, `tt`.`amount` AS `amount`, `tt`.`order` AS `transaction`, `tt`.`error_msg` AS `error_msg`, `tt`.`provider` AS `provider`, `tt`.`date` AS `date` FROM `bx_payment_transactions_pending` AS `tt` WHERE 1 AND (ISNULL(`tt`.`order`) OR (NOT ISNULL(`tt`.`order`) AND `tt`.`error_code`<>''0'')) ', 'bx_payment_transactions_pending', 'id', 'date', '', '', 100, NULL, 'start', '', 'tt`.`order,tt`.`amount,tt`.`date', '', 'auto', '', '', 'BxPaymentGridPending', 'modules/boonex/payment/classes/BxPaymentGridPending.php');
 
 INSERT INTO `sys_grid_fields` (`object`, `name`, `title`, `width`, `translatable`, `chars_limit`, `params`, `order`) VALUES
-('bx_payment_grid_orders_history', 'seller_id', '_bx_payment_grid_orders_field_seller_id', '24%', 0, '20', '', 1),
-('bx_payment_grid_orders_history', 'transaction', '_bx_payment_grid_orders_field_transaction', '22%', 0, '18', '', 2),
-('bx_payment_grid_orders_history', 'license', '_bx_payment_grid_orders_field_license', '22%', 0, '18', '', 3),
-('bx_payment_grid_orders_history', 'amount', '_bx_payment_grid_orders_field_amount', '10%', 1, '10', '', 4),
-('bx_payment_grid_orders_history', 'date', '_bx_payment_grid_orders_field_date', '10%', 0, '10', '', 5),
+('bx_payment_grid_orders_history', 'seller_id', '_bx_payment_grid_column_title_ods_seller_id', '24%', 0, '20', '', 1),
+('bx_payment_grid_orders_history', 'transaction', '_bx_payment_grid_column_title_ods_transaction', '22%', 0, '18', '', 2),
+('bx_payment_grid_orders_history', 'license', '_bx_payment_grid_column_title_ods_license', '22%', 0, '18', '', 3),
+('bx_payment_grid_orders_history', 'amount', '_bx_payment_grid_column_title_ods_amount', '10%', 1, '10', '', 4),
+('bx_payment_grid_orders_history', 'date', '_bx_payment_grid_column_title_ods_date', '10%', 0, '10', '', 5),
 ('bx_payment_grid_orders_history', 'actions', '', '12%', 0, '', '', 6),
 
 ('bx_payment_grid_orders_processed', 'checkbox', '', '2%', 0, '', '', 1),
-('bx_payment_grid_orders_processed', 'client_id', '_bx_payment_grid_orders_field_client_id', '22%', 0, '18', '', 2),
-('bx_payment_grid_orders_processed', 'transaction', '_bx_payment_grid_orders_field_transaction', '20%', 0, '18', '', 3),
-('bx_payment_grid_orders_processed', 'license', '_bx_payment_grid_orders_field_license', '20%', 0, '18', '', 4),
-('bx_payment_grid_orders_processed', 'amount', '_bx_payment_grid_orders_field_amount', '10%', 1, '10', '', 5),
-('bx_payment_grid_orders_processed', 'date', '_bx_payment_grid_orders_field_date', '10%', 0, '10', '', 6),
+('bx_payment_grid_orders_processed', 'client_id', '_bx_payment_grid_column_title_ods_client_id', '22%', 0, '18', '', 2),
+('bx_payment_grid_orders_processed', 'transaction', '_bx_payment_grid_column_title_ods_transaction', '20%', 0, '18', '', 3),
+('bx_payment_grid_orders_processed', 'license', '_bx_payment_grid_column_title_ods_license', '20%', 0, '18', '', 4),
+('bx_payment_grid_orders_processed', 'amount', '_bx_payment_grid_column_title_ods_amount', '10%', 1, '10', '', 5),
+('bx_payment_grid_orders_processed', 'date', '_bx_payment_grid_column_title_ods_date', '10%', 0, '10', '', 6),
 ('bx_payment_grid_orders_processed', 'actions', '', '16%', 0, '', '', 7),
 
 ('bx_payment_grid_orders_pending', 'checkbox', '', '2%', 0, '', '', 1),
-('bx_payment_grid_orders_pending', 'client_id', '_bx_payment_grid_orders_field_client_id', '25%', 0, '25', '', 2),
-('bx_payment_grid_orders_pending', 'transaction', '_bx_payment_grid_orders_field_transaction', '25%', 0, '25', '', 3),
-('bx_payment_grid_orders_pending', 'amount', '_bx_payment_grid_orders_field_amount', '14%', 1, '14', '', 4),
-('bx_payment_grid_orders_pending', 'date', '_bx_payment_grid_orders_field_date', '14%', 0, '14', '', 5),
+('bx_payment_grid_orders_pending', 'client_id', '_bx_payment_grid_column_title_ods_client_id', '25%', 0, '25', '', 2),
+('bx_payment_grid_orders_pending', 'transaction', '_bx_payment_grid_column_title_ods_transaction', '25%', 0, '25', '', 3),
+('bx_payment_grid_orders_pending', 'amount', '_bx_payment_grid_column_title_ods_amount', '14%', 1, '14', '', 4),
+('bx_payment_grid_orders_pending', 'date', '_bx_payment_grid_column_title_ods_date', '14%', 0, '14', '', 5),
 ('bx_payment_grid_orders_pending', 'actions', '', '20%', 0, '', '', 6);
 
 INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `icon_only`, `confirm`, `order`) VALUES
-('bx_payment_grid_orders_history', 'single', 'view_order', '_bx_payment_grid_orders_action_view_order', 'ellipsis-h', 1, 0, 1),
+('bx_payment_grid_orders_history', 'single', 'view_order', '_bx_payment_grid_action_title_ods_view_order', 'ellipsis-h', 1, 0, 1),
 
-('bx_payment_grid_orders_processed', 'independent', 'add', '_bx_payment_grid_orders_action_add', '', 0, 0, 1),
-('bx_payment_grid_orders_processed', 'bulk', 'cancel', '_bx_payment_grid_orders_action_cancel', '', 0, 1, 1),
-('bx_payment_grid_orders_processed', 'single', 'view_order', '_bx_payment_grid_orders_action_view_order', 'ellipsis-h', 1, 0, 1),
-('bx_payment_grid_orders_processed', 'single', 'cancel', '_bx_payment_grid_orders_action_cancel', 'times', 1, 1, 2),
+('bx_payment_grid_orders_processed', 'independent', 'add', '_bx_payment_grid_action_title_ods_add', '', 0, 0, 1),
+('bx_payment_grid_orders_processed', 'bulk', 'cancel', '_bx_payment_grid_action_title_ods_cancel', '', 0, 1, 1),
+('bx_payment_grid_orders_processed', 'single', 'view_order', '_bx_payment_grid_action_title_ods_view_order', 'ellipsis-h', 1, 0, 1),
+('bx_payment_grid_orders_processed', 'single', 'cancel', '_bx_payment_grid_action_title_ods_cancel', 'times', 1, 1, 2),
 
-('bx_payment_grid_orders_pending', 'bulk', 'cancel', '_bx_payment_grid_orders_action_cancel', '', 0, 1, 1),
-('bx_payment_grid_orders_pending', 'single', 'view_order', '_bx_payment_grid_orders_action_view_order', 'ellipsis-h', 1, 0, 1),
-('bx_payment_grid_orders_pending', 'single', 'process', '_bx_payment_grid_orders_action_process', 'refresh', 1, 0, 2),
-('bx_payment_grid_orders_pending', 'single', 'cancel', '_bx_payment_grid_orders_action_cancel', 'times', 1, 1, 3);
+('bx_payment_grid_orders_pending', 'bulk', 'cancel', '_bx_payment_grid_action_title_ods_cancel', '', 0, 1, 1),
+('bx_payment_grid_orders_pending', 'single', 'view_order', '_bx_payment_grid_action_title_ods_view_order', 'ellipsis-h', 1, 0, 1),
+('bx_payment_grid_orders_pending', 'single', 'process', '_bx_payment_grid_action_title_ods_process', 'refresh', 1, 0, 2),
+('bx_payment_grid_orders_pending', 'single', 'cancel', '_bx_payment_grid_action_title_ods_cancel', 'times', 1, 1, 3);
 
 
 -- FORMS

+ 8 - 62
modules/boonex/payment/js/cart.js

@@ -10,8 +10,6 @@ BxPaymentCart.prototype.init = function(oOptions) {
     this._sObjName = oOptions.sObjName == undefined ? 'oPmtCart' : oOptions.sObjName;
     this._sAnimationEffect = oOptions.sAnimationEffect == undefined ? 'fade' : oOptions.sAnimationEffect;
     this._iAnimationSpeed = oOptions.iAnimationSpeed == undefined ? 'slow' : oOptions.iAnimationSpeed;
-
-    this._sErrNothingSelected = '_bx_payment_err_nothing_selected';
 };
 
 BxPaymentCart.prototype.addToCart = function(iVendorId, iModuleId, iItemId, iItemCount, iNeedRedirect) {
@@ -46,70 +44,18 @@ BxPaymentCart.prototype.addToCart = function(iVendorId, iModuleId, iItemId, iIte
     );
 };
 
-/**
- * Isn't used yet.
- */
-BxPaymentCart.prototype.deleteFromCart = function(iVendorId, iModuleId, iItemId) {
-    var oDate = new Date();
-    var $this = this;
-
-    $.post(
-        this._sActionsUrl + 'delete_from_cart/' + iVendorId + '/' + iModuleId + '/' + iItemId,
-        {
-            _t:oDate.getTime()
-        },
-        function(oData) {
-            alert(oData.message);
-
-            if(oData.code == 0) {
-            	/*
-            	 * TODO: Hide item if it's needed.
-            	 * 
-                $('#item-' + iVendorId + '-' + iModuleId + '-' + iItemId).bx_anim('hide', $this._sAnimationEffect, $this._iAnimationSpeed, function() {
-                        $(this).remove();
-                });
-                 */
-            }
-        },
-        'json'
-    );
-};
-
-/**
- * Isn't used yet.
- */
-BxPaymentCart.prototype.emptyCart = function(iVendorId) {
-    var oDate = new Date();
-    var $this = this;    
+BxPaymentCart.prototype.onCartContinue = function(oData) {
+	if (!oData || oData.link == undefined)
+		return;
 
-    $.post(
-        this._sActionsUrl + 'empty_cart/' + iVendorId,
-        {
-            _t:oDate.getTime()
-        },
-        function(oData){
-            if(oData.code == 0) {
-            	/*
-            	 * TODO: Hide vendor from vendors's list if it's needed.
-            	 */
-            }
-            alert(oData.message);
-        },
-        'json'
-    );
+	location.href = oData.link;
 };
 
-BxPaymentCart.prototype.onCartSubmit = function(oForm) {
-    if($(oForm).find(":checkbox[name='items[]']:checked").length > 0)
-    	return true;
-
-    alert(_t(this._sErrNothingSelected));
-	return false;
-};
+BxPaymentCart.prototype.onCartCheckout = function(oData) {
+	if (!oData || oData.link == undefined)
+		return;
 
-BxPaymentCart.prototype.toggleCartVendor = function(oElement) {
-	$(oElement).find('.sys-icon').toggleClass('caret-down').toggleClass('caret-right');
-    $(oElement).parents('.bx-payment-box:first').find('.bx-payment-box-cnt').bx_anim('toggle', 'slide', this._iAnimationSpeed);
+	location.href = oData.link;
 };
 
 BxPaymentCart.prototype.subscribe = function(iVendorId, iModuleId, iItemId, iItemCount) {

+ 0 - 43
modules/boonex/payment/template/cart.html

@@ -1,43 +0,0 @@
-<div class="bx-payment-box-wrp bx-clearfix">
-    <bx_repeat:vendors>
-        <div class="bx-payment-box bx-def-border bx-def-margin-top-auto">
-            <div class="bx-payment-box-cpt bx-def-padding-sec-left">
-                <div class="bx-payment-box-collapse">
-                	<a href="javascript:void(0)" onclick="javascript:__js_object__.toggleCartVendor(this)">
-                		<i class="sys-icon caret-down"></i>
-                	</a>
-                </div>
-                <bx_if:show_link>
-                	<a href="__vendor_url__">__txt_shopping_cart__</a> (__items_count__) - __items_price__ __vendor_currency_code__
-                </bx_if:show_link>
-                <bx_if:show_text>__txt_shopping_cart__ (__items_count__) - __items_price__ __vendor_currency_code__</bx_if:show_text>
-            </div>
-            <div class="bx-payment-box-cnt bx-def-border-top">
-                <form id="items_from___vendor_id__" name="items_from___vendor_id__" method="POST" action="__process_url__" onsubmit="javascript:return __js_object__.onCartSubmit(this)">
-                    <input type="hidden" name="vendor_id" value="__vendor_id__" />
-                    <div class="bx-payment-vendor-icon">
-                    	<img src="__vendor_icon__" />
-                    </div>
-                    <div class="bx-payment-providers">
-                        <bx_repeat:providers>
-                            <div class="bx-payment-provider">
-                                <input type="radio" name="provider" value="__name__" __checked__ />
-                                <b>__caption__</b>
-                            </div>
-                        </bx_repeat:providers>
-                    </div>
-                    <div class="bx-payment-items bx-def-padding-sec">
-                        <bx_repeat:items>
-                            <div class="bx-payment-item">
-                                <input type="checkbox" name="items[]" value="__vendor_id_____module_id_____item_id_____item_quantity__" checked="checked" />
-                                <a href="__item_url__">__item_title__</a> (__item_quantity__) - <bx_if:show_price_paid>__item_price__ __vendor_currency_code__</bx_if:show_price_paid><bx_if:show_price_free><bx_text:_payment_txt_free /></bx_if:show_price_free>
-                            </div>
-                        </bx_repeat:items>
-                    </div>
-                    __control_panel__
-                </form>
-            </div>
-        </div>
-    </bx_repeat:vendors>
-</div>
-__js_content__

+ 1 - 0
modules/boonex/payment/template/link.html

@@ -0,0 +1 @@
+<bx_include_base:../modules/base/payment/template/link.html />