We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 8425
    • 159 Posts
    Hi,
    Has anyone encountered this behaviour before? Somehow the "Add Cart" button started to put 2 items in the cart by default. It worked fine for a while but now it adds 2 products at once. Also where can I get the source for the javascript to debug?
    Any idea of what’s happening?
    Thanks for sharing...
      • 8425
      • 159 Posts
      It seems to come from the fact that I have these 2 lines included twice
      <script type="text/javascript" charset="utf-8">var cart_doc = "index.php?id=11";</script>
      	<script type="text/javascript" src="assets/snippets/treasure_chest/script/treasurechest.js"></script>
      

      How can I change that? I don’t really know why those get inserted twice?
      Thanks
        • 3717
        • 22 Posts
        I had a similar problem to this and managed to fix it by ensuring that each products page was set to be uncachable

        Give it a go and see if it works
          • 10152
          • 156 Posts
          Hi,

          I’m facing the same problem, products are added twice. Above solution has no effect. No page goes to cache, and js files are only included once. Could someone please help ?

          EDIT : the solution in my case was to upgrade YAMS to latest RC.
            • 29703
            • 217 Posts
            I had this problem when I called the cart twice on the page?
              • 12241
              • 80 Posts
              TC was adding products twice to the cart for me because of this call: [!TreasureChest? &service=`global`!] was in my product page template AND I had put the CSS & JS head tags for TreasureChest in the template as well so I had this code in the head section twice:
              <script type="text/javascript" charset="utf-8">var cart_doc = "index.php?id=2";</script>
              	<script type="text/javascript" src="assets/snippets/treasure_chest/script/treasurechest.js"></script>
              	<link rel="stylesheet" type="text/css" href="assets/snippets/treasure_chest/style/thickbox.css" />
              <script type="text/javascript" charset="utf-8">var cart_doc = "index.php?id=2";</script>
              	<script type="text/javascript" src="assets/snippets/treasure_chest/script/treasurechest.js"></script>
              	<link rel="stylesheet" type="text/css" href="assets/snippets/treasure_chest/style/thickbox.css" />


              When I removed the extra CSS&JS tags so that all that is in my page template is [!TreasureChest? &service=`global`!] my ’ADD TO CART’ link now works as it should, adding 1 product per click.
                Environment:
                modx: rev 2.0.8-pl
                localhost: Apache/2.0.63 (Unix) PHP/5.2.11 DAV/2, MySQL client version: 5.1.37