Jump to content
Sign in to follow this  
JesusSuarz

access smarty

Recommended Posts

Hello

I have a variable that is printed with {debug} in the tpl template.

however I want to get the result in php of this variable.

I need to get $customfields from a hook.

how could you access $customfields that is printed inside a product

 

@brian! could you help me?

Share this post


Link to post
Share on other sites
5 hours ago, JesusSuarz said:

how could you access $customfields that is printed inside a product

well assuming the array exists on the page in question (and you say it does - productdetails?), and the hook point can access $vars directly, then $vars['customfields'] should give you access to the product customfields array.

3 hours ago, JesusSuarz said:

in other words, I am trying to get the custom values of a product from a customer....

the other way would be a quick db query - especially if you were only looking for one specific pcf value.

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  

  • Similar Content

    • By JesusSuarz
      Hello,
      I'm trying to get some way to query if a user is online.
      I don't want to know the current user.
      if not something you can define for example $clientid or $userid or $emailclient ...
      I am making an external site. and i need to work with user sessions. (I am making a remote connection with the api).
      this function does not currently exist in the api available.
      I've been seeing this: https://developers.whmcs.com/advanced/authentication/
      however I do not see that it allows to define the user.
      I was also seeing this: https://docs.whmcs.com/Sessions
      I was able to save the cookie in the database, however I can't find any way to identify the one that belongs to each user.
      any idea how I can get (which users are online?) ..
      (please nothing to do with smarty, only php).

      postdata: forget to tell the method I use to get user authentication in my application.
      create the following code for my application:
      I first make a connection to the api: https://developers.whmcs.com/api/authentication/
      soon ValidateLogin: https://developers.whmcs.com/api-reference/validatelogin/
      soon GetClientsDetails: https://developers.whmcs.com/api-reference/getclientsdetails/
      soon CreateSsoToken: https://developers.whmcs.com/api-reference/createssotoken/
      // validar usuario $command = 'ValidateLogin'; $postData = array( 'email' => $email_user, //post 'password2' => $password_user, //post ); $api_login = localAPI($command, $postData); //var de id de usuario: $api_login["userid"]; // si se encuentra el user entonces traer detalles del usuario via email $clientid = array(); // array que tiene el id del cliente if ($api_login["userid"] == true) { $command = 'GetClientsDetails'; $postData = array( 'email' => $email_user, // email login ); $details_client = localAPI($command, $postData); $clientid[] = $details_client["client_id"]; } // variable del clientid es: $clientid[0]; // crear token de session $command = 'CreateSsoToken'; $postData = array( 'client_id' => $clientid[0], ); $results_ssotoken = localAPI($command, $postData); echo '<pre>'; var_dump($results_ssotoken); echo '</pre>'; this will create the url with (CreateSsoToken) where the user will be redirected for autologin, however the cookie is created only after entering the client area. that's why I don't know how to get the cookie, or identify the user.
       
      @brian! would you help me with this?
    • By Innocent SANGWE
      Dear WHMCS community,
      I am getting a 404 page every time an order is placed successfully on my website : hogionline.com
      I tried to change the website twice, reinstalled whmcs many times but i'm still getting the error.
      It seems like the system is trying to generate the invoice then fails.
      The link i am getting is :
      https://hogionline.com/whmcs_bridge/viewinvoice.php?id=2&systpl=six
      But when I log in the client area,  the invoice is located there.
      Any idea on how i can fix the issue!?
      Regards,
    • By Waqas Saeed
      I'm a Domain name and Hosting Reseller; I've integrated the WHMCS that takes order and run module commands on successful transaction; We're happy with the business but it feels now that we should expend the business by offering different services to the vendors, or act as a vendor store;
      1) What the modules in the market that offers WHMCS to act as a vendor store? 
      To take opportunity of developed modules; What modules are widely used? e.g. if you find good module to offer registration of the events through WHMCS ( Get webinars ID)  
       
       
       
       
       
    • By towens
      Hello,

      I have a WHMCS install in which we're using the API to embed an order form in another application. With WHMCS 8x, we're using the CreateSsoToken API function to authenticate the user. This same code is working an another WHMCS install, both of which are on 8.1.3. Users/Clients are being created properly in both installs, but only in the other install are those users being redirected to the cart; in this one, I'm getting this error:
       
      {"error":"access_denied","error_description":"Single Sign-On has been disabled for this account."}
      I did find this community post about the error, but we're not using cPanel application links, I double checked the value in the tblclients.uuid table, and ensured the client had SSO enabled.

      Here is the function we're using to build the SSO token request. This section, and the callwhmcsapi() function it references, are the same between this install (that's throwing the above error) and the other install that's working fine. I've also double checked that this is the proper path for the product.
       
      function whmcssso($client){ $params['client_id'] = $client['client_id']; $params['destination'] = 'sso:custom_redirect'; $params['sso_redirect_path'] = 'cart.php?a=add&pid=1'; $result = callwhmcsapi("CreateSsoToken",$params); return $result['redirect_url']; }
      Any help would be appreciated, thank you.

      Best,
    • By Waqas Saeed
      Hello. 
      Hook file contain this code,. to retrieve the values from the database, With latest version of WHMCS 8 am unable to access the variable through the following code; 
       $invoiceData['merchant_id'] = Capsule::table('tblpaymentgateways')->where('gateway', 'MODULE')->where('setting' , 'ppmerchantId')->get(); if echo $invoiceData['merchant_id'] returns; 
      [{"id":58,"gateway":"MODULE","setting":"ppmerchantId","value":"7247821a8601xxxxxxf862bc00d51df36f8b7f4c7cbc503fdf06e54cc41d09798d3a74513ff8d6ac8c","order":0}] How to retrieve the value in PHP code? 
      Version : Most Latest WHMCS. PHP 7.4
       
  • 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