I've added some hooks that allow other modules to alter commerce_price_table's schema and pre-process the price table item list before validating and formatting. I use this to remove max_qty (since this change won't make it into the core ;-) and add some additional fields to each entry. A .api.php file to describe the hooks is included. I don't think that these changes would have any side effects on existing installations.

Comments

Status:Active» Needs review

Forgot to change status.

The previous file was diff'd against the patch from http://drupal.org/node/1897824 and failed to patch against current 7.x-1.x. Fixed (and fixed a comment).

Third try :-/. Sorry. Is there a way to delete uploaded files?

Related: #691932: No hook_field_schema_alter()

Re: no, history stays there :)

Added commerce_price_table_field_presave() to the items_alter hook. As with field_validate(), this could also be done by implementing hook_field_attach_presave(). Annoyingly this hook only provides $entity_type and $entity as variables, so you would have to copy nearly the whole code of _field_invoke() (field.attach.inc) into your own code (round about 25 lines).

Status:Needs review» Postponed

it feels like you're rewriting some core code here for schema and property alters which I'm not sure they belong to the module, I'd rather wait to include this in case someone else needs it, I'm guessing this is a very particular and specific use case.

I need something like this because I want to show a custom box to display the price table offers. An overridden table or block: and I need some more tokens if I want to do this with Views.
Is this something I can use?

@giuvax I don't completely understand your use case, but I'd say that a new formatter would be enough for you, also you can generate extra tokens without storing them in db

I have just one case in price table: 1 bottle of wine costs X, 6 bottles cost Y.
So I want to put a little box on each node as advertisement to customers, so they know that buying 6 of them they have a discount. I want flexibility to generate this box but I haven't complete tokens control to do it and I don't want to show the standard price table because I want to write some extra formatted text on it.

If it's a content box per product, just add a field to it, this won't help.

Issue summary:View changes

sp