AbanteCart Development > Customization help
Custom layout; different layouts for GS1 & GS2
abantecart:
Maxter explained a database relationship to give better understanding how layouts are related to pages.
There is a different way to load layout to the page/controller.
Did you try to use Dev Tools to generate layout?
http://docs.abantecart.com/pages/developer/template_dev_tools.html
You can build your layout in admin and export it with dev tools. After you export, you need to rename page controller and load back usign code below. Once layout is loaded it will assign new layout to the page/controller.
You can load new layout to your page with the following code that you can include into extension install.php :
--- Code: ---$file = DIR_EXT . '/YOUR_EXTENSION/layout.xml';
$layout = new ALayoutManager('default');
$layout->loadXml(array('file' => $file));
--- End code ---
In layout.xml, you include your layout file with update page controller in <controller>...
Important to specify a page controller that you like to link this layout to.
Here is an example:
--- Code: ---<?xml version="1.0" encoding="UTF-8"?>
<template_layouts>
<layout>
<name>Default Page Layout</name>
<template_id>default</template_id>
<type>Default</type>
<pages>
<page>
<controller>pages/index/home</controller>
<page_descriptions>
<page_description>
<language>english</language>
<name><![CDATA[Page Name]]></name>
</page_description>
</page_descriptions>
</page>
</pages>
<blocks>
...
--- End code ---
Above section registers the page and links a new layout to it.
More manuals:
http://docs.abantecart.com/pages/developer/template_customization_or_development_guide.html
Geoffrey:
Hi, this is the 2nd response I have ever received from you.
In the 1st one, you helped me modify the block_templates table to permit placement of the "menu" block into header_bottom section. That modification became the foundation for my particular style of AbanteCart. It ultimately resulted in a clean approach to responsive navbar and an alternative consideration of categories. It was very helpful in building my streamlined approach to ecommerce, where the homepage is shopping.
I'm continuing to modify AC to remove extraneous pages from the checkout sequence. Less clicks, less pages, less everything.
So thanks for your 2nd response.
It didn't help.
In Developer Tools, I have one project. It is my template extension. It is a clone of default.
If I open that project (my template), I can see 4 buttons to do stuff, but none of them relate to layouts. There is no method for adding a layout.
In Developer Tools, I can start a new project. There are 7 available types of new projects, but none are "layouts".
Furthermore, I do not recognize the wisdom of creating a new extension for a layout for a different extension. I don't recognize the architectural relationship capability of that suggestion. Do I really need a layout extension to add a layout to a different extension? If so, how is it done?
Bottom line - I don't see how Developer Tools is used to create a new layout. I looked. I read. I opened everything. I don't see it.
So I looked at the underlying "values" of your proposal, and I compared them to Maxter's instructions.
By following Maxter, I inserted a new layout in the layouts table.
And I inserted a new layout-to-page relationship in the pages_layouts table.
And I inserted a new page in the pages table, but it isn't really a new page, it's just a more granular or precise specification of an existing page.
Then I inserted all of the new layout elements into the layout.xml file for the template extension. I gave the proper name, controller, and name-CDATA values to this new section of layout.xml. It's just a copy of the Checkout Pages section, but with changed name and controller values.
I looked at install.php for my extension. The code you referenced above is already in that file.
I cleared cache for Configuration and Layouts & Blocks.
The new layout appeared in my menu of layouts for my extension, but the new layout did not change the target page, and furthermore, the new layout was empty.
I think that I accomplished all the "values" mentioned in your response, but I did it by following Maxter's instructions, and I couldn't find anything in Developer Tools to improve or augment those "values" or the outcome.
So I have 2 probs:
1 - my new layout exists, but it is empty.
2 - my page ignored the new layout.
I think it best to solve them in order.
Big picture: there are a lot of checkout pages in AC. A lot.
Some of them are redundant.
Too many clicks, just to finish. Amazon created 1-click checkout for a reason. People wanna be done.
My goal is to shrink the checkout process to bare essentials. Faster. Less clicks.
My success depends on my ability to use different layouts for different checkout pages.
Maybe my needs are less important than the global need. Maybe having all checkout pages based on the same single layout is sub-optimal. Maybe all AC users could benefit from having access to a choice of more than 1 layout for all the checkout pages.
Thanks.
Geoffrey:
If a new layout is inserted into layouts table, and defined in layout.xml, and visible in admin dropdown menu of layouts, why is the layout empty?
Here is the layout.xml snippet:
--- Code: --- <layout>
<name>GS1 Layout</name>
<template_id>joe</template_id>
<type>Active</type>
<pages>
<page>
<controller>pages/checkout/guest_step_1</controller>
<page_descriptions>
<page_description>
<language>english</language>
<name><![CDATA[GS1 Layout]]></name>
</page_description>
</page_descriptions>
</page>
</pages>
<blocks>
<block>
<block_txt_id>header</block_txt_id>
<status>1</status>
<position>10</position>
<block>
<block_txt_id>customer</block_txt_id>
<status>1</status>
<position>20</position>
</block>
<block>
<block_txt_id>menu</block_txt_id>
<status>1</status>
<position>30</position>
</block>
<block>
<block_txt_id>search</block_txt_id>
<status>1</status>
<position>40</position>
</block>
<block>
<block_txt_id>language</block_txt_id>
<status>1</status>
<position>50</position>
</block>
<block>
<block_txt_id>currency</block_txt_id>
<status>1</status>
<position>60</position>
</block>
<block>
<block_txt_id>cart</block_txt_id>
<status>1</status>
<position>70</position>
</block>
</block>
<block>
<block_txt_id>header_bottom</block_txt_id>
<status>1</status>
<position>20</position>
<block>
<block_txt_id>category</block_txt_id>
<status>1</status>
<position>10</position>
</block>
<block>
<block_txt_id>breadcrumbs</block_txt_id>
<status>1</status>
<position>20</position>
</block>
</block>
<block>
<block_txt_id>column_left</block_txt_id>
<status>0</status>
<position>30</position>
</block>
<block>
<block_txt_id>content_top</block_txt_id>
<status>1</status>
<position>40</position>
</block>
<block>
<block_txt_id>content_bottom</block_txt_id>
<status>1</status>
<position>50</position>
</block>
<block>
<block_txt_id>content_bottom</block_txt_id>
<status>1</status>
<position>50</position>
</block>
<block>
<block_txt_id>column_right</block_txt_id>
<status>1</status>
<position>60</position>
<block>
<block_txt_id>order_summary</block_txt_id>
<status>1</status>
<position>10</position>
</block>
</block>
<block>
<block_txt_id>footer_top</block_txt_id>
<status>1</status>
<position>70</position>
</block>
<block>
<block_txt_id>footer</block_txt_id>
<status>1</status>
<position>80</position>
<block>
<block_txt_id>newsletter_signup</block_txt_id>
<status>1</status>
<position>40</position>
</block>
<block>
<block_txt_id>content</block_txt_id>
<status>1</status>
<position>50</position>
</block>
<block>
<block_txt_id>credit_cards</block_txt_id>
<status>1</status>
<position>70</position>
</block>
<block>
<block_txt_id>donate</block_txt_id>
<status>1</status>
<position>80</position>
</block>
</block>
</blocks>
</layout>
--- End code ---
This is my entire install.php from same folder:
--- Code: ---<?php
if (! defined ( 'DIR_CORE' )) {
header ( 'Location: static_pages/' );
}
$file = DIR_EXT . '/joe/layout.xml';
$layout = new ALayoutManager('default');
$layout->loadXml(array('file' => $file));
--- End code ---
Can anyone explain why the layout is empty?
Thx.
abantecart:
XML looks right to me. Do you get any error or warning in the log?
Did you clear cache?
I will try your XML a bit later.
Geoffrey:
The log has a few miscellaneous warnings, but nothing related to layout.xml or anything else related to layouts.
Yes, cache cleared.
Admin page debug is identical for Checkout Pages layout vs new GS1 Layout.
Thanks for help.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version