OroCommerce about the frontend extend or chaplin - orocommerce

The best way to work on the frontend, is via render twig or chaplin?
im trying with {% extends 'OroUIBundle:actions:index.html.twig' %} but i cant extend
tnks

If you want to customize frontend view - you need to override twig templates.
Check this manual:
https://oroinc.com/orocrm/doc/current/dev-guide/customization#overriding-templates
Also check this example:
https://github.com/oroinc/orocommerce/blob/master/src/Oro/Bundle/CustomThemeBundle/README.md

Related

Shortcodes in Shopify no longer working when using render instead of include

I'm currently using shortcodes in Shopify via this customization. Shopify updated liquid to deprecate include and replaced it with render. This seems to break all of my embeds. I have them on pages and product descriptions, enabling using:
{% render 'shortcode' load: page.content %}
It used to be:
{% include 'shortcode' load: page.content %}
Now that I use render, I just get an error on page "include usage is not allowed in this context"
Does the render call change to work properly?
There are a few differences with the render tag in comparison to the include:
You can't use include inside render tag (like in your case)
You must pass all variables to the render tag as arguments, it can't read them if you defined them outside of it and don't pass them.
Variables defined in the render tag are not accessible outside of it.
These are the main differences, so you will need to update your snippet to use only render tags and pass the appropriate variables to it.

Big commerce add active class using handlebar

I am using the cornerstone theme and I need an active class for the current navigation. I have used the jQuery and javascript but I want to use the handlebars HTML template engine.
Yes, It is possible to Handlebar.
You can put {{is_active}} in navigation iteration loop in handlebar.
{{#if is_active}}active{{#if}}

Is it possible to modify <script> tags on the fly, before a page is rendered?

I was wondering if it is possible to modify <script> tags on the fly with the Shopify API?
Scenario:
A page renders some <script> tags.
Before the <script> get rendered, my app adds an attribute to them, so that the tag is rendered with the attribute.
Thanks in advance
No. Your script is taken from Shopify with a GET request where it is inserted into the Liquid rendering pipeline for eventual inclusion in the client's HTML payload. If you want that script to do custom stuff, have it do a callback with an App Proxy which would then make it dynamic.
Read this to learn a lot: https://help.shopify.com/api/sdks/shopify-apps/modifying-online-store/use-javascript-responsibly
A Shopify App with the write_themes scope (see Shopify Documentation) can access and edit Assets and the Theme. Your editing of the Theme could include the modification of a <script> tag to as your put it "add an attribute".
Take into consideration whether the Theme designer hard coded the URL of the script or used liquid tags such as {{ 'example.js' | asset_url | script_tag }} to create the asset URL.

Liquid variable scope between Layout and Template

Is is possible to define liquid variables in a layout file that are visible in the template files?
Variables defined in a layout (e.g. theme.liquid) are visible to any snippets included via <% include %> (and vice versa).
Variables defined in a template (e.g. index.liquid) are visible in any snippets included via <% include %> (e.g. product-grid-item.liquid) and are also visible in the layout file.
And yet variables defined in a layout don't seem to be visible to the template. Presumably the template is evaluated prior to the evaluation of the layout. Is there any way to override this behavior?
Currently in Shopify, Liquid variables cannot be passed from the layout into the template.
One way to get around this would be to do the same logic twice, perhaps in a snippet. Then place the same snippet in both the Layout and the template.
Also worth noting on the subject of Shopify Liquid scope as it isn't documented anywhere is that variables defined inside of sections are scoped inside of that section and cannot be access outside.
EDIT:
Also on the subject of Shopify Liquid variable scope.
There is now also the {% render %} tag which forces a snippet to be called with the required variables explicitly passed in.
For example you could do this with include
{% assign name = 'cart' %}
{% include 'icon' %}
Alternatively, you can use the render tag which has some performance benefits. Just ensure you explicitly pass the name variable.
{% render 'icon' name: 'cart' %}
<!-- OR -->
{% assign name = 'cart' %}
{% render 'icon' name: name %}
The benefit of using render is that the variables are always scoped to the snippet which can prevent some confusing bugs. Additional there is a big speed performance on Shopify's server which will improve the Time to First Byte.

Bigcommerce Stencil custom handlebars helpers

Is it possible to write custom handlebars helpers to use within Stencil templates? If so, where should they be defined? Is there an example somewhere within the documentation?
How/Where to use Custom Handlbars Helpers in Stencil?
All the helpers are predefined that can be used with Stencil "natively". If you'd like to register your own, you'd need to include handlebars as apart of your theme and create them clientside.