samnabi / shopkit

Comprehensive commerce solution for Kirby CMS v2
https://shopkit.samnabi.com
Other
99 stars 15 forks source link

using the snippetfield plugin in a theme #127

Closed louis-ev closed 7 years ago

louis-ev commented 7 years ago

Hi,

I've been trying to set-up snippetfield in a blueprint (and snippet) without touching the shopkit plugin.

However since snippetfield.path is set in shopkit/registry/snippets.php I haven't found a way to link the field to a snippet, for examples:

  slide:
    label: Slide
    type: snippetfield
    modal: medium
    style: items
    snippet: collection/snippet
    fields:
      image:
        label: Image
        type: select
        options: images

The path seems to look for collection/snippet using the snippetfield.path, which redirects to a shopkit folder. Is that right? Any other way to do it?

samnabi commented 7 years ago

You can use a relative path. If your snippet is located at site/snippets/collection/snippet.php, this should work:

snippet: ../../../snippets/collection/snippet

louis-ev commented 7 years ago

Thanks! But wouldn't this break shopkit's calls to snippetfields such as discount-codes and gift-certificates in shopkit/snippets/panel?

samnabi commented 7 years ago

No, the relative path would be in your own custom blueprint under site/blueprints.

Since the snippetfield.path is site/plugins/shopkit/snippets/panel, this path:

../../../snippets/collection/snippet

would resolve to...

site/snippets/collection/snippet

louis-ev commented 7 years ago

Sounds good, thanks.