Customize OXID eShop With oxBlocks

One of the important new features in OXID eShop 4.5.0 is the addition of oxblocks in the new ‘azure’ theme. These are predefined blocks that can be overwritten by any module. The block definitions in the templates (and their usage in modules) are Smarty3-syntax compatible.

Block Usage

In templates, the blocks are defined by

tags, and can by used in overridden blocks with the [{$smarty.block.parent}] tag.

Here is an example:

This block can be activated by inserting the following SQL statement to the OXID eShop database (only necessary in OXID eShop version < 4.6.0):

An overridden module block has to be defined in a separate template file placed in the following module path:

See screencast below for an working example.

Note: any change regarding blocks requires eShop/tmp/ cache to be re-populated.

Block Debugging

To see all defined blocks while browsing the OXID eShop, you can activate

in the config.inc.php. This will enable the debug layer in the frontend, displaying the position and place of all rendered blocks per page.

Admin Blocks

Since OXID eShop 4.6.0, admin templates also support blocks. This makes it possible to enable the following features:

  • Append forms with needed input fields:
  • Include new CSS files:
  • Include new JavaScript files:
  • Append JavaScript:

Default oxBlocks

Template Block Theme Available from eShop version
out/azure/tpl/page/checkout/inc/trustedshops.tpl [{block name=”checkout_payment_trustedshops”}] azure 4.5.1
out/azure/tpl/layout/footer.tpl [{block name=”footer_main”}]
[{block name=”footer_fblike”}]
[{block name=”footer_deliveryinfo”}]
[{block name=”footer_services”}]
[{block name=”footer_information”}]
[{block name=”footer_manufacturers”}]
[{block name=”footer_vendors”}]
[{block name=”footer_categories”}]
azure 4.5.1
out/azure/tpl/widget/product/listitem_grid.tpl [{block name=”widget_product_listitem_grid_price”}]
[{block name=”widget_product_listitem_grid_tobasket”}]
[{block name=”widget_product_listitem_grid_price”}]
azure 4.5.1
out/azure/tpl/widget/product/listitem_infogrid.tpl [{block name=”widget_product_listitem_infogrid_price”}]
[{block name=”widget_product_listitem_infogrid_tobasket”}]
[{block name=”widget_product_listitem_infogrid_variants”}]
[{block name=”widget_product_listitem_infogrid_selections”}]
[{block name=”widget_product_listitem_infogrid_price”}]
azure 4.5.1
out/azure/tpl/widget/product/listitem_line.tpl [{block name=”widget_product_listitem_line_price”}]
[{block name=”widget_product_listitem_line_tobasket”}]
[{block name=”widget_product_listitem_line_variants”}]
[{block name=”widget_product_listitem_line_selections”}]
[{block name=”widget_product_listitem_line_price”}]
azure 4.5.1
out/azure/tpl/layout/sidebar.tpl [{block name=”sidebar_adminbanner”}]
[{block name=”sidebar_categoriestree”}]
[{block name=”sidebar_trustedshopsratings”}]
[{block name=”sidebar_partners”}]
[{block name=”sidebar_boxproducts”}]
[{block name=”sidebar_recommendation”}]
[{block name=”sidebar_tags”}]
[{block name=”sidebar_news”}]
[{block name=”sidebar_facebookfacepile”}]
[{block name=”sidebar_shopluperatings”}]
azure 4.5.1
out/azure/tpl/page/checkout/inc/basketcontents.tpl [{block name=”checkout_basketcontents_grandtotal”}]
[{block name=”checkout_basketcontents_basketitem_image”}]
[{block name=”checkout_basketcontents_basketitem_removecheckbox”}]
[{block name=”checkout_basketcontents_basketitem_titlenumber”}]
[{block name=”checkout_basketcontents_basketitem_wrapping”}]
[{block name=”checkout_basketcontents_basketitem_quantity”}]
[{block name=”checkout_basketcontents_basketitem_unitprice”}]
[{block name=”checkout_basketcontents_basketitem_vat”}]
[{block name=”checkout_basketcontents_basketitem_totalprice”}]
[{block name=”checkout_basketcontents_basketitem”}]
[{block name=”checkout_basketcontents_itemvpe”}]
[{block name=”checkout_basketcontents_itemerror”}]
[{block name=”checkout_basketcontents_giftwrapping”}]
[{block name=”checkout_basketcontents_basketfunctions”}]
[{block name=”checkout_basketcontents_nodiscounttotalnet”}]
[{block name=”checkout_basketcontents_nodiscountproductvats”}]
[{block name=”checkout_basketcontents_totalgross”}]
[{block name=”checkout_basketcontents_discounts”}]
[{block name=”checkout_basketcontents_totalnet”}]
[{block name=”checkout_basketcontents_productvats”}]
[{block name=”checkout_basketcontents_voucherdiscount”}]
[{block name=”checkout_basketcontents_delcosts”}]
[{block name=”checkout_basketcontents_paymentcosts”}]
[{block name=”checkout_basketcontents_ts”}]
[{block name=”checkout_basketcontents_wrappingcosts”}]
[{block name=”checkout_basketcontents_grandtotal”}]
[{block name=”checkout_basketcontents_summary”}]
azure 4.5.1
out/azure/tpl/page/details/inc/productmain.tpl [{block name=”details_productmain_price”}]
[{block name=”details_productmain_zoom”}]
[{block name=”details_productmain_title”}]
[{block name=”details_productmain_productlinksselector”}]
[{block name=”details_productmain_productlinks”}]
[{block name=”details_productmain_artnumber”}]
[{block name=”details_productmain_ratings”}]
[{block name=”details_productmain_manufacturersicon”}]
[{block name=”details_productmain_shortdesc”}]
[{block name=”details_productmain_variantselections”}]
[{block name=”details_productmain_selectlists”}]
[{block name=”details_productmain_persparams”}]
[{block name=”details_productmain_tprice”}]
[{block name=”details_productmain_tobasket”}]
[{block name=”details_productmain_priceperunit”}]
[{block name=”details_productmain_stockstatus”}]
[{block name=”details_productmain_deliverytime”}]
[{block name=”details_productmain_weight”}]
[{block name=”details_productmain_vpe”}]
[{block name=”details_productmain_social”}]
[{block name=”details_productmain_morepics”}]
azure 4.5.1
out/azure/tpl/page/details/inc/tabs.tpl [{block name=”details_tabs_main”}]
[{block name=”details_tabs_facebook”}]
[{block name=”details_tabs_longdescription”}]
[{block name=”details_tabs_attributes”}]
[{block name=”details_tabs_pricealarm”}]
[{block name=”details_tabs_tags”}]
[{block name=”details_tabs_media”}]
[{block name=”details_tabs_fbcomments”}]
[{block name=”details_tabs_fbinvite”}]
[{block name=”details_tabs_fblivestream”}]
azure 4.5.1
out/azure/tpl/page/account/inc/account_menu.tpl [{block name=”account_menu”}] azure 4.5.1
out/azure/tpl/page/account/dashboard.tpl [{block name=”account_dashboard_col1″}]
[{block name=”account_dashboard_col2″}]
azure 4.5.1
out/azure/tpl/widget/header/servicebox.tpl [{block name=”widget_header_servicebox_flyoutbox”}]
[{block name=”widget_header_servicebox_items”}]
azure 4.5.1
out/azure/tpl/page/account/recommendationlist.tpl [{block name=”account_redommendationlist_content”}] azure 4.5.1
out/azure/tpl/widget/reviews/reviews.tpl [{block name=”widget_reviews_record”}]
[{block name=”widget_reviews_form”}]
azure 4.5.1
out/azure/tpl/page/recommendations/inc/list.tpl [{block name=”redommendations_list_content”}] azure 4.5.1
out/azure/tpl/page/recommendations/recommlist.tpl [{block name=”redommlist_desc”}] azure 4.5.1
out/azure/tpl/layout/base.tpl [{block name=”base_style”}]
[{block name=”head_css”}]
[{block name=”base_js”}]
azure 4.5.1
out/azure/tpl/page/checkout/inc/steps.tpl [{block name=”checkout_steps_basket”}]
[{block name=”checkout_steps_send”}]
[{block name=”checkout_steps_pay”}]
[{block name=”checkout_steps_order”}]
[{block name=”checkout_steps_laststep”}]
[{block name=”checkout_steps_main”}]
azure 4.5.1
out/azure/tpl/page/checkout/thankyou.tpl [{block name=”checkout_thankyou_info”}]
[{block name=”checkout_thankyou_proceed”}]
[{block name=”checkout_thankyou_ts”}]
[{block name=”checkout_thankyou_partners”}]
azure 4.5.1
out/azure/tpl/page/checkout/payment.tpl [{block name=”checkout_payment_main”}]
[{block name=”change_shipping”}]
[{block name=”act_shipping”}]
[{block name=”checkout_payment_errors”}]
[{block name=”change_payment”}]
[{block name=”select_payment”}]
[{block name=”checkout_payment_nextstep”}]
[{block name=”checkout_payment_nopaymentsfound”}]
azure 4.5.1
out/azure/tpl/page/checkout/order.tpl [{block name=”checkout_order_vouchers”}]
[{block name=”checkout_order_address”}]
[{block name=”checkout_order_details”}]
[{block name=”checkout_order_btn_confirm_bottom”}]
[{block name=”checkout_order_errors”}]
[{block name=”checkout_order_main”}]
[{block name=”order_basket”}]
[{block name=”shippingAndPayment”}]
azure 4.5.1
out/azure/tpl/email/html/order_cust.tpl [{block name=”email_html_order_cust_basketitem”}]
[{block name=”email_html_order_cust_giftwrapping”}]
[{block name=”email_html_order_cust_voucherdiscount”}]
[{block name=”email_html_order_cust_nodiscounttotalnet”}]
[{block name=”email_html_order_cust_nodiscountproductvats”}]
[{block name=”email_html_order_cust_totalgross”}]
[{block name=”email_html_order_cust_discounts”}]
[{block name=”email_html_order_cust_totalnet”}]
[{block name=”email_html_order_cust_productvats”}]
[{block name=”email_html_order_cust_voucherdiscount”}]
[{block name=”email_html_order_cust_delcosts”}]
[{block name=”email_html_order_cust_paymentcosts”}]
[{block name=”email_html_order_cust_ts”}]
[{block name=”email_html_order_cust_wrappingcosts”}]
[{block name=”email_html_order_cust_giftwrapping”}]
[{block name=”email_html_order_cust_grandtotal”}]
[{block name=”email_html_order_cust_userremark”}]
[{block name=”email_html_order_cust_paymentinfo”}]
[{block name=”email_html_order_cust_username”}]
[{block name=”email_html_order_cust_address”}]
[{block name=”email_html_order_cust_deliveryinfo”}]
[{block name=”email_html_order_cust_orderemail”}]
[{block name=”email_html_order_cust_paymentinfo”}]
[{block name=”email_html_order_cust_orderemailend”}]
[{block name=”email_html_order_cust_tsinfo”}]
azure 4.5.1
out/azure/tpl/email/html/order_owner.tpl [{block name=”email_html_order_owner_basketitem”}]
[{block name=”email_html_order_owner_giftwrapping”}]
[{block name=”email_html_order_owner_voucherdiscount”}]
[{block name=”email_html_order_owner_nodiscounttotalnet”}]
[{block name=”email_html_order_owner_nodiscountproductvats”}]
[{block name=”email_html_order_owner_totalgross”}]
[{block name=”email_html_order_owner_discounts”}]
[{block name=”email_html_order_owner_totalnet”}]
[{block name=”email_html_order_owner_productvats”}]
[{block name=”email_html_order_owner_voucherdiscount”}]
[{block name=”email_html_order_owner_delcosts”}]
[{block name=”email_html_order_owner_paymentcosts”}]
[{block name=”email_html_order_owner_ts”}]
[{block name=”email_html_order_owner_wrappingcosts”}]
[{block name=”email_html_order_owner_giftwrapping”}]
[{block name=”email_html_order_owner_grandtotal”}]
[{block name=”email_html_order_owner_userremark”}]
[{block name=”email_html_order_owner_paymentinfo”}]
[{block name=”email_html_order_owner_username”}]
[{block name=”email_html_order_owner_address”}]
[{block name=”email_html_order_owner_deliveryinfo”}]
[{block name=”email_html_order_owner_orderemail”}]
azure 4.5.1
out/azure/tpl/email/html/sendednow.tpl [{block name=”email_html_sendednow_sendemail”}]
[{block name=”email_html_sendednow_infoheader”}]
[{block name=”email_html_sendednow_address”}]
[{block name=”email_html_sendednow_oxordernr”}]
[{block name=”email_html_sendednow_orderarticles”}]
[{block name=”email_html_sendednow_infofooter”}]
[{block name=”email_html_sendednow_ts”}]
azure 4.5.1
out/azure/tpl/email/plain/sendednow.tpl [{block name=”email_plain_sendednow_sendemail”}]
[{block name=”email_plain_sendednow_infoheader”}]
[{block name=”email_plain_sendednow_address”}]
[{block name=”email_plain_sendednow_oxordernr”}]
[{block name=”email_plain_sendednow_orderarticles”}]
[{block name=”email_plain_sendednow_infofooter”}]
[{block name=”email_plain_sendednow_ts”}]
azure 4.5.1
out/azure/tpl/email/plain/order_cust.tpl [{block name=”email_plain_order_cust_voucherdiscount”}]
[{block name=”email_plain_order_cust_basketitem”}]
[{block name=”email_plain_order_cust_nodiscounttotalnet”}]
[{block name=”email_plain_order_cust_nodiscountproductvats”}]
[{block name=”email_plain_order_cust_totalgross”}]
[{block name=”email_plain_order_cust_discounts”}]
[{block name=”email_plain_order_cust_totalnet”}]
[{block name=”email_plain_order_cust_productvats”}]
[{block name=”email_plain_order_cust_voucherdiscount”}]
[{block name=”email_plain_order_cust_delcosts”}]
[{block name=”email_plain_order_cust_paymentcosts”}]
[{block name=”email_plain_order_cust_ts”}]
[{block name=”email_plain_order_cust_giftwrapping”}]
[{block name=”email_plain_order_cust_wrappingcosts”}]
[{block name=”email_plain_order_cust_giftwrapping”}]
[{block name=”email_plain_order_cust_grandtotal”}]
[{block name=”email_plain_order_cust_userremark”}]
[{block name=”email_plain_order_cust_paymentinfo”}]
[{block name=”email_plain_order_cust_username”}]
[{block name=”email_plain_order_cust_address”}]
[{block name=”email_plain_order_cust_deliveryinfo”}]
[{block name=”email_plain_order_cust_orderemail”}]
[{block name=”email_plain_order_cust_paymentinfo”}]
[{block name=”email_plain_order_cust_orderemailend”}]
[{block name=”email_plain_order_cust_tsinfo”}]
azure 4.5.1
out/azure/tpl/email/plain/order_owner.tpl [{block name=”email_plain_order_ownervoucherdiscount”}]
[{block name=”email_plain_order_ownerbasketitem”}]
[{block name=”email_plain_order_ownernodiscounttotalnet”}]
[{block name=”email_plain_order_ownernodiscountproductvats”}]
[{block name=”email_plain_order_ownertotalgross”}]
[{block name=”email_plain_order_ownerdiscounts”}]
[{block name=”email_plain_order_ownertotalnet”}]
[{block name=”email_plain_order_ownerproductvats”}]
[{block name=”email_plain_order_ownervoucherdiscount”}]
[{block name=”email_plain_order_ownerdelcosts”}]
[{block name=”email_plain_order_ownerpaymentcosts”}]
[{block name=”email_plain_order_ownerts”}]
[{block name=”email_plain_order_ownergiftwrapping”}]
[{block name=”email_plain_order_ownerwrappingcosts”}]
[{block name=”email_plain_order_ownergiftwrapping”}]
[{block name=”email_plain_order_ownergrandtotal”}]
[{block name=”email_plain_order_owneruserremark”}]
[{block name=”email_plain_order_ownerpaymentinfo”}]
[{block name=”email_plain_order_ownerusername”}]
[{block name=”email_plain_order_owneraddress”}]
[{block name=”email_plain_order_ownerdeliveryinfo”}]
[{block name=”email_plain_order_owner_orderemail”}]
azure 4.5.1
out/azure/tpl/widget/product/bargainitems.tpl [{block name=”widget_product_bargainitem_price”}]
[{block name=”widget_product_bargainitem_tobasket”}]
azure 4.5.1
out/azure/tpl/widget/product/boxproducts.tpl [{block name=”widget_product_boxproduct_price”}]
[{block name=”widget_product_boxproduct_image”}]
azure 4.5.1
out/azure/tpl/widget/minibasket/minibasket.tpl [{block name=”widget_minibasket_product”}]
[{block name=”widget_minibasket_total”}]
[{block name=”widget_minibasket”}]
azure 4.5.1
out/azure/tpl/page/checkout/inc/options.tpl [{block name=”checkout_options_noreg”}]
[{block name=”checkout_options_reg”}]
[{block name=”checkout_options_login”}]
[{block name=”checkout_user_options”}]
azure 4.5.1
out/azure/tpl/page/checkout/user.tpl [{block name=”checkout_user_noregistration”}]
[{block name=”checkout_user_registration”}]
[{block name=”checkout_user_change”}]
azure 4.5.1
out/azure/tpl/page/checkout/basket.tpl [{block name=”checkout_basket_main”}]
[{block name=”checkout_basket_emptyshippingcart”}]
[{block name=”checkout_basket_backtoshop_top”}]
[{block name=”checkout_basket_loworderprice_top”}]
[{block name=”basket_btn_next_top”}]
[{block name=”checkout_basket_backtoshop_bottom”}]
[{block name=”checkout_basket_loworderprice_bottom”}]
[{block name=”basket_btn_next_bottom”}]
[{block name=”checkout_basket_vouchers”}]
azure 4.5.1
out/azure/tpl/page/search/search.tpl [{block name=”search_results”}]
[{block name=”search_top_listlocator”}]
azure 4.5.1
out/azure/tpl/widget/header/search.tpl [{block name=”widget_header_search_form”}]
[{block name=”header_search_field”}]
azure 4.5.1
out/azure/tpl/widget/sidebar/partners.tpl [{block name=”partner_logos”}] azure 4.5.1
out/azure/tpl/page/checkout/inc/wrapping.tpl [{block name=”checkout_wrapping_header”}]
[{block name=”checkout_wrapping_contents”}]
[{block name=”checkout_wrapping_item”}]
[{block name=”checkout_wrapping_cards”}]
[{block name=”checkout_wrapping_comment”}]
[{block name=”checkout_wrapping_submit”}]
azure 4.5.1

Important Notes

  • Language files from eshop/modules/<module>/out/lang/<current lang>/*_lang.php will be loaded automatically.
  • The oxViewConfig object has several convenience methods for interacting with module blocks:
    • return path to the requested module file:
    • return url to the requested module file:
  • It is always a good idea to provide a .htaccess file in the module directory which allows the module CSS, JS and image files to be loaded while disallowing access to the PHP and other files, as these should not be available to users.

Resources

Screencasts

You can use the following screencast to find out more about the new template inheritance feature. This feature optimizes the template handling system, making it easy to create flexible designs and integrate templates. The screencast was recorded by Sarunas.

Note: Since the screencast was created, the module blocks path has been changed to eshop/modules/<module>/out/blocks/<blockname>.tpl

Sourcecode used in this screencast

modules/partnerlogo/out/blocks/mypartner.tpl:

modules/partnerlogo/out/blocks/redborder.tpl:

Data in oxtplblocks:

(Note: In Oxid eShop 4.5.6 the path of partners.tpl changed slightly compared with the screencast example).

 

0.00 avg. rating (0% score) - 0 votes


1 reply

Trackbacks & Pingbacks

  1. […] werden. Blöcke können z. B. von Modulen eingebunden und beliebig oft erweitert werden (OXIDforge). Unserer Meinung nach sollte dieses Modul eigentlich direkt in den OXID Core integriert werden. […]

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

Your email address will not be published. Required fields are marked *