Calling right block in Magento 1.6.2 of static html - html

I am creating a CMS page in magento as a teaser for an upcoming product. I am using two columns with a right bar and using the layout update XML in the backend to call some custom blocks I make for the right side.
Well right now I am loading just placeholders then going to edit the phtmls after the fact.
If I use two blocks on the right it looks fine.. but if I add more, then the whole footer corrupts and moves to the right column.
I am trying to get 3 custom blocks on the right side.
Here is my layout update XML
<reference name="right">
<block type="newsletter/subscribe" name="left.newsletter" template="newsletter/rightsubscribe.phtml"/>
<block type="core/template" name="name1" template="page/custom/custom1.phtml"/>
<block type="core/template" name="name2" template="page/custom/custom2.phtml"/>
</reference>
Here is the HTML of the customs blocks I am using.
<div id="shop-with-confidence" class="white-box">
<h3>Custom1</h3>
<div class="white-box-inner">
Testing1
</div>
<div id="shop-with-confidence" class="white-box">
<h3>Custom2</h3>
<div class="white-box-inner">
Testing2
</div>
Does anyone have any idea why that would be wrecking the page I am editing?

OP has already resolved the issue for himself, but it's worth noting that one can easily check parent-child block relationships to determine if an issue is framework- or markup- related.
To check the list of child blocks which a parent block has, one can simply do the following in a template:
Zend_Debug::dump($this->getChild()) //list of children
Zend_Debug::dump($this->getSortedChildren()) //list of ordered children
In the case of blocks lacking templates (core/text_list, e.g. "right"), one could do this from a child block template as well:
Zend_Debug::dump($this->getParentBlock()->getChild()) //list of children
Zend_Debug::dump($this->getParentBlock()->getSortedChildren()) //list of ordered children
Ref Mage_Core_Block_Abstract for more information.

Related

Angular sub-navigation based on route

I'm building an Angular application with two levels of navigation in the header.
The top-level navigation are visible on all routes in the application, however the second-level navigation is context-specific and only exists on certain routes.
For example, when viewing a specific course in a university webapp, the second-level navigation might have links to description, prerequisites, the different subjects, etc.
One way of doing it is creating a subnav component that has a switch statement and renders the correct subnav component based on the route:
<div [ngSwitch]="currentRoute">
<course-sub-nav *ngSwitchCase="course"></course-sub-nav>
<students-sub-nav *ngSwitchCase="students">...</students-sub-nav>
<support-sub-nav *ngSwitchCase="support">...</support-sub-nave>
</div>
I don't like that solution because now the sub-nav component knows too much about all the different context-specific sub-navs.
Another approach is to use a service to manage it. i.e. having a SubNavService.setNavigationLinks(links: NavLink[]) that takes an array of links. The sub-nav component can then listen to changes to the SubNavService and dynamically render a list of sublinks.
This solution is a bit cleaner however it does mean that I need to call that service on ever top-level component to ensure that the sub-nav is being updated. I'd also need to clear the links on pages that don't require sub-navs.
A third solution might be doing something like:
<!-- In header.component.html -->
<div class="sub-nav">
<ng-content="subnav"></ng-content>
</div>
<!-- IN course-page.component.html -->
<div>
<subnav>
<!-- my nav links -->
</subnav>
<div class="course-content">
<router-outlet></router-outlet>
</div>
</div>
I like this approach the most given that if a subnav component exists, the subnav will be rendered, and if not, nothing will show. Additionally, the relevant component has full control over rendering the links within the subnav. however given that course-page isn't actually a child of the header, I'm not sure how I can make it work.
I was wondering if there's any way to get the last approach to work. If not, would the second approach be the most pragmatic solution to this problem or is there a cleaner solution that exists?
The cleanest solution would be the second you mentioned.
Having a service that would handle the menu - menu component would subscribe and listen for changes, meanwhile other components would handle what items they need to have in the menu.

Change layout just for one cms page - for instance "customer-service"

I'm using the pages that comes with the default instalation of magento on my web store. The customer want's to have diferent contents on right column of that pages.
For instance, on "customer-service" page wants to have the top FAQ's but on "contacts" want to have the telephone and mail information.
How can I achive that? I been trying to change the 2columns-right layout, on the right column, to each page but I was unable to find a way to do that.
Thanks in advanced.
In 'CMS > Pages' from the Magento back office, go into the 'Design' tab in each page you want to change and set the 'Layout' to '2 columns with rightbar'.
Then, you can use the right.permanent.callout block to call in what content you wish on various pages/page types as wanted.
For example, displaying an image in the right sidebar on contact page only:-
<contacts_index_index>
<reference name="right">
<block type="catalog/product_compare_sidebar" before="cart_sidebar" name="catalog.compare.sidebar" template="catalog/product/compare/sidebar.phtml"/>
<block type="core/template" name="right.permanent.callout" template="callouts/right_col.phtml">
<action method="setImgSrc"><src>images/media/col_right_callout.jpg</src></action>
<action method="setImgAlt" translate="alt" module="catalog"><alt>Keep your eyes open for our special Back to School items and save A LOT!</alt></action>
</block>
</reference>
</contacts_index_index>
You can modify to change the page, page type, or template/block as you wish.

Generate different pages on the basis of different contents

Let me assume that I have the following architecture
_components (folders)
x1.html
x2.html
x3.html
I have a first page where I got the information from the YAM section for every component.
At this point I would like to add a link for every component to another page where I will display the component in a bigger manner.
So, let me assume I have, in the first page :
<div class="col-md-1">
<span id= "logos" class="material-icons"></span>
</div>
and In the componentbig.html I would like to open the right component on the basis of the link.
Do you have any suggestions for me ?
If I understand You correctly, then collections might be the feature You are looking for. For example, I'm usually using collections to generate a list of products and then have a specific page for each product also. Also make sure You check the easy tutorial by Ben Balter.

CodedUI GetChildren() doesn't return children with HTML5 tags like HEADER, SECTION, ARTICLE, NAV

In codedUI I am unable to traverse by GetChildren() method in an html page with HTML5 tags.
My Html structure is like this.
HTML
|-BODY
|-DIV id="pagetop"
|- HEADER class="headerclass"
|- NAV class="navclass"
|- SECTION class="sectionclass"
|- FOOTER class="footerclass"
|- DIV id="lastdiv"
Issue: On doing GetChildren() on "pagetop" div control, only 1 result is returned having "lastdiv" div control in it.
It should return 5 controls instead.
I am able to capture the UIMap for SECTION(or other HTML5 tags) and able to traverse backward by GetParent() method, but the other way is not working.
SECTION.GetParent() = DIV id="pagetop" [Works as expected]
SECTION.GetParent().GetChildren() = Only 1 result [This is wrong, should be 5]
Is there an issue with traversing HTML5 tags in codedui?
Try looking at the child controls of the one control that is found. I am not aware of anything that says the HTML structure you show MUST be represented with exactly the same number of levels. Phrasing that differently, the UI Controls might have extra levels than the minimum that appear to be necessary for the HTML structure.
To understand how the HTML is represented you could use the Coded UI cross-hairs tool. Start with one of the five sections (or a child of theirs) and then use the four navigation arrows to move up through the hierarchy to see what items Coded UI can see at each level.
Another approach might be to use recursive code that calls GetChildren() to descend the hierarchy and show exactly what is present at each level. You might use code based on the recursive routine in my answer to this question Recursively locating a UIElement with InnerText in C# but using a small maxDepth and adding some Console.Writeline() or other print statements to display the controls found.
I have filed one bug in VS2013 feedback forum for this issue.
It can be tracked here: https://connect.microsoft.com/VisualStudio/feedback/details/898599/
Based on suggestions from AdrianHHH, I am currently doing this to get all the children of a control. This returns all controls including HTML5 controls as HtmlCustom.
private List<UITestControl> GetAllChildren(UITestControl uiTestControl)
{
var child = new HtmlControl(uiTestControl);
child.SearchProperties.Add("InnerText", "", PropertyExpressionOperator.Contains);
var items = child.FindMatchingControls().ToList();
var trueChildren = items.Where(i => i.GetParent().Equals(uiTestControl)).ToList();
return trueChildren;
}

How can I redesign Magento toplinks?

I have browsed through many articles, but none of them mention how I can go about redesigning the toplinks at the top of any Magento store.
Does anyone know how I can modify the default links which are found in the top right of my Magento store and assign an icon to each link and also spread the links across the full width of the top area.
It may include something like the below (example only).
Any suggestions would be much appreciated.
My website is: www.efficienttrade.co.nz if that helps.
Thanks,
Jason
Find the top.links in layout xml files and add a class. Then, you can customize this class via css.
For instance,
<!-- this piece of code available in rss.xml, look at the class define -->
<reference name="footer_links">
<action method="addLink" translate="label title" module="rss" ifconfig="rss/config/active"><label>RSS</label><url>rss</url><title>RSS</title><prepare>true</prepare><urlParams/><position/><li/><a>class="link-rss"</a></action>
</reference>
Same as Ogüz answer + more information:
You have to be a little bit like Sherlock Holmes.
The top links are generated thanks to a block that you can find in the layout file page.xml of your theme. Then search the block name "topLinks" in the header block (in the default theme, it's the name) and you will find <block type="page/template_links" name="top.links" as="topLinks"/>. This block topLinks is generated thanks to the block class Mage_Page_Block_Template_Links. The important method in this block is public function addLink(...), it means that you will have to search into the xml layout the following element/tag <action method='addLink'>...</action>.
An example for the customer module, in the file customer.xml of the layout folder:
<reference name="top.links">
<action method="addLink" translate="label title" module="customer"><label>My Account</label><url helper="customer/getAccountUrl"/><title>My Account</title><prepare/><urlParams/><position>10</position></action>
</reference>
You should find more than one xml element which uses this kind of method.
Pay attention, the addLink method can also be called programmatically (into PHP code), not only in layout file.
Hope it helps