We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 18367
    • 834 Posts
    Can someone who’s successfully got this working please give us an English explanation or mini tute?

    I’ve managed to get the module installed, and it seems ok, and I’ve got the chunks created but I get as far as Point 6 in the included instructions and then something gets lost in the translation.

    I’d especially like to know how to set it up once it’s actually installed, what calls to make etc.

    Thanks

    grin
      Content Creator and Copywriter
      • 4385
      • 372 Posts
      You don’t need step 6,7,8 if are selling items that do not have attributes. It will work fine.

      If you need attributes, such as size or color. You don’t need to modify the core, have a look here http://modxcms.com/forums/index.php/topic,38341.0.html
        DropboxUploader -- Upload files to a Dropbox account.
        DIG -- Dynamic Image Generator
        gus -- Google URL Shortener
        makeQR -- Uses google chart api to make QR codes.
        MODxTweeter -- Update your twitter status on publish.
        • 18367
        • 834 Posts
        Thanks Bwente,

        but I’m still not any wiser as to how to use it.

        Perhaps I should be clearer as to what I need.

        I’ve created a new template and document with TV’s for price and quantity etc.

        But what sort of call do I put in the document?

        Do I need to create order, cart and thank you pages?

        Again, what calls do they require?

        Where does eform fit into all this?

        Do I need to create a new eform snippet or chunk?

        I assume I do, but it’s not very clear what needs to go where.

        Thanks



          Content Creator and Copywriter
          • 4385
          • 372 Posts
          As you said you have the module installed, so I will go over the snippet and chunks.
          Every setup is going to be different based on your layout. Here is how I am doing it.

          I have a template where the cart is visible. It is in a div on the side of the page. I call it like this...

          [!Shopkeeper? &clToCartCont=`shop-stuff` &currency=`USD` &lang=`en` &orderFormPage=`194` &gotoid=`199`!]


          My product template has TV’s for photo,price,color, and size. Shopkeeper does not track inventory, so quantity is not used. (If you need more advance features you should use FoxyCart, I highly recommend for ease of use.) On my main product page I have a ditto call to display the products.

          [!Ditto? &parents=`195` &tpl=`shopItem` &sortBy=`tvprice` &sortDir=`ASC` &showPublishedOnly=`1`!]


          Document 195 is a container for all the product pages. The product page is using the template that has the cart on the side. In my Ditto call I reference the chunk/tpl "shopItem". Here is chunk for it...

          <div class="shop-stuff">
            <div class="relative">
              <div class="shs-title">[+title+]</div>
              <img id="productImg[+id+]" src="[+store_photo+]" title="[+pagetitle+]" alt="product photo" height="120" width="120" />
              <div>price: <span class="shs-price" id="stuff_[+id+]_price">[+price+]</span></div>
          <div>
          [[SHKwidget? &tvname=`sizes` &docid=`[+id+]`]]
          [[SHKwidget? &tvname=`colors` &docid=`[+id+]`]]
          </div>
              <div class="shs-descr">
                [+introtext+]<br />
              </div>
              <input type="hidden" name="shs-id" value="[+id+]" />
              <div align="center"><button class="shs-but">add to cart</button></div>
            </div>
          </div>
          


          Cart chuck is simple.

          <div id="shopCart" class="shop-cart">
            <div align="center"><b>Shopping Cart</b></div>
            <div id="cartEmpty" align="center">empty</div>
          </div>
          


          This should give you a page with your products and a basket/cart on the side that you can add items to. Now I on my checkout page (docid 194) I switch the snippets. You the same shopkeeper call for the basket, but I put it in the main area to display the full cart items. Then I have a eForm call on the side.

          [!eForm? &formid=`shopOrderForm` &to=`[email protected]` &tpl=`buyForm` &report=`shopOrderReport` &ccsender=`1` &gotoid=`199` &subject=`New Order`&eFormOnBeforeMailSent=`populateOrderData`&eFormOnMailSent=`sendOrderToManager` &protectSubmit=`0`!]
          


          Eform chucks are normal, one for the form and one for the email. The "buyForm" contains these fields...

          <form id="shopOrderForm" method="post" action="[~[*id*]~]">
          <input type="hidden" name="formid" value="shopOrderForm" />
          <input type="hidden" name="reportTpl" value="shopOrderReport" />


          and the "shopOrderReport" has this...

          <p>New Order</p>
          <table cellpadding="3">
            <tr><td colspan="2"><b>—Order:</b></td></tr>
            <tr><td colspan="2">[+orderData+]</td>
            </tr><tr><td>Address:</td><td>[+address+]</td></tr>
            <tr><td>—Delivery:</td><td>[+delivery+]</td></tr>
            <tr><td>—Payment:</td><td>[+payment+] </td></tr>
            <tr><td>Full Name</td><td>[+name+]</td></tr>
            <tr><td>E-mail:</td><td><a href="mailto:[+email+]">[+email+]</a></td></tr>
            <tr><td>Phone:</td><td>[+phone+]</td></tr>
            <tr><td>—Notes:</td><td>[+message+]</td></tr>
          </table>
          
          


          The confirmation/thank you page (docid 199) is just a plain page with no snippets at all. I hope that helps, I am sure I missed a few steps. It took me awhile to get it working myself.

            DropboxUploader -- Upload files to a Dropbox account.
            DIG -- Dynamic Image Generator
            gus -- Google URL Shortener
            makeQR -- Uses google chart api to make QR codes.
            MODxTweeter -- Update your twitter status on publish.
            • 18367
            • 834 Posts
            Wow,

            thanks for all this Bwente, I’ll work my way thru it.

            (I didn’t realise Shopkeeper doesn’t do inventory, bit of a shame.)

              Content Creator and Copywriter
              • 4385
              • 372 Posts
              I worked up a quick fix to get inventory to work. I am going to need something like this soon too. I will also need to use Ditto to filter out products when inventory drops to zero. Maybe add an alert too.

              I am not sure how the best way to implement the inventory template variable parameter.

              Here is the code to add to the snippet.

              // added inventory manament
              function removeFromInventory($id,$count) {
                global $modx, $tvInventory;
              if (!isset($tvInventory)) $tvInventory = "inventory";
              	$prefix = $modx->db->config['table_prefix'];
              	
              	$query = "SELECT * FROM ".$prefix."site_tmplvars WHERE name='".$tvInventory."'";
              	$result = $modx->db->query($query);
              	$result = mysql_fetch_array($result);
              	$inventoryId = $result['id'];
              
              	$query = "UPDATE ".$prefix."site_tmplvar_contentvalues SET value = value - ".$count." WHERE (contentid='".$id."' AND tmplvarid='".$inventoryId."')";
              	$modx->db->query($query);
              }
              



              Then somewhere in the function sendOrderToManager of the snippet

                    removeFromInventory($id,$count);
                    -- > above this line $priceAll += $price*$count;



              The problem is where to assign the inventory field? $tvInventory = "inventory" do we add it as a parameter of the snippet call? or just change it in the snippet? I am hoping the original developer can add it to the codebase, and of course clean-up my code.



                DropboxUploader -- Upload files to a Dropbox account.
                DIG -- Dynamic Image Generator
                gus -- Google URL Shortener
                makeQR -- Uses google chart api to make QR codes.
                MODxTweeter -- Update your twitter status on publish.
                • 18367
                • 834 Posts
                Bwente,

                sorry to be a pain, but your instructions are still a bit beyond me. Shopkeeper seems far more complicated to setup than I’d imagined. I understand the big picture of how it should all work, it’s the details that I’m struggling with.

                Just know where and how to start would be something.

                I do need clear, step by step instructions, with no gaps. Sometimes I just don’t even know there are gaps.

                I understand that every setup will be different, so if we could just work with the default chunks that come with the install that might be better. (Do I need to edit those default chunks in any way, or will they work as is?

                I’m sure once the process is mapped out, it will benefit a lot more potential users of this plugin.

                Again, apologies if it seems I’m being boringly pedantic.

                So, starting with a basic product page, what’s the call I need to place on it? (I’ve tried all the default chunks and I get nothing?)

                Thanks

                huh



                  Content Creator and Copywriter
                  • 4385
                  • 372 Posts
                  Ok, let us start off with the basics. Also have a look at the image I uploaded with my earlier comment, it has an example of the flow.

                  MarkG do you have a product page with a Ditto call on it? Is it displaying a list of your items?
                    DropboxUploader -- Upload files to a Dropbox account.
                    DIG -- Dynamic Image Generator
                    gus -- Google URL Shortener
                    makeQR -- Uses google chart api to make QR codes.
                    MODxTweeter -- Update your twitter status on publish.
                    • 18367
                    • 834 Posts
                    Hi Bwente


                    MarkG do you have a product page with a Ditto call on it? Is it displaying a list of your items?

                    I’m starting with a single product page before I try a list. Do I need to create list page first?

                    I’ve tried various calls with the [! !] like you suggested, but none of them work. But then again I’m not exactly sure what to write in them anyway.

                    I tried putting the {{shopToCart}} calls on the page and they worked, so at least I know my chunks can be called. (Of course they’re all in Russian, but that’s another issue I can sort out later.)

                    I’ve also created a separate template with template variables for price etc.

                    And that’s as far as I’ve got.

                    I’ve done nothing with Ditto or eForm other than the examples that came with the install.

                    smiley

                      Content Creator and Copywriter
                      • 4385
                      • 372 Posts
                      Place a call like this to the snippet on you page.
                      [!Shopkeeper? &clToCartCont=`shop-stuff` &currency=`USD` &lang=`en` &orderFormPage=`194` &gotoid=`199`!]

                      When you say none of them work, does that mean it is blank? When you place a call to the snippet it will automatically place a javascript on the page do you see it in the source?

                      <script src="/assets/snippets/shopkeeper/shopkeeper.js" type="text/javascript"></script>


                      If you don’t see that in the source, then you do not have the snippet working.
                        DropboxUploader -- Upload files to a Dropbox account.
                        DIG -- Dynamic Image Generator
                        gus -- Google URL Shortener
                        makeQR -- Uses google chart api to make QR codes.
                        MODxTweeter -- Update your twitter status on publish.