Jump to content

Please help got this error


jimbo79

Recommended Posts

Hi,

 

This is not my code but it is throwing a error when I call it
Parse error: syntax error, unexpected ';', expecting T_FUNCTION in /home/magent74/public_html/part-site/Cron.php on line 54

 

here is the code

 

<?php

require_once(dirname(__FILE__) . "/../../../../../magmi/plugins/inc/magmi_datasource.php");
require_once(dirname(__FILE__) . "/../../../../../magmi/integration/productimport_datapump.php");

class Company_Magmi_Cron {

    public function magmiUpdate()
    {
        $items = array(    
        "sku" => "",
    "qty" => ""); // build your own list of items to create/update

        $this->import($items);
    }

    private function import($items, $mode = 'create', $indexes = 'all')
    {
        if (count($items) > 0) {
            $dp = new Magmi_ProductImport_DataPump();
            $dp->beginImportSession("test", $mode);
            foreach ($items as $item) {
                $dp->ingest($item);
            }
            $dp->endImportSession();
            $this->reindex($indexes);
        }
    }

    private function reindex($string = 'all')
    {
        /** @var $indexer Mage_Index_Model_Indexer */
        $indexer = Mage::getModel('index/indexer');

        $processes = array();

        if ($string == 'all') {
            $processes = $indexer->getProcessesCollection();
        } else {
            $codes = explode(',', $string);
            foreach ($codes as $code) {
                $process = $indexer->getProcessByCode(trim($code));
                if ($process) {
                    $processes[] = $process;
                }
            }
        }

        /** @var $process Mage_Index_Model_Process */
        foreach ($processes as $process) {
            $process->reindexEverything();
        }
    }
    ?>

 

would really love it if someone could help me out.

 

Thanks
 

Link to comment
https://forums.phpfreaks.com/topic/296434-please-help-got-this-error/
Share on other sites

Follow along with the various {s and }s, see where the various functions and control structures (if, foreach, etc.) start and end, and eventually you'll realize you're "inside" the class and "outside" everything else and missing the final closing }.

 

Looking at the indentation works too, as long as the code is properly indented (which that code is).

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.