Skip to content
Grav 2.0 is officially stable. Read the announcement →

Community guidelines

Please keep discussions civil and on-topic. Repeated violations may lead to a temporary ban.

Support

Building a shop question

Solved by Daniel Wrightson View solution

Started by Daniel Wrightson 6 years ago · 11 replies · 879 views
6 years ago

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.

6 years ago

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 : )

6 years ago

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

6 years ago Solution

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:

YAML
            header.print.options:
              type: list
              style: vertical
              label: Print sales
              fields:
                .file:
                  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:

TWIG
{% 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
6 years ago

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
6 years ago

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!

6 years ago

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
6 years ago

I have been looking around the shop question a few days ago, trying to find a simple solution to be used on Grav as well as hand coded websites.
I have tested Ecwid. I managed to easily integrate their scrips in markdown. The shop can be live in just a few hours. They have a free plan up to 10 products for you to test or for production. Just need to add Stripe costs. This is a cheaper and easier solution than Snipcart, though not as flexible for developers.

6 years ago

It depends how many items you have. I have over a hundred, so would be spending £35 a month with Ecwid - Snipcart definitely works out cheaper for me. I also like Snipcart because it's fairly unopinionated, it leaves all the actual store layout to you.

But it's great to have another contender on the block.

6 years ago

The N° of items do not seem to influence much the costs .
The turnover have an influence.
It seems that above 18000€/year, once you add a Stripe or LyraConnect type of payment solution, Ecwid becomes cheaper than Snipcart even at Ecwid’s highest plan.

But above this turnover, it becomes soon more interesting to look at alternatives like Ogone/Paybox/Payzen or your bank’s solution, at least on French market. But these do not seem easily available on Grav.

Of course, these money matters do not factor in the development time, costs, requirements and preferences.
Even if more expensive, I understand Snipcart will be more suitable in some situations.

Did I miss something?

👍 1

Suggested topics

Topic Participants Replies Views Activity
Support · by Thomas, 1 week ago
2 57 15 hours ago
Support · by Anna, 3 days ago
2 65 18 hours ago
Support · by Justin Young, 18 hours ago
1 33 18 hours ago
Support · by Duc , 1 week ago
2 68 5 days ago
Support · by Colin Hume, 1 week ago
2 60 6 days ago