Jump to content

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).

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.