3

I have created Feedback form with PHP,HTML,CSS,JS.

Form Lookalike,

enter image description here

my feedback form Code

https://www.dropbox.com/sh/32zqgejubfllz0h/AACkB_iIh-KJQxtEUikZ8i9Na?dl=0

how can i apply Sidebar Sliding into my home page and all other pages?

  • You want to display that green box in all Magento pages ? – PЯINCƏ Oct 5 '18 at 12:36
  • Yes, I need to display in all pages including home page. – zus Oct 5 '18 at 15:23
  • See my answer bellow – PЯINCƏ Oct 5 '18 at 15:25
2
  1. app/design/frontend/yourTheme/themeName/layout/local.xml

    //add this:
    <default>
        <reference name="content">
            <block type="core/template" name="feedback.box" template="html/feedbackbox.phtml"/>
        </reference>
    </default>
    
  2. app/design/frontend/yourTheme/themeName/template/html/feedbackbox.phtml

    //Your feedback code goes here.
    

Now your feedback will be displayed in all Magento content pages.

UPDATE:

You should not add <head>, <html>and <body> etc... tags in your phtml, the scripts head you add them in local.xml

app/design/frontend/yourTheme/themeName/template/html/feedbackbox.phtml

<!--Feedback Form HTML START -->
    <div id="mrova-feedback">
        <div id="mrova-contact-thankyou" style="display: none;">
            Thank you.  We'hv received your feedback.
        </div>
        <div id="mrova-form">
            <form id="mrova-contactform" action="feedbackbox.phtml" method="post">
                <ul >
                    <li>
                        <label for="mrova-name">Your Name*</label> <input type="text" name="mrova-name" class="required" id="mrova-name" value="">
                    </li>
                    <li>
                        <label for="mrova-email">Email*</label> <input type="text" name="mrova-email" class="required" id="mrova-email" value="">
                    </li>
                    <li>
                        <label for="mrova-message">Message*</label>
                        <textarea class="required" id="mrova-message" name="mrova-message"  rows="8" cols="30"></textarea>
                    </li>
                </ul>
                <input type="submit" value="Send" id="mrova-sendbutton" name="mrova-sendbutton">
            </form>
        </div>
        <div id="mrova-img-control"></div>
    </div>
<!-- Feedback Form HTML END --> 

<?php
header('content-type: application/json; charset=utf-8');

if (isset($_GET["mrova-name"])) {
    $name = strip_tags($_GET['mrova-name']);
    $email = strip_tags($_GET['mrova-email']);
    $message = strip_tags($_GET['mrova-message']);
    $header = "From: ". $name . " <" . $email . ">rn"; 

    $ip = $_SERVER['REMOTE_ADDR'];
    $httpref = $_SERVER['HTTP_REFERER'];
    $httpagent = $_SERVER['HTTP_USER_AGENT'];
    $today = date("F j, Y, g:i a");    

    $recipient = 'abc@gmail.com';
    $subject = 'Contact Form';
    $mailbody = "
First Name: $name
Email: $email
Message: $message

IP: $ip
Browser info: $httpagent
Referral: $httpref
Sent: $today
";
    $result = 'success';

    if (mail($recipient, $subject, $mailbody, $header)) {
        echo json_encode($result);
    }
}
?>

app/design/frontend/yourTheme/themeName/layout/local.xml

<?xml version="1.0" encoding="UTF-8"?>
<layout version="0.1.0">
    <default>
        <reference name="head">
            <action method="addItem"><type>skin_css</type><name>css/mrova-feedback-form.css</name></action>
            <action method="addItem"><type>skin_js</type><name>js/mrova-feedback-form.js</name></action>
        </reference>
        <reference name="content">
            <block type="core/template" name="feedback.box" template="html/feedbackbox.phtml"/>
        </reference>
    </default>
</layout>

Now you add your css, js content inside these files in :

skin/frontend/yourTheme/themeName/css/mrova-feedback-form.css

skin/frontend/yourTheme/themeName/js/mrova-feedback-form.js

  • How to create phtml file using with HTML and PHP code? – Gem Oct 5 '18 at 14:51
  • Yes, you can put php and html in phtml, But if you mean controller, model, etc... you need to create them So create a module for that. – PЯINCƏ Oct 5 '18 at 14:54
  • In my case there is no controller and model, just want to display feedback form in all pages. – zus Oct 5 '18 at 15:25
  • So, Yes you can put your php and html without problem, PHTML = PHP+HTML :) – PЯINCƏ Oct 5 '18 at 15:27
  • @PRINCE step 1) snag.gy/UKiLxH.jpg code : justpaste.it/6df9c step 2) snag.gy/JC7sBe.jpg code : codeshare.io/2K7EBN after clear cache and reindexed still not working. can i get help?p? – zus Oct 6 '18 at 6:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.