Page 1 of 2 12 LastLast
Results 1 to 10 of 18
  1. #1
    Join Date
    Oct 2012
    Posts
    282
    Plugin Contributions
    0

    Default $_SESSION['cart']->total += addedAmount not showing up in $cartShowTotal

    Hey Everyone,
    it's Mr. HazMat here again...

    i'm trying to add a HazMat fee (using a Session variable) to the cart total
    like so....

    PHP Code:
    $_SESSION['cart']->total += $_SESSION['hazMatFee']; 
    i've echoed out the 2 variables:

    $_SESSION['cart']->total and $_SESSION['hazMatFee'];

    on the tpl_shopping_cart_default.php and they seem correct.

    but the $cartShowTotal is not reflecting the added fee.
    and subsequent checkout pages are not showing it either.

    can someone advise on how to get this to be added to the total?

    btw - in the class constuctor method i'm using
    'NOTIFIER_CART_SHOW_TOTAL_END'

  2. #2
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: $_SESSION['cart']->total += addedAmount not showing up in $cartShowTotal

    You can't add amounts to the shopping cart without adding them as line items, otherwise they won't get calculated properly when the line-items are summed.

    Or, use an Order Total module to add the amount to the order during checkout.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  3. #3
    Join Date
    Oct 2012
    Posts
    282
    Plugin Contributions
    0

    Default Re: $_SESSION['cart']->total += addedAmount not showing up in $cartShowTotal

    thanks, what is a 'line item'?

    and for Order Total module, you mean one that already exists?,

  4. #4
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: $_SESSION['cart']->total += addedAmount not showing up in $cartShowTotal

    Quote Originally Posted by tcarden View Post
    thanks, what is a 'line item'?
    Well, in the strictest sense, it's a product.
    So, unless you're adding another "product" to the cart, that's not what you want to bother doing.
    Quote Originally Posted by tcarden View Post
    and for Order Total module, you mean one that already exists?,
    No. I envision that your whole thing needs to ultimately manifest as an order-total entry, which means building an order-total module to read all the other data you've generated elsewhere, and then output it during checkout.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  5. #5
    Join Date
    Oct 2012
    Posts
    282
    Plugin Contributions
    0

    Default Re: $_SESSION['cart']->total += addedAmount not showing up in $cartShowTotal

    ok, thanks

  6. #6
    Join Date
    Oct 2012
    Posts
    282
    Plugin Contributions
    0

    Default Re: $_SESSION['cart']->total += addedAmount not showing up in $cartShowTotal

    I really don't know how to do an order total module YET, but for the time being.
    i'd like to just do a hack, i'm way behind on this as is!

    i'm doing well with these Hazmat session vars and would like to do this, (pseudo code

    if(isset($_SESSION['hazMatFee'])) {
    $shoppingCartTotal += $_SESSION['hazMatFee']; }

    can you tell which file i could add that to? i've been poking around but haven't found it so far

  7. #7
    Join Date
    Jan 2004
    Posts
    66,443
    Plugin Contributions
    279

    Default Re: $_SESSION['cart']->total += addedAmount not showing up in $cartShowTotal

    Try this:
    Attached Files Attached Files
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

  8. #8
    Join Date
    Oct 2012
    Posts
    282
    Plugin Contributions
    0

    Default Re: $_SESSION['cart']->total += addedAmount not showing up in $cartShowTotal

    ok, definitely i will.

    thanks!

  9. #9
    Join Date
    Oct 2012
    Posts
    282
    Plugin Contributions
    0

    Default Re: $_SESSION['cart']->total += addedAmount not showing up in $cartShowTotal

    a huge belated thanks Dr. Byte!, i really appreciate you taking the time to create that code.

    i installed but is not working. i believe the ot_hazmatfee.php is not loading.

    though i put it here.....
    includes/modules/order_total/

    to test i changed function __construct() to function __xconstruct, but there were no errors.

    to troubleshoot, i tried renaming same as the ObserverNotifier class i created hazMatProduct (ot_hazMatProduct.php) but that didn't seem to make it load either.

    how can i get this to load?,

    thanks

  10. #10
    Join Date
    Oct 2012
    Posts
    282
    Plugin Contributions
    0

    Default Re: $_SESSION['cart']->total += addedAmount not showing up in $cartShowTotal

    btw - i looked through the code, and am sure the variable

    $_SESSION['hazMatFee'] is set as i've been echoing it out in tpl_shopping_cart_default.php

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Replies: 8
    Last Post: 24 Apr 2016, 05:36 AM
  2. v150 Sub total and Total not showing on checkout pages 2 and 3
    By moksha in forum General Questions
    Replies: 3
    Last Post: 9 Apr 2013, 03:56 PM
  3. Split order not showing total
    By milstream in forum Managing Customers and Orders
    Replies: 0
    Last Post: 29 Nov 2011, 02:17 PM
  4. showing the shopping cart total on a different page
    By adornit in forum General Questions
    Replies: 1
    Last Post: 13 Feb 2008, 10:47 AM
  5. Sub-total not showing discount
    By cjmarley in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 0
    Last Post: 12 Nov 2007, 03:30 AM

Posting Permissions

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