We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 9995
    • 1,613 Posts
    fourroses666 Reply #1, 11 years ago
    With Magento you can see a message, "Productname" is added to the cart.

    I need this message too!

    Really don't know how to do this.
    I have a Snippet with this content: http://pastebin.com/7A4Twhim

    Maybe some code can be add there?
    Does anyone knows howto?

      Evolution user, I like the back-end speed and simplicity smiley
      • 9995
      • 1,613 Posts
      fourroses666 Reply #2, 11 years ago
      I have had some help. This code below will show the message.

      Need to add this:
      setcookie('added_prod', $productId, time() + 60*60*24*30, '/'); // set cookie

      in my snippet before this line:
      $url = $modx->makeUrl($redirectTo, '', '', $redirectScheme);


      and then create snippet [[!product_added]]

      	<?php
      	if (isset($_COOKIE) && isset($_COOKIE['added_prod']) && !empty($_COOKIE['added_prod'])) {
      		$id_prod = (int) $_COOKIE['added_prod'];
      		$resource = $modx->getObject('modResource',$id_prod);
      		setcookie("added_prod", "", time()-3600); // unset cookie
      	    return '<div class="message">The product "'.$resource->get('pagetitle').'" is added to the basket</div>';
      	}
      


      The problem now is, when a product is added it reloads the page, the message pops up, but it won't disappear when I go to an other page.
        Evolution user, I like the back-end speed and simplicity smiley
        • 9995
        • 1,613 Posts
        fourroses666 Reply #3, 11 years ago
        setcookie("added_prod", "", time()-3600);

        needs to be
        setcookie("added_prod", "", time()-3600, '/'); // unset cookie
          Evolution user, I like the back-end speed and simplicity smiley