cancel
Showing results for 
Search instead for 
Did you mean: 

Custom Admin Module con Form Upload File

Custom Admin Module con Form Upload File

Ciao a tutti,

vorrei implementare a un mio modulo la possibilità di caricare un file di testo per poi utilizzarne il contenuto per sistemare i prodotti.

Ho problemi nel capire come si crea il form, correttamente, e l'action come richiamarla.

Attendo con ansia qualche aiuto

 

Grazie

2 REPLIES

Re: Custom Admin Module con Form Upload File

Credo che i dettagli siano veramente troppo poco per fornirti anche un minimo aiuto..

------------------ [ Antonio Carboni ] ------------------Hosting Magenio
Problema risolto? Clicca Accept as Solution!

Re: Custom Admin Module con Form Upload File

Ok, ti mostro il modulo che al momento è vuoto e necessita questo form così magari partiamo da qualcosa:

app/etc/modules/FrdCts_Stock.xml

 

<?xml version="1.0"?>
<config>
<modules>
<FrdCts_Stock>
    <active>true</active> 
    <codePool>community</codePool>
</FrdCts_Stock>
</modules>
</config>

 

 

app/code/community/FrdCts/Stock/controllers/Adminhtml/StockControllers.php

 

<?php
class FrdCts_Stock_Adminhtml_StockController extends Mage_Adminhtml_Controller_Action
{
    public function indexAction() 
    {
        $this->loadLayout();

        error_reporting( E_ALL );
        require_once MAGENTO_ROOT . '/app/Mage.php';
        Mage::app('admin');
        try { 
                $block = $this->getLayout()
                        ->createBlock('core/text', 'stock-block')
                        ->setText('creare form importazione file');
            } catch (Exception $e) {
                $block = $this->getLayout()
                        ->createBlock('core/text', 'stock-block')
                        ->setText('Caught exception: ',  $e->getMessage(), "\n");
            }

        $this->_addContent($block);
        $this->renderLayout();
    }

    public function configurationAction()
    {
       
    }
}

app/code/community/FrdCts/Stock/etc/adminhtml.xml

 

 

<?xml version="1.0" encoding="UTF-8"?>
<config>
    <menu>
        <magentostock module="frdcts_stock" translate="title">
            <title>Manage Stock</title>
            <sort_order>100</sort_order>
            <children>
                <index module="frdcts_stock" translate="title">
                    <title>Import File</title>
                    <sort_order>1</sort_order>
                    <action>adminhtml/stock</action>
                </index>
                <!--<configuration module="frdcts_stock" translate="title">
                    <title>Configuration</title>
                    <sort_order>2</sort_order>
                    <action>adminhtml/stock/configuration</action>
                </configuration>-->
            </children>
        </magentostock>
    </menu>
    <acl>
        <resources>
            <admin>
                <children>
                    <custom translate="title" module="frdcts_stock">
                        <title>Manage Stock</title>
                        <sort_order>-100</sort_order>
                        <children>
                            <index translate="title">
                                <title>Import File</title>
                                <sort_order>1</sort_order>
                            </index>
                            <!--<configuration translate="title">
                                <title>Configuration</title>
                                <sort_order>2</sort_order>
                            </configuration>-->
                        </children>
                    </custom>
                </children>
            </admin>
        </resources>
    </acl>
</config>

app/code/community/FrdCts/Stock/etc/config.xml

 

<?xml version="1.0"?>  
<config> 
    <modules> 
        <FrdCts_Stock> 
            <version>1.0.0</version> 
        </FrdCts_Stock> 
    </modules>
        <global>
            <models>
                <frdcts_stock>
                    <class>FrdCts_Stock_Model</class>
                </frdcts_stock>
            </models>
            <blocks>
                <frdcts_stock>
                    <class>FrdCts_Stock_Block</class>
                </frdcts_stock>
            </blocks>
            <helpers>
                <frdcts_stock>
                    <class>FrdCts_Stock_Helper</class>
                </frdcts_stock>
            </helpers>
        </global>
    <admin>
        <routers>
            <adminhtml>
                <args>
                    <modules>
                        <foo_bar before="Mage_Adminhtml">FrdCts_Stock_Adminhtml</foo_bar>
                    </modules>
                </args>
            </adminhtml>
        </routers>
    </admin>
</config>

app/code/community/FrdCts/Stock/Data.php

<?php
class FrdCts_Stock_Helper_Data extends Mage_Adminhtml_Helper_Data
{

}

app/code/community/FrdCts/Stock/Model/Stock.php

vuoto

Vorrei poter creare un form che caricasse un file XML che genera un fornitore con tutto l'inventario aggiornato a magazzino, ho creato già la gestione del file e la sua manipolazione con relativo controllo dei prodotto nelle tabelle e funziona, ma vorrei integrarlo in magento per non costringere i ragazzi a usare wamp in locale.