Jump to content
  • 1

Question

Posted

At /admin/settings/company/billing/addcoupon/ there’s no available domain package, since they are hidden. 
At admin/packages/ there’s a checkbox, allowing to ‘’Show Hidden Packages’’.  This feature should be implemented also at coupon level? 
Thx! 
 

1 answer to this question

Recommended Posts

  • 0
Posted

Funny thing, I've done the following patch in the  Blesta 5.1.3, which I should have published earlier, and on upgrade, I was surprised to find that an almost identical patch has already been included in Blesta 5.2.2 ?

diff --git a/app/controllers/admin_company_billing.php b/app/controllers/admin_company_billing.php
index 6a2fc65c..c6ef610a 100644
--- a/app/controllers/admin_company_billing.php
+++ b/app/controllers/admin_company_billing.php
@@ -716,7 +716,8 @@ class AdminCompanyBilling extends AppController
         $all = ['' => Language::_('AdminCompanyBilling.addcoupon.text_all', true)];
         $package_groups = $all + $package_groups;
         $package_attributes = [];
-        $packages = $this->Packages->getAll($this->company_id);
+        $filters = ['hidden' => 1];
+        $packages = $this->Packages->getAll($this->company_id, ['name' => 'ASC'], null, null, $filters);
 
         // Build the package option attributes
         foreach ($packages as $package) {
@@ -901,8 +902,9 @@ class AdminCompanyBilling extends AppController
         );
         $all = ['' => Language::_('AdminCompanyBilling.editcoupon.text_all', true)];
         $package_groups = $all + $package_groups;
-        $package_attributes = [];
-        $packages = $this->Packages->getAll($this->company_id);
+        $package_attributes = [];        
+        $filters = ['hidden' => 1];
+        $packages = $this->Packages->getAll($this->company_id, ['name' => 'ASC'], null, null, $filters);
 
 
         // Build the package option attributes
diff --git a/core/Pricing/Presenter/Items/Service/AbstractServiceItems.php b/core/Pricing/Presenter/Items/Service/AbstractServiceItems.php
index db34a4d9..3def140a 100644
--- a/core/Pricing/Presenter/Items/Service/AbstractServiceItems.php
+++ b/core/Pricing/Presenter/Items/Service/AbstractServiceItems.php
@@ -497,7 +497,8 @@ abstract class AbstractServiceItems implements ServiceItemsInterface
             // Determine the currency from the item price
             $currency = null;
             switch ($meta['_data']['item_type']) {
-                case 'service':
+                case 'service':                
+                case 'domain':
                     $currency = (isset($meta['pricing']->currency) ? $meta['pricing']->currency : null);
                     break;
                 case 'option':
@@ -515,8 +516,9 @@ abstract class AbstractServiceItems implements ServiceItemsInterface
                 // Determine whether this item price can be discounted with this discount
                 $discountItem = false;
                 switch ($meta['_data']['item_type']) {
-                    case 'service':
-                        // Discount always applies to a service item that applies
+                    case 'service':                    
+                    case 'domain':
+                        // Discount always applies to a service and domain item that applies
                         $discountItem = true;
                         break;
                     case 'option':

 

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...