How to remove summery box in magento review form - magento

I have remove the summery box magento product review form. but when i submit the review it still says "Review summary can't be empty". i thought there is server side validation in magento.
anyone help me how can i remove the validation for summery box in product review from

Magento doesn't provide this as a option. But, you can go into template template/review/form.phtml and hide displaying summary field and set some value for it:
<li style="display: none">
<label for="summary_field" class="required"><em>*</em><?php echo $this->__('Summary of Your Review') ?></label>
<div class="input-box">
<input type="text" name="title" id="summary_field" class="input-text required-entry" value="SOMEVALUE" />
</div>
</li>

Magento engine uses client site and server site validation for processing any kinds of form. If you want remove this field completely you need to overwrite core functionality. The following steps should help you.
To stop server site validation
copy the file app/code/core/Mage/Review/Model/Review.php to app/code/local/Mage/Review/Model/Review.php
search the validate method in the copied file(around line number 118)
see the line $errors[] = Mage::helper('review')->__('Review summary can\'t be empty');
and comment this line
To stop client site validation
go to the file template/review/form.phtml in your theme folder.
and remove/hide displaying summary field

Related

parsley.js 'fails' when trying to validate checkbox

We are re-designing a site and part of that re-design involves making the site accessible to screen readers and the like. I'm using latest version (2.8.0). Here's what's happening --- validation for all text, select and textarea fields in our forms work perfectly. In order to be accessible, checkbox and radio inputs are wrapped in tags. The html for a set of checkboxes looks like this:
<div class="form-group">
<p id="applicant_type_desc" style="margin-bottom: 6px;"><strong>I am: <span class="text-danger" aria-hidden="true">*</span><span class="sr-only">Required</span></strong> <em class="small">(check all that apply)</em></p>
<div class="checkbox">
<label id="applicant_type_patient_desc">
<input type="hidden" name="applicant_type_patient" id="" value="N">
<input type="checkbox" name="applicant_type_patient" id="applicant_type_patient" value="Y" {checked_applicant_type_patient} aria-labelledby="applicant_type_desc applicant_type_patient_desc" data-parsley-multiple="type" data-parsley-error-message="Please specify whether you are a patient, relative, employee or other.">
A patient
</label>
</div>
followed by more checkbox divs without error messages and ended with an end div for the for form-group wrapper.
If I load the form and click 'submit', all the text fields are validated properly. If I add 'required' to the checkbox above, when 'submit' is clicked nothing happens and the form is submitted with no validation at all.
The same thing happens when I try to validate a radio button set as required.
There is some custom jQuery and parsley code which creates a div to hold all the error messages and transforms the error messages into links to the field id so that a screen reader can follow them and focus on the field in error. But imho, this should have no effect on why the form validation doesn't kick in.
I'm absolutely baffled.
FYI - I tried this using an earlier version (2.0.3) of parsley and the validation actually worked, although all my custom error processing was ignored.
Any insight would be greatly appreciated.
As it turns out, parsley handles the errorswrapper element differently for text, textarea and selects then it does for checkboxes and radio buttons.
The starting wrapper element for text, textarea and select contains the parsley-data-id attribute whereas checkbox and radio button elements contain the parsley-data-multiple attribute whether that was generated by parsley or entered manually in the html.
My code was looking for parsley-data-id and, of course the jquery selector failed and generated an error. A colleague was able to spot this for me while we were looking at the page in chrome inspector. Once i saw the error, making a simple adjustment to the form:error event function allowed everything to work.

Get rid of additional text in footer

I can't seem to figure out out to get rid of the additional text in Magento 1.9 next to the subscribe button. Pic is attached. It's our website but don't know how it got there. Please help.
Sample
In magento Newsletter block called in this phtml file.
Path of file is :
app\design\frontend\[YOUR THEME]\template\newsletter\subscribe.phtml
In that file, the code for button is this,
<div class="actions">
<button type="submit" title="<?php echo Mage::helper('core')->quoteEscape($this->__('Subscribe')) ?>" class="button"><span><span><?php echo $this->__('Subscribe') ?></span></span></button>
</div>
You can put your code after this, so it will appear there.
Turn ON the developers options from the admin side and referesh your page.. From there you will know from which phtml this content is loaded. go to that phtml and remove the code. If you want to remove a phtml file then you can do this from local.xml.

Displaying Magento Custom Payment Methods Form (Extension Development)

I was unable to display the payment form for "My Custom Gateway" when the method is selected.
I have created the form.phtml template and it is loaded correctly. I can see the tag is loaded properly. Moreover it is visible even when I have not choose that method yet. Thus I have to hide the form until the the gateway is selected, so I have the following form.phtml:
<?php
// PHP Code
?>
<ul class="form-list" id="mygateway_form_<?php echo $this->getMethodCode() ?>" style="display:none;">
<li>
<div class="input-box">
This will be the Forms
</div>
</li>
</ul>
In my Model, I'm extending Mage_Payment_Model_Method_Abstract instead of CC
I couldn't find any reference in the Magento source code that take care this trivial logic: hiding and showing payment form.
So, in magento, how to make my form visible when the user click on that particular payment methods?
Reference List
Create Payment Method Module
Looking at the payment/methods.phtml, the input.onclick will trigger a payment.switchMethod($_code).
Going deeper to the varien/payment.js:switchMethod function, the naming convention is important for the form. the id has to begin with payment_form_<paymentmethod>
Thus, I've made a mistake in the forms.phtml. It should be:
<ul class="form-list" id="payment_form_<?php echo $this->getMethodCode() ?>" style="display:none;">
Now it is correctly display the form.

Display advanced search products from a particular category in magento

I'm new to magento. I have to use the advanced search in magento, but need to display the products only from a particular category in it inspite of the all products.
In short all I need is to display advanced search products only from a single category.
I'm using magento 1.7.
Any help will be appreciated.
Thanks in advance.
You can add "Search by Category" in advanced search section of Magento. The step by step guide on implementing it is shown in Magento wiki: http://www.magentocommerce.com/wiki/5_-_modules_and_development/search_and_advanced_search/how_to_add_search_by_category_to_advanced_search
If you don't want to display the options to select category, just display none the select dropdown and by default make your desired category selected. So all the search results from that category will only be displayed.
inside the search html FORM you can add a new hidden input called "cat" with the id of the category you want to seach for.
<form action="<?php echo $catalogSearchHelper->getResultUrl() ?>" method="get">
<input id="search" type="text" name="q" value="" />
<input id="cat" type="hidden" name="cat" value="ID_OF_YOUR_CAT" />
</form>

Form action submit but NOT redirect (facebook static + magento)

This seems simple enough but there are complications...
I have a facebook FBML static page where I want users to sign up to my magento newsletter.
I think I'm right in saying typically you can put the form code as below into the fbml page and on submit it will add the user to the newsletter;
<form action="http://my-site.com/newsletter/subscriber/new/" method="post" id="newsletter-validate-detail">
<fieldset class="block-content">
<legend>Newsletter</legend>
<label id="newsletter-label" for="newsletter" class="left">Join our mailing list</label>
<div class="input-box left">
<input name="email" type="text" id="newsletter" class="input-text required-entry validate-email" />
</div>
<button id="newsletter-submit" type="submit" class="button btn-submit"><span>Join</span></button>
</fieldset>
</form>
But of course at my site I have an ajax function that returns a thanks for registering, so when this submit is sent from fb, this just lands me at a confirmation message on my domain that is supposed to feed through java and say thanks very much for signing up.
So what I need is some way of posting the action, but keeping the user on facebook, or at least leaving them at some other landing page after the action.
Something that posts but doesn't redirect, or something that posts then redirects to something other than the url in the form action?
Not sure if I need ajax for this or if js is even allowed within the fb environment, could I use any of their proprietary FBML to achieve this?
Many thanks
Could you add onSubmit="handleData(); return false;" to your form so it doesn't submit? and use the handleData() function to proccess the data in whatever way you need? This will keep the user from moving off the current page.

Resources