Magento Content Block Question - layout

Noob Question here. I have created and successfully added an additional Page Layout to the existing theme on a client's website.
I then checked what was going on in the content area and found that a file, named grouped.phtml was being called.
The Problem:
I want to duplicate that file and call it (for example) grouped2.phtml and add it to my custom page layout, while keeping the first file (grouped.phtml) alone. How do I do this? Thank you ahead of time.

Copy grouped.phtml from base/default/template/catalog/product/view/type/ to grouped2.phtml in the same directory of your theme. Edit it as you wish.
Open up layout/catalog.xml in your theme. Find the lines that say
<block type="catalog/product_view_type_grouped" name="product.info.grouped" as="product_type_data" template="catalog/product/view/type/grouped.phtml">
<block type="core/text_list" name="product.info.grouped.extra" as="product_type_data_extra"/>
</block>
Duplicate those lines with your grouped2.phtml
done.
======EDIT===========
If you wish to retain the standard grouped.phtml as the default, but use your grouped2.phtml in some specific instances, you can make XML layout changes in the "Custom Layout Update" field on the Design tab of the specific products or categories in the Magento Admin. In that case, use the following XML:
<remove name="product.info.grouped"/>
<block type="catalog/product_view_type_grouped" name="product.info.alternative.grouped" as="product_type_data" template="catalog/product/view/type/grouped2.phtml">
<block type="core/text_list" name="product.info.grouped.extra" as="product_type_data_extra"/>
</block>
Note that the inserted XML has a different name.

Related

Liferay 7.4: How to create a configurable web content article footer?

I need to create a footer in a Liferay-project, that can be modified from the instance. I've been trying various things in my footer-code and instance, but haven't figured out how to do it.
Any content inside the footer can't be touched and in page edit mode, Liferay says "This area is defined by the theme. You can change the theme settings by clicking more in the Page Design Options panel on the sidebar". I didn't get any help from Page Design Options either. Is there a way to do this?
I found the answer after hours of work and searching and want to share it with everyone here. The working solution was found here, in one of the comments.
You need to write some code (I use Freemarker/ftl) and then configure the site pages a bit, but here's how it works:
Put a new setting inside liferay-look-and-feel.xml:
<settings>
<setting key="footer-article-id" value="" configurable="true" type="text"/>
</settings>
This will create a new configurable option in page options, allowing you to input the ID of the web content.
NOTE: <theme> might get underlined red "The content of element type "theme" must match". This still prints everything correctly, but the tags are given in a wrong order. Inside my <theme>, I have <template-extension>, <settings> and <portlet-decorator> in that order, which removes the error.
Assign a variable in init_custom.ftl (cleans up the footer-code):
<#assign footer_article_id = getterUtil.getString(themeDisplay.getThemeSetting("footer-article-id"))/>
And then add this to the footer-code, to create the spot, where the content is visible:
<#liferay_journal["journal-article"]
articleId=footer_article_id
groupId=page_group.groupId
/>
After this, everything should be ready code-wise.
Create a Web Content for your footer. In the creation screen, there's an ID on the panel on the right. Publish your content and grab the ID.
Finally, go to Site Builder --> Pages and click on configuration from the top bar (behind three dots). You should see the input field like in the first picture: That's where you add the ID.
Save the settings and your web content should now be in the footer.
Hope this helps!

Orchard Placement file not hiding the Title Part

In Orchard I have a placement.info file that should hide the Title part when I view an Author:
<Match ContentType="Author">
<Place Parts_Title="-" />
<Place Parts_Breadcrumbs="-" />
</Match>
Author is a custom content type I've created and the Breadcrumbs Part is a custom part.
The breadcrumbs part is hidden, but the title is still displayed. If I inspect it with Shape Tracing it is definitely Parts_Title I want to remove, but the content of my placement file doesn't seem to work.
I do not have a whole of example to go on there, but it seems to me that this part is conflicting with the Parts_Title that ships with orchard.
Try extending the modifier in your placement as well as your shapes to something like:
Parts_MyModule_Title
This just adds some more clarity and can keep orchard from stepping all over itself.
Similar problem here.
This is because your custom part's Placement.info was loaded first and Orchard Title part was loaded after that overriding it.
To solve it, in your custom part's Module.txt, put a dependence on Title. This will force Orchard Title to be loaded first before your custom part.

Recently viewed products block at bottom of products list page -magento

I would like to display recently viewed products block at bottom of page in Product list page (out of left, content and right block) . It must display from left to right side of page ,i search in many forums but i'm not getting right answer can any one help me please
Would you like to show it on 'Product View Page', if yes, then you can change the xml file like this, comment out the bit which display it on right and write this (Assuming ur using Magento's latest 1.6.x versions,)
<catalog_product_view translate="label">
<reference name="content">
<block type="reports/product_viewed" name="right.reports.product.viewed" as="recently_viewed" template="reports/product_viewed.phtml" />
</reference>
</catalog_product_view>
This should display the 'Recently Viewed Products' on your product page in the main content area.

trying to remove login url from header / change evaluation order of layout updates

I want to remove the login url from the header, but magento won't budge. In the local.xml file I have the following code:
<reference name="top.links">
<action method="removeLinkByUrl"><url helper="customer/getLoginUrl"/></action>
</reference>
After a little debugging I found that the login url is added AFTER it is "removed" (customer.xml:75 of the base/default theme.
How can I change the order in which layout updates are processed? Surely the local.xml is supposed to override just about anything?
edit:
Just to be clear, I am building a theme, so editing existing files is not an option for me.
You'd think that, but it gets tricky. You didn't mention it in your post, but what handle tag are you putting your reference tag in? The base custoemr.xml file that adds the customer/getLoginUrl is run from the customer_logged_out handle. Even if your code's in local.xml, if it's in a default handles or full action name handle, it will run after the code in catalog.xml because local.xml only wins on a per handle.
If that didn't make sense, just add this to your local.xml and you should be good to go.
<customer_logged_out>
<reference name="top.links">
<action method="removeLinkByUrl"><url helper="customer/getLoginUrl"/></action>
</reference>
</customer_logged_out>

Faulty pages created by SiteDefinition

I'm creating some pages using a SiteDefinition, the markup looks something like this:
<File Url="Page.aspx" Name="$Resources:SiteDefinitions,PageName;" Type="GhostableInLibrary">
<Property Name="Title" Value="$Resources:SiteDefinitions,PageTitle;" />
<Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/Somepage.aspx"></Property>
<AllUsersWebPart WebPartZoneID="WebPartZone1" WebPartOrder="1">
-- webpart data here
</AllUsersWebPart>
</File>
The page is created as expected, but it's somewhat faulty. If for instance I click Edit Page and then click Publish (without actually editing anything) I will get this error:
"This Page has been modified since you opened it. You must open the page again."
I will get this error approx. every second time I try an editing action.
If I manually create a page using the same page layout everything works as expected and this error does not show up.
Does anybody have an idea what could be wrong?
I too create a Page using the above method only thing I found missing in your code is that I used to have a title in the PageLayout as
<Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/Somepage.aspx, Your title"></Property>
This should not be the cause, but you can try it, Also refer the articles this or this
I think you're right with using PublishingLayoutPage. I came across this article today while searching for this error caused by something else. It describes your same issue although the person in the article was not inheriting from PublishingLayoutPage and had not specified the PublishingPageLayout property. When they fixed this it worked.
This doesn't directly help you, although I did notice in their article that they are specifying the ContentType property. Have you tried specifying this? As you can see your complete code, are there any other differences you see from the article or additional information from the comments?
Okay, I (kinda) got this working now.
The guy who had made the ONET.xml had put a reference to the page layout in the Url attribute of the element.
Like I wrote in a comment earlier I tried making the page layouts inherit from TemplateRedirectionPage. Instead I now made an empty default.aspx file that inherits from TemplateRedirectionPage and changed all my page layout files back to deriving from the PublishingLayoutPage. And then I added the PublishingPageLayout element below every element.
Funny, or oddly, having a refence to the page layout in the Url attribute and not having the PublishingPageLayout element at all is actually valid. It doesn't make sense, because it will produce these faulty pages, but SharePoint actually accepts it and spits out all the pages defined in the ONET.xml
Only thing left now is that since I made the above changes, when I manually create a new page based on a page layout every default webpart (as defined with AllUsersWebPart) is instantiated 5 times. Really don't know where this behaviour is coming from, but at least it's not as serious as not being able to edit/publish my pages :)

Resources