Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hi,
this module is very powerfully, great work. With standar product is working correctly.
Noe I'm usiging IEF to create a product that use Price Table but the option to hide the standard price doesn't work and we need again to insert also the standard price value. Instead if I create the product directly the price is hide and we don't need to insert the price.
Sameone can help me???
Comments
Comment #1
bojanz CreditAttribution: bojanz commentedCommerce price table should implement hook_inline_entity_form_entity_form_alter() to hide the price field on IEF forms.
Comment #2
andrea.brogi CreditAttribution: andrea.brogi commentedthank bojanz, but I'm not a programmer so I don't know how to alter the hook.
Comment #3
akalata CreditAttribution: akalata commentedI needed the same thing -- thanks Bojanz for the direction. Here's a patch.
Comment #4
andrea.brogi CreditAttribution: andrea.brogi commentedVery Thanks, now i test it
Comment #5
akalata CreditAttribution: akalata commentedRan into #1341294: Integrity constraint violation: 1048 Column 'commerce_unit_price_currency_code' cannot be null as client started adding products with this fix in place (since the hidden field creates no price, and thus sets no currency formatter). Hopefully I'll be able to figure out how the default (non-IEF) implementation solves this.
Comment #6
akalata CreditAttribution: akalata commentedI found the patch at #19 from #1341294: Integrity constraint violation: 1048 Column 'commerce_unit_price_currency_code' cannot be null needed for non-IEF (at least on my existing site), so I've added it to this patch. Unfortunately I don't have time to test out why some people are getting it to work without that patch.
Comment #7
akalata CreditAttribution: akalata commentedNew patch, because that's what I get for posting without testing! :)
Comment #8
pcambraI don't think we should place any formatting as default, won't '0' be just fine?
Comment #9
Cybso CreditAttribution: Cybso commentedSadly, I didn't saw this issue earlier.
So, what do you think about my solution?
This patch removes the commerce_price from the IEF form (if the setting has been enabled) and adds a custom implementation of CommerceProductInlineEntityFormController to display the table as an item list within the IEF table. For this, it introduces a new submodule called commerce_price_inline_entity_table.
Update 2013-01-18: Please ignore this patch, it does not work as intended.
Comment #10
andrea.brogi CreditAttribution: andrea.brogi commentedHi,
I have test akalata Patch #7 and for me is working.
I haven't test patch #9 by Cybso becouse is very complex and I'm not able to edit manually.
Comment #11
Cybso CreditAttribution: Cybso commentedI've reworked my patch from #9. It's now based on akalata's patch.
Explanation of the attached changes:
Please note that line 63 in commerce_price_inline_entity_table/commerce_price_inline_entity_table.module reads:
$header = commerce_price_table_display_quantity_headers($item, @$items[$delta + 1]);
This is based on my patch from http://drupal.org/node/1875688, where commerce_price_table_display_quantity_headers() expects two arguments instead of one, but it will also work with the original code. PHP just ignores the undefined extra argument.
Comment #12
pcambraThanks to all for the patches! generally looks great but this is really difficult to merge. The issue referenced in here is in need work, as far as I understand it.
Please keep patches independent, otherwise it will be impossible to merge them. This is an issue to integrate IEF into the price tables, I'm totally ok with providing a bridge module for this if necessary, but if it's not too much code/integration I'd rather keep it in the same module, the price table module is not that big.
Setting to need work until we get a standalone patch to test the integration.
Comment #13
Cybso CreditAttribution: Cybso commentedOh, no, it applies perfectly on an unmodified 1.1 version. It's only the second parameter in line 63 in commerce_price_inline_entity_table/commerce_price_inline_entity_table.module. It can be removed (although it won't raise any errors or warnings because PHP allows functions to get more arguments than they defined). But it is required if the other patch is merged.
Update: The reason for the extra module is that the same trick (or call it a hack) may be used by some other module, as it is proposed in the ief forum (http://drupal.org/node/1521274). There is no legal way at the moment to extend this table. So I think it absolutely makes sense to keep this feature in an optional submodule. Additionally, ief is not and should not be a dependency for commerce price table, but it must be present to calculate the correct weight for the custom controller.
If you want to split it, just apply the patch and delete the commerce_price_inline_entity_table subfolder :-)
Comment #14
Cybso CreditAttribution: Cybso commentedHere's the same patch without the second parameter.
Comment #15
pcambraThanks for the clarification, as I've mentioned above, I'm ok with having a submodule as we seem to have a good reason to.
Here's a code review for the patch in #14
Packaging script info should not be included
Comments should start with uppercase and end with a dot.
Implements, dot at the end
How is this related with IEF?
This should be in the submodule, right?
Comment #16
Cybso CreditAttribution: Cybso commentedThanks for the hints, I've removed the packaging info from the submodule and corrected the comments.
It isn't, I've removed it from the patch and will make a separate issue from it.
Since it doesn't make many sense to hide the default price field but keeping it in the IEF summary I think you're right. Changed it.
Comment #17
pcambraBack to CNR :)
Comment #18
pcambraCould you provide the patch from the module root?
Comment #19
Cybso CreditAttribution: Cybso commentedThe patch command has a parameter "-p1" that strips the first component from the path. Diffing in the same directory would mean to have an *.orig copy from each modified file. The way I (and most people I know) create a patch (using "diff -rNu ORIG_PATH NEW_PATH") ensures that no modified or created files are missed.
Comment #20
pcambraI'm talking about the root of the module, git diff is normally what I use for this kind of things.
There's extensive documentation about how this should be done: http://drupal.org/node/707484
Comment #21
Cybso CreditAttribution: Cybso commentedI still don't understand what's the difference between
and
since both are applied the same way (patch -p1 < input.patch) and the diff's content is exactly the same.
I used the chance to rename the submodule. It's now called commerce_price_table_ief_support (Commerce Price Table IEF support).I still don
Comment #22
Cybso CreditAttribution: Cybso commentedNeeds review, again
Comment #23
pcambraTake a look to the patch in #1589950: Compact table & hide headers
diff -rNu commerce_price_table-1.1/commerce_price_inline_entity_table/commerce_price_inline_entity_table.info commerce_price_table/commerce_price_inline_entity_table/commerce_price_inline_entity_table.info
vs
diff --git a/commerce_price_table.module b/commerce_price_table.module
Patches in drupal issue queues should not assume any path, they should be generated from within the module root.
Edit: fixed the right patch example :P
Comment #24
pcambraSorry didn't intend to change status, this patch is ok
Comment #25
pcambraPlease name the module and the files the same way, I've got a folder called commerce_price_table_ief_support but the module is called commerce_price_intline_entity_table.module, that's confusing.
I'm fine with "commerce_price_table_ief"
I'm testing this and I can't find the formatter "commerce_multiprice_list_ief" anywhere in the ui and it's not displayed in the inline entity form.
Comment #26
Cybso CreditAttribution: Cybso commentedI've renamed the module (and didn't forget the .info and .module file this time) and tested it.
The formatter is used within the IEF summary table, and can be selected as a Format in "Administration > Store > Configuration > Product variation types > Product Manage display > Price Table" (although this is not the intended use for it, but who knows, maybe someone likes it because it's easier to style a list with CSS than a table).
Maybe it's a conflict with the old module's name, if you have applied the "ief_integration-1823012-7-rt4.patch" patch previously. Can you try to restore the old submodule, uninstall it from the module settings page and than switch to the new submodule?
Comment #27
pcambraOh, with this patch, the formatter appears in the admin displays for the products, it wasn't there before, not sure why.
Almost there!
"Implements" and this should go in a .install file
Is this still needed even if you override the class?
We need a @file block commenting what is this file and a comment on what the class actually does
FALSE
Why would you need a '@' here?
Comment #28
Cybso CreditAttribution: Cybso commentedYes. The class only changes the summary table, not the form. hook_inline_entity_form_entity_form_alter() is the IEF equivalent to hook_form_FORMNAME_alter() for the embedded product form.
To suppress a warning if the commerce_price field hasn't been returned by the superclass for some unknown reason, or has no weight defined. In this case, the expression simply evaluates to 1.
Comment #29
pcambraThen just use isset or empty:
isset($fields['commerce_price']['weight']) ? $fields['commerce_price']['weight'] : 0
Comment #30
Cybso CreditAttribution: Cybso commentedUsing a ternary operator with isset() is ok here, just a longer expression with basically the same result (personally, I prefer "@$var" to "isset($var) ? $var : 0" for this reason wherever it makes sense). empty() won't work, because it would result in a weight of 0 instead of 1 if the original weight is 0 or empty.
Comment #31
pcambraI don't think @ is thought to replace isset: http://michelf.ca/blog/2005/bad-uses-of-the-at-operator/
Comment #32
Cybso CreditAttribution: Cybso commentedComment #33
pcambraAmazing work here, commited, thanks!!!