<?php
$loader = $this->registry->get('load');
$loader->dmodel('marketplace/mktsqlproduto');

class DModelmarketplacemktprodutogaleriapage extends DModelmarketplacemktsqlproduto
{

    public function __construct($registry)
    {
        parent::__construct($registry);

        $this->load->dmodel('marketplace/mktprice');
        $result = $this->dmodel_marketplace_mktprice->getStandardMktPrice(Type_MarketPlace::Tp_Galeriapage);

        $this->customer_group_id = $result->getCustomerGroupId();
    }

    public function getProduct($product_id)
    {
        $data = array(
            'mkt_table_price'   => $this->getCustomerGroupId(),
        );

        return parent::getProductSql($product_id, Type_MarketPlace::Tp_Galeriapage, $data);
    }

    public function getProductGrid($product_key_id, array $data = [])
    {
        $data = array_merge($data, [
                'mkt_table_price'   => $this->getCustomerGroupId(),
            ]
        );

        return parent::getProductGridSql($product_key_id, Type_MarketPlace::Tp_Galeriapage, $data);
    }

    public function getProductsFromGrid($product_key_id, array $data = [])
    {
        $data = array_merge($data, [
                'mkt_table_price'   => $this->getCustomerGroupId(),
            ]
        );
        return parent::getProductsFromGridSql($product_key_id, Type_MarketPlace::Tp_Galeriapage, $data);
    }

    public function getMktProdutos(array $data = [])
    {
        return parent::getMktProdutosSql(Type_MarketPlace::Tp_Galeriapage, $data);
    }

    public function getMktVariationId($product_id)
    {
        return parent::getMktVariationIdSql($product_id, Type_MarketPlace::Tp_Galeriapage);
    }

}