Просмотр исходного кода

Ticket #285 - improvements related to Buy/Rent functionality.

AntonLV 9 лет назад
Родитель
Сommit
fffdec338d

+ 10 - 0
modules/boonex/acl/classes/BxAclGridView.php

@@ -15,6 +15,8 @@ class BxAclGridView extends BxAclGridLevels
 {
 	protected $_iOwner;
 	protected $_oPayment;
+	protected $_bTypeSingle;
+	protected $_bTypeRecurring;
 
     public function __construct ($aOptions, $oTemplate = false)
     {
@@ -22,6 +24,8 @@ class BxAclGridView extends BxAclGridLevels
 
         $this->_iOwner = $this->_oModule->_oConfig->getOwner();
         $this->_oPayment = BxDolPayments::getInstance();
+        $this->_bTypeSingle = $this->_oPayment->isAcceptingPayments($this->_iOwner, BX_PAYMENT_TYPE_SINGLE);
+        $this->_bTypeRecurring = $this->_oPayment->isAcceptingPayments($this->_iOwner, BX_PAYMENT_TYPE_RECURRING);
     }
 
     public function getCode($isDisplayHeader = true)
@@ -31,6 +35,9 @@ class BxAclGridView extends BxAclGridLevels
 
 	protected function _getActionBuy ($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = array())
     {
+        if(!$this->_bTypeSingle || $this->_bTypeRecurring)
+            return '';
+
     	$aJs = $this->_oPayment->getAddToCartJs($this->_iOwner, $this->MODULE, $aRow['id'], 1, true);
     	if(!empty($aJs) && is_array($aJs)) {
     		list($sJsCode, $sJsMethod) = $aJs;
@@ -46,6 +53,9 @@ class BxAclGridView extends BxAclGridLevels
 
     protected function _getActionSubscribe ($sType, $sKey, $a, $isSmall = false, $isDisabled = false, $aRow = array())
     {
+        if(!$this->_bTypeRecurring)
+            return '';
+
     	$aJs = $this->_oPayment->getSubscribeJs($this->_iOwner, '', $this->MODULE, $aRow['id'], 1);
 		if(!empty($aJs) && is_array($aJs)) {
 			list($sJsCode, $sJsMethod) = $aJs;

+ 1 - 1
modules/boonex/acl/install/sql/install.sql

@@ -96,7 +96,7 @@ INSERT INTO `sys_grid_actions` (`object`, `type`, `name`, `title`, `icon`, `icon
 ('bx_acl_administration', 'bulk', 'delete', '_bx_acl_grid_action_delete', '', 0, 1, 1),
 
 ('bx_acl_view', 'single', 'buy', '_bx_acl_grid_action_buy', 'cart-plus', 0, 0, 1),
-('bx_acl_view', 'single', 'subscribe', '_bx_acl_grid_action_subscribe', 'money', 0, 0, 2);
+('bx_acl_view', 'single', 'subscribe', '_bx_acl_grid_action_subscribe', 'credit-card', 0, 0, 2);
 
 
 -- STUDIO PAGE & WIDGET

+ 1 - 1
modules/boonex/market/install/sql/enable.sql

@@ -202,7 +202,7 @@ INSERT INTO `sys_menu_items`(`set_name`, `module`, `name`, `title_system`, `titl
 ('bx_market_view', 'bx_market', 'delete-product', '_bx_market_menu_item_title_system_delete_entry', '_bx_market_menu_item_title_delete_entry', 'page.php?i=delete-product&id={content_id}', '', '', 'remove', '', 2147483647, 1, 0, 2),
 ('bx_market_view', 'bx_market', 'download', '_bx_market_menu_item_title_system_download', '_bx_market_menu_item_title_download', 'page.php?i=download-product&id={content_id}', '', '', 'download', '', 2147483647, 1, 0, 3),
 ('bx_market_view', 'bx_market', 'add-to-cart', '_bx_market_menu_item_title_system_add_to_cart', '{add_to_cart_title}', 'javascript:void(0);', 'javascript:{add_to_cart_onclick}', '', 'cart-plus', '', 2147483647, 1, 0, 4),
-('bx_market_view', 'bx_market', 'subscribe', '_bx_market_menu_item_title_system_subscribe', '{subscribe_title}', 'javascript:void(0);', 'javascript:{subscribe_onclick}', '', 'money', '', 2147483647, 1, 0, 5);
+('bx_market_view', 'bx_market', 'subscribe', '_bx_market_menu_item_title_system_subscribe', '{subscribe_title}', 'javascript:void(0);', 'javascript:{subscribe_onclick}', '', 'credit-card', '', 2147483647, 1, 0, 5);
 
 
 -- MENU: actions menu for my entries