dongyange1101 2013-06-06 15:03
浏览 39
已采纳

解析错误:语法错误,意外$ end fuelphp [关闭]

I have this error on line 98 i cant found what is the error this is the class that produces the error!

Parse error: syntax error, unexpected $end in /var/zpanel/hostdata/tsalopulos/public_html/tsalopoulos_gr/fuel/app/modules/checkoutv2/classes/handle.php on line 98

<?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条回答 默认 最新

  • dongqian9567 2013-06-06 15:17
    关注

    Your file is fine:

    Nathans-iMac:Desktop nathan$ php -l Untitled.php

    No syntax errors detected in Untitled.php

    Re-upload your file to your web server.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 想问一下树莓派接上显示屏后出现如图所示画面,是什么问题导致的
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line
  • ¥500 火焰左右视图、视差(基于双目相机)
  • ¥100 set_link_state
  • ¥15 虚幻5 UE美术毛发渲染
  • ¥15 CVRP 图论 物流运输优化
  • ¥15 Tableau online 嵌入ppt失败
  • ¥100 支付宝网页转账系统不识别账号