Posting in the Magento forums has been disabled pending the implementation of a new and improved forum solution which should better serve the community.

For new questions please post at magento.stackexchange.com, the community-run support site for the Magento community. We will be providing updates on the new forum solution soon. For questions or concerns please email community@magento.com.

Magento Forum

New module problem- nothing shows when I include it to home page
 
Tsvetomir
Jr. Member
 
Total Posts:  2
Joined:  2009-08-27
 

Hello,
I’ve created a new modul for magento.
I put this code in Admin->CMS->Pages -> Home :

{{block type="Mage_Psrch/view" template="psrch/view.phtml"}}

The modul these files app/code/local/Mage/Psrch/Block/view.php with code in it:

<?php
/**
* Psrch View block
*
* @codepool   Local
* @category   Mage
* @package    Mage_Psrch
* @module     Psrch
*/
class Mage_Psrch_Block_View extends Mage_Core_Block_Template
{
private $message;

 
protected function 
createMessage($msg{
$this
->message $msg;
}
      
public function getIdBySku($sku)
    
{
         
return $this->_read->fetchOne('select entity_id from '.$this->getEntityTable().' where sku=?'$sku);
    
}

public function getSrchUrl($id{
          
return $this->_read->fetchOne('select  value from  atscatalog_product_entity_varchar where entity_id='$id.' AND attribute_id=83');


public function getSrchSku() 
    
{
            
if ($_POST['ptype']{
            
                
if ($_POST['ptype']=='car'{
                    
                    
if($_POST['dr2'!= 0{
                        $_POST[
'dr2']='/'.$_POST['dr2'];
                    
else { $_POST['dr2'=''}
                    
                    $sku
$_POST['dr1'].$_POST['dr2'].' R'.$_POST['dr3'];
                
                
                
else if ($_POST['ptype']=='truck'{
                
                    $sku
$_POST['dr1'].$_POST['dr2'].' R'.$_POST['dr3']
                
                }
                
                
if($this->getIdBySku($sku)) {
                    
                    
                    $url 
$this->getSrchUr($this->getIdBySku($sku));
                    
                    
header('Location: ' $url);
                    exit;
                
else {
                    $this
->createMessage('Няма Ñ‚акъв Ð¿Ñ€Ð¾Ð´ÑƒÐºÑ‚');
                
}
            
            }
        
    
    }

public function receiveMessage() {
$this
->getSrchSku;
if(
$this->message != ''{
return $this->message;

}

}

app/code/local/Mage/Psrch/etc/config.xml :

<?xml version="1.0"?>
<config>
<
modules>
<
Mage_Psrch>
<
version>0.1.0</version>
</
Mage_Psrch>
</
modules>
<global>
<
blocks>
<
mage_psrch>
<class>
Mage_Psrch_Block</class>
</
mage_psrch>
</
blocks>
</global>
</
config>

and app/design/frontend/default/f002/template/psrch/view.phtml .

Of course I’ve added to app\etc\modules\Mage_All.xml :

<Mage_Psrch>
<
active>true</active>
<
codePool>local</codePool>
</
Mage_Psrch>
And the modul appears in Admin->System->Configuration......

I just can’t understand where I’m wrong…
I have searched for 2 days in Google… I have read tutorials about creating magento modules.....

Thank you very much,
Regards Tsvetomir.

 
Magento Community Magento Community
Magento Community
Magento Community
 
Tsvetomir
Jr. Member
 
Total Posts:  2
Joined:  2009-08-27
 

Can anyone help me, please?

 
Magento Community Magento Community
Magento Community
Magento Community
Magento Community
Magento Community
Back to top