解析错误:语法错误,意外$ end fuelphp

时间:2013-06-06 15:03:25

标签: php fuelphp

我在第98行有这个错误我找不到错误这是产生错误的类!

解析错误:语法错误,第98行/var/zpanel/hostdata/tsalopulos/public_html/tsalopoulos_gr/fuel/app/modules/checkoutv2/classes/handle.php中的意外$ end

<?php

namespace Checkoutv2;

class Handle{

    public static $_items;

    public $product;

    public $image;

    public $price;

    public $location;

    public $totals = array(
        'total' => 0,
        'items' => 0
    );

    public $_user;


    public $items = array ('items' => array());

    public function __construct( $cart_items, $user)
    {
        static::$_items = $cart_items;
        $this->price = new \ProductPrice();
        $this->image = new \ProductImage();

        $this->_user = $user;
    }


    public function boot()
    {
        foreach(static::$_items as $item)
        {
            $this->product = \Model_Product::query()
                ->related('description')
                ->where('description.lang_code','=',\Session::get("lang"))
                ->where('id',$item->get_id())
                ->get_one();

            $description = $this->getProductDescription($this->product->description);

            $this->totals['items'] += $item->get_qty();
            $this->totals['total'] += round(
                    $this->price->getPriceDiscountedInternet(
                        $this->price->getPriceDiscounted(
                            $item->get_price()
                        )
                    ),2) * $item->get_qty();




            $this->items['items'][] = array(
                'rowid'  => $item->get_rowid(),
                'id'     => $item->get_id(),
                'ids'    => $this->product->id_one.' | '.$this->product->id_two,
                'image'  => $this->image->resizeProductImage( $item->get_id() ),
                'description' => $description,
                'title'  => $item->get_name(),
                'qty'    => $item->get_qty(),
                'qty_north' => $this->product->qty_north,
                'qty_south' => $this->product->qty_south,
                'price'  => round(
                    $this->price->getPriceDiscountedInternet(
                        $this->price->getPriceDiscounted(
                            $item->get_price()
                        )
                    ),2),
                'available' => $this->checkQty( $this->product,$item),
                'have' => $this->product->qty,
                'sub_total' =>round(
                    $this->price->getPriceDiscountedInternet(
                        $this->price->getPriceDiscounted(
                            $item->get_price()
                        )
                    ),2) * $item->get_qty(),
            );

        }

        return array(
            'items' => $this->items,
            'total' => $this->totals['total'],
            'total_items' => $this->totals['items']
        );
    }

    public function checkQty($product, $item)
    {
        $local_qty = $this->getLocalQty(); // line 98

        if($product->$local_qty < $item->get_qty())
            return false;
        else
            return true;
    }

    public function getLocalQty()
    {
       $local = $this->checkUserLocation();
       return $local;
    }

    //check user location
    public function checkUserLocation($reverse = false)
    {
        if($reverse){
            if($this->location == 0)
                return 'qty_south';
            else
                return 'qty_north';
        }else{
            if($this->location == 0)
                return 'qty_north';
            else
                return 'qty_south';
        }
    }

    public function prepareUser()
    {
        $this->location = $this->_user->store;
    }


    public function getProductDescription($description)
    {
        foreach($description as $desc){
            return $desc->title;
        }

    }
}

1 个答案:

答案 0 :(得分:1)

你的文件很好:

  

Nathans-iMac:桌面nathan $ php -l Untitled.php

     

Untitled.php中未检测到语法错误

将您的文件重新上传到您的网络服务器。