Page 1 of 2 12 LastLast
Results 1 to 10 of 18

Hybrid View

  1. #1
    Join Date
    Oct 2006
    Location
    At Home
    Posts
    370
    Plugin Contributions
    0

    Default "Successfully added to cart" message stack - change position

    Any idea how to place 'success message stack' from the header to underneath product price in product info page just like the attached image shown below?
    Attached Images Attached Images  

  2. #2
    Join Date
    Oct 2007
    Location
    Australia
    Posts
    889
    Plugin Contributions
    0

    Default Re: Successfully added to cart message stack - change position

    I'd like to do this too, anyone know how? I believe the main area is in tpl_header.php

    Code:
    <?php
      // Display all header alerts via messageStack:
      if ($messageStack->size('header') > 0) {
        echo $messageStack->output('header');
      }
      if (isset($_GET['error_message']) && zen_not_null($_GET['error_message'])) {
      echo htmlspecialchars(urldecode($_GET['error_message']));
      }
      if (isset($_GET['info_message']) && zen_not_null($_GET['info_message'])) {
       echo htmlspecialchars($_GET['info_message']);
    } else {
    
    }
    ?>
    And then there is this in tpl_product_info_display.php

    Code:
    <?php if ($messageStack->size('product_info') > 0) echo $messageStack->output('product_info'); ?>
    So if I put the top code from the header into the info page where I want it, the message will display there, but how do I stop it from also displaying at the top of the page?

    Can anyone help? lol thanx ;)
    HunnyBee Design - ZC 1.3.9h ~ Digiscrap Forum
    "A man's manners are a mirror in which he shows his portrait." ~ Johann Wolfgang von Goethe

  3. #3
    Join Date
    Dec 2004
    Posts
    831
    Plugin Contributions
    0

    Default Re: Successfully added to cart message stack - change position

    would be interested too.
    Live and learn... the Zen way.

  4. #4
    Join Date
    Oct 2006
    Location
    At Home
    Posts
    370
    Plugin Contributions
    0

    Default Re: Successfully added to cart message stack - change position

    Ok, here what I did.

    Find: includes/templates/*yourtemplate*/common/tpl_header.php

    Cut out this code:

    PHP Code:
    <?php
      
    // Display all header alerts via messageStack:
      
    if ($messageStack->size('header') > 0) {
        echo 
    $messageStack->output('header');
      }
      if (isset(
    $_GET['error_message']) && zen_not_null($_GET['error_message'])) {
      echo 
    htmlspecialchars(urldecode($_GET['error_message']));
      }
      if (isset(
    $_GET['info_message']) && zen_not_null($_GET['info_message'])) {
       echo 
    htmlspecialchars($_GET['info_message']);
    } else {

    }
    ?>
    Then open: includes/templates/*yourtemplates*/templates/tpl_product_info_display.php

    Paste the above code to anywhere, for example after
    <!--eof Reviews button and count -->

    Edit CSS to your likely,

    .messageStackSuccess {
    background-color:red;
    color:#000;
    }

    Then try to add your product to the cart and see how it goes.

  5. #5
    Join Date
    Aug 2008
    Posts
    13
    Plugin Contributions
    0

    Default Re: Successfully added to cart message stack - change position

    Thanks for sharing, Miles! I've been searching for a nifty ajax-like mod or such but just couldn't find one. This will work for me! Thanks! :)

  6. #6
    Join Date
    Jan 2004
    Posts
    58,249
    Blog Entries
    3
    Plugin Contributions
    106

    Default Re: Successfully added to cart message stack - change position

    Keep in mind that MOVING that from the header file into the product-info file specifically will prevent ALL other pages EVERYWHERE on your site from ever seeing any alert messages intended to be shown. And, COPYING instead it will cause duplicates on your product-info page.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donations always welcome: www.zen-cart.com/donate

    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.

  7. #7
    Join Date
    Mar 2007
    Location
    Taiwan
    Posts
    191
    Plugin Contributions
    0

    Default Re: Successfully added to cart message stack - change position

    Is it possible to put an if statement into the header -

    if this is the product info page then don't display

    - so that we can have a custom placement of the "product added" alert, and other alerts won't be affected?

    I'm just thinking out loud - will try experimenting with this in the next couple of days.

  8. #8
    Join Date
    Oct 2007
    Location
    MA, USA
    Posts
    319
    Plugin Contributions
    0

    Default Re: "Successfully added to cart" message stack - change position

    How do we display this and or turn it off. where is the button in the admin again?
    Thank you, Sincerely, MagicMan

  9. #9
    Join Date
    Mar 2007
    Location
    Taiwan
    Posts
    191
    Plugin Contributions
    0

    Default Re: "Successfully added to cart" message stack - change position

    I added an if statement to the includes/templates/YOUR_TEMPLATE/common/tpl_header.php file as so:

    <!--bof Add to Cart Alert-->
    <?php

    if ($current_page_base == 'product_info'){
    //do nothing
    } else {
    // Display all header alerts via messageStack:
    if ($messageStack->size('header') > 0) {
    echo $messageStack->output('header');
    }
    if (isset($_GET['error_message']) && zen_not_null($_GET['error_message'])) {
    echo htmlspecialchars(urldecode($_GET['error_message']));
    }
    if (isset($_GET['info_message']) && zen_not_null($_GET['info_message'])) {
    echo htmlspecialchars($_GET['info_message']);
    } else {

    }
    }
    ?>
    <!--eof Add to Cart Alert-->

    This prevents the header alert from showing up on the product_info pages, but allows other alerts to show correctly. This is important if your product listing pages have an "add to cart" button that doesn't redirect them to the product page - the "add to cart" alert will show up properly.

    I also moved the alert to the bottom of the header - just before the final </div>. This brings the alert closer to the eye level and more obvious.

  10. #10
    Join Date
    May 2006
    Posts
    729
    Plugin Contributions
    0

    Default Re: "Successfully added to cart" message stack - change position

    Did you still move the alert to your product info page and added that if statement or just added that if statement?

 

 
Page 1 of 2 12 LastLast

Similar Threads

  1. Successfully added Product to the cart ...
    By mviben in forum Templates, Stylesheets, Page Layout
    Replies: 3
    Last Post: 29 Apr 2009, 01:08 PM
  2. successfully added to cart not showing
    By gsdcypher in forum General Questions
    Replies: 32
    Last Post: 28 Jan 2009, 10:05 PM
  3. Turn off "Successfully added Product to the cart ..."
    By dietcoke in forum Templates, Stylesheets, Page Layout
    Replies: 12
    Last Post: 23 Sep 2008, 08:42 PM
  4. Successfully added to cart message
    By lviper in forum Templates, Stylesheets, Page Layout
    Replies: 4
    Last Post: 27 Oct 2007, 03:47 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
  •