Jump to content

Fabio R

Member
  • Posts

    4
  • Joined

  • Last visited

About Fabio R

Fabio R's Achievements

Junior Member

Junior Member (1/3)

0

Reputation

  1. Hi Brian! Thank you very much for your new help. This worked perfectly well :) Yesterday was my birthday and that was a great gift. I hope this is useful for other users in the community, just as it is for me. I wish you and your family a great holiday! Regards, Fábio
  2. Hi Brian, Thanks again for your reply! To be honest, I have trouble understanding all of these codes. I'm not a developer, but I'm trying my best to try to contribute here. If I understand your valuable tip well, I should add it within the condition to hide the <div class = "section" id = "creditCardInputFields"> too. Since I have no experience and knowledge about this, I started researching how he could do, everything seems to me to sum up in something like "display: none" but I'm not sure where I put it and I am not able to make it work. Here's what I'm trying to do: <?php # Remove Gateways for Product Addons Hook # Written by brian! function cart_gateway_removal_for_product_addons($vars) { if ($vars['templatefile']=='viewcart'){ $gateways = $vars['gateways']; $allowed = ['my-gateway-name']; if (count($vars['addons']) > 0 && count($vars['products']) == 0) { foreach ($gateways as $k => $item) { if (!in_array($item['sysname'],$allowed)) { unset($gateways[$k]); #creditCardInputFields { display: none } } } if (count($gateways) > 0) { return array("gateways" => $gateways); } } } } add_hook("ClientAreaPageCart", 1, "cart_gateway_removal_for_product_addons"); I'm certainly doing it wrong, because I broke everything. Please, could you point me to where I'm going wrong? If we do that, it’s perfect and all checkout problems go to space. Fábio
  3. Hi Brian, WOW! Thank you so much for looking at this and trying to help us. I believe that like me, this could be useful for many WHMCS users looking for this 🙂 Your code worked perfectly well! Thank you again!! But, it could also hide the "Payment Details" too? It may seem strange, but my payment gateway opens a new secure tab for the customer to pay manually with any card, so having these card options for that gateway on this screen can be very confusing as well. If this information is not useful, please excuse me, I'm not a programmer and I'm just trying to make an effort to contribute to it. I hope you have a great day! Fábio
  4. Hi, I would like to hide a payment gateway only when a customer tries to purchase an addon for a product, let me explain the scenario and the reason: Scenario: I have two payment gateways, they are not native or known as Paypal or Stripe, but they work well, so in summary they work like this: Payment gateway 1: creates a recurring subscription, so the customer is automatically charged every month directly to their credit card. Payment gateway 2: does not create a subscription, so the customer needs to access the invoice manually and pay. Problem: When a customer places the product and addon on the same order, everything works well, as a "plan is created with these items" and the gateway can always charge it. When a customer places a product order first and only then chooses to place an order for an addon for that product, that's exactly my problem. That is, if at the time of ordering the addon he chooses the gateway that creates a subscription, he will receive an error and abandon the cart. Possible solution: I'm not sure if there are better ways to do it, but as a layman I think an alternative would be to create a hook to hide the recurring subscription gateway just at the checkout for an addon order. So in the end it should behave like this: For product orders, the two gateways appear normally (which is already the case today) For orders for addons purchased later, hide one gateway. I tried WHMCS support before, they just told me that they understand how useful this is, but that they don't have this option available (WOW - it seems so important and that could help so many people not to look at it). So I found excellent articles here in the community written by Brian, but unfortunately I don't have the technical knowledge to create a hook with the condition "If it's a" normal "order, show both gateways. If the order is just for an addon later, hide one gateway and show another gateway ". Note: My WHMCS version is 7.10.2 and I use a Lagom theme for the client area. Unfortunately my English is not good, so I'm sorry for the language barrier! Any help or tip would be welcome! Tks!
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use & Guidelines and understand your posts will initially be pre-moderated