-2

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

解析错误:语法错误,第 98 行 /var/zpanel/hostdata/tsalopoulos/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;
        }

    }
}
4

1 回答 1

1

你的文件很好:

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

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

将文件重新上传到 Web 服务器。

于 2013-06-06T15:17:05.370 回答