Jump to content
Sign in to follow this  

Recommended Posts

Posted (edited)
14 hours ago, Remco Official said:

How can i add a custom hook to a whmcs page

https://developers.whmcs.com/hooks/getting-started/

three points to remember are...

  1. these hooks need to use existing hook points - so where you've used 'memory' and 'ssd' in your add_hooks, these need to refer to a relevant hook point listed in the index, e.g ClientAreaPageCart etc - what you want to do, and especially where/when, will determine the correct hook point to use.
  2. usually, you would use the hook to return the results array back to the template and then output the results in the template - generally, echoing wouldn't work and you definitely wouldn't have any control over where the output would be by using that method.
  3. i'm confused as to what you're trying to do, but if this is the cart, the template should already have access to configoptions 2 & 3 already without the need for a hook.
Edited by brian!

Share this post


Link to post
Share on other sites

you mean the products.tpl template file ??

and you're talking about the moduleconfigoptions ? e.g the values in the tblproducts database table ?? you do realise they may be different/empty depending on the module assigned to the product ???

Share this post


Link to post
Share on other sites
Posted (edited)

the hook will add those values to the array (it's not currently doing any validation on the results), and returns the modified array to the template.

you can then edit products.tpl and output them wherever you want to inside the foreach loop on the page, e.g {$product.configoption1}

nKqXJIg.png

Edited by brian!

Share this post


Link to post
Share on other sites
5 minutes ago, Remco Official said:

{$products.configoption3}

it would be {$product.configoption3}

Share this post


Link to post
Share on other sites

add {debug} to the template - that will generate a popup window of the arrays in the template and check the $products array to see what these values are for each product - remember to remove {debug} from the template when you're finished.

Share this post


Link to post
Share on other sites
17 hours ago, Remco Official said:

i get no debug??

it would generate a popup window - are you blocking popup windows in your browser?

Share this post


Link to post
Share on other sites

$products

Origin: "Smarty object"

Value

Array (9)
0 => Array (13)
  pid => 1
  bid => 0
  type => "hostingaccount"
  name => "Dirt"
  description => ""
  features => Array (0)
  featuresdesc => ""
  paytype => "recurring"
  pricing => Array (6)
    type => "recurring"
    monthly => "€0,40 EUR Maandelijks + €0,25 EUR setup/verzendkosten"
    hasconfigoptions => false
    cycles => Array (1)
      monthly => "€0,40 EUR Maandelijks + €0,25 EUR setup/verzendkosten"
    rawpricing => Array (12)
      msetupfee => "0.25"
      qsetupfee => "0.00"
      ssetupfee => "0.00"
      asetupfee => "0.00"
      bsetupfee => "0.00"
      tsetupfee => "0.00"
      monthly => "0.40"
      quarterly => "-1.00"
      semiannually => "-1.00"
      annually => "-1.00"
      biennially => "-1.00"
      triennially => "-1.00"
    minprice => Array (6)
      price => WHMCS\View\Formatter\Price Object (0)
      setupFee => WHMCS\View\Formatter\Price Object (0)
      cycle => "monthly"
      simple => "€0,40"
      cycleText => "<span>€0,40</span>/mnd"
      cycleTextWithCurrency => "<span>€0,40 EUR</span>/mnd"
  freedomain => ""
  freedomainpaymentterms => Array (0)
  qty => ""
  isFeatured => false
1 => Array (13)
  pid => 2
  bid => 0
  type => "hostingaccount"
  name => "Grass"
  description => ""
  features => Array (0)
  featuresdesc => ""
  paytype => "recurring"
  pricing => Array (6)
    type => "recurring"
    monthly => "€0,80 EUR Maandelijks + €0,25 EUR setup/verzendkosten"
    hasconfigoptions => false
    cycles => Array (1)
      monthly => "€0,80 EUR Maandelijks + €0,25 EUR setup/verzendkosten"
    rawpricing => Array (12)
      msetupfee => "0.25"
      qsetupfee => "0.00"
      ssetupfee => "0.00"
      asetupfee => "0.00"
      bsetupfee => "0.00"
      tsetupfee => "0.00"
      monthly => "0.80"
      quarterly => "-1.00"
      semiannually => "-1.00"
      annually => "-1.00"
      biennially => "-1.00"
      triennially => "-1.00"
    minprice => Array (6)
      price => WHMCS\View\Formatter\Price Object (0)
      setupFee => WHMCS\View\Formatter\Price Object (0)
      cycle => "monthly"
      simple => "€0,80"
      cycleText => "<span>€0,80</span>/mnd"
      cycleTextWithCurrency => "<span>€0,80 EUR</span>/mnd"
  freedomain => ""
  freedomainpaymentterms => Array (0)
  qty => ""
  isFeatured => false
2 => Array (13)
  pid => 3
  bid => 0
  type => "hostingaccount"
  name => "Cobbelstone"
  description => ""
  features => Array (0)
  featuresdesc => ""
  paytype => "recurring"
  pricing => Array (6)
    type => "recurring"
    monthly => "€1,60 EUR Maandelijks + €0,25 EUR setup/verzendkosten"
    hasconfigoptions => false
    cycles => Array (1)
      monthly => "€1,60 EUR Maandelijks + €0,25 EUR setup/verzendkosten"
    rawpricing => Array (12)
      msetupfee => "0.25"
      qsetupfee => "0.00"
      ssetupfee => "0.00"
      asetupfee => "0.00"
      bsetupfee => "0.00"
      tsetupfee => "0.00"
      monthly => "1.60"
      quarterly => "-1.00"
      semiannually => "-1.00"
      annually => "-1.00"
      biennially => "-1.00"
      triennially => "-1.00"
    minprice => Array (6)
      price => WHMCS\View\Formatter\Price Object (0)
      setupFee => WHMCS\View\Formatter\Price Object (0)
      cycle => "monthly"
      simple => "€1,60"
      cycleText => "<span>€1,60</span>/mnd"
      cycleTextWithCurrency => "<span>€1,60 EUR</span>/mnd"
  freedomain => ""
  freedomainpaymentterms => Array (0)
  qty => ""
  isFeatured => false
3 => Array (13)
  pid => 4
  bid => 0
  type => "hostingaccount"
  name => "Stone"
  description => ""
  features => Array (0)
  featuresdesc => ""
  paytype => "recurring"
  pricing => Array (6)
    type => "recurring"
    monthly => "€2,40 EUR Maandelijks + €0,25 EUR setup/verzendkosten"
    hasconfigoptions => false
    cycles => Array (1)
      monthly => "€2,40 EUR Maandelijks + €0,25 EUR setup/verzendkosten"
    rawpricing => Array (12)
      msetupfee => "0.25"
      qsetupfee => "0.00"
      ssetupfee => "0.00"
      asetupfee => "0.00"
      bsetupfee => "0.00"
      tsetupfee => "0.00"
      monthly => "2.40"
      quarterly => "-1.00"
      semiannually => "-1.00"
      annually => "-1.00"
      biennially => "-1.00"
      triennially => "-1.00"
    minprice => Array (6)
      price => WHMCS\View\Formatter\Price Object (0)
      setupFee => WHMCS\View\Formatter\Price Object (0)
      cycle => "monthly"
      simple => "€2,40"
      cycleText => "<span>€2,40</span>/mnd"
      cycleTextWithCurrency => "<span>€2,40 EUR</span>/mnd"
  freedomain => ""
  freedomainpaymentterms => Array (0)
  qty => ""
  isFeatured => false
4 => Array (13)
  pid => 5
  bid => 0
  type => "hostingaccount"
  name => "Coal"
  description => ""
  features => Array (0)
  featuresdesc => ""
  paytype => "recurring"
  pricing => Array (6)
    type => "recurring"
    monthly => "€3,20 EUR Maandelijks + €0,25 EUR setup/verzendkosten"
    hasconfigoptions => false
    cycles => Array (1)
      monthly => "€3,20 EUR Maandelijks + €0,25 EUR setup/verzendkosten"
    rawpricing => Array (12)
      msetupfee => "0.25"
      qsetupfee => "0.00"
      ssetupfee => "0.00"
      asetupfee => "0.00"
      bsetupfee => "0.00"
      tsetupfee => "0.00"
      monthly => "3.20"
      quarterly => "-1.00"
      semiannually => "-1.00"
      annually => "-1.00"
      biennially => "-1.00"
      triennially => "-1.00"
    minprice => Array (6)
      price => WHMCS\View\Formatter\Price Object (0)
      setupFee => WHMCS\View\Formatter\Price Object (0)
      cycle => "monthly"
      simple => "€3,20"
      cycleText => "<span>€3,20</span>/mnd"
      cycleTextWithCurrency => "<span>€3,20 EUR</span>/mnd"
  freedomain => ""
  freedomainpaymentterms => Array (0)
  qty => ""
  isFeatured => false
5 => Array (13)
  pid => 6
  bid => 0
  type => "hostingaccount"
  name => "Iron"
  description => ""
  features => Array (0)
  featuresdesc => ""
  paytype => "recurring"
  pricing => Array (6)
    type => "recurring"
    monthly => "€4,00 EUR Maandelijks + €0,25 EUR setup/verzendkosten"
    hasconfigoptions => false
    cycles => Array (1)
      monthly => "€4,00 EUR Maandelijks + €0,25 EUR setup/verzendkosten"
    rawpricing => Array (12)
      msetupfee => "0.25"
      qsetupfee => "0.00"
      ssetupfee => "0.00"
      asetupfee => "0.00"
      bsetupfee => "0.00"
      tsetupfee => "0.00"
      monthly => "4.00"
      quarterly => "-1.00"
      semiannually => "-1.00"
      annually => "-1.00"
      biennially => "-1.00"
      triennially => "-1.00"
    minprice => Array (6)
      price => WHMCS\View\Formatter\Price Object (0)
      setupFee => WHMCS\View\Formatter\Price Object (0)
      cycle => "monthly"
      simple => "€4,00"
      cycleText => "<span>€4,00</span>/mnd"
      cycleTextWithCurrency => "<span>€4,00 EUR</span>/mnd"
  freedomain => ""
  freedomainpaymentterms => Array (0)
  qty => ""
  isFeatured => false
6 => Array (13)
  pid => 7
  bid => 0
  type => "hostingaccount"
  name => "Lapiz"
  description => ""
  features => Array (0)
  featuresdesc => ""
  paytype => "recurring"
  pricing => Array (6)
    type => "recurring"
    monthly => "€8,00 EUR Maandelijks"
    hasconfigoptions => false
    cycles => Array (1)
      monthly => "€8,00 EUR Maandelijks"
    rawpricing => Array (12)
      msetupfee => "0.00"
      qsetupfee => "0.00"
      ssetupfee => "0.00"
      asetupfee => "0.00"
      bsetupfee => "0.00"
      tsetupfee => "0.00"
      monthly => "8.00"
      quarterly => "-1.00"
      semiannually => "-1.00"
      annually => "-1.00"
      biennially => "-1.00"
      triennially => "-1.00"
    minprice => Array (6)
      price => WHMCS\View\Formatter\Price Object (0)
      setupFee => 0
      cycle => "monthly"
      simple => "€8,00"
      cycleText => "<span>€8,00</span>/mnd"
      cycleTextWithCurrency => "<span>€8,00 EUR</span>/mnd"
  freedomain => ""
  freedomainpaymentterms => Array (0)
  qty => ""
  isFeatured => false
7 => Array (13)
  pid => 8
  bid => 0
  type => "hostingaccount"
  name => "Gold"
  description => ""
  features => Array (0)
  featuresdesc => ""
  paytype => "recurring"
  pricing => Array (6)
    type => "recurring"
    monthly => "€12,00 EUR Maandelijks"
    hasconfigoptions => false
    cycles => Array (1)
      monthly => "€12,00 EUR Maandelijks"
    rawpricing => Array (12)
      msetupfee => "0.00"
      qsetupfee => "0.00"
      ssetupfee => "0.00"
      asetupfee => "0.00"
      bsetupfee => "0.00"
      tsetupfee => "0.00"
      monthly => "12.00"
      quarterly => "-1.00"
      semiannually => "-1.00"
      annually => "-1.00"
      biennially => "-1.00"
      triennially => "-1.00"
    minprice => Array (6)
      price => WHMCS\View\Formatter\Price Object (0)
      setupFee => 0
      cycle => "monthly"
      simple => "€12,00"
      cycleText => "<span>€12,00</span>/mnd"
      cycleTextWithCurrency => "<span>€12,00 EUR</span>/mnd"
  freedomain => ""
  freedomainpaymentterms => Array (0)
  qty => ""
  isFeatured => false
8 => Array (13)
  pid => 9
  bid => 0
  type => "hostingaccount"
  name => "Diamond"
  description => ""
  features => Array (0)
  featuresdesc => ""
  paytype => "recurring"
  pricing => Array (6)
    type => "recurring"
    monthly => "€16,00 EUR Maandelijks"
    hasconfigoptions => false
    cycles => Array (1)
      monthly => "€16,00 EUR Maandelijks"
    rawpricing => Array (12)
      msetupfee => "0.00"
      qsetupfee => "0.00"
      ssetupfee => "0.00"
      asetupfee => "0.00"
      bsetupfee => "0.00"
      tsetupfee => "0.00"
      monthly => "16.00"
      quarterly => "-1.00"
      semiannually => "-1.00"
      annually => "-1.00"
      biennially => "-1.00"
      triennially => "-1.00"
    minprice => Array (6)
      price => WHMCS\View\Formatter\Price Object (0)
      setupFee => 0
      cycle => "monthly"
      simple => "€16,00"
      cycleText => "<span>€16,00</span>/mnd"
      cycleTextWithCurrency => "<span>€16,00 EUR</span>/mnd"
  freedomain => ""
  freedomainpaymentterms => Array (0)
  qty => ""
  isFeatured => false

Found it but ido no what the error is

 

Share this post


Link to post
Share on other sites

Join the conversation

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

Guest
Reply to this topic...

×   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.

Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • 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