Jump to content

kang28ivan

Senior Member
  • Content Count

    36
  • Joined

  • Last visited

Community Reputation

0 Neutral

About kang28ivan

  • Rank
    Newbie

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. 😅 Right, because in our many clients buy a domain without buying hosting just because the .com domain has a slightly cheaper price than other providers in my country Once again, thank you so much 🙏
  2. Hi sir @Kian I immediately tried the code that you updated and the result on lagom templates... I really thank you very much for the hook you developed, it was very useful 😍
  3. Already try but not working 😄 I modified code like this <?php /** * One-off Products/Services & Domain purchase require Product/Service * * @writtenby Kian */ use WHMCS\Database\Capsule; add_hook('ClientAreaHeadOutput', 1, function($vars) { $onetimeProducts = array(); // The following Product/Service IDs are treated as "one-off" (each customer can purchase them only once) $onetimeProductGroups = array(); // Same as above but works on Product Group IDs ("one-off" concept extends to all products/services in such groups) $domainRequiresProduct = true; // Allow domain purchase only when if any of the following conditions is met: a) Customer has an existing Product/Service (Pending and Terminated don't count) b) Customer is purchasing a domain and a Product/Service if ($_SESSION['uid']) { if ($_SESSION['cart']['products'] AND ($onetimeProductGroups OR $onetimeProducts)) { $disallowedPids = Capsule::table('tblproducts')->whereIn('gid', $onetimeProductGroups)->orWhereIn('id', $onetimeProducts)->pluck('id'); $userProducts = Capsule::table('tblhosting')->where('userid', '=', $_SESSION['uid'])->WhereIn('packageid', $disallowedPids)->groupBy('packageid')->pluck('packageid'); foreach ($_SESSION['cart']['products'] as $k => $v) { if (in_array($v['pid'], $userProducts)) { $removedFromCart = true; unset($_SESSION['cart']['products'][$k]); } } if ($removedFromCart) { header('Location: cart.php?a=checkout&disallowed=1'); die(); } } elseif ($_SESSION['cart']['domains'] AND $domainRequiresProduct) { $userHasProduct = Capsule::table('tblhosting')->where('userid', '=', $_SESSION['uid'])->whereNotIn('domainstatus', array('Pending', 'Terminated'))->pluck('id'); if (!$userHasProduct AND !$_SESSION['cart']['products']) { unset($_SESSION['cart']['domains']); header('Location: cart.php?a=checkout&requireProduct=1'); die(); } } } }); add_hook('ClientAreaHeadOutput', 1, function($vars) { if ($_SESSION['uid'] AND $vars['filename'] == 'cart' AND $_GET['a'] == 'checkout') { if ($_GET['disallowed']) { return <<<HTML <script type="text/javascript"> $(document).ready(function() { $("form[action='/cart.php?a=checkout']").prepend('<div class="alert alert-warning text-center" role="alert">The Product/Service can be purchased only once.</div>'); }); </script> HTML; } elseif ($_GET['requireProduct']) { return <<<HTML <script type="text/javascript"> $(document).ready(function() { $("form[action='/cart.php?a=checkout']").prepend('<div class="alert alert-warning text-center" role="alert">Domain purchase require an active Product/Service.</div>'); }); </script> HTML; } } }); Code just appears in the header not in the body 😅
  4. Thank you very much for the code you provided, sir. The code works well in Six templates, but it doesn't work in Lagom templates just redirect to cart view no message show on the page
  5. Thank you very much sir, I will try your code soon Hope this helps me
  6. Dear, Is there a way to deactivate domain registration when the client not have active product hosting service? I have a lot of clients who register domains without buying hosting services so I want to prevent them from having hosting services controlled Thank you
  7. Hi, Maybe this feature available on modules Project Management, but I have never used this module before 😄
  8. Woo this works fine, thank you very much @brian! 😍
  9. Hi @brian! sorry I'm bumping this thread again. once again I want to ask how to display notifications based on the package/product ID or group ID not service ID?
  10. Thank you @brian! very helpful For serviceID this can multiple service ID separated by commas?? if ($serviceID == '600')
  11. I also use nginx long time ago but on vestacp and it works well by adding templates to vestacp.
  12. Hi @brian! Sorry I bump this thread. How to be displayed on specific products? for example I want to display for certain packages used by the user and displayed on the service details page
  13. Hello Wan;t to ask, how to change code on Choose Billing Cycle dropdown on standard cart with dropdown like this Maybe someone can help, thank you in advance
×
×
  • 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