-
-
Notifications
You must be signed in to change notification settings - Fork 436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Widget instance layout updates doesn't store correctly for longer product types #4162
Comments
Can you please provide a sample layout update? (everything that makes it easier to reproduce helps a lot) |
@sreichel I mean there isn't much to configure? The HTML for this looks like this, notice the ID <div class="no-display products group_container" id="b3it_virtualevent_products_0">
<input type="hidden" class="container_name" name="__[container_name]" value="widget_instance[0][b3it_virtualevent_products]">
<input type="hidden" name="widget_instance[0][b3it_virtualevent_products][page_id]" value="2">
<input type="hidden" class="layout_handle_pattern" name="widget_instance[0][b3it_virtualevent_products][layout_handle]" value="default,catalog_product_view,PRODUCT_TYPE_b3it_virtualevent">
<table cellspacing="0" class="option-header">
<colgroup>
<col width="200">
<col width="220">
<col width="320">
<col>
</colgroup>
<thead>
<tr>
<th>
<label>Products</label>
</th>
<th>
<label>Block-Referenz
<span class="required">*</span>
</label>
</th>
<th>
<label>Vorlage</label>
</th>
<th> </th>
</tr>
</thead>
<tbody>
<tr>
<td>
<input type="radio" class="radio for_all" id="all_b3it_virtualevent_products_0" name="widget_instance[0][b3it_virtualevent_products][for]" value="all" onclick="WidgetInstance.togglePageGroupChooser(this)" checked="checked">
<label for="all_b3it_virtualevent_products_0">Alle</label>
<input type="radio" class="radio for_specific" id="specific_b3it_virtualevent_products_0" name="widget_instance[0][b3it_virtualevent_products][for]" value="specific" onclick="WidgetInstance.togglePageGroupChooser(this)">
<label for="specific_b3it_virtualevent_products_0">Bestimmte Products</label>
</td>
<td>
<div class="block_reference_container">
<div class="block_reference"></div>
</div>
</td>
<td>
<div class="block_template_container">
<div class="block_template"></div>
</div>
</td>
</tr>
</tbody>
</table>
<div class="no-display chooser_container" id="b3it_virtualevent_products_ids_0">
<input type="hidden" class="is_anchor_only" name="widget_instance[0][b3it_virtualevent_products][is_anchor_only]" value="">
<input type="hidden" class="product_type_id" name="widget_instance[0][b3it_virtualevent_products][product_type_id]" value="b3it_virtualevent">
<p>
<input type="text" class="input-text entities" name="widget_instance[0][b3it_virtualevent_products][entities]" value="" readonly="readonly">
<a class="widget-option-chooser" href="javascript:void(0)" onclick="WidgetInstance.displayEntityChooser('products', 'b3it_virtualevent_products_ids_0')" title="Öffne Auswahlmöglichkeit">
<img src="/skin/adminhtml/default/default/images/rule_chooser_trigger.gif" class="v-middle" alt="Öffne Auswahlmöglichkeit">
</a>
<a href="javascript:void(0)" onclick="WidgetInstance.hideEntityChooser('b3it_virtualevent_products_ids_0')" title="Anwenden">
<img src="/skin/adminhtml/default/default/images/rule_component_apply.gif" class="v-middle" alt="Anwenden">
</a>
</p>
<div class="chooser"></div>
</div>
</div> after save and reload of the page, the Data looks like this: WidgetInstance.addPageGroup({"page_id":"2","group":"b3it_virtualevent_product","block":"content","for_value":"all","layout_handle":"PRODUCT_TYPE_b3it_virtualevent","b3it_virtualevent_product_entities":"","template":"cms\/widget\/static_block\/default.phtml"}); Notice the group, it is Because |
This example ProductType is enough to trigger the problem, no other PHP file needed. Just add this <?xml version="1.0"?>
<!DOCTYPE config>
<config>
<modules>
<B3It_LongProductName>
<version>0.0.1.0</version>
</B3It_LongProductName>
</modules>
<global>
<catalog>
<product>
<type>
<b3it_longproductname translate="label">
<label>LongProductName</label>
<composite>0</composite>
<can_use_qty_decimals>0</can_use_qty_decimals>
<is_qty>1</is_qty>
</b3it_longproductname>
<configurable>
<allow_product_types>
<b3it_longproductname/>
</allow_product_types>
</configurable>
</type>
<grouped>
<allow_product_types>
<b3it_longproductname/>
</allow_product_types>
</grouped>
</product>
</catalog>
</global>
</config> which causes the JS to look like this: WidgetInstance.addPageGroup({"page_id":"1","group":"b3it_longproductname_prod","block":"content","for_value":"all","layout_handle":"PRODUCT_TYPE_b3it_longproductname","b3it_longproductname_prod_entities":"","template":"cms\/widget\/static_block\/default.phtml"}); |
That helps a lot, thanks. |
I added a possible minimum Size: |
Any suggestions? Simply change table column seems not to be a good choice. |
Imo I would just simply increase the table column size Anything else, like not storing "_products" would break existing data |
Mhhh ... 1st - you could make your product type shorter How about adding a validation for max length? |
That's why I said the column needs to hold the max possible type name that can be stored in the product table + that '_products' suffix That the type name in the etc config shouldn't be longer than what the product table can store is another can of worms |
Maybe it was a typo to set Are the any technical reasons to use 25? |
Long story short ... PR to increase column length made. |
Preconditions (*)
catalog_product_entity.type_id
table column is 32 characterswidget_instance_page.page_group
table column is 25 charactersSteps to reproduce (*)
page_group
is created by$typeId . '_products'
, it can't save the entire name it should have into it.Expected result (*)
Actual result (*)
See this JS error:
Possible Fix
widget_instance_page.page_group
should have a table column size of:41 characters = 32 (
catalog_product_entity.type_id
size) + 9 (_products
)The text was updated successfully, but these errors were encountered: