CART adding categories?

Hi all,

it would be very helpful to add “Categories” like in the screenshot to the cart

Is that possible?

Best regards,

Sure. Not with that kind of interface, but with drop down menus from each Product and Attribute.

One way is to create a Licensing product with attributes for each type of usage. Then options for each attribute that can further refine the usage.

Another way is to create a product for each type of usage. Then attributes and options to refine the usage. This way would give you an extra layer of usage options.

Hi Rod,
thank you for your reply!

For now I was able to create something like this:

It would be great to have the “categories” like editorial or commercial above the Produkt.

How to do that??? :thinking:

that would probably require @Ben to rewrite the cart code.

You could try using Products for your categories.

Maybe use a naming scheme like:

commercial - 1
commercial - 2
consumer product - 1
consumer product - 2
consumer product - 3
editorial - book
editorial - e-book
editorial - intranet
editorial - website / mobile app
editorial - magazine

Please share a link once you have implemented something. I’m curious to see how it will look like since for a while, I was wondering how I would go about implementing stock licensing. Thanks!

We probably need one layer above every “Product attributes” with the option to configure different usages :thinking:

Like I said, that would likely require that @Ben rewrites the Cart code (and probably database structure). It’s probably a lot more complicated than just adding another field in the product set up.

Don’t count on that happening any time soon. You’ll need to work within what Cart offers or look for a dedicated image licensing platform.

As always thank you all for your replies!

And is there a way to hide the percentages in the fields? (see screenshot)

:pray: :pray: :pray:

I don’t know, but I doubt it. Is it part of the option you created?

Yes, it is in the “Manage Pricing Scheme”. I did it in percentage

Yep, no way to hide it that I know of

Hi @volvoxturbo, this can mostly be done in JavaScript with some changes needed to the Cart code.
Those changes are needed because if you move an attribute above the Product then the attribute will no longer be in the purchaseOptions containing div, which is used to determine the fields to submit when adding items to the cart.

After changing the Cart code to accomodate this, the following JavaScript code in modules/pangolin-album/static/js/ttgcart.hooks.js moves the attribute above Product and also removes the + 10.0 % text from any options:

	ttgCart.post_open_modal = function() {
		var element = $('input[value=Usage]').parent().detach();

		$('select.purchaseOption option').each(function() {
			var updated = ($(this).html().replace(/ \+ [0-9].*%$/, ''));

One problem with this approach is that jquery.ttghooks.js is intended for TTG development so that the Cart can work with different types of galleries without updating the cart code. It’s not intended for end users, and any updates to the Pangolin Album module will overwrite changes you’ve put in.

Here’s how it looks on my development site. The Finish field had percentages prior to adding in the JS.

Hi Ben,

thank you very much for your quick reply!
After all I was able to copy your code into ttgcart.hoks.js :grin:

But what changes do I need to make in which cart code to make the cart work like yours? :thinking:

Best regards,

Hi Oliver,

I still need to do further testing on the code changes to the cart, to see that it covers different scenarios for products.

I’ve added the changes so far into our testing version of Backlight. To use this, follow these steps:

  1. Rename backlight/installer/env.php.skel to backlight/installer/env.php
  2. Edit backlight/installer/env.php and change line 13 from:
define('STREAM', 'release');


define('STREAM', 'testing');

Once that change is in, you should see a red ‘Testing’ badge in the footer when logged in as admin:
Screen Shot 2021-11-02 at 9.54.19 pm

If you then visit Admin > Backlight Modules and click Reinstall for the entry for module-cart then the code changes should come through. The only difference between the main release and testing at this point is to two files:


I recommend that once I release an update to Cart that you rename env.php back to env.php.skel and update the modules in the usual way. testing may otherwise have other changes that aren’t stable.

I think Olivier (@volvoxturbo) has to clarify the intended functionality for ‘categories’. For me, selecting a category would provide a different group of products.

Hi Daniel,

I would like to give a buyer the option to first select the usage like here on lookphotos -> please select editorial, commercial or consumer product first, to get to their cart:

Here you have the option to select between different types of usage what makes it clearer than an endless list of products and options.

Hi @volvoxturbo, do my proposed changes meet the requirements of what you’re trying to do?

Dear Ben,
thank you so much for getting back :slight_smile:

I changed the JavaScript code, and followed your instructions renaming and editing env.php and there is the red Testing badge.
But I cannot see any difference in the Products or Pricing Schemes edit windows. I am sure I did something wrong, or?
What can I do?

Best regards and so many thanks for helping me!

What Ben’s code is doing is moving an attribute named “Usage” to above the Product name in the add-to-cart pop-up. It’s not actually creating a new item (like “Category”) in the Add Product/Edit Product dialog.

So create an attribute and name it “Usage” and give it some options. In the pricing scheme, add prices.

After doing this, be sure to reset the Cart.