protected function getRecentProduct()
    {
        $items = $this->product_view->set($this->data_product['product_id'], $this->cart_uid);

        $product_ids = array();

        foreach ((array) $items as $id => $item) {
            if ($item['product_id'] != $this->data_product['product_id']) {
                $product_ids[$id] = $item['product_id'];
            }
        }

        if (empty($product_ids)) {
            return array();
        }

        $products = $this->getProducts(array('product_id' => $product_ids));

        // Retain original order
        uksort($products, function ($key1, $key2) use ($product_ids) {
            return (array_search($key1, $product_ids) < array_search($key2, $product_ids));
        });

        return $products;
    }
protected function getRecentProduct()
    {
        $items = $this->product_view->set($this->data_product['product_id'], $this->cart_uid);

        $product_ids = array();

        foreach ((array) $items as $id => $item) {
            if ($item['product_id'] != $this->data_product['product_id']) {
                $product_ids[$id] = $item['product_id'];
            }
        }

        if (empty($product_ids)) {
            return array();
        }

        $products = $this->getProducts(array('product_id' => $product_ids));

        // Retain original order
        uksort($products, function ($key1, $key2) use ($product_ids) {
            return (array_search($key1, $product_ids) < array_search($key2, $product_ids));
        });

        return $products;
    }
protected function getRecentProduct ( ) { $ items = $ this -> product_view -> set ( $ this -> data_product [ 'product_id' ] , $ this -> cart_uid ) ; $ product_ids = array ( ) ; foreach ( ( array ) $ items as $ id => $ item ) { if ( $ item [ 'product_id' ] != $ this -> data_product [ 'product_id' ] ) { $ product_ids [ $ id ] = $ item [ 'product_id' ] ; } } if ( empty ( $ product_ids ) ) { return array ( ) ; } $ products = $ this -> getProducts ( array ( 'product_id' => $ product_ids ) ) ; // Retain original order uksort ( $ products , function ( $ key1 , $ key2 ) use ( $ product_ids ) { return ( array_search ( $ key1 , $ product_ids ) < array_search ( $ key2 , $ product_ids ) ) ; } ) ; return $ products ; }
Returns an array of recent products
@return array
Returns an array of recent products