Jump to content

Shopping cart contents and hooks


tomdchi

Recommended Posts

I am working on a addon that needs to know what products are in the shopping cart and I am trying to use the hook PreCalculateCartTotals. The problem is that this hook doesn't give much useful info other than the product id. I thought I had a solution when I put the cartsummary.tpl into debug mode and the smarty debug console showed a very detailed $products array of everything in the cart.

 

	Array (1)
0 => Array (12)
 pid => "3"
 domain => ""
 billingcycle => "monthly"
 configoptions => ""
 customfields => Array (0)
 addons => Array (0)
 server => ""
 productinfo => Array (9)
   pid => "3"
   gid => "2"
   type => "other"
   groupname => "test"
   name => "blah blaha"
   description => ""
   freedomain => ""
   freedomainpaymentterms => Array (1)
     0 => ""
   freedomaintlds => Array (1)
     0 => ""
 allowqty => "1"
 qty => 1
 pricing => Array (5)
   baseprice => "$125.00 USD"
   setup => "$0.00 USD"
   recurring => Array (1)
     Monthly => "$125.00 USD"
   totaltoday => "$125.00 USD"
   recurringexcltax => Array (1)
     Monthly => "$125.00 USD"
 pricingtext => "$125.00 USD"

 

PERFECT...not so fast...

In my hook function I am grabbing the smarty vars like this:

    
   global $smarty;
   $tpl_vars = $smarty->get_template_vars();

 

Thought I was golden until I realized that the $tpl_vars array is not the same as what is in the smarty debug console. The products array is not there at all.

 

Anyone have an idea of how to get this products array from smarty? This array has to be somewhere. I looked in the session array and nothing was there so I don't know where its hiding.

Link to comment
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.

  • 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