Building a shop question

Hi, I have a general question about how to frame a problem.

I’m building a shop for art prints and cards. The prints and cards tend to be in a limited number of standard sizes but not all the paintings are available as prints and cards. So I’d like to make a library of print sizes and options, and then be able to simply turn that option on or off on the painting’s page.

At the moment I’m filling all the details in for each painting but it’s horribly un-DRY

I’d thought of making a page with a list of all print options and then choosing which one to include via a dropdown, but I’m wondering if there isn’t a more intelligent way to do it - maybe with Flex Objects. I’m unsure how one associates Flex Objects across categories, however.

Any advice, ideas, appreciated.

Hello @dan-james
I would suggest to use the Shop Site Skeleton from the Skeletons page:

Then use the Shopping Cart plugin from the plugins page:

You can have categories and products.

The GRAV documentation is here:

Hope this helps.

Hi @joejac, thanks, I’ve seen these and I’ve also already built a couple of shops with Grav. My problem is just that this one is slightly more complex - and would benefit from a slightly different approach. I don’t think I explained the problem very well, but I’m still working on it and will publish the solution when i get it.

Essentially I want to have some fixed templates and parameters for certain categories, so that if I’m selling printed cards of, say, 50 different images, and I change the pricing, I can change it only one place, not have to go to every card’s page.

I think it’s relatively simple but I haven’t had tim to just sit down and work it out : )

Hello @dan-james sorry I can not be more helpful, unfortunately I am not at that technical level, hope you can work it out.

Cheers @joejac, I’m getting there!

I’m using page-inject to pull in the information from other pages. So I have a folder called “prints” which has subfolders for each kind of print that is available (there are only about 5 or 6).

The, in the blueprint for each image’s page, I have a dropdown that allows me to select which print versions are available for each image:

              type: list
              style: vertical
              label: Print sales
                  type: pages
                  size: medium
                  classes: fancy
                  label: items for sale
                  start_route: '/art-for-sale/giclee-prints'
                  show_all: false
                  show_modular: false
                  show_root: false

And in the template I imply check if the files exist and recurse over them:

{% for a in page.header.print.options %}
                        {% set print = page.find(a.file) %}
                        <div class="sidebar__details"><span>Print {{ print.header.paper_size }}</span><span> <strong>£ {{ print.header.price }}</strong></span></div>
                        <div class="sidebar__details-text"><p>Paper: {{ print.header.paper }}</p></div>
                        <button class="button snipcart-add-item"
                            data-item-id="{{ print.header.code }}-{{ a.paper_size }}"
                            data-item-price="{{ print.header.price }}"
                            data-item-url="{{ page.url }}"
                            data-item-description="{{ page.header.original.strapline }} - Print {{ print.header.paper_size }} on {{ print.header.paper }}"
                            data-item-image="{{ image.url }}"
                            data-item-name="Print of {{ page.header.title }}"
                            Add {{ print.header.title }} to cart</button>
                    {% endfor %}

There ae details to tidy up but I now only have to describe and price up the prints once, then I just pull them into each image page that needs them : )

1 Like

Wow, that is nice @dan-james, thanks a lot for sharing it!
Please post the link of the web site when you are done.
Best regards

1 Like

Hi Joe, it’s here

But I’m still fiddling with it… : )

1 Like

Thanks @dan-james very nice store and artworks, beautiful!.
So you are using snipcart Grav plugin. I see they have lower fees than PayPal, How is their service and integration?
Regards and success!

Thanks. Snipcart has been great so far. I didn’t use the plugin but just coded the snipcart requirements into the template. I changed the blueprint for each item to add fields for price, code, weight - all the bits and bobs that snipcart buttons need…

1 Like