从变量取消设计

时间:2016-12-02 07:12:35

标签: php unset

我正在展示产品ID,产品名称,设计师,但我需要隐藏"设计师"。

enter image description here

所以我试图从变量$ orderitems取消设置designer,我正在尝试下面的代码,但仍然显示Designer列

我从此代码中获取产品ID,名称,设计师:->addAttributeToSelect('dproduct_id')&尝试使用此代码取消设置:unset($orderitems['designer_id'])

function getDesignerCollection()
    {
    $user_home = new USER();
    $stmts = $user_home->runQuery("SELECT * FROM tbl_users WHERE userID=:uid");
    $stmts->execute(array(
        ":uid" => $_SESSION['userSession']
    ));
    $rows = $stmts->fetch(PDO::FETCH_ASSOC); 

    $accountType = $rows['type'];
    if ($accountType == "admin")
        {
        $order = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('designer_id', array(
            'nin' => '0'
        ));
        }
      else
        {
        $order = Mage::getModel('sales/order')->getCollection()->addAttributeToFilter('designer_id', array(
            'like' => '%' . $_SESSION['userSession'] . '%'
        ))

->addAttributeToSelect('dproduct_id') 
->addAttributeToSelect('state');    
//unset($orderitems['designer_id']);
        }

    $i = 0;
    foreach($order as $orderData)
        {
        $orderitems = $orderData['dproduct_id'];
        $orderitemsarray = explode(",", $orderitems);
        $k = 0;
        $oDate = new DateTime($orderData['created_at']);
        $sDate = $oDate->format("Y-m-d");
        while ($k < count($orderitemsarray))
            {
            if ($orderitemsarray[$k] != '0')
                {
                $stmtorders = $user_home->runQuery("SELECT * FROM order_details WHERE designerorder_id=:designerorder_id");
                $stmtorders->execute(array(
                    ":designerorder_id" => $orderData['entity_id']
                ));
                $roworders = $stmtorders->fetch(PDO::FETCH_ASSOC);
                $productdetail = Mage::getModel('catalog/product')->load($orderitemsarray[$k]);
                $designerName = getDesignerName($productdetail->getDesignerID()) . " -(" . $productdetail->getDesignerID() . ")";
                $responce[] = array(
                    $orderData->getIncrementId() ,
                    $orderData->getIncrementId() ,
                    $orderitemsarray[$k],
                    $productdetail->getName() ,
                    $designerName,
                    $orderData['status'],
                    $orderData['grand_total'],
                    $orderData['customer_email'],
                    $commission,
                    $dorderStatus,
                    $sDate
                );
                }

            $k++;
            $i++;
            }
        }

    echo json_encode($responce);
    unset($orderitems['designer_id']);
    }

注意:在发布之前我真的很努力,我是php的新手。

0 个答案:

没有答案