where i can change the words of Newsletter in Magento2 - magento

i am very new of Magento2, I saw in the "page" that this form should be used to call out the newsletter form :
{{block class="Magento\Newsletter\Block\Subscribe"
name="static.newsletter"
template="Magento_Newsletter::subscribe.phtml"}}
But I would like to change the words of this form, or add more words there. I have already tried looking for in the system but didn't find it and I dont know where to change it. Does anyone can help ?

There are 2 approaches for changing words inside that form.
If you want to change this form for everywhere on your Magento system, you can override it inside your theme.
app/design/frontend/[Vendor]/[Theme]/Magento_Newsletter/templates/subscribe.phtml
If you want to change this form to a specific page, you can create your own template and assign it.

Related

How to apply condition for specific page in magento?

I want to apply condition for specific page coming from url. It is neither a category page nor a custom cms page. Url is like localhost/project/index.php/news/blog.html. I want to apply condition for this 'news/blog.html' . News or blog is not a category and not any cms page. Can anybody help me?
It depends on the type of condition, you want to user over there. You can try with the following.
1. Try to put a observer in the relevant controller using the cheat sheet https://www.nicksays.co.uk/magento-events-cheat-sheet-1-5/
2. Directly try to edit model in the module of that page.
3. Try to put some code directly into the file.
Thanks,
Use the following code.
Mage::app()->getRequest()->getControllerName();
It will give controller name to your module. Put consition for this name and write your code. It will work for sure.

How we call "Pages" name in Dropdown in Signup form of PHPfox?

In PHPfox, i want to call "Pages" name in drop-down in Signup form. Reason for calling "Pages", Actually i have created many pages for college name & that are saved in database. So if someone comes for signup, i want to show them college name in drop-down (which are basically "Pages").
Please help me.
Thanks in advance.
You will need 2 plugins, one to show the HTML and one to process what to do with the user input:
1) Make a plugin that fetches the pages, maybe the hook user.component_controller_register_1 or another in that controller would do but otherwise you can always use a low level hook like run_start and check if its the section where you want it.
To show the HTML you have 2 options: include a JS file to populate the sign up form with anything that you want, or if you have a custom template you can just assign the array to the template variable and look through it in your template.
2) Once the html part is showing and working make a plugin for the sign up routine, I think the hook user.service_process_add_1 should be enough given its location.
Dont forget that the input name for the signup is an array, so your drop down needs to look somewhat like this:
<select name="val[my_dropdown]">

How to add richtext (wysiwyg) field to a Magento widget

I created a few small widgets for magento. Everything fine, but I can`t seem to figure out how to add a richtext (tinymce wysiwyg) field to my widget.
Only thing I find on this is: "use ‘wysiwyg’ => true" in "$fieldset->addField". But I cannot use this in my custom widget, can I?
I understand that I can use addField to add a field to for example a product or CMS page.
But the only way of adding fields in my custom widget, as far as I know, is by adding parameters in my widget.xml. Other widget I build by following some tutorial returns a button, by using a custom type as parameter:
$removeButton = $this->getLayout()->createBlock('adminhtml/widget_button')
->setType('button')
->setClass('delete')
->setLabel($this->__('Remove Image'))
->setOnclick('document.getElementById(\''.$element->getId().'\').value=\'\';if(document.getElementById(\''.$element->getId().'_image\'))document.getElementById(\''.$element->getId().'_image\').parentNode.remove()')
->setDisabled($element->getReadonly())
->setStyle('margin-left:10px;margin-top:7px');
But i just can`t figure out how to add a richtext field in either my Widget.xml or my phpfile for the custom type.
What am I missing? Hope someone can help me out.
There are a few related entries here on stackoverflow, try searching if you are still having problem with this. Also, have a look at this brilliant article: http://www.behrendt.io/2013/04/12/using-a-wysiwyg-editor-in-a-magento-widget/
It helped me getting started. I got it working as a plain text field but whenever I turn the field to true WYSIWYG the content is never updated and the AJAX call does not contain the new HTML.

How to call a custom php file on magento product page

if getChildHtml('product_type_data') ?> maps directly to catalog/product/view/type/simple.phtml by default, how do I map to my own file? If I wanted to create a file that would produce a small image to place on the product page, right under "availability" how would I tell magento to map to where I have put the file? From what I understand getChildHtml('product_type_data') ?> defaults to the file path: catalog/product/view/type/simple.phtml so how can I customize the magento defaults and tell it to map to my custom files i've created?
Could I do something like getChildHtml('etc/etc/my-file.phtml') ?>
Essentially, what I am trying to do is add a small image under "availability" of my site (ex: http://climbhigh.com/climbing/climbing-ropes/petzl-dragonfly-rope-8-2mm.html) that says free shipping. Just trying to find the best way to do it.
I hope I have explained this well enough, if not, please let me know and I will try to explain more. Any help or guidance would be awesome. Thanks.
The code getChildHtml('product_type_data') doesn't always map directly to the template file catalog/product/view/type/simple.phtml. It only maps to that file if the layout handle PRODUCT_TYPE_simple is loaded, i.e. if the current product is a simple product. In order to change the template to be a different one you need to update the template attribute in the layout. At it's most simple this can be achieved by editing app/design/frontend/base/layout/catalog.xml and changing the template attribute.
<block type="catalog/product_view_type_simple" name="product.info.simple" as="product_type_data" template="your/new/path.phtml">
Of course editing core files is a bad idea, so you should make a quick search for how to correctly add layout updates via either local.xml or customer layout update files.
I ended up figuring out what I needed to do. I simply wanted to add a small image to my product detail page that highlight a free shipping option. All I had to do was create a static block in the admin panel of magento and go into catalog>product>view.phtml file and insert:
getLayout()->createBlock('cms/block')->setBlockId('your_block_id')->toHtml(); ?>
it worked like a charm!
thanks for the help Crags

Magento : create ajax dropdown populated with labels of 3 product's attributes.

Greetings,
I'm, unluckily in need of having this :
Product has (lets say) 6 attributes with "Yes/No" values.
I need a dropdown on that product's page that will populate with attributes with "yes" value.
attributes are :bundle1,bundle2....,bundle6.
When selection is made - I need to know whats have been selected to pass that to php on that page.
I have no idea what preexists in Magento (in terms of Ajax snippets) that could be used for this, searching for solution...
I used additional request.js and pulled attributes from a newly created table in DB (manually, for 1 product, just for test) and it works.
But, thats not idea, I dont want to do it manually everytime.
Syntax is killling me.
Thank you.
This may not be helpful at all... But I just recently created a module that taps into Magento's ajax autopopulate functionality. What this module does is does an autopopulate of all the manufacturers, depending on the string you are typing in. I know this isn't directly what you are wanting to do, but this may help you get started, at least with the ajax:
/app/etc/modules/Ash_Manufacturers.xml
http://pastie.org/841014
/app/code/local/Ash/Manufacturers/etc/config.xml
http://pastie.org/841017
/app/code/local/Ash/Manufacturers/controllers/IndexController.php
http://pastie.org/841018
/app/code/local/Ash/Manufacturers/Block/Manufacturers.php
http://pastie.org/841020
Look at rows 79-92 on this one:
/app/design/frontend/default/ash/template/catalog/layer/filter.phtml : http://pastie.org/841027

Resources