Results 1 to 4 of 4
  1. #1

    Default Header And Session Error After Adding Free Gift Mod

    hi everyone sorry to post again. we are working on getting a free gift mod in out store. we figured out how to do it, this is what we did

    we made this file and named it config.freeProduct.php and uploaded to includes/autoloaders


    Code:
    <?php 
    
    $autoLoadConfig[90][] = array('autoType'=>'class',
                   'loadFile'=>'observers/class.freeProduct.php');
    $autoLoadConfig[90][] = array('autoType'=>'classInstantiate',
                   'className'=>'freeProduct',
                   'objectName'=>'freeProduct');
    ?>
    and made this file named class.freeProduct.php and uploaded to includes/classes/observers

    Code:
    <?php
    /**
     * Observer class used to add a free product to the cart if the user spends more than $x
     *
     */
    class freeProduct extends base {
     /**
      * The threshold amount the customer needs to spend.
      * 
      * Note this is defined in the shops base currency, and so works with multi currency shops
      *
      * @var decimal
      */
     var $freeAmount = 50;
     /**
      * The id of the free product.
      * 
      * Note. This must be a true free product. e.g. price = 0 Also make sure that if you don't want the customer
      * to be charged shipping on this, that you have it set correctly.
      *
      * @var integer
      */
     var $freeProductID = 57;
     /**
      * constructor method
      * 
      * Attaches our class to the $_SESSION['cart'] class and watches for 2 notifier events.
      */
     function freeProduct() {
      $_SESSION['cart']->attach($this, array('NOTIFIER_CART_ADD_CART_END', 'NOTIFIER_CART_REMOVE_END'));
     }
     /**
      * Update Method
      * 
      * Called by observed class when any of our notifiable events occur
      *
      * @param object $class
      * @param string $eventID
      */
     function update(&$class, $eventID) {
      if ($_SESSION['cart']->show_total() >= $this->freeAmount && !$_SESSION['cart']->in_cart($this->freeProductID) ) {
       $_SESSION['cart']->add_cart($this->freeProductID);
      }
      if ($_SESSION['cart']->show_total() < $this->freeAmount && $_SESSION['cart']->in_cart($this->freeProductID) ) {
       $_SESSION['cart']->remove($this->freeProductID);
      }
      if ($_SESSION['cart']->in_cart($this->freeProductID)) {
       $_SESSION['cart']->contents[$this->freeProductID]['qty'] = 1;
      }
     }
    }
    ?>

    once these were uploaded we got these errors

    Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/cara1977/public_html/includes/auto_loaders/config.freeProduct.php:8) in /home/cara1977/public_html/includes/functions/sessions.php on line 100

    Warning: Cannot modify header information - headers already sent by (output started at /home/cara1977/public_html/includes/auto_loaders/config.freeProduct.php:8) in /home/cara1977/public_html/includes/init_includes/init_templates.php on line 78


    also the font sizes on our site changed.

    i searched and found alot of header error but none related to this mod.

    we are using 1.3.0.2

    im just not sure what to do, if anyone has any insight i would greatly appreciate it.

    thanks so much

    Cara

  2. #2
    Join Date
    Apr 2006
    Posts
    44
    Plugin Contributions
    0

    Re: Header And Session Error After Adding Free Gift Mod

    I seem to be getting the same error (but did not add the free gift mod).

    Warning: Variable passed to each() is not an array or object in /home/www/staging/includes/classes/db/mysql/query_factory.php on line 112

    Warning: session_start() [function.session-start]: Cannot send session cache limiter - headers already sent (output started at /home/www/staging/includes/classes/db/mysql/query_factory.php:112) in /home/www/staging/includes/functions/sessions.php on line 100

    Warning: Cannot modify header information - headers already sent by (output started at /home/www/staging/includes/classes/db/mysql/query_factory.php:112) in /home/www/staging/includes/init_includes/init_templates.php on line 78

    Any one have any input?

    The other messages I found on the forums about this had remarks about removing unseen spaces at the end of the .php file in the errors above. I checked those files for excess spaces and it has not corrected the situation.

    ??
    --
    Brad Schwartz <baschwar at baschwar dot com>
    http://www.baschwar.com/

  3. #3
    Join Date
    Apr 2006
    Posts
    44
    Plugin Contributions
    0

    Default Re: Header And Session Error After Adding Free Gift Mod

    I found my own fix. :)

    I had run out of disk space!! The last thing I had done on the site was to upload a bunch of sample .mp3 files and it pushed my over my server limit, thus causing an error about the session cache, i.e. not able to write to the cache directory, yielding the ugly error! Woo-hoo!
    --
    Brad Schwartz <baschwar at baschwar dot com>
    http://www.baschwar.com/

  4. #4
    Join Date
    May 2006
    Posts
    12
    Plugin Contributions
    0

    Default Re: Header And Session Error After Adding Free Gift Mod

    Good-bye OsCommerce
    Hello Zen-Cart

    As a recent convert to Zen-Cart, it just keeps getting better and better. This is the single best addition to the Zen-Cart that I've seen so far. Thank you very much for the work that went into developing it. It works like a charm.

 

 

Similar Threads

  1. After adding SSL, getting your session has timed out error
    By roekoe in forum General Questions
    Replies: 7
    Last Post: 11 Feb 2013, 10:57 PM
  2. Admin session does not expire after removal of Admin Profile mod.
    By gamenano in forum All Other Contributions/Addons
    Replies: 0
    Last Post: 16 Jul 2010, 02:54 AM
  3. Free Gift after certian amount.
    By wmorris in forum General Questions
    Replies: 3
    Last Post: 24 Jun 2009, 07:49 PM
  4. Gift Certificate not showing up in Queue after ordered using Value GV mod
    By vegascoug in forum Discounts/Coupons, Gift Certificates, Newsletters, Ads
    Replies: 1
    Last Post: 3 Dec 2007, 08:00 AM
  5. Free Gift Mod......A Couple Of Questions
    By bobbyt in forum All Other Contributions/Addons
    Replies: 6
    Last Post: 30 Oct 2007, 07:30 AM

Bookmarks

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
Zen-Cart, Internet Selling Services, Klamath Falls, OR