Magento 1.9 – How to Add Sales/Guest/Form to CMS Page

cmsformsmagento-1.9

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/

Best Answer

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"}}
Related Topic