Shopping cart - one solution

I’ve been looking for some time for a way of implementing a shopping cart to help support our archive by selling prints of our photos (we don’t get grants). If you’re OK using PayPal here’s a way to do it:

  1. Get a PayPal account and generate an add to cart button
  2. Grab the code for the button and insert it in the Items/show.php file for your theme (next to the image for example)
  3. In the Items/show.php create a $variable that contains the Title or Identifier DC field of your choice.
    4.Insert that variable in the OS1 value field for the button form in this format <?php echo $variable; ?>

You may need to play around a bit to get the formatting right and also to generate a view cart button, Any questions just ask. Critical feedback very welcome (please).

You can see it at work here >>> http://theafteraliceproject.org/items/show/5864

Personally, I think this is great! I’ve long thought that a shopping cart makes sense for archives or galleries that – no surprise – need to encourage funding options.

Have you considered generalizing this process out into a standalone plugin, instead of embedding it directly into the theme? The weakness of that approach is that it would probably just drop the needed code at the bottom of the page, using the public_items_show hook. But the strength would be that it wouldn’t require any theme modification, which is good for sustainability and broader usage.

In the plugin world, it sounds like there would be a config form for the PayPal info, but I’m not entirely sure since I haven’t followed all the steps you describe yet.

Even fancier would be a plugin that also creates a shortcode that could be inserted as a theme modification. That’s more work, but gives the flexibility of placement within the theme.

TL;DR: This is great, and it’s worth thinking about whether it could work as a plugin to share back to the Omeka community. Thanks!

Thanks Patrick - but I’m not a programmer I wouldn’t know where to start with writing a plugin. I do agree that a plugin/shortcode solution would be better though, there will be many users who don’t want to tinker with the program files (it took me while before I dared to do it).

This topic was automatically closed 250 days after the last reply. New replies are no longer allowed.