Community Forums

Discuss, share and get help from our community of friendly WHMCS users

Close
Login to Your Account
Page 2 of 2 FirstFirst 12
Results 16 to 24 of 24
  1. #16
    Join Date
    Oct 2007
    Location
    Thessaloniki, Greece
    Posts
    267

    Default Re: Order Summary in non cart pages

    Quote Originally Posted by brian! View Post
    front page of the cart is products.tpl,
    Seems that is not so easy job even for simple things. eg when I seen in the template {$product.name} I thought that all tblproducts data are available so by using for example {$product.mod_eshop_logo} I'll have the product's logo.
    Unfortunatelly seems that in the cart.php there "JOIN TABLES" and in the array $products there are only few values avaiable. I add in the [email protected]_r} template to see the array's values and what I got is:
    PHP Code:
    Array (     [pid] => 2     [bid] => 0     [type] => other     [name] => Social Blog     [description] => This is the description     [features] => Array         (         )      [featuresdesc] => This is the description
         
    [paytype] => recurring     [pricing] => Array         (             [type] => recurring             [semiannually] => €15,00EUR Semi-Annually + €20,00EUR Setup Fee             [hasconfigoptions] =>              [cycles] => Array                 (                     [semiannually] => €15,00EUR Semi-Annually + €20,00EUR Setup Fee                 )              [rawpricing] => Array                 (                     [msetupfee] => 0.00                     [qsetupfee] => 0.00                     [ssetupfee] => 20.00                     [asetupfee] => 0.00                     [bsetupfee] => 0.00                     [tsetupfee] => 0.00                     [monthly] => -1.00                     [quarterly] => -1.00                     [semiannually] => 15.00                     [annually] => -1.00                     [biennially] => -1.00                     [triennially] => -1.00                 )              [minprice] => Array                 (                     [price] => WHMCS\View\Formatter\Price Object                         (                             [price:protected] => 15                             [currency:protected] => Array                                 (                                     [id] => 1                                     [code] => EUR                                     [prefix] => €                                     [suffix] => EUR                                     [format] => 3                                     [rate] => 1.00000                                 )                              [defaultFormat:protected] => {PREFIX}{PRICE}{SUFFIX}                             [defaultCurrencyDescriptor:protected] => Array                                 (                                     [format] => 1                                     [prefix] =>                                      [suffix] =>                                  )                          )                      [setupFee] => WHMCS\View\Formatter\Price Object                         (                             [price:protected] => 20                             [currency:protected] => Array                                 (                                     [id] => 1                                     [code] => EUR                                     [prefix] => €                                     [suffix] => EUR                                     [format] => 3                                     [rate] => 1.00000                                 )                              [defaultFormat:protected] => {PREFIX}{PRICE}{SUFFIX}                             [defaultCurrencyDescriptor:protected] => Array                                 (                                     [format] => 1                                     [prefix] =>                                      [suffix] =>                                  )                          )                      [cycle] => semiannually                     [simple] => €15,00                     [cycleText] => €15,00/6 mo                     [cycleTextWithCurrency] => €15,00EUR/6 mo                 )          )      [freedomain] =>      [freedomainpaymentterms] => Array         (         )      [qty] =>      [isFeatured] =>  ) 1 
    I tried some other combinations eg {$product.products.mod_eshop_logo} but didn't worked eighter. As cart.php is encoded I can't see what variable names are used there and I can't say that I'm Mantis to find them.

    This means that even for the simpliest tasks I need to add queries with hooks.
    eWHMCS
    Professional WHMCS Extras

  2. #17
    Join Date
    Feb 2013
    Location
    UK
    Posts
    6,964

    Default Re: Order Summary in non cart pages

    $products is a complicated array that pulls content from a number of different tables (plus some additional tweaking to the results) and would take some effort to reproduce as is... if you've modified tblproducts with additional fields, and they aren't being shown in the array, then that would imply that the query that creates $products is only selecting specific fields (which would make some sense).

    {debug} will show you what's available to the template.

    for the simplest task, the hook will likely be simple too...

    getting one value from a database (e.g logo filename) is potentially just one line within a hook and then at the end of the hook, you just pass all the variables/arrays you've created back to the template for outputting.

  3. #18
    Join Date
    Oct 2007
    Location
    Thessaloniki, Greece
    Posts
    267

    Default Re: Order Summary in non cart pages

    Quote Originally Posted by brian! View Post
    $products is a complicated array that pulls content from a number of different tables (plus some additional tweaking to the results) and would take some effort to reproduce as is... if you've modified tblproducts with additional fields, and they aren't being shown in the array, then that would imply that the query that creates $products is only selecting specific fields (which would make some sense).
    The "Greek" way
    Code:
    use Illuminate\Database\Capsule\Manager as Capsule;
    
    function ct_product_list($vars) {
        $gid = $_REQUEST["gid"];
        if (!$gid || $gid < 1)
        {
            $sql_ct_products = Capsule::table('tblproducts')
                    ->where('hidden','0')
                    ->get();
        } else {
            $sql_ct_products = Capsule::table('tblproducts')
                    ->where('gid',$gid)
                    ->where('hidden','0')
                    ->get();        
        }
        $encodedata = json_encode($sql_ct_products);
        $decodedata = json_decode($encodedata, true);
    
        return array("ct_browse_products" => $decodedata);
    }
    
    // If Cart page
    if ($filename=="cart")
    {
    
        add_hook("ClientAreaPage",1,"ct_product_list");
    }
    so I've the array that I want

    Quote Originally Posted by brian! View Post
    {debug} will show you what's available to the template.
    Does not works. Have started another thread. I tried many combination but does not works. And the strange is that I'm using {debug} very often in my PHP scripts.

    - - - Updated - - -

    Edited.....
    A quick question:
    Code:
    ->order('order','DESC')
    ->order('updated_at','DESC')
    ->order('created_at','DESC')
    should works like:
    Code:
    ORDER BY 'order' ASC, updated_at DESC, created_at DESC
    eWHMCS
    Professional WHMCS Extras

  4. #19
    Join Date
    Feb 2013
    Location
    UK
    Posts
    6,964

    Default Re: Order Summary in non cart pages

    Quote Originally Posted by ChrisTERiS View Post
    The "Greek" way
    if you're writing this for WHMCS v7+, then use ClientAreaPageCart instead of ClientAreaPage in your hook and you won't need to check the filename... other than that, hook looks fine to me.

    Quote Originally Posted by ChrisTERiS View Post
    Does not works. Have started another thread. I tried many combination but does not works. And the strange is that I'm using {debug} very often in my PHP scripts.
    if you're not seeing the window, and assuming your modification to smarty.class isn't causing this (and you shouldn't need to edit it), then my first thought would be to see if the browser/firewall/av is stopping the popup window launching.

    Quote Originally Posted by ChrisTERiS View Post
    - - - Updated - - -

    Edited.....
    A quick question:
    Code:
    ->order('order','DESC')
    ->order('updated_at','DESC')
    ->order('created_at','DESC')
    should works like:
    Code:
    ORDER BY 'order' ASC, updated_at DESC, created_at DESC
    you want to be using orderBy not order...

    PHP Code:
    ->orderBy('order','desc')
    ->
    orderBy('updated_at','desc')
    ->
    orderBy('created_at','desc'

  5. #20
    Join Date
    Oct 2007
    Location
    Thessaloniki, Greece
    Posts
    267

    Default Re: Order Summary in non cart pages

    The first (little) step to the glory
    https://www.teriakis.com/cart.php?gid=1
    The image is there !!

    - - - Updated - - -

    Also I seen that user currency is on the session so I can make it multi currency. If I knew the function name to format the price should be fine. Otherwise I need to build my own function. Not a big deal, but I want to shorten the developing time.
    eWHMCS
    Professional WHMCS Extras

  6. #21
    Join Date
    Feb 2013
    Location
    UK
    Posts
    6,964

    Default Re: Order Summary in non cart pages

    Quote Originally Posted by ChrisTERiS View Post
    The first (little) step to the glory
    https://www.teriakis.com/cart.php?gid=1
    The image is there !!
    well done!

    btw - Firefox is showing this popup error...



    so it's trying to show the {debug} popup window but your browser will be blocking it - if you can tweak your browser to allow popup windows from your site, you should start seeing the debug window.

    Quote Originally Posted by ChrisTERiS View Post
    Also I seen that user currency is on the session so I can make it multi currency. If I knew the function name to format the price should be fine. Otherwise I need to build my own function. Not a big deal, but I want to shorten the developing time.
    https://developers.whmcs.com/advance...cy-formatting/

  7. #22
    Join Date
    Oct 2007
    Location
    Thessaloniki, Greece
    Posts
    267

    Default Re: Order Summary in non cart pages

    Nice ....... Now I must keep a bit silence to think about an issue. Like "To be or not to be" ...... To use product configuration template to show product details or design a separate template? I tested and (even with some difficulties) I can use product configuration. The problem is that when user goes to that page to read the details the product is added to the cart. Not good solution. Imagine a user who visited 10 products to read the details. He'll see them on his cart. So most probably I'll insert a separate page between product listing and product configuration. The only that I can do is to add a setting in product table when to use this extra page or goes directly to configuration. In simple words, in product listing the user will see one of:
    1.- Order Now (as works now) and he'll redirect to configuration page
    2.- More Details which will redirects him to that special page.
    eWHMCS
    Professional WHMCS Extras

  8. #23
    Join Date
    Oct 2007
    Location
    Thessaloniki, Greece
    Posts
    267

    Default Re: Order Summary in non cart pages

    use Illuminate\Database\Capsule\Manager as Capsule; is for 7.x version while
    use WHMCS\Database\Capsule is for 6.x versions?
    eWHMCS
    Professional WHMCS Extras

  9. #24
    Join Date
    Feb 2013
    Location
    UK
    Posts
    6,964

    Default Re: Order Summary in non cart pages

    i've used... use Illuminate\Database\Capsule\Manager as Capsule; for v6 hooks previously without issue.

Page 2 of 2 FirstFirst 12

Similar Threads

  1. Order Summary Show Other Pages
    By FlyHost in forum Developer Corner
    Replies: 11
    Last Post: 02-14-17, 05:54 PM
  2. [Not A Bug] VAT does not reflect in the Cart Summary of Ajax Order Template
    By SindreM in forum Troubleshooting Issues
    Replies: 1
    Last Post: 12-26-13, 05:13 PM
  3. Floating Cart Summary floats to far!
    By kristofferR in forum Using WHMCS
    Replies: 1
    Last Post: 10-03-11, 07:34 PM
  4. [NOT A BUG] Cart summary box on ajax order form
    By magga in forum Troubleshooting Issues
    Replies: 6
    Last Post: 04-11-11, 07:49 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •