In Magento 2 How to Override core customer model? - magento2

I have to override customer ResourceModel's customer.php file in my custom module.
I have tried but its not working.so what is correct way to override Model?
Please help me.
I follow below steps to override Model,
I have my own module called Namespace_Module with a di.xml file,
<?xml version="1.0"?>
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="../../../../../lib/internal/Magento/Framework/ObjectManager/etc/config.xsd">
<preference for="Magento\Customer\Model\ResourceModel\Customer" type="Namespace\Modulename\Model\ResourceModel\Customer" />
</config>
Then I have created php file,
Namespace\Modulename\Model\ResourceModel\Customer.php
and try to override core file.but its not working for me.
So plz anyone help me to solve my problem.
thanks.

Related

Receiving an error within Google Play Library in Eclipse

I am new to eclipse and receiving this error
error: no resource found that matches the given name (at 'drawable' with value '#drawable/ common_google_signin_btn_icon_dark_disabled').
Here is my common_google_signin_btn_icon_dark.xml file
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:state_enabled="false"
android:drawable="#drawable/common_google_signin_btn_icon_dark_disabled" />
<item
android:state_pressed="true"
android:drawable="#drawable/common_google_signin_btn_icon_dark_pressed" />
<item
android:state_focused="true"
android:drawable="#drawable/common_google_signin_btn_icon_dark_focused" />
<item
android:drawable="#drawable/common_google_signin_btn_icon_dark_normal" />
</selector>
Any help would be appreciated thanks
This seems like a case of missing files. You are using a drawable image/resource that doesn't exist. Go to your drawable folder and make sure you have those png (PNGs are normally used for buttons)images namely: common_google_signin_btn_icon_dark_disabled.png, common_google_signin_btn_icon_dark_pressed.png, etc.
This SO post, although not exactly same, may offer insight.
Thanks for the reply, files were probably missing in the library because i was able to upload a newer version of google play services library and worked perfect.

Adding popup description to custom JSF tags in Eclipse

I have a list of custom JSF tags, declared in an xml file in the following format:
I'd like to provide the developers documentation for these tags that shows up in eclipse like the one for the builtin JSF tags.
How can I achieve this?
Start by using a WAAAAY more current taglib... a 2.2 one would be good...
<facelet-taglib
xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-facelettaglibrary_2_2.xsd"
version="2.2"
>
Then you'll notice (via code completion) that inside the <tag> elements you can add a <documentation>
See e.g. https://github.com/omnifaces/omnifaces/blob/2.6.4/src/main/resources/META-INF/omnifaces-ui.taglib.xml

How to add two help contents in eclipse RCP application?

In my application I want to add two help contents. Currently I have only one contents in my help book. To add a new one I have declared another help plugin and Tried to add that in to product dependencies. But my second help did not appear in the help book. Am i missing something here?
2 contents snapshot:
I want to do something like this
Any help on this will be appreciated.
Toc.xml
<?xml version="1.0" encoding="UTF-8"?>
<?NLS TYPE="org.eclipse.help.toc"?>
<toc label="XXX">
<topic label="Main Topic" href="html/maintopic.html">
<topic label="Sub Topic" href="html/subtopic.html"/>
</topic>
<topic label="Main Topic 2"/>
</toc>
Looking at the Eclipse help plug-ins they just use:
<extension point="org.eclipse.help.toc">
<toc file="toc.xml" primary="true" />
</extension>
in each plugin.xml. The toc.xml is like yours.

PropertyChanged.Fody migrating notifypropertychanged

I have been using NotifyProperyWeaver and noticed it is deprecated in the latest build to Fody using PropertyChanged.Fody.
I had NotifyProperyWeaver to only weave the properties i had attributes on and all other notifying was disabled.
Is there a way to configure PropertyChanged.Fody such that only [attributed] properties get weaved? and not the reverse. I don't see any info in the documentation page on it, is there a hidden property in the FodyWeavers.xml
<?xml version="1.0" encoding="utf-8"?>
<Weavers>
<PropertyChanged />
</Weavers>
This question was also asked here https://github.com/Fody/PropertyChanged/issues/5 and from that issue...
PropertyChanged.Fody makes the assumption that if you implement
INotifyPropertyChanged then you would most likely want to notify for
most, if not all, properties. If you wish to exclude them, which
should be the exception not the rule, then you can add a
[DoNotNotifyAttribute] to a class or a property. see here for more
details https://github.com/Fody/PropertyChanged/wiki/Attributes

Why is Magento not picking up my theme template file for transactional email order?

I made some template changes to Magento's New Order transactional email template in the backend. The textual changes at the top of the email (in the "thanks for your order..." section) worked fine. But when I change the templates for the order details, they are not appearing in my email.
I have created two files within my template which I thought would override the email:
app/design/frontend/default/mythemehere/template/email/order/items.phtml
app/design/frontend/default/mythemehere/template/email/order/items/order/default.phtml
These are referenced in my sales.xml file in app/design/frontend/default/mythemehere/layout
<sales_email_order_items>
<block type="sales/order_email_items" name="items" template="email/order/items.phtml">
<action method="addItemRender"><type>default</type><block>sales/order_email_items_order_default</block><template>email/order/items/order/default.phtml</template></action>
<action method="addItemRender"><type>grouped</type><block>sales/order_email_items_order_grouped</block><template>email/order/items/order/default.phtml</template></action>
<block type="sales/order_totals" name="order_totals" template="sales/order/totals.phtml">
<action method="setLabelProperties"><value>colspan="2" align="right" style="padding:3px 9px"</value></action>
<action method="setValueProperties"><value>align="right" style="padding:3px 9px"</value></action>
<block type="tax/sales_order_tax" name="tax" template="tax/order/tax.phtml">
<action method="setIsPlaneMode"><value>1</value></action>
</block>
</block>
</block>
<block type="core/text_list" name="additional.product.info" />
</sales_email_order_items>
However, when I place my order, I get the base template in the email.
If I commit the Cardinal Sin in Magento of overriding base template files (app/design/frontend/base/default/template/email/order ...), lo and behold, I see my changes! Seems Magento is very keen to use its base template.
I have overridden other templates in the sales section (eg: sales/order/view.phtml, sales/order/print.phtml), and various posts on Magento's forums indicate I'm doing the right thing in concept. But alas! It's just not working for me.
To use your custom theme file for order email "app/design/frontend/default/mythemehere/template/email/order/items.phtml"
In the admin go to System->configuration->design
Select your website from the top left
Now in the themes template uncheck the checkbok and add the theme name.
I had the same problem. I discovered that the emails will use the /app/design/frontend/default/default templates before the 'base' templates. So if you copy the base templates into the default/default folder your files will not be overwritten on update.
However it is still not ideal as this is still outside your theme folder, however it is better than using 'base' files. I still haven't found a true solution.
This kind of situation happens because if we mention wrong values under System>Configuration>General -> Design section
We can have following two scenarios.
1) Default package with custom design
2) Custom package
If we do not fill correct values under Current Package Name field then issue mentioned in the question will occur.
It happened with me when I was using a custom package but had given value as
default under Current Package Name field.
We should configure the theme properly so that Magento can follow theme fallback properly.
Overwriting templates in base/default and default/default is strongly discouraged, because updating Magento will overwrite those directories.
What worked for me (with emails) is to put the modified files under app/design/frontend/your_design_package/default/templates/.