How to add image icon on custom page link on layout? - layout

I have create 'page' link on header.links can show on homepage headers.
But I could like add image icon next my 'service-center' link. How to make it?
<block class="Magento\Framework\View\Element\Html\Link\Current" name="service-center" >
<arguments>
<argument name="label" xsi:type="string">Service center</argument>
<argument name="path" xsi:type="string">service-center</argument>
</arguments>
</block>

there are 2 ways to do this
1) You can add css class in link using :
<block class="Magento\Framework\View\Element\Html\Link\Current" name="service-center" >
<arguments>
<argument name="label" xsi:type="string">Service center</argument>
<argument name="path" xsi:type="string">service-center</argument>
<argument name="css_class" xsi:type="string">service-center</argument>
</arguments>
</block>
after that you need to write CSS for the ICON/Image
2) You need to define template .phtml file for this.
<block class="Magento\Framework\View\Element\Html\Link\Current" name="service-center" template="YourCompany_YourModule::account/customer.phtml" />
Make Sure to change namespace defined : YourCompany_YourModule

Related

You cannot proceed with such operation, your reCaptcha reputation is too low error when register customer in magento2

I have added login and register form on same login page. But i am getting this error as below
You cannot proceed with such operation, your reCaptcha reputation is too low.
Before i have two different pages for login and register form. but now i had done changes in login layout file so now both form in one page but now when i registered as customer its redirect to old create url (i.e. https://mywebsite.com/customer/account/create/) and get the below error.
You cannot proceed with such operation, your reCaptcha reputation is too low.
My login page layout changes as follows (path : /var/www/html/abc/vendor/magento/module-customer/view/frontend/layout) :
<?xml version="1.0"?>
<!--
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
-->
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<head>
<link src="Magedelight_SMSProfile::js/profile-phone-validation.js"/>
<css src="Magedelight_SMSProfile::css/smsprofile.css"/>
<title>Customer Login</title>
</head>
<body>
<referenceBlock name="head.components">
<block class="Magento\Framework\View\Element\Js\Components" name="customer_account_create_head_components" template="Magento_Customer::js/components.phtml"/>
</referenceBlock>
<referenceContainer name="content">
<!-- customer.form.login.extra -->
<container name="customer.login.container" label="Customer Login Container" htmlTag="div" htmlClass="login-container">
<block class="Magento\Customer\Block\Form\Login" name="customer_form_login" template="Magento_Customer::form/login.phtml">
<container name="form.additional.info" as="form_additional_info"/>
</block>
<!-- <block class="Magento\Customer\Block\Form\Login\Info" name="customer.new" template="Magento_Customer::newcustomer.phtml"/> -->
<block class="Magento\Customer\Block\Form\Register" name="customer_form_register" template="Magento_Customer::form/register.phtml">
<arguments>
<argument name="attribute_data" xsi:type="object">Magento\Customer\Block\DataProviders\AddressAttributeData</argument>
</arguments>
<container name="form.additional.info" as="form_additional_info"/>
<container name="customer.form.register.fields.before" as="form_fields_before" label="Form Fields Before" htmlTag="div" htmlClass="customer-form-before"/>
</block>
<referenceBlock name = "customer_form_register">
<action method="setTemplate">
<argument name="template" xsi:type="string">Magedelight_SMSProfile::register.phtml</argument>
</action>
</referenceBlock>
<!-- <block class="Magento\Cookie\Block\RequireCookie" name="require-cookie" template="Magento_Cookie::require_cookie.phtml">
<arguments>
<argument name="triggers" xsi:type="array">
<item name="registerSubmitButton" xsi:type="string">.action.submit</item>
</argument>
</arguments>
</block> -->
</container>
<block class="Magento\Cookie\Block\RequireCookie" name="require-cookie" template="Magento_Cookie::require_cookie.phtml">
<arguments>
<argument name="triggers" xsi:type="array">
<item name="loginButton" xsi:type="string">.action.login</item>
</argument>
</arguments>
</block>
<block class="Magento\Cookie\Block\RequireCookie" name="require-cookie" template="Magento_Cookie::require_cookie.phtml">
<arguments>
<argument name="triggers" xsi:type="array">
<item name="registerSubmitButton" xsi:type="string">.action.submit</item>
</argument>
</arguments>
</block>
</referenceContainer>
<referenceContainer name="form.additional.info">
<block class="Magento\Framework\View\Element\Template" name="form_additional_info_customer" template="Magento_Customer::additionalinfocustomer.phtml"/>
</referenceContainer>
</body>
</page>
My login and register phtml files come from the below path
/var/www/html/abc/app/design/frontend/Megnor/mag110246_4/Magedelight_SMSProfile/templates
So i am not getting why redirect to old register page nd that page showing error. If anyone help me then let me know

Override view.phtml of layered navigation not working

I am trying to override magentoe\app\design\frontend\rwd\mytheme\template\instockonly\catalog\layer\view.phtml file in my custom module say instockonly -
module config.xml file -
<?xml version="1.0"?>
<config>
<modules>
<Namespace_InStockOnly>
<version>1.0</version>
</Namespace_InStockOnly>
</modules>
<frontend>
<routers>
<instockonly>
<use>standard</use>
<args>
<module>Namespace_InStockOnly</module>
<frontName>instockonly</frontName>
</args>
</instockonly>
</routers>
<layout>
<updates>
<instockonly>
<file>instockonly.xml</file>
</instockonly>
</updates>
</layout>
</frontend>
</config>
Here is module xml file
//path magentoe\app\design\frontend\rwd\enterprise\layout\instockonly.xml
<?xml version="1.0"?>
<layout version="0.1.0">
<catalog_category_layered translate="label">
<reference name="catalog.leftnav">
<action method="setTemplate">
<template>instockonly/catalog/layer/view.phtml</template>
</action>
</block>
</reference>
</catalog_category_layered>
</layout>
and path of phtml file is -
magentoe\app\design\frontend\rwd\enterprise\template\instockonly\catalog\layer\view.phtml
where i am doing wrong,because i have tried a lot but still i am unable to overirde phtml file.
Please suggest ASAP.

Magento - How to override persistent billing.phtml using custom module

Stuck on this for a long now :( I am trying to override a core template file
app/design/frontend/base/default/template/persistent/checkout/onepage/billing.phtml
using custom module which I have successfully activated and the config file for my new module is located at
app/code/local/CustomCheckout/Checkout/etc/config.xml.
Below are the content
<config>
<modules>
<CustomCheckout_Checkout>
<version>1.0.0</version>
</CustomCheckout_Checkout>
</modules>
<frontend>
<routers>
<checkout>
<args>
<modules>
<CustomCheckout_Checkout before="Mage_Checkout">CustomCheckout_Checkout</CustomCheckout_Checkout>
</modules>
</args>
</checkout>
</routers>
<layout>
<updates>
<checkout>
<file>persistent.xml</file>
</checkout>
</updates>
</layout>
</frontend>
</config>
I am trying to override the persistent.xml layout which in turn calls the said billing.phtml file. I placed the new layout file at following location
app/design/frontend/default/CustomCheckout/layout/persistent.xml.
Below are the content
<layout version="0.1.0">
<checkout_onepage_index>
<reference name="checkout.onepage.billing">
<action method="setTemplate">
<template>checkout/onepage/billing.phtml</template>
</action>
</reference>
</checkout_onepage_index>
</layout>
I have placed my modified billing.phtml file under
app/design/frontend/default/CustomCheckout/template/checkout/onepage/billing.phtml
but it is not being picked up. I am scratching my head...any help is appreciated.
Hopefully you've found an answer by now, but for posterity...
The issue here is that the "Persistent" module is already overriding that template. If you look in the persistent.xml layout file you see the following:
<reference name="checkout.onepage.billing">
<action method="setTemplate"><template>persistent/checkout/onepage/billing.phtml</template></action>
<block type="persistent/form_remember" name="persistent.remember.me" template="persistent/remember_me.phtml" />
<block type="core/template" name="persistent.remember.me.tooltip" template="persistent/remember_me_tooltip.phtml" />
</reference>
Magento's default loading order is alphabetical. So, since the Persistent module is "Mage_Persistent" and your module is "CustomCheckout_Checkout", the Persistent module is loaded last, and it's override is the one that sticks.
There are several solutions. One is to rename your module so that it's after Mage_Persistent in the alphabet.
A better solution is to use Magento's dependency functionality. In your module declaration file (app/etc/modules/CustomCheckout_Checkout.xml), you probably have something like this:
<?xml version="1.0"?>
<config>
<modules>
<CustomCheckout_Checkout>
<active>true</active>
<codePool>local</codePool>
</CustomCheckout_Checkout>
</modules>
</config>
Modify this as shown here:
<?xml version="1.0"?>
<config>
<modules>
<CustomCheckout_Checkout>
<active>true</active>
<codePool>local</codePool>
<depends>
<Mage_Persistent />
</depends>
</CustomCheckout_Checkout>
</modules>
</config>
This indicates to Magento that your module "depends" on Mage_Persistent and should therefore be loaded after it.
If that does not work for you, another technique would be to use a "remove" node in your layout xml to get rid of the original billing block:
<remove name="checkout.onepage.billing" />
Then re-add it with a different name, as it is in checkout.xml. Make sure to add all necessary blocks and actions underneath it from various layout files and use the same alias (as="billing").
Finally, if this module is not intended for re-use (the change is just for your current install) you could simply copy the phtml file into the same path in your custom package/theme folder.
I am magento developer. I did implement your problem at localhost & find solution. I just create kinex/links (namespace/module). In this module layout file contain the following code:
<checkout_onepage_index>
<reference name="checkout.onepage.billing">
<action method="setTemplate">
<template>kinex/links/billing.phtml</template>
</action>
</reference>
</checkout_onepage_index>
This is very Simple, You can simply write the xml as:
<checkout_onepage_index>
<reference name="checkout.onepage.billing">
<action method="setTemplate">
<template>your-module/checkout/onepage/billing.phtml</template>
</action>
<block type="persistent/form_remember" name="persistent.remember.me" template="persistent/remember_me.phtml" />
<block type="core/template" name="persistent.remember.me.tooltip" template="persistent/remember_me_tooltip.phtml" />
</reference>
</checkout_onepage_index>
If there is some error in checkout page, then it means billing or shipping.phtml file is missing.

Provisioning a default.aspx page to use a custom page layout

I have a custom site definition I created that deploys a couple of custom page layouts. Does anyone know what needs to be done so that when a user uses my site definition to create a site, their default.aspx page is created using my custom page layout?
Below is the module section of my site definition:
<Modules>
<Module Name="DefaultHome" Url="$Resources:osrvcore,List_Pages_UrlName;" Path="">
<File Url="default.aspx" Type="GhostableInLibrary" >
<Property Name="Title" Value="Test Home Page" />
<Property Name="PublishingPageLayout" Value="~SiteCollection/_catalogs/masterpage/MyCustomPageLayout.aspx, My Custom PageLayout" />
<Property Name="ContentType" Value="$Resources:cmscore,contenttype_welcomepage_name;" />
<Property Name="PublishingPageContent" Value="Welcome to the My Test Publishing Site" />
</File>
</Module>
</Modules>
In your onet.xml file you need to set the DefaultPageLayout property like below
<!-- Publishing Feature -->
<Feature ID="22A9EF51-737B-4ff2-9346-694633FE4416">
<Properties xmlns="http://schemas.microsoft.com/sharepoint/">
<Property Key="WelcomePageUrl" Value="$Resources:osrvcore,List_Pages_UrlName;/Default.aspx" />
<Property Key="ChromeMasterUrl" Value="~SiteCollection/_catalogs/masterpage/MyMasterPage.master"/>
<Property Key="SimplePublishing" Value="True" />
<Property Key="VersioningOnPages" Value="Major" />
<Property Key="RequireCheckoutOnPages" Value="False" />
<Property Key="AvailablePageLayouts" Value="~SiteCollection/_catalogs/masterpage/MyPageLayout.aspx:~SiteCollection/_catalogs/masterpage/MyPageLayout.aspx"/>
<Property Key="DefaultPageLayout" Value="~SiteCollection/_catalogs/masterpage/MyPageLayout.aspx"/>
<Property Key="AvailableWebTemplates" Value="ENTERWIKIRBKC#2;"/>
<Property Key="AllowSpacesInNewPageName" Value="false"/>
</Properties>
</Feature>
The default.aspx page in SiteDefinition created by VS inherits from webpart page. Make sure that you delete all the code and add the below. This has worked for me.
<%# Page Inherits="Microsoft.SharePoint.Publishing.TemplateRedirectionPage,Microsoft.SharePoint.Publishing,Version=14.0.0.0,Culture=neutral,PublicKeyToken=71e9bce111e9429c" %>
<%# Reference VirtualPath="~TemplatePageUrl" %>
<%# Reference VirtualPath="~masterurl/custom.master" %>

SharePoint > Custom Page-Library & PageLayout

I have a custom page-library which a custom content-type and a page-layout all inside a site-definition.
Works as expected. The only thing I cannot get around is that if I upgrade the solution with the page-lib, ctype, page-layout via stsadm everything is updated except the page-layout.
New fields in the ctype --> no problem
Changed views in the page-lib --> no problem
Updated PageLayout --> ERROR
The page-layout section:
<!-- specific page-layout to display LKW data -->
<File Url="CustomPage.aspx" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE" >
<Property Name="Title" Value="$Resources:CustomLayouts,Title;" />
<Property Name="MasterPageDescription"
Value="$Resources:cmscore,PageLayout_BlankWebPartPage_Description;" />
<Property Name="ContentType"
Value="$Resources:cmscore,contenttype_pagelayout_name;" />
<Property Name="PublishingPreviewImage"
Value="~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview Images/BlankWebPartPage.png, ~SiteCollection/_catalogs/masterpage/$Resources:core,Culture;/Preview Images/BlankWebPartPage.png" />
<Property Name="PublishingAssociatedContentType"
Value=";#$Resources:FieldsCTypes,cTypeDisplayName;;#0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900D38AAFB8072F441984BC947D49503947;#" />
</File>
The relevant section in the onet.xml:
<Module Name="Home" Url="$Resources:cmscore,List_Pages_UrlName;Custom" Path="">
<File Url="Default.aspx" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE">
<Property Name="Title"
Value="$Resources:Layouts,DisplayName;" />
<Property Name="ContentType"
Value="$Resources:cmscore,contenttype_welcomepage_name;"/>
<Property Name="PublishingPageLayout"
Value="~SiteCollection/_catalogs/masterpage/CustomPage.aspx, $Resources:PalfingerPlatformsOrderRoot,LKWpageDefaultTitle;" />
<Property Name="PublishingPageContent"
Value="" />
</File>
</Module>
The strange thing is, if I just have a page-layout with no underlying page-library I can update the page-ayout.
The problem only occurs if I use a custom page-layout inside a custom page-library.
I did some Google search and found a hint - the problem could be that the page-layout is unghosted.
I checked this with a small sample code:
SPFile file = folder.Files["Default.aspx"];
if (file.CustomizedPageStatus == SPCustomizedPageStatus.Customized)
{
file.RevertContentStream();
}
After executing the code the Page-Layout is upgraded and uses the new page-layout.
The Problem is that this is no real solution for me because I have approx. 1000 site-collections using the site-def. and the page-layout.
Updating all of them is quite painful. Does anybody know a solution for this?
I would like to comment on one thing. Looks like IgnoreIfAlreadyExists="TRUE" is not working properly refer to this link, may be reverting the value to FALSE should help.
<File Url="CustomPage.aspx" Type="GhostableInLibrary" IgnoreIfAlreadyExists="TRUE" >

Resources