Page 1 of 2 12 LastLast
Results 1 to 10 of 18
  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
    Oct 2007
    Location
    MA, USA
    Posts
    319
    Plugin Contributions
    0

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

    Sweet! Nice post. I now understand better how to move things around.
    Thank you, Sincerely, MagicMan

  7. #7
    Join Date
    Jan 2004
    Posts
    58,246
    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.

  8. #8
    Join Date
    Mar 2007
    Location
    Taiwan
    Posts
    190
    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.

  9. #9
    Join Date
    Jan 2004
    Posts
    58,246
    Blog Entries
    3
    Plugin Contributions
    106

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

    To some degree, yes. But what you're all trying to do is mimic ajax-like behavior, and many do that very badly. The biggest problem I see with people doing that is they bypass the shopping-cart page but never provide a *clear* easy-to-find link to see the actual cart contents and/or begin checkout. Huge mistake IMO.

    Nevertheless, if you're trying to deal specifically with positioning the "product added" alert, it would be a whole lot easier to set it to use its own messageStack class in the shopping-cart class and then echo only that particular messageStack class in the middle of your product 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.

  10. #10
    Join Date
    Mar 2007
    Location
    Taiwan
    Posts
    190
    Plugin Contributions
    0

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

    Quote Originally Posted by DrByte View Post
    To some degree, yes. But what you're all trying to do is mimic ajax-like behavior, and many do that very badly. The biggest problem I see with people doing that is they bypass the shopping-cart page but never provide a *clear* easy-to-find link to see the actual cart contents and/or begin checkout.
    I can't speak for anyone else, but the reason I want this change is that my site is set to stay on the product info page after adding an item to the cart, and the green "added successfully" notice in the header is not really obvious, so it sometimes seems that nothing has happened when you add the item. By placing the notification within the product description, near the "add to cart button" they've just clicked, there's no confusion about what has just happened.

 

 
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
  •