Does anyone know how I can add an additional checkbox/parameter to the specific settings of an appearance type when editing blocks?
What I want to do is take the products_multicolumns.tpl from the views/products/components and pass the buy_now.tpl call within it show_features=true so that the features for a product are displayed with the other info.
I’ve currently achieved this using hooks (created a product_multicolumns_list.override.tpl in addons\my_changes\hooks\products and customised the code to add this parameter to the buy_now.tpl call.
That’s fine and is does what I want but now where ever I use the products_multicolumns.tpl appearance type for a products content type, I get my override - and I don’t always want to!
So… my question boils down to:
Can I create my own appearance type for products? and how. I’ve tried just copying the products_multicolums.tpl and renaming it but it doesn’t appear in the appearance type drop down.
Can I add another parameter to the specific settings values for an existing appearance type?
I got as far as following the admin code to the update.tpl in admin\views\block_manager but could see how the select dropdown options where being populated.
I think you need to also create a new tpl in /skins/YOURSKIN/customer/blocks - I believe the dropdown is populated based on these. Just copy /skins/YOURSKIN/customer/blocks/products_multicolumns.tpl and adjust the include to point to your new file in /views/products/components/.
thanks for the advice, I did sort of try that with the products_multicolumns.tpl before my hooks override. So I tried to keep it simple and copied the products2.tpl to products3.tpl in the [my skin]\customer\blocks folder. I updated the refs inside this file to products3.tpl and refreshed the blocks screen in admin with the &cc option to clear the cache.
but I’ve only got the follow options in the appearance dropdown - Multicolumns , Multicolumns small , Products , Products2 , Short list and Hot deals
So I’m doing something stupid (entirely possible!) there must be somewhere else that needs updating?
I’ve just played around with this a bit and this is what I have found.
I copied /skins/YOURSKIN/customer/blocks/products_multicolumns.tpl to a new file: products_test.tpl. I left the include as is. I now have a new standard sidebox available in the block content option called ‘Multicolumns’. If I create the block using the ‘Multicolumns’ option, the block shows the following:
Content: multicolumns
Appearance: blocks/products-test.tpl
So this appears to populate the dropdown although I have no idea from where it is grabbing the name ‘Multicolumns’. Also, the block does not display in the storefront.
I will try to play some more when I have the time.
ok, I’ve found where the config for these files is - schemas\block_manager. in specific_settings.php and structure.php is defined these various tpl block files that are available when you choose a block content (eg Products) and then choose a location. You can configure which appearances are available for specific locations which is quite handy for what I want
The only thing I’ll need to work is:
How to link new specific settings definitions to the code in the tpl - for example I want to add a checkbox for ‘Show Features’, like the Show Item Number’ checkbox. How to link that back to the show_features=true call in the tpl…
My copied products2.tpl → products3.tpl is showing as _products3 in the appearances list. How to make it products3 without the underscore. Is this a language translaition/conversion thing??
thanks if you are intersted in carrying on the research
[edit]
ok, I added show_features=$block.properties.show_features to access the new specific setting and I insert the new field name into cscart_language_values in order for the field to be displayed nicely.
insert into cscart_language_values (
lang_code
,name
,value
) VALUES (
‘EN’ – lang_code
,‘products3’ – name of template file used in block manager
,‘Products3’ – value to display
)
This does what I wanted so I’m happy. I’m suprised this hasn’t been covered in another forum thread, making me wonder if there is an easier way of doing it?
Just a suggestion: It would be useful if I could set Filling to “Manually” and Appearance type to “Accordion Menu” - allowing me to configure menu blocks with a specific set of categories. Of course, I’d also like to see the same treatment for the stock category types (Emenu, Plain, etc.). I’ll post a feature request in the Bug Tracker…