Closed Hanmac closed 3 weeks ago
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? Just create a Product Type with type name > 16 characters. my Type name was "b3it_virtualevent" with 17 characters.
The HTML for this looks like this, notice the ID b3it_virtualevent_products_0
<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 b3it_virtualevent_product
instead of b3it_virtualevent_products
what it should be?
Because b3it_virtualevent_products
doesn't fit the widget_instance_page.page_group
table column, so it gets cut to b3it_virtualevent_product
This example ProductType is enough to trigger the problem, no other PHP file needed.
Just add this B3It_LongProductName/etc/config.xml
<?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:
41 characters = 32 (catalog_product_entity.type_id
column size) + 9 (_products
string)
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 2nd - next one will use a much more longer type-name
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 varchar(25)
instead of varchar(255)
.
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
)