Page 1 of 2 12 LastLast
Results 1 to 10 of 11
  1. #1
    Join Date
    Sep 2012
    Posts
    40
    Plugin Contributions
    0

    Default Automatic message in checkout/shopping basket when certain items are selected

    Hello,

    [Using 1.3.9h, upgrading organically]

    I'm trying to set up a series of special order products on our site, and wish for a message saying something akin to:

    "As there are some special order items in your basket, please note that the complete order shall be delivered within seven working days whilst we source your SO items - we endeavour to contact you within 24 hours of your order for a more precise update".

    Is there a way to make a message come up only when selected items are chosen?

    We've tried using the SO Products Module, but it didnt really work out for us, so wanting an alternative solution and we're just one message away.

    Thank you ZC

  2. #2
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Automatic message in checkout/shopping basket when certain items are selected

    Are all of these special order products in one category?
    Zen-Venom Get Bitten

  3. #3
    Join Date
    Sep 2012
    Posts
    40
    Plugin Contributions
    0

    Default Re: Automatic message in checkout/shopping basket when certain items are selected

    No, but could it be an option to put all 'special order' products into one master category and then 'link' the products individually to other categories?

  4. #4
    Join Date
    Sep 2012
    Posts
    40
    Plugin Contributions
    0

    Default Re: Automatic message in checkout/shopping basket when certain items are selected

    Sorry, by that I meant - in order to make this work based on a certain catagory, i could put all these products into one category with ease, so that could be a viable option.

  5. #5
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,761
    Plugin Contributions
    9

    Default Re: Automatic message in checkout/shopping basket when certain items are selected

    Add an if statement to your templates tpl_product_info_display.php file
    What ever the cat number for this cat is is what you will want to insert for cpath=65

    Code:
      if (in_array($current_page_base,explode(cpath=65)) ) {
        <div id="specialOrder"  <?php echo "Your special order text.";
        ?> 
       </div>
      }
    You can also add #specialOrder to your stylesheet if necessary for specific styling
    Zen-Venom Get Bitten

  6. #6
    Join Date
    Sep 2012
    Posts
    40
    Plugin Contributions
    0

    Default Re: Automatic message in checkout/shopping basket when certain items are selected

    Hello,

    I tried inserting the code, but no messages come up in my shopping basket or checkout for items chosen from the specific 'special order' category.

    Am I meant to put the code in a specific place in the tpl_product_info_display.php

    Please let me know :-)

  7. #7
    Join Date
    Mar 2008
    Location
    Cape Town & London (depends on the season)
    Posts
    2,975
    Plugin Contributions
    0

    Default Re: Automatic message in checkout/shopping basket when certain items are selected

    Quote Originally Posted by christospur View Post
    Hello,

    I tried inserting the code, but no messages come up in my shopping basket or checkout for items chosen from the specific 'special order' category.
    Well it wouldn't appear in checkout or shopping cart, because the code is in tpl_product_info_display.php

    Quote Originally Posted by christospur View Post
    Am I meant to put the code in a specific place in the tpl_product_info_display.php

    Please let me know :-)
    The position of the message (in PRODUCT INFO PAGES) is determined by where it is placed in relation to other <!---bof xxxxxxxxxx --> <!--eof xxxxxxxxxx --> elements.

  8. #8
    Join Date
    Sep 2012
    Posts
    40
    Plugin Contributions
    0

    Default Re: Automatic message in checkout/shopping basket when certain items are selected

    I see... how can I get a message to appear in the shopping basket / checkout if certain items are chosen?

  9. #9
    Join Date
    Sep 2012
    Posts
    40
    Plugin Contributions
    0

    Default Re: Automatic message in checkout/shopping basket when certain items are selected

    Basically, I want to create a way for a message to come up in the shopping basket checkout (similar to the way that out of stock products have the message) for when certain products are chosen.

    Please could you let me know how I can do this, as the Special Order module didnt quite work out.

  10. #10
    Join Date
    Jan 2004
    Posts
    66,373
    Blog Entries
    7
    Plugin Contributions
    274

    Default Re: Automatic message in checkout/shopping basket when certain items are selected

    Two, maybe three steps:

    1. Upload the following as a new file to your site, as: /includes/classes/observers/class.observerProductsInCartMessage.php
    Code:
    <?php
    /**
     * if the site is multilingual, copy the following define() statement to a new extra custom language file at /includes/languages/your_language_folder/extra_definitions/extra_products_message.php
     */
    if (!defined('DEFINED_LANGUAGE_STRING_FOR_SPECIAL_PRODUCT_MESSAGE')) {
      define('DEFINED_LANGUAGE_STRING_FOR_SPECIAL_PRODUCT_MESSAGE', "As there are some special order items in your basket, please note that the complete order shall be delivered within seven working days whilst we source your SO items - we endeavour to contact you within 24 hours of your order for a more precise update.");
    }
    
    
    /**
     * If a customer adds certain products to their cart, display a special message on the shopping-cart page
     */
    class observerProductsInCartMessage extends base
    {
      /**
       * list the affected product IDs in this array, separating each with a comma:
       */
      var $products_array = array(10, 11, 12, 13);
    
      function __construct ()
      {
        $_SESSION['cart']->attach($this, array(
                        'NOTIFIER_CART_ADD_CART_END' ,
                        'NOTIFIER_CART_REMOVE_END',
                        'NOTIFIER_CART_GET_PRODUCTS_END'));
      }
    
      function update (&$class, $eventID, $paramsArray = array())
      {
        global $messageStack;
        static $alertSent = FALSE;
        /**
         * NOTE: The $alertSent variable is used to prevent displaying the message multiple times when multiple items are in the cart
         */
        $msgLocation = 'shopping_cart';
        foreach($this->products_array as $key) {
          if ($_SESSION['cart']->in_cart_check('products_id', $key) > 0) {
            if ($alertSent == FALSE) $messageStack->add_session($msgLocation, DEFINED_LANGUAGE_STRING_FOR_SPECIAL_PRODUCT_MESSAGE, 'caution');
            $alertSent = TRUE;
          }
        }
      }
    }
    2. Upload the following as a new file to your site, as: /includes/auto_loaders/config.observerProductsInCartMessage.php
    Code:
    <?php
    /**
     * @package observerscripts
     * @copyright Copyright 2003-2013 Zen Cart Development Team
     * @license http://www.zen-cart.com/license/2_0.txt GNU Public License V2.0
     */
    $autoLoadConfig[200][] = array('autoType'=>'class',
                                  'loadFile'=>'observers/class.observerProductsInCartMessage.php');
    $autoLoadConfig[200][] = array('autoType'=>'classInstantiate',
                                  'className'=>'observerProductsInCartMessage',
                                  'objectName'=>'observerProductsInCartMessage');
    3. Optionally set up multilingual support by creating the extra_definitions language file as described in the beginning of the code in #1 above.


    If it suits your needs, donations always welcome at www.zen-cart.com/donate
    .

    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.

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. v152 FREE SHIPPING over a Certain Price - BUT SELECTED ITEMS
    By sle39lvr in forum General Questions
    Replies: 1
    Last Post: 13 May 2014, 11:29 PM
  2. Help with disabling certain product variations if others are already selected...
    By chipmaker29 in forum Setting Up Categories, Products, Attributes
    Replies: 0
    Last Post: 8 Feb 2011, 01:48 AM
  3. Automatic Free Shipping for certain items/categories?
    By jgdovin in forum Setting Up Categories, Products, Attributes
    Replies: 9
    Last Post: 8 Aug 2009, 06:44 AM
  4. Fly to Basket when Adding Item to Shopping Cart
    By iZilla_Pod in forum General Questions
    Replies: 0
    Last Post: 12 Jun 2008, 02:52 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