How to render a link in prestashop 1.7 with Apollo page builder - smarty

Im developing a e-commerce in prestashop and it's using Apollo Page builder to template it.
In the product page (Ap Products Details Builder) i want to add a link to a cms page.
Here's what i've tried:
Ap PageBuilder -> Ap Products Details Builder -> detail2556437236 -> Edit
On the builder, dragged block tpl code inside the template and added:
{url entity='cms' id=6 id_lang='1'}
In the file detail2556437236.tpl added:
{url entity='cms' id=10 id_lang=2}
In the file detail2556437236.tpl added:
On every try, nothing appears in the elements neither errors on console. It seems like it's not even getting called

I'm pretty sure that you can't use a Smarty template inside editor in Appolo Page Builder, but the best person to answer this is the author of this module.
You can always link like this:
/index.php?controller=cms&id_cms=111

Ok i realized that content wasn't appearing because of some weird cache.
Beside that i had something wrong. On tpl code block it still needs to have the anchor tag:
text
and now it works fine as a charm
But the #KrystianPodemski answer also works, with 1 minus.
If the page is no debug mode, it will show a redirect page instead.

Related

magento 2 custom phtml page

Having just got myself acquainted (enough) with Magento 1.9, and able to make the customisations required, I've been told that once it's out, we're moving to Magento v2.0.
Having found the differences in the file structure, I believe I can see where to place my code for the custom pages we use, but how can I add this page from my project to a static block for later use?
Previously, the method used was as follows (I realise this may not follow the best practise, but it worked):
Create element folder within theme or core templates directory.
eg. /app/design/frontend/<theme>/default/template/myelement/mypage.phtml
Add this page/element to a static block using the following in the content editor:
{{block type="<theme>/default" template="myelement/mypage.phtml"}}
This block can then be added to the category pages as required.
In Magento 2, I have tried what I believe to be required, which is replicating the file structure and adding phtml files to this, so the template file now resides in:
/app/code/<supplier>/<module>/view/frontend/templates/mypage.phtml
Adding to the content editor the following:
{{block type="<supplier>/<module>" template="mypage.phtml"}}
Unfortunately, this does not display the intended page (element). It doesn't display the calling "{{block" entry either, which usually happens when the line is invalid, so I can only assume that I'm missing something with the link to this template.
If anyone can offer some assistance with this, I would be most grateful.
EDIT:
Continued research on this has led me to the following assumptions:
Magento 2 requires more than just a new .phtml page, even for simple customizations.
I'm still missing something.....
Having gone through 3 different tutorials on creating new modules for Magento 2, each providing slightly different methods, but fundamentally being the same thing, I now have what I believe should be all the code elements to make a new .phtml template for display in a static block.
This has led to an additional problem though.
While I have the required code, I cannot add the module. Adding the module to etc/config.php, as suggested in 2 out of the 3 tutorials, simply crashed M2, both admin and frontend when you try to clear the cache. This is the case after manually clearing cache folders in the var directory.
Also, still unable to add the .phtml template file to a static block or page using content editor.
Not much hair left to pull out here, so looking for help! Thanks in advance
There are a few samples on GitHub, including https://github.com/magento/magento2-samples/tree/master/sample-module-newpage which shows a module adding a new page with a very simple PHTML template file. This example does not use CMS content editing however - it is a sample based on using layout files.
You mentioned you were getting crashes. Would need more details to help on that one. If you got it solved, could you update this question and accept a response to close it out? Thx!
You Should try "class" instead of "type". So your code should look like.
{{block class="<package>\<module>\Block\MyBlock" template="mypage.phtml"}}
You Should try "VenderName_Modulename::myelement/mypage.phtml" instead of "myelement/mypage.phtml". So your code should look like.
{{block class="VenderNameModulename\Block\MyBlock" template="VenderName_Modulename::myelement/mypage.phtml"}}

Magento: Update several pages with a different tracking code

I have to put some Tracking code on several pages: some category pages, homepage, cart and success page. Whats the best way to accomplish that?
I thought:
homepage --> place the code in CMS -> pages -> home
success --> edit the success.phtml
cart --> edit the cart.phtml
categories -> create a CMS block --> place layout update in the concerning category page to load CMS block
But it looks like it is just a mess because for every code I have another solution. What would you suggest to get it done? Did I miss a better solution?
Thank you,
Hannes
If it's the same tracking code for each one, you could
Create a .phtml file containing the code
Add the file to the relevant hard pages (success, cart) using your layout xml files
Add the file to the relevant soft pages (home, categories) using the custom design tab / custom layout update area.
If the code changes based on the page, then you may need to create a new module with a block that alters the tracking code according to a parameter you include in the layout.
You can include a tracking script using the available Magento configurations fields.
Go to System > Configuration > Design
Under the HTML Head section, insert your tracking script into the Miscellaneous Scripts field.
Save Config, and clear your Magento caches.
Alternatively if you want it in the Footer instead, look under the Footer section and use the Miscellaneous HTML box there.

The module creator for Magento gives me a blank page when seeing the admin page for it

I am using Shell's module creator and when I load up the Brands.php block for the admin panel to CRUD my custom database for my module, I am given a blank page upon clicking Manage Items from the Brand menu. Have you any idea why? I checked the error logs and there's nothing there.
From the image it looks like the Grid_Container isn't getting loaded into your layout. Try enabling Template / Block hints and seeing if there is anything loaded. I'm guessing your layout is misconfigured/missing.

Overriding magento cms controller for noRoute action

I'm looking for example of overriding cms controller for noRoute action. I'm trying to make my 404 page send me an email when it happens.
I have followed this tutorial and did everything exactly as written but nothing happens.
I googled some more and found this which also doesen't work for me.
My Magento version is 1.5.0.0-rc1.
Could anyone give me any link to some tutorial or example code? Thank you very much!
I've did some try/error research and managed to create my module. After a lot of search I found that Magento uses custom No-route controller for 404 pages (this page is GOLD: http://alanstorm.com/magentos_many_404_pages). This can be set as following:
Under "System -> Configuration -> Web -> Default Pages" I've changed the setting for Default No-route URL which now points to my custom made controller.
I've basically copied contents from the existing CMS IndexController and added my own logic (sending email and showing search form). That's it, it works form me.
Thanks to everyone.
mXperts skuroute extension - get it and edit the controller.
http://www.magentocommerce.com/magento-connect/mxperts/extension/1749/mxperts-skuroute

In a custom Joomla! template, how can I determine whether I am on the home page?

I am trying to create a custom template, but I want the template to look a little different for my Joomla! homepage/frontpage. Is there a easy boolean-type expression I can use to determine whether I am on my site's homepage?
That way, I can just say if ($on_homepage) { [custom homepage html] } else { [regular template] }
Thanks in advance!
You can create a separate template for your homepage. More details here.
This is very easy, just create 2 templates. One for your homepage and one for the rest of your site. Then install both, make sure you give them a descriptive name in their xml file so you know the difference.
Once they are installed you can set a default template that would be site wide. Then choose/click on your homepage template and it's options will load up. On the bottom left you can select the menu items where this template will be visible. This setup is very much like the way in which you define where modules are shown.

Resources