We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 4385
    • 372 Posts
    Hi everyone. I was looking for a simple cart yesterday and found Shopkeeper. It is a little difficult to get installed, (some of the information is lost in translation). But the thing that concerned me the most was with having to modify the core to get the options to work. You only need to if need additional parameters, such as color, size, etc. It so happens that I do but I was able to create a snippet instead.

    In your shopStuff chunk call the following snippet like this...

    [[additSelect? &tvname=`colors` &docid=`[+id+]`]]

    the TV assigned to this document contains something like this "red==0||green==0||blue==0"

    <?php
    // Snippet name: additSelect
    // $tvname = 'colors';
    // $docid = 4034;
    $tvArray= array($tvname);
    $tvoutput = $modx->getTemplateVarOutput($tvArray, $docid, 1);
    $jsFunc='jQuery.additOpt(this)';
    $val = '';
    
    $value = $tvoutput[$tvname];
    			  $options = "";
    			  $count = 0;
    			  $value = explode("||",$value);
    			  foreach($value as $val){
    			    $count++;
    			    list($item,$itemvalue) = explode("==",$val);
    			    $selected = $count==1 && $params['selected']=='Yes' ? ' selected' : '';
    			    $options .= "\n  <option value=\"".$item."_".$itemvalue."\"$selected>$item</option>";
    			   }
    
    			  $o = "\n<select class=\"addparam\" name=\"".$tvname."_".$docid."\" onchange=\"".$jsFunc."\">$options\n</select>\n";
    return $o;
    ?>
    


    It is a bit of a hack. I cut and paste and got it to work for my installation. Hopefully it will encourage other to try out the snippet and continue improving it.

      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.
      • 4385
      • 372 Posts
      Thank you, Andchir!
        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.