Creating a partial view (contact us) & displaying it on all the webpage on 2.2

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
12 years ago
Hi ,

Can anyone help me creating a partial view , I want to show contact form on all the pages of my website.
Any suggestions or help will be appreciated.
12 years ago
Hi

I just did that. I created a partial view called _CustomerService.cshtml under folder Views\Common (either in the web application root view folder or in your custom theme's view folder).

Here's mine for example:
Views/Common/_CustomerService.cshtml


<div class="block block-info">
    <div class="title" id="atencioncliente">
        Customer Service
    </div>
    <div class="clear">
    </div>
    <div class="listbox">
    <table width="100%">
    <tr>
        <td>Phone</td>
        <td><strong>917362630</strong></td>
    </tr>
    <tr>
        <td>Twitter</td>
        <td><a href="http://twitter.com/xxx">Our twitter</a></td>
    </tr>
    <tr>
        <td>Facebook</td>
        <td><a href="http://www.facebook.com/xxxx">Our facebook page</a></td>
    </tr>  
    </table>
    </div>
</div>


Then, if you want it added on every page, you must add it to _ColumnsTwo.cshtml and _ColumnsThree.cshtml, basically the layouts your current theme is using (it may be also one of the fluid layouts).

You can then open those files and put this code to render the partial in the spot you want it to appear:

 
@Html.Action("MiniShoppingCart", "ShoppingCart")
<div class="clear">
</div>
@Html.Partial("../Common/_CustomerService")


This is from _ColumnsThree.cshtml, near the end of the file (~ line 75).

Personally I chose to put it next to the mini shopping cart, either right side in 3-cols or left side in 2-cols.

You may notice the path to the partial is not using the standard ~/Views/Common/xxxx approach. It's not working for me that way, even with nop 2.20 so I switched to relative paths instead.

Hope it helps,
C
12 years ago
I want to create another page (or topic) and include the contact form (but I want to add more fields to it). Do you have any idea how to do that?. I was trying to copy and paste the "ContactUs.cshtml", rename it Recycle.cshtml, and change replace all ContacUs by Recycle, but I wasn't able to find the path once I did it. It didn't work. I really don't know how to do it.  I would appreciate your help. Thanks
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.