2

This question is asked for many times, but none of the solution worked for me. I tried referring core modules to correct the errors in my config files, but it helped me little. Following are the code snippets:

config.xml

<?xml version="1.0"?>
<config>
    <modules>
        <Package_OriginalPricing>
            <version>1.0.1</version>
        </Package_OriginalPricing>
    </modules>

    <!-- Global Configuration Starts -->
    <global>

        <helpers> <!-- Helpers -->
            <originalpricing>
                <class>Package_OriginalPricing_Helper</class>
            </originalpricing>
        </helpers>

        <blocks> <!-- Blocks -->
            <originalpricing>
                <class>Package_OriginalPricing_Block</class>
            </originalpricing>
        </blocks>

        <models>

            <originalpricing>
                <class>Package_OriginalPricing_Model</class>
                <resourceModel>originalpricing_resource</resourceModel>
            </originalpricing>

            <originalpricing_resource>

                <class>Package_OriginalPricing_Model_Resource</class>

                <entities>
                    <csvprice>
                        <table>originalpricing_csvprice</table>
                    </csvprice>
                </entities>

            </originalpricing_resource>

        </models>

        <resources>

            <originalpricing_setup>
                <setup>
                    <module>Package_OriginalPricing</module>
                </setup>
            </originalpricing_setup>

            <originalpricing_write>
                <connection>
                    <use>core_write</use>
                </connection>
            </originalpricing_write>

            <originalpricing_read>
                <connection>
                    <use>core_read</use>
                </connection>
            </originalpricing_read>

        </resources>

    </global>
    <!-- !! Global Configuration -->

    <!-- Admin Configuration Starts -->
    <admin>
        <!-- Routing Configuration Starts -->
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <originalpricing before="Mage_Adminhtml">Package_OriginalPricing_Adminhtml</originalpricing>
                    </modules>
                </args>
            </adminhtml>
        </routers>
        <!-- !! Routing Configuration -->
    </admin>
    <!-- !! Admin Configuration -->

    <!-- Adminhtml Configuration Starts -->
    <adminhtml>
        <!-- Layouts Configuration Starts -->
        <layout>
            <updates>
                <originalpricing>
                    <file>originalpricing.xml</file>
                </originalpricing>
            </updates>
        </layout>
        <!-- !! Layouts Configuration -->

        <!-- Menu Configuration Starts -->
        <menu>
            <catalog>
                <children>
                    <!-- Parent menu -->
                    <originalpricing module="originalpricing" translate="title">

                        <title>Original Price CSV</title>
                        <sort_order>10</sort_order>

                        <children> <!-- Child menu -->
                            <index translate="title"> <!-- Assign menu -->
                                <title>Upload CSV</title>
                                <sort_order>1</sort_order>
                                <action>adminhtml/originalpricing</action>
                            </index>

                            <removeproducts translate="title"> <!-- Remove menu -->
                                <title>Remove CSV</title>
                                <sort_order>2</sort_order>
                                <action>adminhtml/originalpricing/removeproducts</action>
                            </removeproducts>
                        </children>

                    </originalpricing>

                </children>
            </catalog>
        </menu>
        <!-- !! Menu Configuration -->

    </adminhtml>
    <!-- !! Adminhtml Configuration -->

</config>

originalpricing.xml

<?xml version='1.0'?>

<layout version="0.1.0">

    <adminhtml_originalpricing_index> <!-- bulkpricing index action -->
        <reference name="content">
            <block type="originalpricing/adminhtml_originalpricing_assign" name="orig_assign_products" />
        </reference>
    </adminhtml_originalpricing_index>

</layout>

Controller

class Package_OriginalPricing_Adminhtml_OriginalpricingController extends Mage_Adminhtml_Controller_Action
{


    public function indexAction ()
    {
        $this->_title($this->__('Catalog'))->_title($this->__('Upload CSV'));
        $this->loadLayout();
        $this->_setActiveMenu('catalog/catalog');
        $this->renderLayout();
    }

}

Block Assign

class Package_OriginalPricing_Block_Adminhtml_Originalpricing_Assign extends Mage_Adminhtml_Block_Widget_Form_Container
{
    public function __construct()
    {
        parent::__construct();

        $helper = Mage::helper('originalpricing');

        $this->_objectId = 'id';
        $this->_blockGroup = 'originalpricing';
        $this->_controller = 'adminhtml_originalpricing';
        $this->_mode = 'assign';
        $this->_headerText = $helper->__('Upload CSV');

        $this->_updateButton('save', 'label', $helper->__('Upload & Save'));

        $this->_removeButton('back');
    }
}

Form

class Package_OriginalPricing_Block_Adminhtml_Originalpricing_Assign_Form extends Mage_Adminhtml_Block_Widget_Form
{

    protected function _prepareForm()
    {
        $form = new Varien_Data_Form(array(
                'id' => 'edit_form',
                'action' => $this->getUrl('*/*/assign'),
                'method' => 'post',
                'enctype' => 'multipart/form-data'
            )
        );

        $helper = Mage::helper('originalpricing');

        $form->setUseContainer(true);

        $this->setForm($form);

        $fieldset = $form->addFieldset('assign_form', array(
            'legend' =>$helper->__('Upload CSV for Products')
        ));

        $fieldset->addField('sku_list', 'textarea', array(
            'label'     => $helper->__('SKU(s)'),
            'class'     => 'required-entry',
            'required'  => true,
            'name'      => 'sku_list',
            'note'     => $helper->__('Enter Product SKU separated by (,) comma'),
        ));

        $fieldset->addField('csv_file', 'file', array(
            'label'     => $helper->__('CSV File'),
            'class'     => 'required-entry',
            'required'  => true,
            'name'      => 'csv_file',
            'note'     => $helper->__('Choose a .csv file to be uploaded'),
        ));

        return parent::_prepareForm();
    }

}

Everything is working fine on my local but not on live server.

8
  • @Priyank I have updated question with controllers code
    – Sagar Guhe
    Commented Dec 4, 2017 at 4:30
  • Yes it's placed here app/design/adminhtml/default/default/layout/originalpricing.xml
    – Sagar Guhe
    Commented Dec 4, 2017 at 4:35
  • Please replace "OriginalPricing" to "Originalpricing" in all files and check
    – Abdul
    Commented Dec 4, 2017 at 4:39
  • Module Name? dir name and modules/Package_OriginalPricing.xml all have same name...
    – Sagar Guhe
    Commented Dec 4, 2017 at 4:41
  • It is case sensitive module name issue
    – Abdul
    Commented Dec 4, 2017 at 4:43

1 Answer 1

1

I am posting answer to my question after two days of frustration and useless changes... The problem was not in my code but the the site had Compilation enabled from System >> Tools >> Compilation so I recompiled magento and suddenly all started to work. This was working on my local just because of the same reason that my local donot have Compilation enabled

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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