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

class DModelmarketplacemktprodutoshopee extends DModelmarketplacemktsqlproduto
{

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

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

        $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_Shopee, $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_Shopee, $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_Shopee, $data);
    }

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

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

}