3

I'd like to add the sales guest form to a cms page? This is the form you find at yourdomain.com//sales/guest/form/ it's template is app/design/frontend/base/default/template/sales/guest/form.phtml

Sales Guest form

I've tried using this method which outlines how to do it for the Magento contacts form but am not sure how to re-work this method for the sales/guest/form, I think my action attribute is wrong.

This is what I have

<!– Order Search Form –>
{{block type="core/template" name="orderSearchForm" form_action="/sales/guest/view" template="sales/guest/form.phtml"}}
<!– Order Search Form –>

This displays the form on the page but when I submit it, it just reloads the page rather than find the order at ourdomain.com/sales/guest/view/

  • This doesn't look like native functionality. At least I can't find the file you're talking about. Is this a module? – Sander Mangel Aug 14 '15 at 10:42
  • @SanderMangel, it is native functionality, at least in 1.9, if you go to yourdomain.com//sales/guest/form/ you will see the form. The template is app/design/frontend/base/default/template/sales/guest/form.phtml – Holly Aug 14 '15 at 10:44
  • why was this question voted to be closed? If you are going to vote to close the question, at least give some feedback! – Holly Aug 14 '15 at 10:46
  • Was me, sawry, wasn't looking correctly. Answering right now – Sander Mangel Aug 14 '15 at 10:47
3

In the layout/sales.xml layout file the block is included as follows

<block type="sales/widget_guest_form" name="guest.form" template="sales/guest/form.phtml"/>

In the phtml file sales/guest/form.phtml the method getActionUrl retrieves the post action URL. This method returns a standard value that can't be set from layout XML

 /**
     * Return quick search form action url
     *
     * @return string
     */
    public function getActionUrl()
    {
        return $this->getUrl('sales/guest/view', array('_secure' => $this->_isSecure()));
    }

Including the block like this would solve it I'd say

{{block type="sales/widget_guest_form" name="orderSearchForm" template="sales/guest/form.phtml"}}
2

I'd like to offer an alternative:

The above answers work fine, however you could add the following in the the Layout > Layout update XML section of your CMS page:

<reference name="content">
    <block after="-" type="sales/widget_guest_form" name="guest.form" template="sales/guest/form.phtml"/>
    <action method="insert" ifconfig="sales/widget_guest_form">
        <block>guest.form</block>
    </action>
</reference>

This way, clients are also less likely to edit this tab since it's not within the content section!

Hope this helps anyone else with this issue!

  • great solution. – Pixelomo Feb 2 '16 at 9:53

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.