Results 1 to 10 of 12

Hybrid View

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

    Default Re: Is there some way to trigger adding a specific product to an open cart?

    Quote Originally Posted by David R View Post
    Do you know if anyone ever pushed that tutorial example far enough to know it will work?
    I know I did, years ago. Not sure if I still have that code around anyplace.
    It's very challenging to also have an Admin interface to manage all the possible options. What I'd done was all handled in a PHP file, without any admin-side controls about what products qualified with other products etc. Very rigid implementation. But certainly doable. If you want nice admin controls and switches and fancy dialogs you'll be needing to invest more to provide that.
    .

    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.

  2. #2
    Join Date
    Sep 2009
    Location
    Stuart, FL
    Posts
    13,872
    Plugin Contributions
    96

    Default Re: Is there some way to trigger adding a specific product to an open cart?

    Note, too, that the example should be updated to show the use of the __construct function (that's going to be needed for PHP 7.0 compliance), e.g. changing references like:
    Code:
    <?php
     class myObserver extends base {
       function myObserver() {
         $this->attach($this, array('NOTIFIER_CART_ADD_CART_END'));
       }
    ...
     }
    to
    Code:
    <?php
     class myObserver extends base {
       function __construct() {
         $this->attach($this, array('NOTIFIER_CART_ADD_CART_END'));
       }
    ...
     }

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

    Default Re: Is there some way to trigger adding a specific product to an open cart?

    Quote Originally Posted by lat9 View Post
    Note, too, that the example should be updated to show the use of the __construct function (that's going to be needed for PHP 7.0 compliance), e.g. changing references like:
    Code:
    <?php
     class myObserver extends base {
       function myObserver() {
         $this->attach($this, array('NOTIFIER_CART_ADD_CART_END'));
       }
    ...
     }
    to
    Code:
    <?php
     class myObserver extends base {
       function __construct() {
         $this->attach($this, array('NOTIFIER_CART_ADD_CART_END'));
       }
    ...
     }
    Good point. Updated. Thanks.
    .

    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.

  4. #4
    Join Date
    Oct 2011
    Posts
    42
    Plugin Contributions
    0

    Default Re: Is there some way to trigger adding a specific product to an open cart?

    Quote Originally Posted by DrByte View Post
    Good point. Updated. Thanks.
    Thanks very much!

    We don't need any admin interface component to this, and I can repurpose some of the dialog functions we use now. I'll try to get it working from the tutorial as it stands, so I don't introduce any new troubleshooting issues with the __construct function for now.

  5. #5
    Join Date
    Feb 2008
    Posts
    529
    Plugin Contributions
    0

    Default Re: Is there some way to trigger adding a specific product to an open cart?

    Out of curiosity...is the idea to add the free product before or after shipping is calculated? And/or would the customer be able to remove the free item from their cart if they didn't want it, or if there was a shipping cost and they didn't want to pay?

  6. #6
    Join Date
    Oct 2011
    Posts
    42
    Plugin Contributions
    0

    Default Re: Is there some way to trigger adding a specific product to an open cart?

    Quote Originally Posted by soxophoneplayer View Post
    Out of curiosity...is the idea to add the free product before or after shipping is calculated? And/or would the customer be able to remove the free item from their cart if they didn't want it, or if there was a shipping cost and they didn't want to pay?
    I've got the luxury of working on this in the narrow confines of our situation: the added product is free, shipping is free, these items are not taxable.

    There is at least one old thread on this topic where the writer was protesting the propriety of adding an item to a customer's cart. I'm sure the questions of tax and shipping would amplify that if someone is trying to make a general purpose contribution.

    In what again is our narrow case, the goal is to have this work automatically without requiring any additional steps on the customer's part, and (ideally) to not allow them to trick the system by removing qualifying items during the process. Failing that last, we will have to screen each order during the promotion to be sure it really qualifies.

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

    Default Re: Is there some way to trigger adding a specific product to an open cart?

    In this older post I made I gave some code examples that might be helpful as inspiration for your situation.
    .

    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.

 

 

Similar Threads

  1. Upgraded database, some customer orders there, some open to a blank page?
    By indigobnb in forum Upgrading from 1.3.x to 1.3.9
    Replies: 1
    Last Post: 6 Sep 2010, 07:42 PM
  2. Looking for a specific cart organized a specific way.
    By cpt_owner in forum Basic Configuration
    Replies: 0
    Last Post: 5 Sep 2009, 03:34 AM
  3. Is there a way of adding a product but stopping it from adding to new products?
    By philpalmerdevon in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 19 Jan 2009, 02:07 PM
  4. Is there any way to have product-specific attributes instead of global ones?
    By Ibrahim in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 11 Aug 2008, 03:54 PM
  5. Is there a way to setup a open amount product?
    By jdsmith8 in forum Setting Up Categories, Products, Attributes
    Replies: 2
    Last Post: 20 May 2007, 06:50 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
  •  
disjunctive-egg