Smarty notice fixes on premium block
authorEileen McNaughton <emcnaughton@wikimedia.org>
Tue, 17 Oct 2023 21:01:07 +0000 (10:01 +1300)
committerEileen McNaughton <emcnaughton@wikimedia.org>
Tue, 17 Oct 2023 21:01:07 +0000 (10:01 +1300)
CRM/Contribute/BAO/Premium.php
templates/CRM/Contribute/Form/Contribution/Main.tpl
templates/CRM/Contribute/Form/Contribution/PremiumBlock.tpl

index 2f648474de4b119f8248242d5a89f454ff622aab..f79715f40a2f66fd9a3756dd59b4c10237142165 100644 (file)
@@ -114,6 +114,7 @@ class CRM_Contribute_BAO_Premium extends CRM_Contribute_DAO_Premium {
           else {
             CRM_Core_DAO::storeValues($productDAO, $products[$productDAO->id]);
           }
+          $products[$productDAO->id] += ['thumbnail' => '', 'image' => ''];
         }
         $options = $temp = [];
         $temp = explode(',', $productDAO->options);
@@ -127,10 +128,10 @@ class CRM_Contribute_BAO_Premium extends CRM_Contribute_DAO_Premium {
       if (count($products)) {
         $form->assign('showPremium', $formItems);
         $form->assign('showSelectOptions', $formItems);
-        $form->assign('products', $products);
         $form->assign('premiumBlock', $premiumBlock);
       }
     }
+    $form->assign('products', $products ?? NULL);
   }
 
   /**
index c6a322673b7446ca96f7b770dce31ef49b6cb383..520c85da1d5e4e0748b1910c53971f3ee808f048 100644 (file)
         {include file="CRM/common/CMSUser.tpl"}
       </div>
       <div class="crm-public-form-item crm-section premium_block-section">
-        {include file="CRM/Contribute/Form/Contribution/PremiumBlock.tpl" context="makeContribution"}
+        {include file="CRM/Contribute/Form/Contribution/PremiumBlock.tpl" context="makeContribution" preview=false}
       </div>
 
       {if $honoreeProfileFields && $honoreeProfileFields|@count}
index 7077c12d7539e0891dbc228e2dc387a61080c352..309ced9349f353f81c6340b1b818389cf557b73a 100644 (file)
     {literal}
     <script>
       CRM.$(function($) {
-        var is_separate_payment = {/literal}{if $membershipBlock.is_separate_payment}{$membershipBlock.is_separate_payment}{else}0{/if}{literal};
+        var is_separate_payment = {/literal}{if $isShowMembershipBlock && $membershipBlock.is_separate_payment}{$membershipBlock.is_separate_payment}{else}0{/if}{literal};
 
         // select a new premium
         function select_premium(premium_id) {